From d1ce79c837650689ab47bbf587d076743fcb3a5f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 19 五月 2025 17:25:38 +0800
Subject: [PATCH] 1. 问题审核界面新增场景信息编辑入口 2. 问题审核界面场景图片查询新增图片类型修改功能

---
 src/components/FYImageSelectDialog.vue |  117 ++++++++++++++++++++--------------------------------------
 1 files changed, 40 insertions(+), 77 deletions(-)

diff --git a/src/components/FYImageSelectDialog.vue b/src/components/FYImageSelectDialog.vue
index 04bc1b3..6e283c3 100644
--- a/src/components/FYImageSelectDialog.vue
+++ b/src/components/FYImageSelectDialog.vue
@@ -8,21 +8,25 @@
     destroy-on-close
     :close-on-press-escape="false"
   >
-    <!-- <div class="main"> -->
-    <el-row justify="end" v-if="!readonly">
-      <el-text size="small" type="info" class="m-r-8"
-        >鏈�澶氶�夋嫨{{ maxSelect }}寮犲浘鐗�</el-text
-      >
-      <el-button
-        size="small"
-        type="primary"
-        @click="handleSubmit"
-        :disabled="selectedImgUrlList.length == 0"
-        >纭畾</el-button
-      >
-      <el-button size="small" type="primary" @click="handleCancel"
-        >鍙栨秷</el-button
-      >
+    <el-row justify="end">
+      <el-text v-if="onContextMenu != undefined" size="small" type="info">{{
+        `锛�${contextMenuStr}锛塦
+      }}</el-text>
+      <div v-if="!readonly">
+        <el-text size="small" type="info" class="m-r-8"
+          >鏈�澶氶�夋嫨{{ maxSelect }}寮犲浘鐗�</el-text
+        >
+        <el-button
+          size="small"
+          type="primary"
+          @click="handleSubmit"
+          :disabled="selectedImgUrlList.length == 0"
+          >纭畾</el-button
+        >
+        <el-button size="small" type="primary" @click="handleCancel"
+          >鍙栨秷</el-button
+        >
+      </div>
     </el-row>
 
     <div class="center">
@@ -49,8 +53,11 @@
             :class="[img.isSelect ? 'selected' : 'noActive', 'image']"
             fit="cover"
             :src="img.url"
-            :preview-src-list="readonly ? typeImgMap.get(activeId).map((v) => v.url) : []"
+            :preview-src-list="
+              readonly ? typeImgMap.get(activeId).map((v) => v.url) : []
+            "
             :initial-index="i"
+            @contextmenu="(e) => showContextMenu(e, i)"
             @click="onSelect(img, i)"
             @load="onOneImgLoadSuccess(img)"
             @error="onOneImgLoadError(img)"
@@ -61,7 +68,6 @@
         </el-row>
       </el-scrollbar>
     </div>
-    <!-- </div> -->
   </el-dialog>
 </template>
 <script setup>
@@ -86,21 +92,25 @@
     type: Boolean,
     default: false
   },
-  defaultFile: {
-    type: Array,
-    default: () => []
-  },
   // 鍥剧墖鍙�夋暟閲忥紝褰撲紶鍏ユ暟瀛楁椂锛屼唬琛ㄥ浘鐗囨暟閲�
   maxSelect: {
     type: Number,
     default: 3
+  },
+  // 鍥剧墖鍙抽敭鐐瑰嚮浜嬩欢
+  onContextMenu: {
+    type: Function
+  },
+  contextMenuStr: {
+    type: String,
+    default: '鍙抽敭鐐瑰嚮鍥剧墖瑙﹀彂棰濆鎿嶄綔'
   }
 });
 
 const emit = defineEmits(['submit', 'cancel', 'update:dialogVisible']);
 
 const activeId = ref('');
-// const typeImgMap = ref(new Map());
+
 const selectedImgUrlList = ref([]);
 
 let loadedImgCount = ref(0);
@@ -158,20 +168,6 @@
   }
 }
 function handleOpen() {
-  // if (props.typeImgMap.get(activeId.value) == undefined) {
-  //     return;
-  //   }
-  //   props.typeImgMap.get(activeId.value).forEach((i) => {
-  //     if (i.isSelect == true) {
-  //       return;
-  //     }
-  //     props.defaultFile.forEach((imgItem) => {
-  //       if (imgItem.url == i.url) {
-  //         i.isSelect = true;
-  //         selectedImgUrlList.value.push(i);
-  //       }
-  //     });
-  //   });
   emit('update:dialogVisible', true);
 }
 function handleClose() {
@@ -189,6 +185,14 @@
   emit('update:dialogVisible', false);
 }
 
+// 鍥剧墖鍙抽敭鐐瑰嚮鏃堕棿
+function showContextMenu(event, index) {
+  if (props.onContextMenu) {
+    event.preventDefault();
+    props.onContextMenu(event, activeId.value, index);
+  }
+}
+
 watch(
   () => props.typeList,
   (nV, oV) => {
@@ -198,47 +202,6 @@
   },
   { immediate: true }
 );
-// watch(
-//   () => props.defaultFile,
-//   (nV, oV) => {
-//     if (props.typeImgMap.get(activeId.value) == undefined) {
-//       return;
-//     }
-//     props.typeImgMap.get(activeId.value).forEach((i) => {
-//       if (i.isSelect == true) {
-//         return;
-//       }
-//       nV.forEach((imgItem) => {
-//         if (imgItem.url == i.url) {
-//           i.isSelect = true;
-//           selectedImgUrlList.value.push(i);
-//         }
-//       });
-//     });
-//   },
-//   { deep: true, immediate: true }
-// );
-
-// watch(
-//   () => props.typeImgMap,
-//   (newMap, oldMap) => {
-//     if (newMap.get(activeId.value) == undefined) {
-//       return;
-//     }
-//     newMap.get(activeId.value).forEach((i) => {
-//       if (i.isSelect == true) {
-//         return;
-//       }
-//       props.defaultFile.forEach((imgItem) => {
-//         if (imgItem.url == i.url) {
-//           i.isSelect = true;
-//           selectedImgUrlList.value.push(i);
-//         }
-//       });
-//     });
-//   },
-//   { immediate: true }
-// );
 </script>
 <style scoped>
 .center {

--
Gitblit v1.9.3