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')