| | |
| | | </el-date-picker> |
| | | </div> |
| | | <div style="margin: 10px 0"> |
| | | <el-table id="templateParamTable" ref="yearTable" :data="calibrationPlanDetailList" height="300px" |
| | | <el-table id="templateParamTable" ref="yearTable" :data="calibrationPlanDetailList" height="560px" |
| | | v-loading="yearTableLoading" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border |
| | | row-key="deviceId" style="width: 100% ;"> |
| | |
| | | }, |
| | | 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 |
| | | }) |
| | |
| | | }, |
| | | }, |
| | | } |
| | | // 格式化日期为 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> |