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/operationInstruction.vue |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue b/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
index c373600..31b74e7 100644
--- a/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
+++ b/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
@@ -3,7 +3,7 @@
   <div>
     <div style="margin: 10px 0;text-align: right">
       <el-button size="small" type="primary" @click="getList">鍒锋柊</el-button>
-      <el-button size="small" type="primary" @click="dialogVisible = true">鍙楁帶鐢宠</el-button>
+      <el-button size="small" type="primary" @click="openInstructionDia">鍙楁帶鐢宠</el-button>
     </div>
     <el-table :data="tableData" border height="calc(100vh - 18em)"
 >
@@ -188,7 +188,9 @@
   pageByPageQueryOfHomeworkInstructions,
   selectDeviceParameter,
 } from '@/api/cnas/resourceDemand/device.js'
+import draftSave from '@/mixins/draftSave'
 export default {
+  mixins: [draftSave],
   props: {
     clickNodeVal: {
       type: Object,
@@ -259,6 +261,8 @@
     },
     dialogVisible(newVal) {
       if (newVal === false) {
+        this.draftStop('instructionForm')
+        this.draftStop('instructionRows')
         this.instructionForm = {}
         this.documentTableData = []
         this.fileList1 = []
@@ -337,7 +341,17 @@
           this.documentTableData.forEach((v, k) => {
             v.index = k
           })
+          this.draftRestore('instructionForm', 'instructionForm', row.instructionId, 'dialogVisible')
+          this.draftRestore('instructionRows', 'documentTableData', row.instructionId, 'dialogVisible')
         }
+      })
+    },
+    // 鎵撳紑鍙楁帶鐢宠寮圭獥锛堟柊澧烇級
+    openInstructionDia() {
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        this.draftRestore('instructionForm', 'instructionForm', '', 'dialogVisible')
+        this.draftRestore('instructionRows', 'documentTableData', '', 'dialogVisible')
       })
     },
     handleSizeChange(val) {
@@ -355,6 +369,8 @@
           newHomeworkGuidebookAdded(this.instructionForm).then(res => {
             if (res.code == 200) {
               this.$message.success('鎿嶄綔鎴愬姛锛�')
+              this.draftClear('instructionForm')
+              this.draftClear('instructionRows')
               this.dialogVisible = false
               this.getList()
             }
@@ -396,6 +412,7 @@
     addFile() {
       this.$refs.form.validate((valid) => {
         if (valid) {
+          this.draftClear('instructionRowForm')
           if (this.tableDataIndex !== undefined) {
             this.documentTableData[this.tableDataIndex] = this.form
             this.dialogVisible1 = false;
@@ -418,7 +435,7 @@
       this.form.deviceName = this.clickNodeVal.label
       this.onDeviceNameChange()
       this.fileList = []
-
+      this.draftRestore('instructionRowForm', 'form', '', 'dialogVisible1')
     },
     editFun(row, index) {
       this.form = { ...row }
@@ -429,8 +446,10 @@
         this.fileList.push({ name: this.form.fileName })
       }
       this.dialogVisible1 = true
+      this.draftRestore('instructionRowForm', 'form', row.id !== undefined ? row.id : ('row' + index), 'dialogVisible1')
     },
     closeDia() {
+      this.draftStop('instructionRowForm')
       this.dialogVisible1 = false
       this.$refs['form'].resetFields()
       this.fileList = []

--
Gitblit v1.9.3