From a1e4d36f3ab3eb2e10373adfffebda4430e0ea3f Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期二, 27 十月 2026 09:41:51 +0800
Subject: [PATCH] feat(device): 核查计划检查日期精确到日;提前审核增加归档提醒;删除放开至未开始/待批准行

---
 src/views/CNAS/resourceDemand/device/component/checkRecord.vue |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 107 insertions(+), 1 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
index f7b367f..f4ea5a5 100644
--- a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
+++ b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
@@ -141,6 +141,7 @@
   findExaminePlanDetail,
   resolveExaminePlanDetail,
   updateDeviceExaminePlanDetail,
+  getDeviceById,
 } from '@/api/cnas/resourceDemand/device.js'
 import { selectUserCondition } from "@/api/performance/class";
 import LimsAttachment from '@/components/Attachment/lims-attachment.vue'
@@ -178,6 +179,7 @@
       selectedDeviceId: '',
       submitFormLoading: false,
       userList: [],
+      planDueDate: '',
       rules: {
         checkMethod: [{ required: true, message: '璇峰~鍐欐牳鏌ユ柟寮�', trigger: 'blur' }],
       },
@@ -209,6 +211,15 @@
         fileName: row.fileName || '',
         fileUrl: row.fileUrl || '',
         planDetailsId: row.planDetailsId,
+      }
+      this.planDueDate = ''
+      if (row.deviceId && /^\d{4}-\d{2}$/.test(this.form.checkTime)) {
+        getDeviceById({ deviceId: row.deviceId }).then(res => {
+          const due = res.data && res.data.nextExamineDate
+          if (due && String(due).slice(0, 7) === this.form.checkTime) {
+            this.planDueDate = String(due).slice(0, 10)
+          }
+        }).catch(() => {})
       }
     },
     // 鏂板鏍告煡璁板綍锛氳嚜閫夎澶囷紝鎻愪氦鏃惰嚜鍔ㄥ尮閰�/鍒涘缓鏈疆璁″垝鏄庣粏
