From 825172fe39308a3c8a36c4bece5aba7c8761b0db Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期四, 22 十月 2026 20:28:19 +0800
Subject: [PATCH] fix: 完善检验设备显示与报告印章提示

---
 src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
index 9b01a34..09a92ea 100644
--- a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
+++ b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
@@ -96,13 +96,11 @@
   deviceScopeSearch
 } from '@/api/cnas/resourceDemand/device.js'
 import Sortable from "sortablejs";
-import draftSave from '@/mixins/draftSave'
 
 export default {
   name: "addYearPlanDia",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
   components: {},
-  mixins: [draftSave],
   data() {
     // 杩欓噷瀛樻斁鏁版嵁
     return {
@@ -136,10 +134,6 @@
           calibrationPlanDetailList: [],
         }
         this.calibrationPlanDetailList = []
-        this.$nextTick(() => {
-          this.draftRestore('addYearPlanDiaForm', 'form', '', 'applicationForm')
-          this.draftRestore('addYearPlanDiaRows', 'calibrationPlanDetailList', '', 'applicationForm')
-        })
       } else {
         this.getRowInfo(row)
       }
@@ -154,10 +148,6 @@
           this.form.planName = res.data.planName
           this.form.planYear = res.data.planYear
           this.form.planId = res.data.planId
-          this.$nextTick(() => {
-            this.draftRestore('addYearPlanDiaForm', 'form', this.form.planId, 'applicationForm')
-            this.draftRestore('addYearPlanDiaRows', 'calibrationPlanDetailList', this.form.planId, 'applicationForm')
-          })
         }
       }).catch(err => {
         this.yearTableLoading = false
@@ -172,7 +162,13 @@
       this.selectionRows = selection
     },
     changeMachineName() {
-      this.selectionRows.map(val => {
+      const existingIds = new Set(this.calibrationPlanDetailList.map(item => item.deviceId))
+      let skipped = 0
+      this.selectionRows.forEach(val => {
+        if (existingIds.has(val.id)) {
+          skipped++
+          return
+        }
         // 灏� val.nextCalibrationDate 杞崲涓� Date 瀵硅薄骞跺噺鍘� 5 澶�
         let nextCalibrationDate = val.nextCalibrationDate ? new Date(val.nextCalibrationDate) : null;
         if (nextCalibrationDate) {
@@ -187,7 +183,11 @@
           verificationUnit: val.calibrationServices,
           deviceAmount: 1
         })
+        existingIds.add(val.id)
       })
+      if (skipped > 0) {
+        this.$message.warning(`宸茶烦杩� ${skipped} 鍙板凡鍦ㄨ鍒掍腑鐨勮澶嘸)
+      }
       this.addEquipDia = false
       this.rowDrop()
     },
@@ -219,14 +219,24 @@
     },
     // 鎻愪氦鏂板
     submitForm() {
+      if (!this.form.planName) {
+        this.$message.warning('璇疯緭鍏ヨ鍒掑悕绉�')
+        return
+      }
+      if (!this.form.planYear) {
+        this.$message.warning('璇烽�夋嫨骞翠唤')
+        return
+      }
+      if (!this.calibrationPlanDetailList.length) {
+        this.$message.warning('璇锋坊鍔犺澶�')
+        return
+      }
       this.form.calibrationPlanDetailList = this.HaveJson(this.calibrationPlanDetailList)
       this.submitFormLoading = true
       if (this.operationType === 'add') {
         addDeviceCalibrationPlan(this.form).then(res => {
           if (res.code == 200) {
             this.$message.success('鏂板鎴愬姛')
-            this.draftClear('addYearPlanDiaForm')
-            this.draftClear('addYearPlanDiaRows')
             this.closeDialog()
             this.$emit('closeDia')
           }
@@ -237,9 +247,7 @@
       } else {
         updateDeviceCalibrationPlan(this.form).then(res => {
           if (res.code == 200) {
-            this.$message.success('鏂板鎴愬姛')
-            this.draftClear('addYearPlanDiaForm')
-            this.draftClear('addYearPlanDiaRows')
+            this.$message.success('淇敼鎴愬姛')
             this.closeDialog()
             this.$emit('closeDia')
           }
@@ -250,8 +258,6 @@
       }
     },
     closeDialog() {
-      this.draftStop('addYearPlanDiaForm')
-      this.draftStop('addYearPlanDiaRows')
       this.applicationForm = false
     },
     // 鑾峰彇鎵�鏈夎澶�

--
Gitblit v1.9.3