From 71f0635be1960863c9d2897e5f29475bdaf4da16 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Thu, 6 Nov 2025 09:45:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(dms):=E4=BC=98=E5=8C=96=E6=95=85=E9=9A=9C?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为设备选择器添加过滤和变更处理功能 - 隐藏操作权限列并调整表格字段显示 - 使用 Object.assign 优化表单数据响应式更新- 完善知识库选择与文件上传预览功能 - 增强表单验证与操作记录管理逻辑 - 调整样式与间距提升界面可读性 --- .../dms/dmsBillsFaultInstance/detail.vue | 138 +++++++++--------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/src/views/dms/dmsBillsFaultInstance/detail.vue b/src/views/dms/dmsBillsFaultInstance/detail.vue index 5ceaf55..2ec106d 100644 --- a/src/views/dms/dmsBillsFaultInstance/detail.vue +++ b/src/views/dms/dmsBillsFaultInstance/detail.vue @@ -54,9 +54,9 @@ - @@ -226,11 +226,11 @@ - + @@ -388,10 +388,10 @@ export default { repairInstanceId: null, // 工单状态(0待维修 1维修中 2维修完成) billsStatus: null, - + // 设备列表 deviceList: [], - + // 设备信息 deviceForm: { deviceCode: '', @@ -401,7 +401,7 @@ export default { location: '', deviceSpec: '' }, - + // 故障信息 faultForm: { deviceId: null, @@ -414,25 +414,25 @@ export default { faultDescription: '', designOperations: '' }, - + // 维修要求 requireForm: { requireEndTime: null, verifyMethod: '' }, - + // 处理意见 processOpinion: '', - + // 操作记录列表 activityList: [], - + // 知识库相关 knowledgeDialogVisible: false, knowledgeList: [], selectedKnowledge: null, tempSelectedKnowledge: null, - + // 开始维修对话框 startRepairDialogVisible: false, startRepairForm: { @@ -445,7 +445,7 @@ export default { { required: true, message: '请输入维修人', trigger: 'blur' } ] }, - + // 操作记录对话框 recordDialogVisible: false, recordDialogTitle: '', @@ -455,21 +455,21 @@ export default { processHandleResolution: '', fileList: [] }, - + // 文件上传 uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload', uploadHeaders: { Authorization: 'Bearer ' + getToken() }, - + // 图片预览 previewDialogVisible: false, previewImageUrl: '', - + // 附件查看 filesDialogVisible: false, currentFiles: [], - + // 表单验证规则 rules: { deviceId: [{ required: true, message: '请选择设备', trigger: 'change' }], @@ -478,7 +478,7 @@ export default { faultType: [{ required: true, message: '请选择故障类型', trigger: 'change' }], faultDescription: [{ required: true, message: '请输入故障描述', trigger: 'blur' }] }, - + recordRules: { processActivityName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }], processHandleResolution: [{ required: true, message: '请输入处理措施', trigger: 'blur' }] @@ -493,7 +493,7 @@ export default { } // 判断是否为查看模式 this.isView = this.$route.query.view === 'true' - + // 新增模式下加载设备列表 if (!this.repairInstanceId || id === 'new') { this.loadDeviceList() @@ -513,67 +513,67 @@ export default { location: data.deviceLocation, deviceSpec: data.deviceSpec } - - // 故障信息 - this.faultForm = { + + // 故障信息 - 使用 Object.assign 保持 Vue 响应式引用 + Object.assign(this.faultForm, { occurTime: data.applyTime, applyUser: data.applyUser, applyUserPhone: data.applyUserPhone || '', faultType: data.faultType, faultLevel: data.faultLevel || '', isShutdown: data.isShutdown || '0', - faultDescription: data.faultDescription, - designOperations: data.designOperations - } - - // 维修要求 - this.requireForm = { + faultDescription: data.faultDescription || '', + designOperations: data.designOperations || '' + }) + + // 维修要求 - 使用 Object.assign 保持 Vue 响应式引用 + Object.assign(this.requireForm, { requireEndTime: data.requireEndTime, - verifyMethod: data.verifyMethod - } - + verifyMethod: data.verifyMethod || '' + }) + // 处理意见 this.processOpinion = data.processHandleResolution || '' - + // 操作记录 this.activityList = data.dmsFaultInstanceActivityList || [] - + // 工单状态 this.billsStatus = data.billsStatus || null - + // 知识库ID this.faultForm.knowledgeRepairId = data.knowledgeRepairId - + // 如果有知识库ID,加载知识库信息(可选) if (data.knowledgeRepairId) { // TODO: 调用知识库API获取详情并赋值给 selectedKnowledge } - + // 知识库 if (data.knowledgeRepairId) { // TODO: 加载知识库详情 } }) }, - + /** 打开知识库选择对话框 */ openKnowledgeDialog() { this.knowledgeDialogVisible = true this.loadKnowledgeList() }, - + /** 加载知识库列表 */ loadKnowledgeList() { getKnowledgeRepairList({ isFlag: '0' }).then(response => { this.knowledgeList = response.data || [] }) }, - + /** 选择知识库 */ selectKnowledge(row) { this.tempSelectedKnowledge = row }, - + /** 确认选择知识库 */ confirmKnowledge() { if (this.tempSelectedKnowledge) { @@ -588,7 +588,7 @@ export default { } this.knowledgeDialogVisible = false }, - + /** 添加操作记录 */ handleAddRecord() { this.recordDialogTitle = '添加操作记录' @@ -599,7 +599,7 @@ export default { } this.recordDialogVisible = true }, - + /** 编辑操作记录 */ handleEditRecord(row) { this.recordDialogTitle = '编辑操作记录' @@ -611,7 +611,7 @@ export default { } this.recordDialogVisible = true }, - + /** 删除操作记录 */ handleDeleteRecord(row) { this.$confirm('是否确认删除该操作记录?', '警告', { @@ -626,14 +626,14 @@ export default { } }) }, - + /** 提交操作记录 */ submitRecord() { this.$refs.recordForm.validate(valid => { if (valid) { // 提取文件URLs用于后端保存 const fileUrls = this.recordForm.fileList.map(f => f.filePath || f.url) - + const record = { ...this.recordForm, handleTime: new Date(), @@ -643,7 +643,7 @@ export default { fileUrls: fileUrls, // 传递给后端 dmsInstanceFiles: this.recordForm.fileList // 用于前端显示 } - + if (record.instanceActivityId) { // 编辑 const index = this.activityList.findIndex(item => item.instanceActivityId === record.instanceActivityId) @@ -655,13 +655,13 @@ export default { record.instanceActivityId = -new Date().getTime() this.activityList.push(record) } - + this.recordDialogVisible = false this.$message.success('保存成功') } }) }, - + /** 文件上传成功 */ handleUploadSuccess(res, file) { if (res.code === 200) { @@ -672,42 +672,42 @@ export default { }) } }, - + /** 文件移除 */ handleUploadRemove(file, fileList) { this.recordForm.fileList = fileList }, - + /** 查看附件 */ viewFiles(row) { this.currentFiles = row.dmsInstanceFiles || [] this.filesDialogVisible = true }, - + /** 下载文件 */ downloadFile(file) { window.open(file.url || file.filePath, '_blank') }, - + /** 预览文件 */ previewFile(file) { this.previewImageUrl = file.url || file.filePath this.previewDialogVisible = true }, - + /** 判断是否为图片 */ isImage(fileName) { if (!fileName) return false const ext = fileName.toLowerCase().split('.').pop() return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(ext) }, - + /** 图片预览 */ handlePicturePreview(file) { this.previewImageUrl = file.url this.previewDialogVisible = true }, - + /** 开始维修 - 打开对话框 */ onStartRepair() { if (!this.repairInstanceId) { @@ -720,7 +720,7 @@ export default { } this.startRepairDialogVisible = true }, - + /** 确认开始维修 */ confirmStartRepair() { this.$refs.startRepairForm.validate((valid) => { @@ -739,7 +739,7 @@ export default { } }) }, - + /** 完成维修 */ onCompleteRepair() { if (!this.repairInstanceId) { @@ -759,16 +759,16 @@ export default { this.loadData() }) }, - + /** 提交表单 */ handleSubmit() { console.log('提交表单, faultForm:', this.faultForm) console.log('deviceId:', this.faultForm.deviceId) - + this.$refs.faultForm.validate((valid, errors) => { console.log('表单验证结果:', valid) console.log('验证错误:', errors) - + if (valid) { const data = { ...this.faultForm, @@ -777,9 +777,9 @@ export default { knowledgeRepairId: this.selectedKnowledge ? this.selectedKnowledge.knowledgeRepairId : null, dmsFaultInstanceActivityList: this.activityList } - + console.log('提交数据:', data) - + if (this.repairInstanceId) { data.repairInstanceId = this.repairInstanceId updateDmsBillsFaultInstance(data).then(() => { @@ -797,14 +797,14 @@ export default { } }) }, - + /** 加载设备列表 */ loadDeviceList() { getDeviceLedgerList({}).then(response => { this.deviceList = response.data || [] }) }, - + /** 设备选择变化 */ handleDeviceChange(objId) { console.log('设备选择变化, objId:', objId) @@ -825,7 +825,7 @@ export default { console.error('未找到设备, objId:', objId, '设备列表:', this.deviceList) } }, - + /** 返回 */ goBack() { this.$tab.closePage() @@ -839,18 +839,18 @@ export default { .fault-repair-detail { .box-card { margin-bottom: 20px; - + .card-title { font-weight: bold; font-size: 16px; color: #303133; } } - + .footer-buttons { text-align: center; padding: 20px 0; - + .el-button { min-width: 100px; }