From 3bcb5936b5bcce24ef479b15415f6bf2dde50ff0 Mon Sep 17 00:00:00 2001 From: dshclm <3321914460@qq.com> Date: Fri, 23 Aug 2024 09:15:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E5=AE=B6=E7=A7=98=E5=AF=86=E8=BD=BD?= =?UTF-8?q?=E4=BD=93=E7=BB=9F=E8=AE=A1=E6=89=93=E5=8D=B0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/fileprovide/filenum/print.html | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/system/fileprovide/filenum/print.html b/ruoyi-admin/src/main/resources/templates/system/fileprovide/filenum/print.html index 10ca3e2..14321f5 100644 --- a/ruoyi-admin/src/main/resources/templates/system/fileprovide/filenum/print.html +++ b/ruoyi-admin/src/main/resources/templates/system/fileprovide/filenum/print.html @@ -848,21 +848,30 @@ document.querySelector('.areaid').innerHTML = getCity(res.data,[[${tdCarrier.areaDistrict}]]) }) , }); - function conversionDate(date){ + function conversionDate(date) { var year = date.getFullYear(); - var month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要加 1 - var day = String(date.getDate()).padStart(2, '0'); // 日可能是个位数,需要补零 - return year + '-' + month + '-' + day + var month = String(date.getMonth() + 1).padStart(2, '0'); + var day = String(date.getDate()).padStart(2, '0'); + return year + '-' + month + '-' + day; } - document.querySelector('#dqdate').innerHTML ='日期:' + conversionDate(new Date()) + document.querySelector('#dqdate').innerHTML = '日期:' + conversionDate(new Date()); var examinestateToFind = []; document.querySelectorAll('.provideDate').forEach(function(element) { - examinestateToFind.push(element.innerHTML); + if (element.innerHTML.trim()) { + examinestateToFind.push(element.innerHTML.trim()); + } }); examinestateToFind.forEach(function(value) { - document.querySelectorAll('.provideDate').forEach(function(element) { - element.innerHTML = conversionDate(new Date(document.querySelector('.provideDate').innerHTML)) - }); + var date = new Date(value); + if (!isNaN(date.getTime())) { + document.querySelectorAll('.provideDate').forEach(function(element) { + if (element.innerHTML.trim() === value) { + element.innerHTML = conversionDate(date); + } + }); + } else { + console.error('无效的日期格式:', value); + } }); var carrierLevelData = [[${@dict.getType('sys_provide_level')}]] selectDictLabel(carrierLevelData,'carrierLevel')