From dc16b68e74c18b617c8f79d82fd3c3306badbcbe Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 21 十一月 2024 17:22:23 +0800
Subject: [PATCH] 修复场景报告中设备图片选择弹框错误问题

---
 src/views/fysp/data-product/ProdSceneReport.vue |   46 ++++++++++-----
 src/views/fysp/check/ProCheck.vue               |   39 +------------
 src/views/fysp/check/ProCheckProxy.js           |   34 +++++++++++
 src/components.d.ts                             |   10 +++
 src/components/SideList.vue                     |    4 
 5 files changed, 80 insertions(+), 53 deletions(-)

diff --git a/src/components.d.ts b/src/components.d.ts
index 611607b..d9c2fb8 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -20,6 +20,7 @@
     ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
     ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
     ElButton: typeof import('element-plus/es')['ElButton']
+    ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
     ElCalendar: typeof import('element-plus/es')['ElCalendar']
     ElCard: typeof import('element-plus/es')['ElCard']
     ElCascader: typeof import('element-plus/es')['ElCascader']
@@ -35,6 +36,9 @@
     ElDialog: typeof import('element-plus/es')['ElDialog']
     ElDivider: typeof import('element-plus/es')['ElDivider']
     ElDrawer: typeof import('element-plus/es')['ElDrawer']
+    ElDropdown: typeof import('element-plus/es')['ElDropdown']
+    ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
+    ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
     ElEmpty: typeof import('element-plus/es')['ElEmpty']
     ElForm: typeof import('element-plus/es')['ElForm']
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
@@ -43,14 +47,18 @@
     ElImage: typeof import('element-plus/es')['ElImage']
     ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
     ElInput: typeof import('element-plus/es')['ElInput']
+    ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
     ElLink: typeof import('element-plus/es')['ElLink']
     ElMain: typeof import('element-plus/es')['ElMain']
     ElMenu: typeof import('element-plus/es')['ElMenu']
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
     ElOption: typeof import('element-plus/es')['ElOption']
+    ElPageHeader: typeof import('element-plus/es')['ElPageHeader']
     ElPagination: typeof import('element-plus/es')['ElPagination']
+    ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
     ElPopover: typeof import('element-plus/es')['ElPopover']
+    ElRadio: typeof import('element-plus/es')['ElRadio']
     ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
     ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
     ElRow: typeof import('element-plus/es')['ElRow']
@@ -61,6 +69,7 @@
     ElStep: typeof import('element-plus/es')['ElStep']
     ElSteps: typeof import('element-plus/es')['ElSteps']
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
+    ElSwitch: typeof import('element-plus/es')['ElSwitch']
     ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     ElTabPane: typeof import('element-plus/es')['ElTabPane']
@@ -68,6 +77,7 @@
     ElTag: typeof import('element-plus/es')['ElTag']
     ElText: typeof import('element-plus/es')['ElText']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
+    ElTransfer: typeof import('element-plus/es')['ElTransfer']
     ElTree: typeof import('element-plus/es')['ElTree']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     Footer: typeof import('./components/core/Footer.vue')['default']
diff --git a/src/components/SideList.vue b/src/components/SideList.vue
index dc3f4ff..846be3d 100644
--- a/src/components/SideList.vue
+++ b/src/components/SideList.vue
@@ -1,5 +1,5 @@
 <template>
-  <div class="state-label">
+  <div v-if="legend" class="state-label">
     <el-input
       v-model="filterText"
       icon="Search"
@@ -7,7 +7,7 @@
       placeholder="鍏抽敭瀛楃瓫閫�"
       clearable
     />
-    <el-tooltip v-if="legend" placement="bottom-start" effect="dark">
+    <el-tooltip placement="bottom-start" effect="dark">
       <template #content>
         <el-space>
           <el-space v-for="(item, index) in stateLabels" :key="index" :size="1">
