From a44b8e3243bcfd4a37818366375ba197fc2fc1e9 Mon Sep 17 00:00:00 2001 From: wersd <1523826083@qq.com> Date: Sat, 22 Nov 2025 23:13:03 +0800 Subject: [PATCH] =?UTF-8?q?mod=20=E5=B7=A1=E6=A3=80=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E5=8F=AA=E8=83=BD=E5=A1=AB=E6=8A=A5=E5=BD=93=E5=89=8D=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E5=8F=8A=E4=B9=8B=E5=89=8D=E7=9A=84=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../record/ProjectInspectionRecordUploadForm.vue | 15 +++++++++++++++ src/views/crm/project/inspection/record/index.vue | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/views/crm/project/inspection/record/ProjectInspectionRecordUploadForm.vue b/src/views/crm/project/inspection/record/ProjectInspectionRecordUploadForm.vue index 07f061ee4..b53cf5547 100644 --- a/src/views/crm/project/inspection/record/ProjectInspectionRecordUploadForm.vue +++ b/src/views/crm/project/inspection/record/ProjectInspectionRecordUploadForm.vue @@ -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('该巡检记录没有配置巡检类型') diff --git a/src/views/crm/project/inspection/record/index.vue b/src/views/crm/project/inspection/record/index.vue index a218b7e9b..4f5f466fd 100644 --- a/src/views/crm/project/inspection/record/index.vue +++ b/src/views/crm/project/inspection/record/index.vue @@ -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