From 481ce9ffb9396cdd8c48bf9b28dffe228b83bc9e Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 17 四月 2025 14:20:33 +0800 Subject: [PATCH] 设备维护保养页面开发、联调 --- src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue index 09c36ce..951dfbc 100644 --- a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue +++ b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue @@ -163,12 +163,17 @@ }, changeMachineName() { this.selectionRows.map(val => { + // 灏� val.nextCalibrationDate 杞崲涓� Date 瀵硅薄骞跺噺鍘� 5 澶� + let nextCalibrationDate = val.nextCalibrationDate ? new Date(val.nextCalibrationDate) : null; + if (nextCalibrationDate) { + nextCalibrationDate.setDate(nextCalibrationDate.getDate() - 5); // 鍑忓幓 5 澶� + } this.calibrationPlanDetailList.push({ deviceId: val.id, deviceName: val.label, deviceNumber: val.value, specificationModel: val.specificationModel, verificationCycles: val.calibrationDate, lastDate: val.lastCalibrationDate && val.lastCalibrationDate.substring(0, 10), - planDate: val.nextCalibrationDate && val.nextCalibrationDate.substring(0, 10), + planDate: nextCalibrationDate ? formatDate(nextCalibrationDate) : null, verificationUnit: val.calibrationServices, deviceAmount: 1 }) @@ -250,6 +255,13 @@ }, }, } +// 鏍煎紡鍖栨棩鏈熶负 YYYY-MM-DD 鏍煎紡 +function formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕�+1 + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} </script> <style scoped></style> -- Gitblit v1.9.3