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 +++++++++++++++++++++++++++++++++++
 src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue |   37 ++++++++++--
 2 files changed, 138 insertions(+), 7 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>
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
index fa984f8..6c5e8d8 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
@@ -90,7 +90,7 @@
               @click="handleRecord(scope.row)">瀹℃牳</el-button>
             <el-button v-if="scope.row.recordStatus === 2 || scope.row.recordStatus === 3"
               size="small" link type="primary" @click="handleDown(scope.row)">瀵煎嚭</el-button>
-            <el-button v-if="scope.row.recordStatus === 0 && scope.row.recordContrastStatus === 0"
+            <el-button v-if="scope.row.recordStatus === 0 || scope.row.recordStatus === 1"
               size="small" link type="danger" @click="deleteFun1(scope.row.planDetailsId)">鍒犻櫎</el-button>
           </template>
         </el-table-column>
@@ -114,10 +114,14 @@
             </el-col>
             <el-col :span="12">
               <el-form-item label="妫�鏌ユ棩鏈燂細" prop="checkTime">
-                <el-date-picker v-model="form.checkTime" :disabled="operationType === 'view'" clearable
-                  format="YYYY-MM" placeholder="閫夋嫨妫�鏌ユ棩鏈�" size="small" style="width:100%" type="month"
-                  value-format="YYYY-MM">
-                </el-date-picker>
+                <el-input v-if="operationType === 'view'" :model-value="formatCheckMonth(null, null, form.checkTime)"
+                  disabled size="small"></el-input>
+                <template v-else>
+                  <el-date-picker v-model="checkTimeEditValue" clearable format="YYYY-MM-DD" placeholder="閫夋嫨妫�鏌ユ棩鏈�"
+                    size="small" style="width:100%" type="date" value-format="YYYY-MM-DD">
+                  </el-date-picker>
+                  <div v-if="isMonthOnlyCheckTime" class="check-time-tip">绯荤粺鐧昏鍙埌鏈堜唤锛岄�夋嫨鍏蜂綋鏃ユ湡鍚庡皢鎸夋棩淇濆瓨</div>
+                </template>
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -500,7 +504,7 @@
     },
     // 鏄庣粏-鍒犻櫎
     deleteFun1(id) {
-      this.$confirm('鍒犻櫎鍚庯紝鑻ヨ璁惧杩樻湁瀹℃牳閫氳繃鐨勬牳鏌ヨ褰曪紝妗f鐨勬渶杩戞牳鏌ユ棩鏈熷皢鍥為��鍒版渶杩戜竴娆″畬鎴愯褰曪紱鑻ユ病鏈夛紝鍒欐竻绌烘。妗堢殑鏍告煡鏃ユ湡鍜屾牳鏌ュ懆鏈熴�傛槸鍚︾户缁�?', '鎻愮ず', {
+      this.$confirm('鍒犻櫎鍚庯紝璇ヨ鏈鏍哥殑鏍告煡璁板綍鍙婇檮浠朵細涓�骞跺垹闄わ紱鑻ヨ璁惧杩樻湁瀹℃牳閫氳繃鐨勬牳鏌ヨ褰曪紝妗f鐨勬渶杩戞牳鏌ユ棩鏈熷皢鍥為��鍒版渶杩戜竴娆″畬鎴愯褰曪紱鑻ユ病鏈夛紝鍒欐竻绌烘。妗堢殑鏍告煡鏃ユ湡鍜屾牳鏌ュ懆鏈熴�傛槸鍚︾户缁�?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
@@ -650,6 +654,19 @@
       }
       return list
     },
+    // 鏃ユ湡鎺т欢鍙帴鍙� YYYY-MM-DD锛涚郴缁熺櫥璁扮殑寰呮牳鏌ヨ鍙湁骞存湀锛屾湭鏀规棩鏈熸椂涓嶈兘鎶娾�滄棩鈥濆啓杩涜〃鍗�
+    checkTimeEditValue: {
+      get() {
+        const val = this.form.checkTime || ''
+        return /^\d{4}-\d{2}$/.test(val) ? `${val}-01` : val
+      },
+      set(val) {
+        this.form.checkTime = val || ''
+      }
+    },
+    isMonthOnlyCheckTime() {
+      return /^\d{4}-\d{2}$/.test(this.form.checkTime || '')
+    },
   },
 }
 </script>
@@ -737,6 +754,14 @@
   margin-bottom: 12px;
 }
 
+.check-time-tip {
+  width: 100%;
+  font-size: 12px;
+  line-height: 1.4;
+  color: #909399;
+  margin-top: 2px;
+}
+
 .export-panel {
   border: 1px solid #e4e7ed;
   border-radius: 6px;

--
Gitblit v1.9.3