From 2f3ed8493285728d0f83d50f3a342dbad5a06f9f Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期二, 22 十月 2024 10:38:27 +0800
Subject: [PATCH] 问题修改乱码bug

---
 src/views/fysp/check/components/CompProblemAddOrUpd.vue |   94 +++++++++++++++++++---------------------------
 1 files changed, 39 insertions(+), 55 deletions(-)

diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue
index 19c20e3..eaad334 100644
--- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue
+++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue
@@ -22,7 +22,7 @@
             v-for="item in descriptionOptions"
             :key="item.guid"
             :label="item.description"
-            :value="item.guid"
+            :value="item.description"
           />
         </el-select>
       </el-form-item>
@@ -83,7 +83,7 @@
         accept="image/*"
       >
         <el-button type="primary" id="uploadBtnId" style="display: none"></el-button>
-        <el-icon>
+        <el-icon v-show="fileList.length != 3">
           <Plus />
         </el-icon>
       </el-upload>
@@ -109,6 +109,7 @@
       </ArbitraryPhoto>
     </el-dialog>
     <el-dialog
+      title="鍙拌处鍥剧墖"
       width="80%"
       v-model="ledgerPicDialog"
       :before-close="beforeLedgerPicDialogclose"
@@ -141,7 +142,7 @@
       </CompDevicePhono>
     </el-dialog>
     <el-dialog v-model="previewDialogVisible">
-      <img w-full :src="previewDialogImageUrl" alt="棰勮" class="preview-pic"/>
+      <img w-full :src="previewDialogImageUrl" alt="棰勮" class="preview-pic" />
     </el-dialog>
   </div>
 </template>
@@ -153,7 +154,7 @@
 
 import { $fysp } from '@/api/index.js';
 import fileUtil from '@/utils/fileUtils.js';
-import { useCloned } from '@vueuse/core';
+import { get, useCloned } from '@vueuse/core';
 import { ElMessage } from 'element-plus';
 import deviceApi from '@/api/fysp/deviceApi';
 export default {
@@ -231,7 +232,6 @@
   watch: {
     fileList: {
       handler(newFileList, oldFileList) {
-        console.log('newFileList', newFileList);
         // 鍥剧墖鏍¢獙
         this.pictureValidate();
       },
@@ -241,11 +241,13 @@
   computed: {
     descriptionOptions() {
       const descriptions = [];
+      
       this.problemTypeList.forEach((item) => {
         if (item.typename == this.proType) {
           descriptions.push(item);
         }
       });
+      
       return descriptions;
     },
     problemTypeOptions() {
@@ -258,9 +260,8 @@
       }, []);
     },
     adviseOptions() {
-      var array = this.suggestions.filter((item) => item.adProblemtypeguid == this.currProTypeGuid);
-      console.log('adName', array);
-
+      var problemGuid = this.currProTypeGuid || this.problem.guid;
+      var array = this.suggestions.filter((item) => item.adProblemtypeguid == problemGuid);
       return array;
     }
   },
@@ -281,8 +282,7 @@
       // 灏嗕竴涓猨s瀵硅薄涓墍鏈塪i锛寃i锛宲i寮�澶寸殑灞炴�у叏閮ㄦ敼鎴愬幓鎺夎繖浜涘墠缂�骞朵笖閲嶆柊鍙樹负椹煎嘲寮忓懡鍚�
       const newObj = {};
       for (const key in obj) {
-        if (obj.hasOwnProperty(key)) {
-          let newKey = key;
+        let newKey = key;
           if (key.startsWith('di')) {
             newKey = key.substring(2);
           } else if (key.startsWith('wi')) {
@@ -292,7 +292,6 @@
           }
           newKey = newKey.charAt(0).toLowerCase() + newKey.slice(1);
           newObj[newKey] = obj[key];
-        }
       }
       return newObj;
     },
@@ -311,12 +310,11 @@
         return new Date(x.dlCreateTime) - new Date(y.dlCreateTime); //	闄嶅簭锛屽崌搴忓垯鍙嶄箣
       });
     },
