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/checkRecord.vue | 52 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
index 03d702f..3fe2c2f 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">
@@ -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