@@ -328,6 +339,48 @@
     },
     // 鎻愪氦瀹℃牳
     examine(statue) {
+      const checkTime = this.form.checkTime || ''
+      const now = new Date()
+      const nowMonth = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`
+      const checkMonth = checkTime.slice(0, 7)
+      const isEarlyReview = statue === 1 && /^\d{4}-\d{2}/.test(checkTime) && checkMonth > nowMonth
+      if (!isEarlyReview) {
+        this.submitReview(statue)
+        return
+      }
+      const isMonthOnly = /^\d{4}-\d{2}$/.test(checkTime)
+      const nowYear = nowMonth.slice(0, 4)
+      const todayStr = `${nowMonth}-${String(now.getDate()).padStart(2, '0')}`
+      const plannedText = isMonthOnly
+        ? (this.planDueDate ? `${this.planDueDate}锛堣鍒掓湀浠� ${checkTime}锛塦 : `${checkTime}锛堢郴缁熻鍒掑彧鐧昏鍒版湀浠斤級`)
+        : checkTime
+      const head = `<div class="er-head">璇ユ潯璁板綍鐨勮鍒掓牳鏌ユ椂闂翠负 <b>${plannedText}</b>锛屽綋鍓嶅鏍告棩鏈熸槸 <b>${todayStr}</b>锛屽睘浜�<b>鎻愬墠瀹℃牳</b>銆�</div>`
+      const items = isMonthOnly
+        ? [
+          `鏈疆璁板綍鎸夊疄闄呭鏍告湀浠藉綊妗o細鏍告煡鏃堕棿鐧昏涓� <b>${nowMonth}</b>锛堝疄闄呭鏍告棩鏈� ${todayStr}锛夛紝骞跺綊鍏� <b>${nowYear} 骞磋澶囨牳鏌ヨ鍒�</b>锛堝垏鍒� ${nowYear} 骞村彲鐪嬪埌锛岀姸鎬佹樉绀衡�滈�氳繃鈥濓級銆俙,
+          `绯荤粺浼氭寜璁惧鐨勬牳鏌ュ懆鏈熻嚜鍔ㄧ敓鎴愪笅涓�杞緟鏍告煡浠诲姟锛堝湪涓嬫鏍告煡鏃ユ湡鎵�灞炲勾浠界殑璁″垝涓級锛屽垵濮嬬姸鎬佲�滄湭寮�濮嬧�濃�斺�旇繖鏄甯哥幇璞★紝涓嶆槸瀹℃牳娌$敓鏁堛�俙,
+          `璁惧妗f鐨勬渶杩戞牳鏌ユ棩鏈熸洿鏂颁负 <b>${todayStr}</b>锛屼笅娆℃牳鏌ユ棩鏈熸寜鏍告煡鍛ㄦ湡鑷姩璁$畻銆俙
+        ]
+        : [
+          `璇ヨ褰曚繚鐣欏師鏍告煡鏃ユ湡 <b>${checkTime}</b>锛屽鏍哥姸鎬佹樉绀衡�滈�氳繃鈥濄�俙,
+          `绯荤粺浼氭寜璁惧鐨勬牳鏌ュ懆鏈熻嚜鍔ㄧ敓鎴愪笅涓�杞緟鏍告煡浠诲姟锛堝湪涓嬫鏍告煡鏃ユ湡鎵�灞炲勾浠界殑璁″垝涓級锛屽垵濮嬬姸鎬佲�滄湭寮�濮嬧�濓紝杩欐槸姝e父鐜拌薄銆俙,
+          `璁惧妗f鐨勬渶杩戞牳鏌ユ棩鏈熸洿鏂颁负 <b>${todayStr}</b>锛屼笅娆℃牳鏌ユ棩鏈熸寜鏍告煡鍛ㄦ湡鑷姩璁$畻銆俙
+        ]
+      const content = `${head}<div class="er-title">閫氳繃鍚庣郴缁熶細鍋氫笁浠朵簨锛�</div>` +
+        `<ol class="er-list">${items.map(item => `<li>${item}</li>`).join('')}</ol>` +
+        `<div class="er-question">鏄惁纭閫氳繃锛�</div>`
+      this.$confirm(content, '鎻愬墠瀹℃牳鎻愰啋', {
+        confirmButtonText: '纭閫氳繃',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning',
+        dangerouslyUseHTMLString: true,
+        customClass: 'early-review-message',
+      }).then(() => {
+        this.submitReview(statue, isMonthOnly)
+      }).catch(() => {})
+    },
+    // 鐪熸鎻愪氦瀹℃牳
+    submitReview(statue, isMonthOnly = false) {
       this.submitFormLoading = true
       const params = {
         planDetailsId: this.form.planDetailsId,
@@ -335,7 +388,12 @@
       }
       reviewExamineRecord(params).then(res => {
         if (res.code == 200) {
-          this.$message.success(statue === 1 ? '瀹℃牳閫氳繃' : '宸查��鍥�')
+          if (statue === 1 && isMonthOnly) {
+            const now = new Date()
+            this.$message.success(`瀹℃牳閫氳繃锛屾湰杞凡褰掑叆 ${now.getFullYear()} 骞磋澶囨牳鏌ヨ鍒抈)
+          } else {
+            this.$message.success(statue === 1 ? '瀹℃牳閫氳繃' : '宸查��鍥�')
+          }
           this.resetForm()
         }
         this.submitFormLoading = false
@@ -447,3 +505,51 @@
   margin-bottom: 12px;
 }
 </style>
+
+<style>
+.early-review-message {
+  width: 560px !important;
+  max-width: calc(100vw - 40px);
+}
+
+.early-review-message .el-message-box__message {
+  line-height: 1.8;
+}
+
+.early-review-message .er-head {
+  padding: 10px 14px;
+  margin-bottom: 16px;
+  line-height: 1.8;
+  color: #303133;
+  background: #fdf6ec;
+  border-left: 4px solid #e6a23c;
+  border-radius: 4px;
+}
+
+.early-review-message .er-title {
+  margin-bottom: 8px;
+  font-weight: 600;
+  color: #303133;
+}
+
+.early-review-message .er-list {
+  margin: 0 0 0 4px;
+  padding-left: 20px;
+  list-style: decimal;
+}
+
+.early-review-message .er-list li {
+  margin-bottom: 10px;
+  line-height: 1.8;
+  color: #303133;
+}
+
+.early-review-message .er-list li:last-child {
+  margin-bottom: 0;
+}
+
+.early-review-message .er-question {
+  margin-top: 16px;
+  color: #606266;
+}
+</style>

--
Gitblit v1.9.3