From a1faa94fbf85553f22da934a1abc745d89dd8667 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期一, 19 十月 2026 17:23:49 +0800
Subject: [PATCH] fix: 取消设备核查/比对的身份限制与三张设备计划的审批功能

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

diff --git a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
index 03d702f..c651824 100644
--- a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
+++ b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="dialogVisible"
-      title="浠櫒璁惧鏈熼棿鏍告煡姣斿璁板綍琛�" width="80%" @close="resetForm">
+      title="浠櫒璁惧鏈熼棿鏍告煡璁板綍琛�" width="80%" @close="resetForm">
       <el-steps :active="currentStep" align-center finish-status="success">
         <el-step title="濉啓璁惧鏍告煡瀵规瘮璁板綍"></el-step>
         <el-step title="瀹℃牳"></el-step>
@@ -10,9 +10,9 @@
         <el-col :span="8">
           <div class="form-item">
             <span style="width: 110px">浠櫒鍚嶇О锛�</span>
-            <el-select v-model="form.deviceName" :disabled="currentStep !== 0" class="table_input" clearable filterable
-              placeholder="璁惧鍚嶇О" size="small" style="width:200px" @change="(val) => changeMachineName(val)">
-              <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.label">
+            <el-select v-model="selectedDeviceId" :disabled="currentStep !== 0" class="table_input" clearable filterable
+              placeholder="璁惧鍚嶇О" size="small" style="width:200px" @change="changeMachineName">
+              <el-option v-for="item in equipOptions" :key="item.id" :label="item.label" :value="item.id">
                 {{ item.label + '-' + item.value }}
               </el-option>
             </el-select>
@@ -84,11 +84,11 @@
           </div>
         </el-col>
       </el-row>
-      <el-button size="small" style="margin: 10px 0" type="primary" @click="addRow">娣诲姞</el-button>
+      <el-button v-if="currentStep === 0" size="small" style="margin: 10px 0" type="primary" @click="addRow">娣诲姞</el-button>
       <el-table :data="recordDetailList" height="300" style="width: 100%" border>
         <el-table-column label="娴嬭瘯鐐�" min-width="130" prop="testPoint">
           <template #default="scope">
-            <el-input v-model="scope.row.testPoint" clearable size="small"></el-input>
+            <el-input v-model="scope.row.testPoint" :disabled="currentStep !== 0" clearable size="small"></el-input>
           </template>
         </el-table-column>
         <el-table-column min-width="180">
@@ -210,10 +210,10 @@
       </el-row>
       <template #footer><span  class="dialog-footer">
         <el-button @click="resetForm">鍙� 娑�</el-button>
-        <el-button v-if="currentStep === 0 && checkChargerUserId == userId" :loading="submitFormLoading" type="primary" @click="submitCheck">纭�
+        <el-button v-if="currentStep === 0" :loading="submitFormLoading" type="primary" @click="submitCheck">纭�
           瀹�</el-button>
-        <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" @click="examine(0)">涓嶉�氳繃</el-button>
-        <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" type="primary" @click="examine(1)">閫�
+        <el-button v-if="currentStep === 1" :loading="submitFormLoading" @click="examine(0)">涓嶉�氳繃</el-button>
+        <el-button v-if="currentStep === 1" :loading="submitFormLoading" type="primary" @click="examine(1)">閫�
           杩�</el-button>
       </span></template>
     </el-dialog>
@@ -229,10 +229,12 @@
 } from '@/api/cnas/resourceDemand/device.js'
 import { selectUserCondition } from "@/api/performance/class";
 import {mapGetters} from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
 export default {
   name: "check-record",
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
   components: {},
+  mixins: [draftSave],
   data() {
     // 杩欓噷瀛樻斁鏁版嵁
     return {
@@ -281,6 +283,7 @@
         { label: '鐩稿鍋忓樊', value: 2 },
       ],
       equipOptions: [],
+      selectedDeviceId: '',
       submitFormLoading: false,
       userList: [],
       reviewUserId: '',
@@ -297,6 +300,7 @@
   methods: {
     openDialog(row) {
       this.dialogVisible = true
+      this.selectedDeviceId = ''
       this.form.planDetailsId = row.planDetailsId
       this.checkChargerUserId = row.checkChargerUserId
       this.getEquipOptions()
@@ -319,15 +323,38 @@
             this.currentStep = 2
           }
           this.reviewUserId = this.form.reviewUserId
+          this.matchDeviceOption()
+          this.$nextTick(() => {
+            this.draftRestore('checkRecordForm', 'form', this.form.planDetailsId, 'dialogVisible')
+            this.draftRestore('checkRecordRows', 'recordDetailList', this.form.planDetailsId, 'dialogVisible')
+            // 鑽夌閲屽彲鑳芥敼杩囪澶囷紝鎭㈠鍚庨噸鏂板尮閰嶄笅鎷夐�変腑椤�
+            this.matchDeviceOption()
+          })
         }
       }).catch(error => {
         console.error(error)
       })
     },
-    // 璧嬪�间华鍣ㄧ紪鍙�
+    // 鎸夎澶� id 鍥炲~鍚嶇О鍜岀紪鍙凤紝閬垮厤鍚屽悕璁惧閫夐敊
     changeMachineName(value) {
-      const index = this.equipOptions.findIndex(item => item.deviceName === value)
-      this.form.deviceNumber = this.equipOptions[index].managementNumber
+      const item = this.equipOptions.find(device => device.id === value)
+      if (item) {
+        this.form.deviceName = item.deviceName
+        this.form.deviceNumber = item.managementNumber
+      } else {
+        this.form.deviceName = ''
+        this.form.deviceNumber = ''
+      }
+    },
+    // 鍘嗗彶璁板綍娌℃湁 deviceId锛屾寜鍚嶇О+缂栧彿鍙嶆煡涓嬫媺閫夐」
+    matchDeviceOption() {
+      if (!this.equipOptions.length || !this.form.deviceName) {
+        return
+      }
+      const match = this.form.deviceNumber
+        ? this.equipOptions.find(item => item.deviceName === this.form.deviceName && item.managementNumber === this.form.deviceNumber)
+        : this.equipOptions.find(item => item.deviceName === this.form.deviceName)
+      this.selectedDeviceId = match ? match.id : ''
     },
     addRow() {
       this.recordDetailList.push({ testPoint: '' })
@@ -340,6 +367,8 @@
       addExamineRecord(this.form).then(res => {
         if (res.code == 200) {
           this.$message.success('鏂板鎴愬姛')
+          this.draftClear('checkRecordForm')
+          this.draftClear('checkRecordRows')
           this.resetForm()
         }
         this.submitFormLoading = false
@@ -356,6 +385,8 @@
       reviewExamineRecord(params).then(res => {
         if (res.code == 200) {
           this.$message.success('瀹℃牳鎴愬姛')
+          this.draftClear('checkRecordForm')
+          this.draftClear('checkRecordRows')
           this.resetForm()
         }
         this.submitFormLoading = false
@@ -364,6 +395,8 @@
       })
     },
     resetForm() {
+      this.draftStop('checkRecordForm')
+      this.draftStop('checkRecordRows')
       this.dialogVisible = false
       this.$emit('closeDialog1')
     },
@@ -378,6 +411,7 @@
             m.id = m.id
             return m
           })
+          this.matchDeviceOption()
         }
       }).catch(error => {
         console.error(error)

--
Gitblit v1.9.3