From c6e96cdb8b1cfb51e9a45bf86c38d1353e983127 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期一, 19 十月 2026 15:19:48 +0800
Subject: [PATCH] 设备模块业务完善及前序页面优化
---
src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue | 44 +++++++++++++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
index 8c16006..0c661a4 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
@@ -25,10 +25,13 @@
<el-row>
<el-col :span="24">
<el-form-item label="缁存姢鍐呭:" prop="maintenanceContentArr">
- <el-checkbox-group v-model="form.maintenanceContentArr" :disabled="operationType === 'view'">
+ <el-checkbox-group v-if="qualificationList.length" v-model="form.maintenanceContentArr"
+ :disabled="operationType === 'view'">
<el-checkbox v-for="city in qualificationList" :key="city.label" :label="city.label"
:value="city.label"></el-checkbox>
</el-checkbox-group>
+ <el-input v-else v-model="form.maintenanceContentText" :disabled="operationType === 'view'"
+ size="small" placeholder="璇疯緭鍏ョ淮鎶ゅ唴瀹�" style="width: 100%"></el-input>
</el-form-item>
</el-col>
</el-row>
@@ -67,6 +70,7 @@
} from "@/api/cnas/resourceDemand/device";
import limsTable from "@/components/Table/lims-table.vue";
import {selectUserCondition} from "@/api/system/user";
+import {saveBlobOrShowError} from '@/utils/saveBlob'
export default {
name: '',
@@ -127,6 +131,7 @@
maintenanceDate: '',
maintenanceContentArr: [],
maintenanceContent: '',
+ maintenanceContentText: '',
maintenanceUserId: '',
remark: '',
},
@@ -135,7 +140,19 @@
qualificationList: [],
rules: {
maintenanceDate: [{ required: true, message: '璇烽�夋嫨缁存姢鏃ユ湡', trigger: 'change' }],
- maintenanceContentArr: [{ required: true, message: '璇烽�夋嫨缁存姢鍐呭', trigger: 'change' }],
+ maintenanceContentArr: [{
+ validator: (rule, value, callback) => {
+ if (this.qualificationList.length) {
+ if (!value || value.length === 0) {
+ return callback(new Error('璇烽�夋嫨缁存姢鍐呭'))
+ }
+ } else if (!this.form.maintenanceContentText || !this.form.maintenanceContentText.trim()) {
+ return callback(new Error('璇疯緭鍏ョ淮鎶ゅ唴瀹�'))
+ }
+ callback()
+ },
+ trigger: 'change'
+ }],
maintenanceUserId: [{ required: true, message: '璇烽�夋嫨缁存姢浜�', trigger: 'change' }],
},
responsibleOptions: [],
@@ -153,6 +170,7 @@
},
// 鍒嗛〉鍒囨崲
pagination(page) {
+ this.page.current = page.page
this.page.size = page.limit
this.getTableList()
},
@@ -178,7 +196,8 @@
this.form.id = ''
if (this.operationType === 'edit') {
this.form = {...row}
- this.form['maintenanceContentArr'] = this.form.maintenanceContent.split(',')
+ this.form['maintenanceContentArr'] = this.form.maintenanceContent ? this.form.maintenanceContent.split(',') : []
+ this.form['maintenanceContentText'] = this.form.maintenanceContent || ''
}
})
this.getDictS()
@@ -201,10 +220,14 @@
'鍒舵牱瀹�': 'sample_maintenance_content',
'浣庢俯瀹為獙瀹�': 'hypothermia_maintenance_content',
};
- // 鑾峰彇褰撳墠鑺傜偣鐨勫疄楠屽鍚嶇О
- const name = this.clickNodeVal.parent.label;
+ // 鍙栬澶囧瓨鏀剧偣鍚嶇О浣滀负鏄犲皠閿�
+ const name = this.clickNodeVal.storagePoint || '鍏朵粬';
// 鏍规嵁鏄犲皠鍏崇郴鑾峰彇瀵瑰簲鐨勭被鍨�
const type = labTypeMapping[name];
+ if (!type) {
+ this.qualificationList = [];
+ return;
+ }
this.getDicts(type).then((response) => {
this.qualificationList = response.data.map((m) => {
return {
@@ -220,13 +243,14 @@
deviceId: this.clickNodeVal.value
}).then(res => {
this.outLoading = false
- const blob = new Blob([res], { type: 'application/octet-stream' });
- this.$download.saveAs(blob, '璁惧缁存姢淇濆吇.doc')
+ saveBlobOrShowError(res, '璁惧缁存姢淇濆吇.doc', 'application/msword')
+ }).catch(() => {
+ this.outLoading = false
})
},
handleDeleteClick(row) {
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+ this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ潯淇濆吇璁板綍, 鏄惁缁х画?', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
@@ -250,7 +274,9 @@
this.$refs.form.validate((valid) => {
if (valid) {
this.buttonLoading = true;
- this.form.maintenanceContent = this.form.maintenanceContentArr.join(',')
+ this.form.maintenanceContent = this.qualificationList.length
+ ? this.form.maintenanceContentArr.join(',')
+ : (this.form.maintenanceContentText || '').trim()
this.form.deviceId = this.clickNodeVal.value
addDeviceMaintenance(this.form).then(res => {
this.buttonLoading = false;
--
Gitblit v1.9.3