From 39154a82354b08c2449918c0665457fdb2701b9b Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期五, 16 十月 2026 16:02:23 +0800
Subject: [PATCH] 设备模块各标签页弹窗新增草稿自动保存与恢复:编辑或录入数据中途关闭/刷新页面,再次打开同一弹窗时自动恢复未保存的编辑内容(弹窗显示"已恢复上次未保存的编辑内容"提示),保存成功后草稿自动清除;新增 src/mixins/draftSave.js 同时清理设备死代码:management.vue 数采配置旧弹窗及其提交方法、calibration.vue 被注释的导出按钮、device.js 中 numberCollect/deviceMetricRecordExport 两个死接口定义

---
 src/views/CNAS/resourceDemand/device/component/management.vue |   93 +++++++---------------------------------------
 1 files changed, 14 insertions(+), 79 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/management.vue b/src/views/CNAS/resourceDemand/device/component/management.vue
index ee16e8f..16e5c67 100644
--- a/src/views/CNAS/resourceDemand/device/component/management.vue
+++ b/src/views/CNAS/resourceDemand/device/component/management.vue
@@ -27,7 +27,7 @@
         </el-form>
       </div>
       <div>
-        <el-button size="small" type="primary" @click="dialogVisible2 = true">鏂板</el-button>
+        <el-button size="small" type="primary" @click="openAdd2">鏂板</el-button>
         <el-button size="small" type="primary" @click="handleDownOne">瀵煎嚭</el-button>
       </div>
     </div>
@@ -408,42 +408,6 @@
 				</el-row>
 			</span></template>
 		</el-dialog>
-		<el-dialog title="鏁伴噰閰嶇疆" v-model="dialogVisible3" width="400px">
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>IP锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.ip"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>閲囬泦鍦板潃锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.collectUrl"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍌ㄥ瓨鍦板潃锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.storageUrl"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍙傜収锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.refer"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>X锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.x"></el-input>
-			</div>
-			<div class="search_thing" style="margin-bottom: 14px;">
-				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>Y锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.y"></el-input>
-			</div>
-			<div class="search_thing">
-				<div class="search_label">鍏紡锛�</div>
-				<el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="configForm.formula"></el-input>
-			</div>
-			<template #footer><span  class="dialog-footer">
-				<el-row justify="end">
-					<el-button @click="dialogVisible3 = false">鍙� 娑�</el-button>
-					<el-button type="primary" @click="submitForm3" :loading="upLoad3">纭� 瀹�</el-button>
-				</el-row>
-			</span></template>
-		</el-dialog>
 		<dataAcquisitionConfig v-if="showData" :deviceId="deviceId" />
 	</div>
 </template>
@@ -456,13 +420,13 @@
 	getInsProduction,
 	upDeviceParameter,
 	addDeviceParameter,
-	numberCollect,
 	getDeviceParameter,
 	delDeviceParameter,
 } from '@/api/cnas/resourceDemand/device.js'
 import { selectUserCondition } from "@/api/business/inspectionTask";
 import dayjs from 'dayjs'
 import { selectQualifiedSupplierManagementPage } from '@/api/cnas/externalService/supplierManage/supplierManage'
+import draftSave from '@/mixins/draftSave'
 export default {
 	props: {
 		clickNodeVal: {
@@ -476,6 +440,7 @@
 		limsTable,
 		dataAcquisitionConfig,
 	},
+	mixins: [draftSave],
 	data() {
 		return {
 			dateFormat: 'yyyy-MM-dd',
@@ -522,9 +487,6 @@
 			deviceStatusList: [],
 			upLoad: false,
 			upLoad2: false,
-			dialogVisible3: false,
-			upLoad3: false,
-			configForm: {},
 			queryParams: {},
 			tableData: [],
 			column: [
@@ -808,7 +770,14 @@
 				})
 			})
 		},
+		openAdd2() {
+			this.dialogVisible2 = true
+			this.$nextTick(() => {
+				this.draftRestore('managementAdd', 'formData2', '', 'dialogVisible2')
+			})
+		},
 		handleClose() {
+			this.draftStop('management')
 			this.formData = {
 				authorizedPerson: []
 			}
@@ -821,6 +790,7 @@
 			this.upLoad = false;
 		},
 		handleClose2() {
+			this.draftStop('managementAdd')
 			this.formData = {
 				authorizedPerson: []
 			}
@@ -864,6 +834,7 @@
 					this.formData[key] = `${this.formData[key]} 00:00:00`
 				}
 			})
+			this.draftRestore('management', 'formData', this.formData.id, 'dialogVisible')
 		},
 		beforeUpload(file) {
 			if (file.size > 1024 * 1024 * 10) {
@@ -958,6 +929,7 @@
 				this.$message.success('淇敼鎴愬姛')
 				this.upLoad = false
 				this.refreshTable('page')
+				this.draftClear('management')
 				this.dialogVisible = false
 			}).catch(e => {
 				this.$message.error('淇敼澶辫触')
@@ -1001,6 +973,7 @@
 				this.$message.success('鎻愪氦鎴愬姛')
 				this.upLoad2 = false
 				this.refreshTable('page')
+				this.draftClear('managementAdd')
 				this.dialogVisible2 = false
 				this.formData2 = {
 					imageUpload: '',
@@ -1035,44 +1008,6 @@
 		closeDataVue() {
 			this.clickSidebar(this.clickNodeVal)
 			this.showData = false
-		},
-		submitForm3() {
-			if (!this.configForm.ip) {
-				this.$message.error('璇峰~鍐橧P');
-				return
-			}
-			if (!this.configForm.collectUrl) {
-				this.$message.error('璇峰~鍐欓噰闆嗗湴鍧�');
-				return
-			}
-			if (!this.configForm.storageUrl) {
-				this.$message.error('璇峰~鍐欏偍瀛樺湴鍧�');
-				return
-			}
-			if (!this.configForm.refer) {
-				this.$message.error('璇峰~鍐欏弬鐓�');
-				return
-			}
-			if (!this.configForm.x) {
-				this.$message.error('璇峰~鍐橷');
-				return
-			}
-			if (!this.configForm.y) {
-				this.$message.error('璇峰~鍐橸');
-				return
-			}
-
-			this.upLoad3 = true
-			numberCollect(this.configForm).then(res => {
-				this.upLoad3 = false
-				this.$message.success('鎿嶄綔鎴愬姛')
-				this.refreshTable('page')
-				this.dialogVisible3 = false
-			}).catch(e => {
-				this.$message.error('鎿嶄綔澶辫触')
-				this.dialogVisible3 = false
-				this.upLoad3 = false
-			})
 		},
 		// 鐐瑰嚮渚ц竟鏍忓埛鏂�
 		clickSidebar(clickNodeVal) {

--
Gitblit v1.9.3