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/state.vue |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/state.vue b/src/views/CNAS/resourceDemand/device/component/state.vue
index 15f53ba..884b9ad 100644
--- a/src/views/CNAS/resourceDemand/device/component/state.vue
+++ b/src/views/CNAS/resourceDemand/device/component/state.vue
@@ -242,7 +242,9 @@
 import { selectUserCondition } from "@/api/business/inspectionTask";
 import { dateFormat } from '@/utils/date'
 import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
 export default {
+  mixins: [draftSave],
   props: {
     clickNodeVal: {
       type: Object,
@@ -365,6 +367,7 @@
             if (res.code == 200) {
               this.$message.success('鎻愪氦鎴愬姛')
               this.getDeviceStatePage(this.clickNodeVal.value)
+              this.draftClear('deviceState')
               this.dialogVisible = false
               this.closeLoading()
             }
@@ -393,6 +396,9 @@
         this.form.managementNumber = res.data.managementNumber
         this.$nextTick(() => {
           this.$refs['form'].clearValidate()
+          if (!this.form.stateId) {
+            this.draftRestore('deviceState', 'form', '', 'dialogVisible')
+          }
         })
       });
       // 鑾峰彇璐熻矗浜轰俊鎭�
@@ -414,6 +420,9 @@
       this.currentStepClick = this.currentStep === 4 ? 0 : this.currentStep
       this.$nextTick(() => {
         this.$refs['form'].clearValidate()
+        if (this.currentStep === 0) {
+          this.draftRestore('deviceState', 'form', this.form.stateId, 'dialogVisible')
+        }
       })
       this.dialogVisible = true
     },
@@ -489,6 +498,7 @@
     },
     dialogVisible(newVal) {
       if (!newVal) {
+        this.draftStop('deviceState')
         this.form = {
         }
         this.closeLoading()

--
Gitblit v1.9.3