From c6e96cdb8b1cfb51e9a45bf86c38d1353e983127 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期一, 19 十月 2026 15:19:48 +0800
Subject: [PATCH] 设备模块业务完善及前序页面优化

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

diff --git a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
index 3269482..09a92ea 100644
--- a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
+++ b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
@@ -162,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) {
@@ -177,7 +183,11 @@
           verificationUnit: val.calibrationServices,
           deviceAmount: 1
         })
+        existingIds.add(val.id)
       })
+      if (skipped > 0) {
+        this.$message.warning(`宸茶烦杩� ${skipped} 鍙板凡鍦ㄨ鍒掍腑鐨勮澶嘸)
+      }
       this.addEquipDia = false
       this.rowDrop()
     },
@@ -209,6 +219,18 @@
     },
     // 鎻愪氦鏂板
     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') {
@@ -225,7 +247,7 @@
       } else {
         updateDeviceCalibrationPlan(this.form).then(res => {
           if (res.code == 200) {
-            this.$message.success('鏂板鎴愬姛')
+            this.$message.success('淇敼鎴愬姛')
             this.closeDialog()
             this.$emit('closeDia')
           }

--
Gitblit v1.9.3