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/api/cnas/resourceDemand/device.js | 19 -
src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue | 16 +
src/views/CNAS/resourceDemand/device/component/files.vue | 17 +
src/views/CNAS/resourceDemand/device/component/management.vue | 93 +-------
src/views/CNAS/resourceDemand/device/component/state.vue | 10 +
src/views/CNAS/resourceDemand/device/component/inspectionForm.vue | 11 +
src/views/CNAS/resourceDemand/device/component/calibration.vue | 30 +-
src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue | 9
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue | 16 +
src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue | 9
src/views/CNAS/resourceDemand/device/component/accidentForm.vue | 8
src/views/CNAS/resourceDemand/device/component/fault.vue | 9
src/views/CNAS/resourceDemand/device/component/checkRecord.vue | 12 +
src/mixins/draftSave.js | 157 +++++++++++++++
src/views/CNAS/resourceDemand/device/component/applicationForm.vue | 12 +
src/views/CNAS/resourceDemand/device/component/check.vue | 7
src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue | 16 +
src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue | 16 +
src/views/CNAS/resourceDemand/device/component/scrapApplicationForm.vue | 8
src/views/CNAS/resourceDemand/device/component/borrow.vue | 8
src/views/CNAS/resourceDemand/device/component/operationInstruction.vue | 23 ++
src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue | 7
src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue | 16 +
src/views/CNAS/resourceDemand/device/component/record.vue | 9
src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue | 14 +
src/views/CNAS/resourceDemand/device/component/resourceReservation.vue | 4
src/views/CNAS/resourceDemand/device/component/failureForm.vue | 8
src/views/CNAS/resourceDemand/device/component/acceptanceForm.vue | 11 +
src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue | 9
29 files changed, 468 insertions(+), 116 deletions(-)
diff --git a/src/api/cnas/resourceDemand/device.js b/src/api/cnas/resourceDemand/device.js
index bd162b7..74e1f1e 100644
--- a/src/api/cnas/resourceDemand/device.js
+++ b/src/api/cnas/resourceDemand/device.js
@@ -74,15 +74,6 @@
});
}
-// 缁存姢鏁伴噰閰嶇疆
-export function numberCollect(data) {
- return request({
- url: "/deviceScope/numberCollect",
- method: "post",
- data: data,
- });
-}
-
//璁惧棰勭害鎺ュ彛-鍒楄〃
export function getDeviceParameter(query) {
return request({
@@ -823,16 +814,6 @@
return request({
url: "/deviceMetricRecord/deleteDeviceMetricRecord",
method: "delete",
- params: query,
- });
-}
-
-//璁惧鏍″噯 瀵煎嚭
-export function deviceMetricRecordExport(query) {
- return request({
- url: "/deviceMetricRecord/deviceMetricRecordExport",
- method: "get",
- responseType: "blob",
params: query,
});
}
diff --git a/src/mixins/draftSave.js b/src/mixins/draftSave.js
new file mode 100644
index 0000000..1308752
--- /dev/null
+++ b/src/mixins/draftSave.js
@@ -0,0 +1,157 @@
+import cache from '@/plugins/cache'
+import useUserStore from '@/store/modules/user'
+
+// 寮圭獥缂栬緫鑽夌鑷姩淇濆瓨/鎭㈠锛�
+// 鎵撳紑寮圭獥鏃舵敞鍐屽敮涓�涓氬姟 key锛岃〃鍗曟湁鏀瑰姩鏃堕槻鎶栧啓鍏� localStorage锛�
+// 鍏抽棴/鍒囬〉/鍒锋柊鍚庡啀娆℃墦寮�鍚屼竴寮圭獥鏃惰嚜鍔ㄦ仮澶嶆湭淇濆瓨鐨勫唴瀹癸紱淇濆瓨鎴愬姛鍚庤崏绋挎竻闄ゃ��
+export default {
+ data() {
+ return {
+ draftStates: {}
+ }
+ },
+ created() {
+ this.draftBeforeUnload = () => {
+ this.draftFlushAll()
+ }
+ window.addEventListener('beforeunload', this.draftBeforeUnload)
+ },
+ beforeUnmount() {
+ this.draftFlushAll()
+ window.removeEventListener('beforeunload', this.draftBeforeUnload)
+ },
+ methods: {
+ // 鎵撳紑寮圭獥銆佽〃鍗曞~濂藉悗璋冪敤锛涙湁鏈繚瀛樿崏绋垮垯鑷姩鎭㈠
+ // bizKey锛氬叏灞�鍞竴涓氬姟鍚嶏紱formField锛氳〃鍗曞瓧娈靛悕(濡� 'form')锛況ecordId锛氱紪杈戜紶璁板綍id銆佹柊澧炰紶涓婁笅鏂囷紱visibleField锛氬脊绐楁樉闅愬瓧娈�(濡� 'dialogVisible')
+ draftRestore(bizKey, formField, recordId, visibleField) {
+ const old = this.draftStates[bizKey]
+ if (old) {
+ this.draftTeardown(old)
+ }
+ let uid = ''
+ try {
+ uid = useUserStore().id || ''
+ } catch (e) {
+ }
+ const rid = (recordId === null || recordId === undefined || recordId === '') ? 'new' : recordId
+ const state = {
+ key: `limsDraft_${uid}_${bizKey}_${rid}`,
+ formField,
+ visibleField,
+ active: true,
+ timer: null,
+ baseline: ''
+ }
+ state.unwatchForm = this.$watch(formField, () => this.draftSchedule(state), { deep: true })
+ if (visibleField) {
+ state.unwatchVisible = this.$watch(visibleField, (val) => {
+ if (!val) {
+ this.draftStop(bizKey)
+ }
+ })
+ }
+ state.baseline = this.draftSnapshot(state)
+ this.draftStates[bizKey] = state
+ const raw = cache.local.get(state.key)
+ if (raw) {
+ try {
+ const draft = JSON.parse(raw)
+ const target = this[formField]
+ if (Array.isArray(target) && Array.isArray(draft)) {
+ target.splice(0, target.length, ...draft)
+ } else if (target && typeof target === 'object') {
+ Object.assign(target, draft)
+ } else {
+ this[formField] = draft
+ }
+ this.$message({ type: 'info', message: '宸叉仮澶嶄笂娆℃湭淇濆瓨鐨勭紪杈戝唴瀹�' })
+ } catch (e) {
+ cache.local.remove(state.key)
+ }
+ }
+ },
+ draftSnapshot(state) {
+ try {
+ return JSON.stringify(this[state.formField])
+ } catch (e) {
+ return ''
+ }
+ },
+ draftSchedule(state) {
+ if (!state.active) {
+ return
+ }
+ if (state.timer) {
+ clearTimeout(state.timer)
+ }
+ state.timer = setTimeout(() => {
+ state.timer = null
+ this.draftWrite(state, true)
+ }, 300)
+ },
+ draftWrite(state, checkVisible) {
+ if (!state.active) {
+ return
+ }
+ if (checkVisible && state.visibleField && !this[state.visibleField]) {
+ return
+ }
+ const json = this.draftSnapshot(state)
+ if (json === '' || json === state.baseline) {
+ cache.local.remove(state.key)
+ } else {
+ cache.local.set(state.key, json)
+ }
+ },
+ // 鐢ㄦ埛鍙栨秷/鍏抽棴寮圭獥鏃惰皟鐢�(蹇呴』鍦ㄦ竻绌鸿〃鍗曚箣鍓�)
+ draftStop(bizKey) {
+ const state = this.draftStates[bizKey]
+ if (!state || !state.active) {
+ return
+ }
+ if (state.timer) {
+ clearTimeout(state.timer)
+ state.timer = null
+ }
+ this.draftWrite(state, false)
+ this.draftTeardown(state)
+ },
+ // 淇濆瓨鎴愬姛鍚庤皟鐢�
+ draftClear(bizKey) {
+ const state = this.draftStates[bizKey]
+ if (!state) {
+ return
+ }
+ if (state.timer) {
+ clearTimeout(state.timer)
+ state.timer = null
+ }
+ cache.local.remove(state.key)
+ this.draftTeardown(state)
+ },
+ draftTeardown(state) {
+ state.active = false
+ if (state.unwatchForm) {
+ state.unwatchForm()
+ state.unwatchForm = null
+ }
+ if (state.unwatchVisible) {
+ state.unwatchVisible()
+ state.unwatchVisible = null
+ }
+ },
+ draftFlushAll() {
+ Object.keys(this.draftStates).forEach((k) => {
+ const state = this.draftStates[k]
+ if (state && state.active) {
+ if (state.timer) {
+ clearTimeout(state.timer)
+ state.timer = null
+ }
+ this.draftWrite(state, true)
+ this.draftTeardown(state)
+ }
+ })
+ }
+ }
+}
diff --git a/src/views/CNAS/resourceDemand/device/component/acceptanceForm.vue b/src/views/CNAS/resourceDemand/device/component/acceptanceForm.vue
index 331d207..a0d204e 100644
--- a/src/views/CNAS/resourceDemand/device/component/acceptanceForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/acceptanceForm.vue
@@ -79,10 +79,12 @@
updateDeviceAcceptance,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import draftSave from '@/mixins/draftSave'
export default {
name: "acceptance-form",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -122,13 +124,19 @@
this.getUserList()
if (this.form.acceptanceId) {
this.searchInfo()
+ } else if (this.operationType !== 'view') {
+ this.draftRestore('acceptanceForm', 'form', this.form.deviceId, 'dialogVisible')
}
},
// 鏌ヨ璇︽儏
searchInfo() {
getDeviceAcceptance({ acceptanceId: this.form.acceptanceId }).then(res => {
if (res.code === 200) {
+ const id = this.form.acceptanceId
this.form = { ...res.data }
+ if (this.operationType !== 'view') {
+ this.draftRestore('acceptanceForm', 'form', id, 'dialogVisible')
+ }
}
}).catch(error => {
console.error(error)
@@ -142,6 +150,7 @@
addDeviceAcceptance(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('acceptanceForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -152,6 +161,7 @@
updateDeviceAcceptance(this.form).then(res => {
if (res.code == 200) {
this.$message.success('淇敼鎴愬姛')
+ this.draftClear('acceptanceForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -164,6 +174,7 @@
},
// 鍏抽棴寮规
resetForm() {
+ this.draftStop('acceptanceForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
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')
},
diff --git a/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue b/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue
index 744b380..c7cfbc6 100644
--- a/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue
+++ b/src/views/CNAS/resourceDemand/device/component/acquisitionConfig.vue
@@ -181,10 +181,12 @@
getNoConfigProduct,
} from '@/api/cnas/resourceDemand/device.js'
import limsTable from "@/components/Table/lims-table.vue";
+import draftSave from '@/mixins/draftSave'
export default {
name: "dataAcquisitionConfig",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {limsTable},
+ mixins: [draftSave],
props: {
deviceId: {
type: Number,
@@ -405,6 +407,9 @@
this.configForm["sampleCode"] = res.data.sampleCode;
this.configForm["dbFileName"] = res.data.dbFileName;
this.configForm["fiberOpticRibbon"] = res.data.fiberOpticRibbon
+ this.$nextTick(() => {
+ this.draftRestore('acquisitionConfig4', 'configForm', this.deviceId, 'dialogVisible4')
+ })
})
},
// 鎻愪氦鏂囦欢閰嶇疆
@@ -423,6 +428,7 @@
this.upLoad4 = true;
saveDeviceFileConfiguration({ deviceId: this.deviceId, ...obj }).then(res => {
if (res.code == 200) {
+ this.draftClear('acquisitionConfig4')
this.dialogVisible4 = false;
this.init();
this.$message.success("鎿嶄綔鎴愬姛");
@@ -481,6 +487,10 @@
});
});
}
+ this.$nextTick(() => {
+ this.draftRestore('acquisitionConfig3', 'configForm', row.structureItemParameterId, 'dialogVisible3')
+ this.draftRestore('acquisitionConfig3Domains', 'domains', row.structureItemParameterId, 'dialogVisible3')
+ })
});
},
// 鎻愪氦鏁伴噰閰嶇疆
@@ -520,6 +530,8 @@
dataConfigList: this.domains,
isDevice: false
}).then(res => {
+ this.draftClear('acquisitionConfig3')
+ this.draftClear('acquisitionConfig3Domains')
this.dialogVisible3 = false;
this.domains = [
{
@@ -580,6 +592,8 @@
this.page.current = val;
},
closeForm() {
+ this.draftStop('acquisitionConfig3')
+ this.draftStop('acquisitionConfig3Domains')
this.deleteList = [];
this.domains = [
{
diff --git a/src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue b/src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue
index 03716dc..c367d6a 100644
--- a/src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue
+++ b/src/views/CNAS/resourceDemand/device/component/addVerificationYearPlanDia.vue
@@ -99,10 +99,12 @@
deviceScopeSearch,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
+import draftSave from '@/mixins/draftSave'
export default {
name: "addVerificationYearPlanDia",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -137,6 +139,10 @@
examinePlanDetailsList: [],
}
this.examinePlanDetailsList = []
+ this.$nextTick(() => {
+ this.draftRestore('addVerificationYearPlanDiaForm', 'form', '', 'applicationForm')
+ this.draftRestore('addVerificationYearPlanDiaRows', 'examinePlanDetailsList', '', 'applicationForm')
+ })
} else {
this.getRowInfo(row)
}
@@ -152,6 +158,10 @@
this.form.planName = res.data.planName
this.form.planYear = res.data.planYear
this.form.planId = res.data.planId
+ this.$nextTick(() => {
+ this.draftRestore('addVerificationYearPlanDiaForm', 'form', this.form.planId, 'applicationForm')
+ this.draftRestore('addVerificationYearPlanDiaRows', 'examinePlanDetailsList', this.form.planId, 'applicationForm')
+ })
}
}).catch(error => {
this.yearTableLoading = false
@@ -212,6 +222,8 @@
addDeviceExaminePlan(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('addVerificationYearPlanDiaForm')
+ this.draftClear('addVerificationYearPlanDiaRows')
this.closeDialog()
this.$emit('closeDia')
}
@@ -223,6 +235,8 @@
updateDeviceExaminePlan(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('addVerificationYearPlanDiaForm')
+ this.draftClear('addVerificationYearPlanDiaRows')
this.closeDialog()
this.$emit('closeDia')
}
@@ -233,6 +247,8 @@
}
},
closeDialog() {
+ this.draftStop('addVerificationYearPlanDiaForm')
+ this.draftStop('addVerificationYearPlanDiaRows')
this.applicationForm = false
},
// 鑾峰彇鎵�鏈夎澶�
diff --git a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
index 3269482..9b01a34 100644
--- a/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
+++ b/src/views/CNAS/resourceDemand/device/component/addYearPlanDia.vue
@@ -96,11 +96,13 @@
deviceScopeSearch
} from '@/api/cnas/resourceDemand/device.js'
import Sortable from "sortablejs";
+import draftSave from '@/mixins/draftSave'
export default {
name: "addYearPlanDia",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -134,6 +136,10 @@
calibrationPlanDetailList: [],
}
this.calibrationPlanDetailList = []
+ this.$nextTick(() => {
+ this.draftRestore('addYearPlanDiaForm', 'form', '', 'applicationForm')
+ this.draftRestore('addYearPlanDiaRows', 'calibrationPlanDetailList', '', 'applicationForm')
+ })
} else {
this.getRowInfo(row)
}
@@ -148,6 +154,10 @@
this.form.planName = res.data.planName
this.form.planYear = res.data.planYear
this.form.planId = res.data.planId
+ this.$nextTick(() => {
+ this.draftRestore('addYearPlanDiaForm', 'form', this.form.planId, 'applicationForm')
+ this.draftRestore('addYearPlanDiaRows', 'calibrationPlanDetailList', this.form.planId, 'applicationForm')
+ })
}
}).catch(err => {
this.yearTableLoading = false
@@ -215,6 +225,8 @@
addDeviceCalibrationPlan(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('addYearPlanDiaForm')
+ this.draftClear('addYearPlanDiaRows')
this.closeDialog()
this.$emit('closeDia')
}
@@ -226,6 +238,8 @@
updateDeviceCalibrationPlan(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('addYearPlanDiaForm')
+ this.draftClear('addYearPlanDiaRows')
this.closeDialog()
this.$emit('closeDia')
}
@@ -236,6 +250,8 @@
}
},
closeDialog() {
+ this.draftStop('addYearPlanDiaForm')
+ this.draftStop('addYearPlanDiaRows')
this.applicationForm = false
},
// 鑾峰彇鎵�鏈夎澶�
diff --git a/src/views/CNAS/resourceDemand/device/component/applicationForm.vue b/src/views/CNAS/resourceDemand/device/component/applicationForm.vue
index 290e701..744f2ee 100644
--- a/src/views/CNAS/resourceDemand/device/component/applicationForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/applicationForm.vue
@@ -115,10 +115,12 @@
addDeviceExternalApply,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import draftSave from '@/mixins/draftSave'
export default {
name: "applicationForm",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -165,12 +167,17 @@
this.getUserList()
if (this.form.externalApplyId) {
this.searchInfo()
+ } else {
+ this.$nextTick(() => {
+ this.draftRestore('applicationForm', 'form', '', 'dialogVisible')
+ })
}
},
// 鏌ヨ璇︽儏
searchInfo() {
getDeviceExternalApply({ externalApplyId: this.form.externalApplyId }).then(res => {
if (res.code === 200) {
+ const externalApplyId = this.form.externalApplyId
this.form = { ...res.data }
if (res.data.isFinish === 0) {
if (this.form.departmentHeadUserId) {
@@ -189,6 +196,9 @@
this.currentStep = 4
this.showStep = 3
}
+ this.$nextTick(() => {
+ this.draftRestore('applicationForm', 'form', externalApplyId, 'dialogVisible')
+ })
}
}).catch(error => {
console.error(error)
@@ -205,6 +215,7 @@
addDeviceExternalApply(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('applicationForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -216,6 +227,7 @@
},
// 鍏抽棴寮规
resetForm() {
+ this.draftStop('applicationForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
diff --git a/src/views/CNAS/resourceDemand/device/component/borrow.vue b/src/views/CNAS/resourceDemand/device/component/borrow.vue
index 90f69da..ce3326a 100644
--- a/src/views/CNAS/resourceDemand/device/component/borrow.vue
+++ b/src/views/CNAS/resourceDemand/device/component/borrow.vue
@@ -207,7 +207,9 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -343,6 +345,7 @@
},
dialogVisible(newVal) {
if (!newVal) {
+ this.draftStop('borrow')
this.form = {}
this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳
this.currentStepClick = 0 // 鐐瑰嚮姝ラ鏉″彉鍖�
@@ -448,6 +451,7 @@
saveDeviceBorrow(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鎻愪氦鎴愬姛')
+ this.draftClear('borrow')
this.dialogVisible = false
this.refreshTable()
}
@@ -510,6 +514,9 @@
this.currentStepClick = i
}
console.log(this.currentStepClick)
+ if (this.currentStep < 2) {
+ this.draftRestore('borrow', 'form', this.form.id, 'dialogVisible')
+ }
this.dialogVisible = true
}
})
@@ -532,6 +539,7 @@
}
this.form.deviceName = this.clickNodeVal.label
this.form.deviceId = this.clickNodeVal.value
+ this.draftRestore('borrow', 'form', this.clickNodeVal.value, 'dialogVisible')
},
//瀵煎嚭
handleDown() {
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: '', // 璁¢噺鍗曚綅
diff --git a/src/views/CNAS/resourceDemand/device/component/check.vue b/src/views/CNAS/resourceDemand/device/component/check.vue
index e9f048c..19b44b0 100644
--- a/src/views/CNAS/resourceDemand/device/component/check.vue
+++ b/src/views/CNAS/resourceDemand/device/component/check.vue
@@ -250,8 +250,10 @@
<script>
import file from '@/utils/file';
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
components: {},
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -385,6 +387,7 @@
// 鏍″噯椤圭洰缁存姢
calibrationMaintenance() {
this.dialogVisible0 = true
+ this.draftRestore('checkMaintenanceDia', 'form0', this.clickNodeVal.value, 'dialogVisible0')
this.getXmsg();
},
addCalibrate() {
@@ -403,6 +406,7 @@
}).then(res => {
if (res.code == 200) {
this.$message.success('淇濆瓨鎴愬姛')
+ this.draftClear('checkMaintenanceDia')
this.$refs['form0'].resetFields()
this.getXmsg() // 鍒锋柊璁惧鏍″噯鍙傛暟琛ㄦ牸
}
@@ -447,6 +451,7 @@
}).then(res => {
if (res.code == 200) {
this.$message.success('娣诲姞鎴愬姛')
+ this.draftClear('checkAddRecordDia')
this.dialogVisible1 = false
this.getTableList(this.clickNodeVal.value)
}
@@ -462,6 +467,7 @@
})
},
resetcalibrationRecord() {
+ this.draftStop('checkAddRecordDia')
this.$refs.calibrationRecord.resetFields()
},
// 闄勪欢涓婁紶
@@ -518,6 +524,7 @@
add(type) {
this.operationType = type
this.dialogVisible1 = true
+ this.draftRestore('checkAddRecordDia', 'calibrationRecord', this.clickNodeVal.value, 'dialogVisible1')
this.getXmsg()
},
// 鏌ョ湅璇︽儏
diff --git a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
index 03d702f..5c7eca4 100644
--- a/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
+++ b/src/views/CNAS/resourceDemand/device/component/checkRecord.vue
@@ -229,10 +229,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import {mapGetters} from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: "check-record",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -319,6 +321,10 @@
this.currentStep = 2
}
this.reviewUserId = this.form.reviewUserId
+ this.$nextTick(() => {
+ this.draftRestore('checkRecordForm', 'form', this.form.planDetailsId, 'dialogVisible')
+ this.draftRestore('checkRecordRows', 'recordDetailList', this.form.planDetailsId, 'dialogVisible')
+ })
}
}).catch(error => {
console.error(error)
@@ -340,6 +346,8 @@
addExamineRecord(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('checkRecordForm')
+ this.draftClear('checkRecordRows')
this.resetForm()
}
this.submitFormLoading = false
@@ -356,6 +364,8 @@
reviewExamineRecord(params).then(res => {
if (res.code == 200) {
this.$message.success('瀹℃牳鎴愬姛')
+ this.draftClear('checkRecordForm')
+ this.draftClear('checkRecordRows')
this.resetForm()
}
this.submitFormLoading = false
@@ -364,6 +374,8 @@
})
},
resetForm() {
+ this.draftStop('checkRecordForm')
+ this.draftStop('checkRecordRows')
this.dialogVisible = false
this.$emit('closeDialog1')
},
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue
index 1bb40cf..49898a7 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue
@@ -229,10 +229,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: "equipment-calibration-plan",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: { AddVerificationYearPlanDia, AddYearPlanDia },
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -459,6 +461,9 @@
if (this.operationType !== 'add') {
this.$nextTick(() => {
this.form = this.HaveJson(row)
+ if (this.operationType !== 'view') {
+ this.draftRestore('equipmentCalibrationPlan', 'form', this.form.planDetailId, 'dialogVisible')
+ }
})
} else {
this.form = {
@@ -473,6 +478,7 @@
planId: this.currentRow.planId,
planDetailId: '',
}
+ this.draftRestore('equipmentCalibrationPlan', 'form', this.form.planId, 'dialogVisible')
}
},
// 鎻愪氦琛ㄥ崟
@@ -484,6 +490,7 @@
addDeviceCalibrationPlanDetail(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('equipmentCalibrationPlan')
this.dialogVisible = false
this.getYearTableData()
}
@@ -496,6 +503,7 @@
updateDeviceCalibrationPlanDetail(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('equipmentCalibrationPlan')
this.dialogVisible = false
this.getYearTableData()
}
@@ -550,6 +558,7 @@
})
},
resetForm() {
+ this.draftStop('equipmentCalibrationPlan')
this.$refs.modelForm.resetFields();
this.dialogVisible = false
},
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue b/src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue
index b409be9..5be3be7 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue
@@ -147,10 +147,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import {mapGetters} from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: "equipment-check",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -213,6 +215,10 @@
this.currentStep = 2
}
this.reviewUserId = this.form.reviewUserId
+ if (this.currentStep === 0) {
+ this.draftRestore('equipmentCheck', 'form', this.form.planDetailsId, 'dialogVisible')
+ this.recordContrastDetailsList = this.form.recordContrastDetailsList || []
+ }
}
}).catch(error => {
console.error(error)
@@ -243,6 +249,7 @@
addExamineRecordContrast(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('equipmentCheck')
this.resetForm()
}
this.submitFormLoading = false
@@ -258,6 +265,7 @@
reviewExamineRecordContrast(params).then(res => {
if (res.code == 200) {
this.$message.success('瀹℃牳鎴愬姛')
+ this.draftClear('equipmentCheck')
this.resetForm()
}
this.submitFormLoading = false
@@ -266,6 +274,7 @@
})
},
resetForm() {
+ this.draftStop('equipmentCheck')
this.dialogVisible = false
this.$emit('closeDialog')
},
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
index 75c1e31..cd31ba8 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
@@ -67,11 +67,13 @@
} from "@/api/cnas/resourceDemand/device";
import limsTable from "@/components/Table/lims-table.vue";
import {selectUserCondition} from "@/api/system/user";
+import draftSave from '@/mixins/draftSave'
export default {
name: '',
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {limsTable},
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -180,6 +182,9 @@
this.form = {...row}
this.form['maintenanceContentArr'] = this.form.maintenanceContent.split(',')
}
+ if (this.operationType !== 'view') {
+ this.draftRestore('equipmentMaintenance', 'form', this.operationType === 'edit' ? this.form.id : this.clickNodeVal.value, 'dialogVisible')
+ }
})
this.getDictS()
this.getUserList()
@@ -259,6 +264,7 @@
addDeviceMaintenance(this.form).then(res => {
this.buttonLoading = false;
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('equipmentMaintenance')
this.closeDia()
this.getTableList()
}).catch(err => {
@@ -268,6 +274,7 @@
})
},
closeDia () {
+ this.draftStop('equipmentMaintenance')
this.$refs['form'].resetFields();
this.dialogVisible = false
this.refreshTableList()
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
index 8605832..bbf2faa 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
@@ -166,10 +166,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: "equipment-maintenance-plan",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -273,12 +275,22 @@
if (res.code === 200) {
this.form = res.data
this.deviceMaintenancePlanDetails = this.form.deviceMaintenancePlanDetails
+ this.restoreMaintenancePlanDraft()
}
}).catch(error => {
console.error(error)
})
+ } else {
+ this.restoreMaintenancePlanDraft()
}
this.getEquipOptions()
+ },
+ restoreMaintenancePlanDraft() {
+ if (this.operationType === 'add' || this.operationType === 'edit') {
+ const rid = this.operationType === 'edit' ? this.maintenancePlanId : ''
+ this.draftRestore('maintenancePlanForm', 'form', rid, 'applicationForm')
+ this.draftRestore('maintenancePlanRows', 'deviceMaintenancePlanDetails', rid, 'applicationForm')
+ }
},
// 娣诲姞璁惧
addTableRow() {
@@ -331,6 +343,8 @@
addMaintenancePlan(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('maintenancePlanForm')
+ this.draftClear('maintenancePlanRows')
this.applicationForm = false
this.getYearTableDetailData()
}
@@ -342,6 +356,8 @@
updateMaintenancePlan(this.form).then(res => {
if (res.code == 200) {
this.$message.success('淇敼鎴愬姛')
+ this.draftClear('maintenancePlanForm')
+ this.draftClear('maintenancePlanRows')
this.applicationForm = false
this.getYearTableDetailData()
}
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
index 928e2cb..0aa34b9 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
@@ -249,10 +249,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: "equipment-verification-plan",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: { AddVerificationYearPlanDia, CheckRecord, EquipmentCheck },
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -495,6 +497,9 @@
if (this.operationType !== 'add') {
this.$nextTick(() => {
this.form = this.HaveJson(row)
+ if (this.operationType !== 'view') {
+ this.draftRestore('equipmentVerificationPlan', 'form', this.form.planDetailsId, 'dialogVisible')
+ }
})
} else {
this.form = {
@@ -510,6 +515,7 @@
planId: this.currentRow.planId,
planDetailsId: '',
}
+ this.draftRestore('equipmentVerificationPlan', 'form', this.form.planId, 'dialogVisible')
}
},
// 鎻愪氦琛ㄥ崟
@@ -521,6 +527,7 @@
addDeviceExaminePlanDetail(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('equipmentVerificationPlan')
this.dialogVisible = false
this.getYearTableData()
}
@@ -533,6 +540,7 @@
updateDeviceExaminePlanDetail(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('equipmentVerificationPlan')
this.dialogVisible = false
this.getYearTableData()
}
@@ -564,6 +572,7 @@
})
},
resetForm() {
+ this.draftStop('equipmentVerificationPlan')
this.$refs.modelForm.resetFields();
this.dialogVisible = false
},
diff --git a/src/views/CNAS/resourceDemand/device/component/failureForm.vue b/src/views/CNAS/resourceDemand/device/component/failureForm.vue
index d006a2b..c218cb7 100644
--- a/src/views/CNAS/resourceDemand/device/component/failureForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/failureForm.vue
@@ -72,10 +72,12 @@
addDeviceBreakdownMaintenance,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import draftSave from '@/mixins/draftSave'
export default {
name: "failure-form",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -116,6 +118,8 @@
this.getUserList()
if (this.form.maintenanceId) {
this.searchInfo()
+ } else {
+ this.draftRestore('failureForm', 'form', this.form.deviceId, 'dialogVisible')
}
},
// 鏌ヨ璇︽儏
@@ -124,7 +128,9 @@
maintenanceId: this.form.maintenanceId
}).then(res => {
if (res.code === 200) {
+ const id = this.form.maintenanceId
this.form = { ...res.data }
+ this.draftRestore('failureForm', 'form', id, 'dialogVisible')
if (this.form.isFinish === 0) {
if (this.form.departmentHeadUserId) {
this.currentStep = 1
@@ -154,6 +160,7 @@
addDeviceBreakdownMaintenance(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('failureForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -165,6 +172,7 @@
},
// 鍏抽棴寮规
resetForm() {
+ this.draftStop('failureForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
diff --git a/src/views/CNAS/resourceDemand/device/component/fault.vue b/src/views/CNAS/resourceDemand/device/component/fault.vue
index f042ae3..0217efa 100644
--- a/src/views/CNAS/resourceDemand/device/component/fault.vue
+++ b/src/views/CNAS/resourceDemand/device/component/fault.vue
@@ -279,7 +279,9 @@
<script>
import { dateFormat } from '@/utils/date'
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -407,6 +409,7 @@
}).then(res => {
if (res.code == 200) {
this.$message.success('鎻愪氦鎴愬姛')
+ this.draftClear('fault')
this.getTableList(this.clickNodeVal.value)
this.dialogVisible = false
}
@@ -431,6 +434,11 @@
this.form.manufacturer = res.data.manufacturer
this.form.specificationModel = res.data.specificationModel
this.form.managementNumber = res.data.managementNumber
+ if (!this.form.id) {
+ this.draftRestore('fault', 'form', this.clickNodeVal.value, 'dialogVisible')
+ } else if (this.currentStep === 0) {
+ this.draftRestore('fault', 'form', this.form.id, 'dialogVisible')
+ }
});
// 鑾峰彇璐熻矗浜轰俊鎭�
this.getUserList()
@@ -580,6 +588,7 @@
},
dialogVisible(newVal) {
if (!newVal) {
+ this.draftStop('fault')
this.form = {}
this.closeLoading()
this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳
diff --git a/src/views/CNAS/resourceDemand/device/component/files.vue b/src/views/CNAS/resourceDemand/device/component/files.vue
index 4228c5f..bb231a9 100644
--- a/src/views/CNAS/resourceDemand/device/component/files.vue
+++ b/src/views/CNAS/resourceDemand/device/component/files.vue
@@ -5,7 +5,7 @@
<h4><span class="line"></span><span>璁惧妗f</span></h4>
<div class="btns">
<el-button type="primary" size="small" @click="openEditForm" style="">淇妗f</el-button>
- <el-button type="primary" size="small" @click="dialogVisible1 = true" style="">娣诲姞闄勪欢</el-button>
+ <el-button type="primary" size="small" @click="openAddFileDia" style="">娣诲姞闄勪欢</el-button>
<el-button type="primary" size="small" @click="deviceDialog = true" style="">鏌ョ湅璁惧浜岀淮鐮�</el-button>
<el-button type="primary" size="small" @click="handleDownOne" style="">瀵煎嚭</el-button>
</div>
@@ -504,7 +504,9 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import { selectQualifiedSupplierManagementPage } from '@/api/cnas/externalService/supplierManage/supplierManage'
+import draftSave from '@/mixins/draftSave'
export default {
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -682,6 +684,14 @@
})
this.fileList.push(obj)
}
+ this.draftRestore('fileAdd', 'addFile', row.id, 'dialogVisible1')
+ },
+ // 鎵撳紑娣诲姞闄勪欢寮圭獥
+ openAddFileDia() {
+ this.dialogVisible1 = true
+ this.$nextTick(() => {
+ this.draftRestore('fileAdd', 'addFile', this.clickNodeVal.value, 'dialogVisible1')
+ })
},
handleDeleteClick(row) {
// 鍒犻櫎閫昏緫
@@ -712,6 +722,7 @@
updateDocument(this.addFile).then(res => {
if (res.code == 200) {
this.$message.success('鏇存柊鎴愬姛')
+ this.draftClear('fileAdd')
this.dialogVisible1 = false;
this.getPage()
}
@@ -721,6 +732,7 @@
addDocument(this.addFile).then(res => {
if (res.code == 200) {
this.$message.success('淇濆瓨鎴愬姛')
+ this.draftClear('fileAdd')
this.dialogVisible1 = false;
this.getPage()
}
@@ -804,6 +816,7 @@
this.editData = JSON.parse(JSON.stringify(this.Mdata))
this.$nextTick(() => {
this.dialogVisible = true
+ this.draftRestore('fileRevision', 'editData', this.clickNodeVal.value, 'dialogVisible')
})
},
// 涓嬫鏃ユ湡 = 鏈�杩戞棩鏈� + 鍛ㄦ湡锛堟湀锛夛紝鑷姩璁$畻
@@ -875,6 +888,7 @@
upDeviceParameter(formData).then(res => {
this.$message.success('淇敼鎴愬姛')
this.upLoad = false
+ this.draftClear('fileRevision')
this.getList(this.clickNodeVal.value)
this.dialogVisible = false
}).catch(e => {
@@ -977,6 +991,7 @@
},
dialogVisible1(newVal) {
if (newVal == false) {
+ this.draftStop('fileAdd')
this.isAddFileUpdate = false
this.addFile = {}
this.fileList = []
diff --git a/src/views/CNAS/resourceDemand/device/component/inspectionForm.vue b/src/views/CNAS/resourceDemand/device/component/inspectionForm.vue
index e0d8659..894998f 100644
--- a/src/views/CNAS/resourceDemand/device/component/inspectionForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/inspectionForm.vue
@@ -144,10 +144,12 @@
reviewDeviceInspectionRecord,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import draftSave from '@/mixins/draftSave'
export default {
name: "inspection-form",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -186,6 +188,8 @@
this.getUserList()
if (this.form.inspectionRecordId) {
this.searchInfo()
+ } else if (this.operationType !== 'check') {
+ this.draftRestore('inspectionForm', 'form', this.form.deviceId, 'dialogVisible')
}
},
searchInfo() {
@@ -193,8 +197,12 @@
inspectionRecordId: this.form.inspectionRecordId
}).then(res => {
if (res.code === 200) {
+ const id = this.form.inspectionRecordId
this.form = { ...res.data }
this.details = this.form.details || []
+ if (this.operationType !== 'check') {
+ this.draftRestore('inspectionForm', 'form', id, 'dialogVisible')
+ }
}
}).catch(error => {
console.error(error)
@@ -211,6 +219,7 @@
addDeviceInspectionRecord(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('inspectionForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -221,6 +230,7 @@
updateDeviceInspectionRecord(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('inspectionForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -245,6 +255,7 @@
})
},
resetForm() {
+ this.draftStop('inspectionForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
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) {
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 = []
diff --git a/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue b/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
index 5c48070..1ce5c03 100644
--- a/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/quantityValueTraceabilityPlan.vue
@@ -174,10 +174,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import { mapGetters } from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: "quantity-value-traceability-plan",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -284,11 +286,21 @@
if (res.code === 200) {
this.form = res.data
this.deviceTraceabilityManagementDetails = this.form.deviceTraceabilityManagementDetails
+ this.restoreTraceabilityDraft()
}
}).catch(error => {
console.error(error)
this.yearTableLoading = false
})
+ } else {
+ this.restoreTraceabilityDraft()
+ }
+ },
+ restoreTraceabilityDraft() {
+ if (this.operationType === 'add' || this.operationType === 'edit') {
+ const rid = this.operationType === 'edit' ? this.traceabilityManagementId : ''
+ this.draftRestore('traceabilityForm', 'form', rid, 'applicationForm')
+ this.draftRestore('traceabilityRows', 'deviceTraceabilityManagementDetails', rid, 'applicationForm')
}
},
// 娣诲姞璁惧
@@ -349,6 +361,8 @@
addTraceabilityManagement(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('traceabilityForm')
+ this.draftClear('traceabilityRows')
this.applicationForm = false
this.getYearTableDetailData()
}
@@ -360,6 +374,8 @@
updateTraceabilityManagement(this.form).then(res => {
if (res.code == 200) {
this.$message.success('淇敼鎴愬姛')
+ this.draftClear('traceabilityForm')
+ this.draftClear('traceabilityRows')
this.applicationForm = false
this.getYearTableDetailData()
}
diff --git a/src/views/CNAS/resourceDemand/device/component/record.vue b/src/views/CNAS/resourceDemand/device/component/record.vue
index 1ef3cd1..d6d37ba 100644
--- a/src/views/CNAS/resourceDemand/device/component/record.vue
+++ b/src/views/CNAS/resourceDemand/device/component/record.vue
@@ -157,7 +157,9 @@
deleteDeviceRecord,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import draftSave from '@/mixins/draftSave'
export default {
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -288,6 +290,7 @@
this.form.managementNumber = res.data.managementNumber
this.$nextTick(() => {
this.$refs['form'].clearValidate()
+ this.draftRestore('record', 'form', '', 'dialogVisible')
})
});
},
@@ -309,6 +312,7 @@
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
this.getTableList(this.clickNodeVal.value)
+ this.draftClear('record')
this.dialogVisible = false
}
})
@@ -318,6 +322,7 @@
if (res.code == 200) {
this.$message.success('淇敼鎴愬姛')
this.getTableList(this.clickNodeVal.value)
+ this.draftClear('record')
this.dialogVisible = false
}
})
@@ -343,6 +348,9 @@
list.push(row.useStartDate)
list.push(row.useEndDate)
this.form['useDateList'] = list
+ if (type === 'edit') {
+ this.draftRestore('record', 'form', this.form.id, 'dialogVisible')
+ }
},
handleDeleteClick(index, row) {
this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
@@ -379,6 +387,7 @@
},
dialogVisible(newVal) {
if (newVal === false) {
+ this.draftStop('record')
this.form = {
// deviceId:'',
sampleCode: '',
diff --git a/src/views/CNAS/resourceDemand/device/component/resourceReservation.vue b/src/views/CNAS/resourceDemand/device/component/resourceReservation.vue
index 9bf9517..9248342 100644
--- a/src/views/CNAS/resourceDemand/device/component/resourceReservation.vue
+++ b/src/views/CNAS/resourceDemand/device/component/resourceReservation.vue
@@ -120,7 +120,9 @@
</template>
<script>
+import draftSave from '@/mixins/draftSave'
export default {
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -381,6 +383,7 @@
this.addReservation.reservationTime = this.yuyuetime + " " + this.yuyue.time;
this.addReservation.specificTime = this.yuyue.time;
this.addReservation.deviceNumber = 'TX-ABC-01'+Math.floor(Math.random() * 10 + 1);
+ this.draftRestore('reservation', 'addReservation', this.yuyue.id + '_' + this.yuyuetime, 'addVisiable')
},
handleSelectionChange(selected) {
this.selectedRow = selected.length > 0 ? selected : null;
@@ -421,6 +424,7 @@
this.$axios.post(this.$api.deviceReservate.save, this.addReservation).then(res => {
if (res.code == 200) {
this.$message.success('淇濆瓨鎴愬姛')
+ this.draftClear('reservation')
this.addVisiable = false
this.getList();
this.query();
diff --git a/src/views/CNAS/resourceDemand/device/component/scrapApplicationForm.vue b/src/views/CNAS/resourceDemand/device/component/scrapApplicationForm.vue
index 5e4bfcf..46ba37e 100644
--- a/src/views/CNAS/resourceDemand/device/component/scrapApplicationForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/scrapApplicationForm.vue
@@ -78,10 +78,12 @@
addDeviceScrapped,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
+import draftSave from '@/mixins/draftSave'
export default {
name: "scrapApplicationForm",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
+ mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
@@ -123,6 +125,8 @@
this.getUserList()
if (this.form.scrappedId) {
this.searchInfo()
+ } else {
+ this.draftRestore('scrapApplicationForm', 'form', this.form.deviceId, 'dialogVisible')
}
},
// 鏌ヨ璇︽儏
@@ -131,7 +135,9 @@
scrappedId: this.form.scrappedId
}).then(res => {
if (res.code === 200) {
+ const id = this.form.scrappedId
this.form = { ...res.data }
+ this.draftRestore('scrapApplicationForm', 'form', id, 'dialogVisible')
if (this.form.isFinish === 0) {
if (this.form.departmentHeadUserId) {
this.currentStep = 1
@@ -165,6 +171,7 @@
addDeviceScrapped(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('scrapApplicationForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -176,6 +183,7 @@
},
// 鍏抽棴寮规
resetForm() {
+ this.draftStop('scrapApplicationForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
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()
diff --git a/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue b/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
index bcd8062..f3e8ab6 100644
--- a/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
+++ b/src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
@@ -122,11 +122,13 @@
} from "@/api/cnas/resourceDemand/device";
import {selectUserCondition} from "@/api/system/user";
import {mapGetters} from "@/utils/store-compat";
+import draftSave from '@/mixins/draftSave'
export default {
name: '',
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {limsTable},
+ mixins: [draftSave],
props: {
clickNodeVal: {
type: Object,
@@ -323,13 +325,23 @@
this.deviceImpowerDetails.forEach(item => {
item['delegatedUserArr'] = item.delegatedUser.split(',')
})
+ this.restoreImpowerDraft()
}
}).catch(error => {
console.error(error)
})
+ } else {
+ this.restoreImpowerDraft()
}
this.getEquipOptions()
this.getUserList()
+ },
+ restoreImpowerDraft() {
+ if (this.operationType === 'add' || this.operationType === 'edit') {
+ const rid = this.operationType === 'edit' ? this.impowerId : ''
+ this.draftRestore('usageAuthorizationForm', 'form', rid, 'usageTableDia')
+ this.draftRestore('usageAuthorizationRows', 'deviceImpowerDetails', rid, 'usageTableDia')
+ }
},
closeDialog () {
this.usageTableDia = false
@@ -356,6 +368,8 @@
addImpower(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
+ this.draftClear('usageAuthorizationForm')
+ this.draftClear('usageAuthorizationRows')
this.usageTableDia = false
this.refreshTableList()
}
@@ -367,6 +381,8 @@
updateImpower(this.form).then(res => {
if (res.code == 200) {
this.$message.success('淇敼鎴愬姛')
+ this.draftClear('usageAuthorizationForm')
+ this.draftClear('usageAuthorizationRows')
this.usageTableDia = false
this.refreshTableList()
}
--
Gitblit v1.9.3