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 | 59 ++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 40 insertions(+), 19 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/calibration.vue b/src/views/CNAS/resourceDemand/device/component/calibration.vue
index 3f7b529..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>
@@ -110,8 +109,10 @@
<el-row>
<el-col :span="6">
<el-form-item label="鏍″噯鏈嶅姟鏈烘瀯:" prop="unitOfMeasure">
- <el-input v-model="calibrationRecord.unitOfMeasure" :disabled="operationType === 'view'"
- size="small"></el-input>
+ <el-select v-model="calibrationRecord.unitOfMeasure" :disabled="operationType === 'view'" clearable filterable
+ size="small" style="width: 100%">
+ <el-option v-for="name in calibrationServiceOptions" :key="name" :label="name" :value="name"></el-option>
+ </el-select>
</el-form-item>
</el-col>
<el-col :span="8">
@@ -256,14 +257,15 @@
deviceMetricRecordPage,
showDeviceMetricsCopy,
deleteDeviceMetricRecord,
- deviceMetricRecordExport,
deleteCNASFile,
selectDeviceMetric,
deleteDeviceMetrics,
addOrUpdateDeviceMetricRecord,
saveOrUpdateDeviceMetric
} 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: {
@@ -273,6 +275,7 @@
}
}
},
+ mixins: [draftSave],
data() {
return {
value: "",
@@ -295,7 +298,7 @@
fileName: '', //
},
formRules: {
- unitOfMeasure: [{ required: true, message: '璇疯緭鍏ユ牎鍑嗘湇鍔℃満鏋�', trigger: 'blur' }],
+ unitOfMeasure: [{ required: true, message: '璇烽�夋嫨鏍″噯鏈嶅姟鏈烘瀯', trigger: 'change' }],
calibrationDate: [{ required: true, message: '璇烽�夋嫨鏍″噯鏃ユ湡', trigger: 'change' }],
calculatingApparatus: [{ required: true, message: '璇疯緭鍏ヨ绠楀櫒鍏�', trigger: 'blur' }],
standardRange: [{ required: true, message: '璇疯緭鍏ヨ绠楁爣鍑嗛噺绋�', trigger: 'blur' }],
@@ -332,6 +335,7 @@
addRecordLoading: false,
upLoading: false,
operationType: '',
+ qualifiedSupplierNames: [],
search: {
size: 20,
current: 1,
@@ -341,16 +345,33 @@
},
// 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
computed: {
+ // 鏍″噯鏈嶅姟鏈烘瀯涓嬫媺閫夐」锛堝悎鏍间緵搴斿晢 + 褰撳墠鍊煎厹搴曪級
+ calibrationServiceOptions() {
+ const list = this.qualifiedSupplierNames.slice();
+ const value = this.calibrationRecord.unitOfMeasure;
+ if (value && list.indexOf(value) === -1) list.push(value);
+ return list;
+ },
...mapGetters(["nickName"]),
action() {
return this.javaApi + '/personBasicInfo/saveCNASFile'
}
},
mounted() {
+ this.obtainQualifiedSupplierList()
//鑾峰彇鎿嶄綔璁板綍淇℃伅
this.getTableList(this.clickNodeVal.value) // 鑾峰彇璁惧鏍″噯鍒楄〃鏁版嵁
},
methods: {
+ // 鎷夊彇鍚堟牸渚涘簲鍟嗗垪琛紙鏍″噯鏈嶅姟鏈烘瀯涓嬫媺閫夐」锛�
+ obtainQualifiedSupplierList() {
+ selectQualifiedSupplierManagementPage({ current: 1, size: 999 }).then(res => {
+ if (res.code === 200) {
+ const rows = (res.data && res.data.records) || [];
+ this.qualifiedSupplierNames = [...new Set(rows.map(r => r.supplierName).filter(Boolean))];
+ }
+ });
+ },
//鐘舵�佸垽瀹�
checkRadio() {
let resultList = this.calibrateParams.map(ele => ele.result)
@@ -387,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) {
@@ -419,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: '纭畾',
@@ -456,6 +468,9 @@
calibrationMaintenance() {
this.dialogVisible0 = true
this.getXmsg();
+ this.$nextTick(() => {
+ this.draftRestore('calibrationMaintain', 'form0', this.clickNodeVal.value, 'dialogVisible0')
+ })
},
// 鑾峰彇璁惧鏍″噯鍙傛暟table淇℃伅
async getXmsg() {
@@ -502,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
@@ -533,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)
}
@@ -587,6 +606,8 @@
},
dialogVisible1(newVal) {
if (newVal === false) {
+ this.draftStop('calibrationRecord')
+ this.draftStop('calibrationRecordParams')
this.calibrateParams = []
this.calibrationRecord = {
unitOfMeasure: '', // 璁¢噺鍗曚綅
@@ -684,7 +705,7 @@
.el-table {
font-size: 14px;
- color: #333;
+ color: var(--lims-text);
}
.el-table thead {
--
Gitblit v1.9.3