diff --git a/src/views/fysp/check/ProCheck.vue b/src/views/fysp/check/ProCheck.vue
index 9cda78a..92e3617 100644
--- a/src/views/fysp/check/ProCheck.vue
+++ b/src/views/fysp/check/ProCheck.vue
@@ -239,7 +239,7 @@
       taskApi.getSubtaskSummary(param).then((res) => {
         const list = [];
         res.forEach((s) => {
-          const t = this.getSubtaskType(s);
+          const t = ProCheckProxy.getSubtaskType(s);
           list.push({
             status: s.subtask.status,
             type: t,
@@ -254,39 +254,6 @@
           this.mainLoading = false;
         }
       });
-    },
-    //鑾峰彇浠诲姟闂鐨勫鏍告儏鍐�
-    getSubtaskType(s) {
-      let type = 0;
-      // 鏃犻棶棰�
-      if (s.proNum == 0) {
-        type = 0;
-      } 
-      // 闂鏈鏍�
-      else if (s.proCheckedNum == 0) {
-        type = 1;
-      }
-      // 闂閮ㄥ垎瀹℃牳
-      else if (s.proCheckedNum < s.proNum) {
-        type = 2;
-      }
-      // 鏈暣鏀� 
-      else if (s.changeNum < s.proNum) {
-        type = 3;
-      }
-      // 鏁存敼鏈鏍�
-      else if (s.changeCheckedNum == 0) {
-        type = 4;
-      }
-      // 鏁存敼閮ㄥ垎瀹℃牳
-      else if (s.changeCheckedNum < s.changeNum) {
-        type = 5;
-      }
-      // 瀹屽叏瀹℃牳
-      else {
-        type = 6;
-      }
-      return type;
     },
     //鐐瑰嚮宸︿晶鑿滃崟浠诲姟浜嬩欢
     chooseSubtask(s) {
@@ -309,7 +276,7 @@
     // 闂鍗$墖缁勪欢涓诲姩鍙戣捣鍒锋柊鐖剁粍浠舵暟鎹�
     updateSubtask(refresh = false) {
       this.curSubtask.data.proCheckedNum++;
-      this.curSubtask.type = this.getSubtaskType(this.curSubtask.data);
+      this.curSubtask.type = ProCheckProxy.getSubtaskType(this.curSubtask.data);
       if (this.proAddOrUpdDialogVisible) {
         this.proAddOrUpdDialogVisible = false;
       }
@@ -351,7 +318,7 @@
       this.curSubtask.data.proCheckedNum = status.proCheckedNum
       this.curSubtask.data.changeNum = status.changeNum
       this.curSubtask.data.changeCheckedNum = status.changeCheckedNum
-      this.curSubtask.type = this.getSubtaskType(this.curSubtask.data)
+      this.curSubtask.type = ProCheckProxy.getSubtaskType(this.curSubtask.data)
     }
   },
   mounted() {}
diff --git a/src/views/fysp/check/ProCheckProxy.js b/src/views/fysp/check/ProCheckProxy.js
index 533d9d6..938422f 100644
--- a/src/views/fysp/check/ProCheckProxy.js
+++ b/src/views/fysp/check/ProCheckProxy.js
@@ -219,6 +219,40 @@
     }
   },
 
