mod 巡检日期检查逻辑,确保只能填报当前日期及之前的巡检记录

pull/853/head
wersd 2025-11-22 23:13:03 +08:00
parent 834bb4f53b
commit a44b8e3243
2 changed files with 29 additions and 1 deletions

View File

@ -263,6 +263,21 @@ const open = async (record: ProjectInspectionRecordApi.ProjectInspectionRecordVO
formLoading.value = true
try {
// <=
if (record.inspectionDate) {
const inspectionDate = new Date(record.inspectionDate)
inspectionDate.setHours(0, 0, 0, 0)
const currentDate = new Date()
currentDate.setHours(0, 0, 0, 0)
//
if (inspectionDate > currentDate) {
message.warning('只有巡检日期的年月日小于等于当前年月日才能填报')
dialogVisible.value = false
return
}
}
// configType
if (!record.configType || !Array.isArray(record.configType) || record.configType.length === 0) {
message.warning('该巡检记录没有配置巡检类型')

View File

@ -664,7 +664,20 @@ const canShowUploadButton = (row: ProjectInspectionRecordApi.ProjectInspectionRe
return false
}
// 2.
// 2. <=
if (row.inspectionDate) {
const inspectionDate = new Date(row.inspectionDate)
inspectionDate.setHours(0, 0, 0, 0)
const currentDate = new Date()
currentDate.setHours(0, 0, 0, 0)
//
if (inspectionDate > currentDate) {
return false
}
}
// 3.
const inspectorIdNum = typeof row.inspector === 'string' ? Number(row.inspector) : row.inspector
const currentUserId = userStore.user.id