From 0108bdd2a028858d988dcc7d7d2cff75db10cfbf Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 23 十月 2026 09:11:54 +0800
Subject: [PATCH] fix(download): 修复文件下载路径拼接问题

---
 src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue |   43 +++++++++++++++++++++++++++++--------------
 1 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenance.vue
index cd31ba8..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,13 +70,12 @@
 } from "@/api/cnas/resourceDemand/device";
 import limsTable from "@/components/Table/lims-table.vue";
 import {selectUserCondition} from "@/api/system/user";
-import draftSave from '@/mixins/draftSave'
+import {saveBlobOrShowError} from '@/utils/saveBlob'
 
 export default {
   name: '',
   // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
   components: {limsTable},
-  mixins: [draftSave],
   props: {
     clickNodeVal: {
       type: Object,
@@ -129,6 +131,7 @@
         maintenanceDate: '',
         maintenanceContentArr: [],
         maintenanceContent: '',
+        maintenanceContentText: '',
         maintenanceUserId: '',
         remark: '',
       },
@@ -137,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: [],
@@ -155,6 +170,7 @@
     },
     // 鍒嗛〉鍒囨崲
     pagination(page) {
+      this.page.current = page.page
       this.page.size = page.limit
       this.getTableList()
     },
@@ -180,10 +196,8 @@
         this.form.id = ''
         if (this.operationType === 'edit') {
           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.form['maintenanceContentArr'] = this.form.maintenanceContent ? this.form.maintenanceContent.split(',') : []
+          this.form['maintenanceContentText'] = this.form.maintenanceContent || ''
         }
       })
       this.getDictS()
@@ -229,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'
@@ -259,12 +274,13 @@
       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;
             this.$message.success('鏂板鎴愬姛')
-            this.draftClear('equipmentMaintenance')
             this.closeDia()
             this.getTableList()
           }).catch(err => {
@@ -274,7 +290,6 @@
       })
     },
     closeDia () {
-      this.draftStop('equipmentMaintenance')
       this.$refs['form'].resetFields();
       this.dialogVisible = false
       this.refreshTableList()

--
Gitblit v1.9.3