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/calibration.vue |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/calibration.vue b/src/views/CNAS/resourceDemand/device/component/calibration.vue
index 5564222..f165298 100644
--- a/src/views/CNAS/resourceDemand/device/component/calibration.vue
+++ b/src/views/CNAS/resourceDemand/device/component/calibration.vue
@@ -4,7 +4,6 @@
     <div class="btnS">
       <el-button size="small" type="primary" @click="calibrationMaintenance()">鏍″噯椤圭洰缁存姢</el-button>
       <el-button size="small" type="primary" @click="add('add')">娣诲姞鏍″噯璁板綍</el-button>
-      <!-- <el-button size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button> -->
     </div>
     <div class="tables" style="margin-top: 10px;">
       <el-table :data="tableData" height="calc(100vh - 20em)" border>
@@ -258,7 +257,6 @@
   deviceMetricRecordPage,
   showDeviceMetricsCopy,
   deleteDeviceMetricRecord,
-  deviceMetricRecordExport,
   deleteCNASFile,
   selectDeviceMetric,
   deleteDeviceMetrics,
@@ -267,6 +265,7 @@
 } from '@/api/cnas/resourceDemand/device.js'
 import { selectQualifiedSupplierManagementPage } from '@/api/cnas/externalService/supplierManage/supplierManage'
 import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
 export default {
   props: {
     clickNodeVal: {
@@ -276,6 +275,7 @@
       }
     }
   },
+  mixins: [draftSave],
   data() {
     return {
       value: "",
@@ -408,7 +408,10 @@
     add(type) {
       this.operationType = type
       this.dialogVisible1 = true
-      this.getXmsg()
+      this.draftRestore('calibrationRecord', 'calibrationRecord', '', 'dialogVisible1')
+      this.getXmsg().then(() => {
+        this.draftRestore('calibrationRecordParams', 'calibrateParams', '', 'dialogVisible1')
+      })
     },
     // 鏌ョ湅璇︽儏
     handleViewClick(type, row) {
@@ -440,18 +443,6 @@
     handleAttachmentClick(row) {
       this.$download.saveAs(row.systemFileName, row.systemFileName)
     },
-    //瀵煎嚭
-    handleDown() {
-      this.outLoading = true
-      deviceMetricRecordExport({
-        deviceId: this.clickNodeVal.value,
-        type: 'calibrate'
-      }).then(res => {
-        this.outLoading = false
-        const blob = new Blob([res], { type: 'application/octet-stream' });
-        this.$download.saveAs(blob, '璁惧鏍″噯.xlsx')
-      })
-    },
     deleteFile() {
       this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎鏂囦欢, 鏄惁缁х画?', '鎻愮ず', {
         confirmButtonText: '纭畾',
@@ -477,6 +468,9 @@
     calibrationMaintenance() {
       this.dialogVisible0 = true
       this.getXmsg();
+      this.$nextTick(() => {
+        this.draftRestore('calibrationMaintain', 'form0', this.clickNodeVal.value, 'dialogVisible0')
+      })
     },
     // 鑾峰彇璁惧鏍″噯鍙傛暟table淇℃伅
     async getXmsg() {
@@ -523,6 +517,8 @@
             if (res.code == 200) {
               this.$message.success('淇濆瓨鎴愬姛')
               this.$refs['form0'].resetFields()
+              this.draftClear('calibrationMaintain')
+              this.draftRestore('calibrationMaintain', 'form0', this.clickNodeVal.value, 'dialogVisible0')
               this.getXmsg() // 鍒锋柊璁惧鏍″噯鍙傛暟琛ㄦ牸
             }
             this.calibrateParamsLoading = false
@@ -554,6 +550,8 @@
             addOrUpdateDeviceMetricRecord(this.calibrationRecord).then(res => {
               if (res.code == 200) {
                 this.$message.success('娣诲姞鎴愬姛')
+                this.draftClear('calibrationRecord')
+                this.draftClear('calibrationRecordParams')
                 this.dialogVisible1 = false
                 this.getTableList(this.clickNodeVal.value)
               }
@@ -608,6 +606,8 @@
     },
     dialogVisible1(newVal) {
       if (newVal === false) {
+        this.draftStop('calibrationRecord')
+        this.draftStop('calibrationRecordParams')
         this.calibrateParams = []
         this.calibrationRecord = {
           unitOfMeasure: '', // 璁¢噺鍗曚綅

--
Gitblit v1.9.3