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/accidentForm.vue | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/accidentForm.vue b/src/views/CNAS/resourceDemand/device/component/accidentForm.vue
index a6d4ebc..12a8797 100644
--- a/src/views/CNAS/resourceDemand/device/component/accidentForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/accidentForm.vue
@@ -100,10 +100,12 @@
getDeviceAccidentReport,
addDeviceAccidentReport,
} from '@/api/cnas/resourceDemand/device.js'
+import draftSave from '@/mixins/draftSave'
export default {
name: "accident-form",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -150,13 +152,17 @@
this.getUserList()
if (this.form.accidentReportId) {
this.searchInfo()
+ } else {
+ this.draftRestore('accidentForm', 'form', this.form.deviceId, 'dialogVisible')
}
},
// 鏌ヨ璇︽儏
searchInfo() {
getDeviceAccidentReport({ accidentReportId: this.form.accidentReportId }).then(res => {
if (res.code === 200) {
+ const id = this.form.accidentReportId
this.form = { ...res.data }
+ this.draftRestore('accidentForm', 'form', id, 'dialogVisible')
if (res.data.isFinish === 0) {
if (this.form.assessorUserId) {
this.currentStep = 1
@@ -194,6 +200,7 @@
addDeviceAccidentReport(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('accidentForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -205,6 +212,7 @@
},
// 鍏抽棴寮规
resetForm() {
+ this.draftStop('accidentForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
--
Gitblit v1.9.3