-    getDeviceImgList() {
+    async getDeviceImgList() {
       this.deviceImgObjList = [];
-      this.deviceTopTypes.forEach(e => {
-        
-        const topTypeId = e.id;
-        deviceApi.fetchDevices(this.subtask.sceneId, topTypeId).then((result) => {
+      for (const deviceTopTypeElement of this.deviceTopTypes) {
+        const topTypeId = deviceTopTypeElement.id;
+        await deviceApi.fetchDevices(this.subtask.sceneId, topTypeId).then((result) => {
           // 鏍囧噯鍖栧睘鎬у悕
           for (let i = 0; i < result.data.length; i++) {
             var element = this.convertKeys(result.data[i]);
@@ -346,8 +344,6 @@
                     this.saveStatus(newDevice, statusItem);
                     newDevice.dlLocation = statusItem.dlLocation;
                     newDevice.topTypeId = topTypeId;
-                    console.log('newDevice.topTypeId', newDevice.topTypeId);
-                    console.log('newDevice', newDevice);
 
                     this.deviceImgObjList.push(newDevice);
                   }
@@ -356,11 +352,10 @@
               .catch((err) => {});
           }
         });
-      });
+      }
     },
     initOptions() {
       if (this.problem == undefined || this.problem == null) {
-        this.problem = {};
         this.deepCopyProblem = {};
       } else {
         this.deepCopyProblem = useCloned(this.problem).cloned.value;
@@ -423,10 +418,6 @@
       // 闂寤鸿
       problemApi.getSuggestion().then((res) => {
         this.suggestions = res.data;
-        // 濉厖褰撳墠闂寤鸿
-        this.deepCopyProblem.advise = this.suggestions.filter(
-          (item) => item.adProblemtypeguid == this.deepCopyProblem.guid
-        )[0].adName;
       });
 
       // 闂浣嶇疆
@@ -444,7 +435,7 @@
         this.oldFileList.filter((item) => item.url != file.url);
       }
     },
-    handleLedgerPicPhono() {
+    handleLedgerPicPhono(data) {
       this.beforeLedgerPicDialogclose();
       let isExist = false;
       for (const item of data) {
@@ -462,9 +453,6 @@
         isExist = false;
       }
     },
-    beforeLedgerPicDialogclose() {
-      this.ledgerPicDialog = false;
-    },
     findProTypeByGuid(guid) {
       let result;
       this.problemTypeList.forEach((item) => {
@@ -475,7 +463,7 @@
       return result;
     },
     changeProblemname() {
-      if (this.proRemark == null || this.proRemark == '') {
+      if (!this.proRemark || this.proRemark == null || this.proRemark == '') {
         this.deepCopyProblem.problemname = this.deepCopyProblem.description;
       } else {
         this.deepCopyProblem.problemname =
@@ -489,15 +477,25 @@
       this.deepCopyProblem.description = '';
       this.deepCopyProblem.advise = '';
     },
+    findProByProDesName(name) {
+      let result
+      this.problemTypeList.forEach(item=>{
+        if (item.description == name) {
+          result = item;
+        }
+      })
+      return result
+    },
     onProDesChange(value) {
-      let currPro = this.findProTypeByGuid(value);
+      let currPro = this.findProByProDesName(value)
       this.deepCopyProblem.advise = '';
-      this.currProTypeGuid = value;
-      this.deepCopyProblem.description = currPro.description;
+      this.currProTypeGuid = currPro.guid;
+      // this.deepCopyProblem.description = currPro.description;
       this.changeProblemname();
       this.deepCopyProblem.advise = '';
 
-      this.deepCopyProblem.advise = this.adviseOptions[0].adName;
+      var adName = this.adviseOptions.length == 0 ? '' : this.adviseOptions[0].adName;
+      this.deepCopyProblem.advise = adName;
     },
     onProLocationChange(value) {
       this.posList.forEach((item) => {
@@ -551,7 +549,6 @@
           }
           exclude = false;
           // picUrls.push(item)
-        } else {
         }
       });
       if (this.type == 1) {
@@ -570,7 +567,6 @@
         const deepCopySubTask = useCloned(this.subtask).cloned.value;
         const that = this;
         fileUtil.getImageFiles(picUrls, function (files) {
-          console.log('deepCopySubTask', deepCopySubTask);
           deepCopyPro.insGuid = deepCopySubTask.insGuid;
           delete deepCopyPro['advise'];
           delete deepCopyPro['description'];
@@ -623,25 +619,6 @@
         }
         isExist = false;
       }
-    },
-    handleLedgerPicPhono(data) {
-      let isExist = false;
-      for (const item of data) {
-        for (const already of this.fileList) {
-          if (item.url == already.url) {
-            isExist = true;
-          }
-        }
-        if (!isExist) {
-          this.fileList.push({
-            url: item.url,
-            name: '1'
-          });
-        }
-        isExist = false;
-      }
-
-      this.beforeAnyPhotoDialogclose();
     },
     chosePicFromAnyPic() {
       this.anyPhotoDialog = true;
@@ -706,9 +683,13 @@
 .row {
   width: 100%;
 }
-
+::v-deep .el-dialog {
+  --el-dialog-margin-top: 2vh;
+  height: 98vh;
+}
 ::v-deep .el-dialog__body {
   width: 95%;
+  height: 100%;
 }
 ::v-deep .el-upload-list--picture-card .el-upload-list__item-thumbnail {
   object-fit: cover !important;
@@ -718,4 +699,7 @@
   width: 100%;
   height: 100%;
 }
+::v-deep .el-upload--picture-card {
+  border: 0 !important;
+}
 </style>

--
Gitblit v1.9.3