From 87958d6d33603fa673cb7c8f5caf2394689959bf Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期四, 21 十一月 2024 11:00:43 +0800
Subject: [PATCH] 1. 图片选择组件移动到全局组件文件夹 2. 涉及到使用图片选择组件添加图片区域loading 3. 无用页面删除

---
 src/views/fysp/check/components/ArbitraryPhoto.vue |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/views/fysp/check/components/ArbitraryPhoto.vue b/src/views/fysp/check/components/ArbitraryPhoto.vue
index 46b1c88..52034e9 100644
--- a/src/views/fysp/check/components/ArbitraryPhoto.vue
+++ b/src/views/fysp/check/components/ArbitraryPhoto.vue
@@ -1,5 +1,6 @@
 <template>
   <FYImageSelectDialog
+    v-loading="loading"
     title="鍦烘櫙鍥剧墖"
     :typeList="typesList"
     :typeImgMap="typesMap"
@@ -20,6 +21,7 @@
       // 鏃犳暟鎹�
       typesList: [],
       typesMap: new Map(),
+      loading: true,
     };
   },
   mounted() {
@@ -29,21 +31,9 @@
     // 鍥剧墖鍒嗙被
     getGroupImgs() {
       mediafileApi.getRoutineByStGuid(this.subtask.stGuid).then((res) => {
+        this.loading = true
         let typeList = [];
         let typeMap = new Map();
-        function hasThisTypeName(typeName) {
-          return typeList.map((item) => item.typeName).indexOf(typeName) != -1;
-        }
-        function addNewType(typeId, typeName, img) {
-          typeList.push({
-            typeId: typeId,
-            typeName: typeName
-          });
-          typeMap.set(typeId, [img]);
-        }
-        function addToThisType(typeId, img) {
-          typeMap.get(typeId).push(img);
-        }
         const data = res.data;
         for (const e of data) {
           let img = {
@@ -51,18 +41,24 @@
           };
           const businesstype = e.businesstype;
           const businesstypeid = e.businesstypeid;
-          if (hasThisTypeName(businesstype)) {
-            addToThisType(businesstypeid, img);
+          if (
+            typeList.find((item) => item.typeName == businesstype) != undefined
+          ) {
+            typeMap.get(businesstypeid).push(img);
           } else {
-            addNewType(businesstypeid, businesstype, img);
+            typeList.push({
+              typeId: businesstypeid,
+              typeName: businesstype
+            });
+            typeMap.set(businesstypeid, [img]);
           }
         }
-
         this.typesList = typeList;
         this.typesMap = typeMap;
-      });
+      }).finally(() => (this.loading = false));
     }
   }
 };
 </script>
 <style scoped></style>
+ 
\ No newline at end of file

--
Gitblit v1.9.3