+  //鑾峰彇浠诲姟闂鐨勫鏍告儏鍐�
+  getSubtaskType(s) {
+    let type = 0;
+    // 鏃犻棶棰�
+    if (s.proNum == 0) {
+      type = 0;
+    } 
+    // 闂鏈鏍�
+    else if (s.proCheckedNum == 0) {
+      type = 1;
+    }
+    // 闂閮ㄥ垎瀹℃牳
+    else if (s.proCheckedNum < s.proNum) {
+      type = 2;
+    }
+    // 鏈暣鏀� 
+    else if (s.changeNum < s.proNum) {
+      type = 3;
+    }
+    // 鏁存敼鏈鏍�
+    else if (s.changeCheckedNum == 0) {
+      type = 4;
+    }
+    // 鏁存敼閮ㄥ垎瀹℃牳
+    else if (s.changeCheckedNum < s.changeNum) {
+      type = 5;
+    }
+    // 瀹屽叏瀹℃牳
+    else {
+      type = 6;
+    }
+    return type;
+  },
+
   /**
    * 闂瀹℃牳鍚庣姸鎬佸彉鎹�
    * @param {String} s 褰撳墠闂鐘舵��
diff --git a/src/views/fysp/data-product/ProdSceneReport.vue b/src/views/fysp/data-product/ProdSceneReport.vue
index dd38e5c..2f2a140 100644
--- a/src/views/fysp/data-product/ProdSceneReport.vue
+++ b/src/views/fysp/data-product/ProdSceneReport.vue
@@ -5,6 +5,7 @@
     </template>
     <template #aside>
       <SideList
+        legend
         :items="subtasks"
         :loading="sideLoading"
         @item-click="chooseSubtask"
@@ -12,6 +13,7 @@
     </template>
     <template #main>
       <el-scrollbar class="el-scrollbar" v-loading="mainLoading">
+        <div></div>
         <CompSceneConstructionInfo
           title="A銆佸熀鏈俊鎭�"
           :scene="formScene"
@@ -80,7 +82,15 @@
     @submit="handleSelectAnyPhoto"
     :defaultFile="[sceneImg]"
   ></ArbitraryPhoto>
-  <el-dialog
+  <FYImageSelectDialog
+    v-model:dialog-visible="deiveceImgDialog"
+    title="璁惧鍥剧墖"
+    :max-select="1"
+    :typeList="showDeviceTypeList"
+    :typeImgMap="showDeviceImgMap"
+    @submit="handleSelectDevicePhoto"
+  ></FYImageSelectDialog>
+  <!-- <el-dialog
     title="璁惧鍥剧墖"
     width="66%"
     v-model="deiveceImgDialog"
@@ -88,10 +98,10 @@
   >
     <CompDevicePhono
       @selectPhonoEvent="handleSelectDevicePhoto"
-      :imgPathsDataSource="showDeviceImgList"
+      :imgPathsDataSource="showDeviceImgMap"
     >
     </CompDevicePhono>
-  </el-dialog>
+  </el-dialog> -->
 </template>
 <script setup>
 import { ref, computed } from 'vue';
@@ -105,10 +115,10 @@
 import { enumDevice, toLabel } from '@/enum/device/device';
 import { exportDocx } from '@/utils/doc';
 import right_triangle from '@/assets/image/right_triangle.png';
+import ProCheckProxy from '@/views/fysp/check/ProCheckProxy';
 
 import CompSceneConstructionInfo from '@/views/fysp/scene/CompSceneConstructionInfo.vue';
 import ArbitraryPhoto from '@/views/fysp/check/components/ArbitraryPhoto.vue';
-import CompDevicePhono from '@/views/fysp/check/components/CompDevicePhono.vue';
 import CompImgInfo from '@/views/fysp/data-product/components/CompImgInfo.vue';
 import CompProblemTable from './components/CompProblemTable.vue';
 import dayjs from 'dayjs';
@@ -146,8 +156,9 @@
   taskApi.getSubtaskSummary(param).then((res) => {
     const list = [];
     res.forEach((s) => {
-      const t = getSubtaskType(s);
+      const t = ProCheckProxy.getSubtaskType(s);
       list.push({
+        status: s.subtask.status,
         type: t,
         title: s.stName,
         categoly: s.stPlanTime.split('T')[0],
@@ -210,36 +221,37 @@
 // 璁惧鍥剧墖閫夋嫨瀵硅瘽妗�
 const deiveceImgDialog = ref(false);
 const showDeviceIndex = ref(0);
-const showDeviceImgList = ref([]);
+const showDeviceTypeList = ref([]);
+const showDeviceImgMap = ref(new Map());
 // 璁惧鍥剧墖鍒楄〃
 const deviceList = ref([]);
 
 function showDevicePhotoDialog(device, index) {
   showDeviceIndex.value = index;
   deiveceImgDialog.value = true;
-  showDeviceImgList.value = [];
+  showDeviceTypeList.value = [
+    { typeId: device.topTypeId, typeName: device._deviceTypeName }
+  ];
+  showDeviceImgMap.value.clear();
   let imgList = [];
   device._status
     .map((s) => s._picUrls)
     .forEach((pics) => {
       imgList = imgList.concat(
         pics.map((p) => {
-          return {
-            topTypeId: device.topTypeId,
-            _picUrl: p
-          };
+          return { url: p };
         })
       );
     });
   // console.log(imgList);
 
-  showDeviceImgList.value = imgList;
+  showDeviceImgMap.value.set(device.topTypeId, imgList);
 }
 
 function handleSelectDevicePhoto(data) {
   deiveceImgDialog.value = false;
   if (data.length > 0) {
-    deviceList.value[showDeviceIndex.value]._showStatusPic = data[0]._picUrl;
+    deviceList.value[showDeviceIndex.value]._showStatusPic = data[0].url;
   }
 }
 
@@ -354,8 +366,12 @@
       _showStatusPic_1: d1._showStatusPic ? d1._showStatusPic : right_triangle,
       _deviceTypeName_1: d1._deviceTypeName,
       // hasPic2: d2 ? true : false,
-      _showStatusPic_2: d2 ? (d2._showStatusPic ? d2._showStatusPic : right_triangle) : right_triangle,
-      _deviceTypeName_2: d2 ? d2._deviceTypeName : '',
+      _showStatusPic_2: d2
+        ? d2._showStatusPic
+          ? d2._showStatusPic
+          : right_triangle
+        : right_triangle,
+      _deviceTypeName_2: d2 ? d2._deviceTypeName : ''
     });
   }
   const param = {

--
Gitblit v1.9.3