xiaohaizhao 1 неделя назад
Родитель
Сommit
9cba9edec0

+ 14 - 2
src/MAR/assetsStore/detail/index.vue

@@ -112,14 +112,26 @@ const mianData = async () => {
   });
 
   res.data.attinfos = utils.fileList(res.data.attinfos);
-  res.data.attinfos_pic = utils.fileList(res.data.attinfos_pic.map(v => v.attinfos[0]));
+
+  if (res.data.attinfos_pic.length == 0) {
+    res.data.attinfos_pic = utils.fileList(res.data.attinfos.filter(v => v.usetype == 'file'));
+  } else {
+    res.data.attinfos_pic = utils.fileList(res.data.attinfos_pic.map(v => v.attinfos[0]));
+  }
 
   // 记录创建时间早于主数据的附件信息
   const mainCreatedate = res.data.createdate;
   const excludedAttachments = [];
 
-  // 过滤附件:排除创建时间早于主数据的附件
+  // 过滤附件:排除创建时间早于主数据的附件,以及 usetype 为 'richtext' 的附件
   res.data.attinfos = res.data.attinfos.filter(attachment => {
+    if (attachment.usetype === 'richtext') {
+      excludedAttachments.push({
+        linksid: attachment.linksid,
+        attachmentid: attachment.attachmentid
+      });
+      return false;
+    }
     if (attachment.createdate && mainCreatedate) {
       const attachmentDate = new Date(attachment.createdate);
       const mainDate = new Date(mainCreatedate);

+ 41 - 3
src/MAR/signManage/modules/preview.vue

@@ -4,7 +4,7 @@
       <div class="file-list" style="max-width:70vw;">
         <div
           class="item"
-          v-for="(item, index) in utils.fileList(rowData.attinfos)"
+          v-for="(item, index) in getFilteredAttinfos()"
           :key="index"
         >
           <template v-if="item.fileType == 'image'">
@@ -34,7 +34,7 @@
     <div class="file-list">
       <div
         class="item"
-        v-for="(item, index) in utils.fileList(rowData.attinfos)"
+        v-for="(item, index) in getFilteredAttinfos()"
         :key="index"
       >
         <template v-if="item.fileType == 'image'">
@@ -54,9 +54,47 @@
   <script setup>
 import { ref, defineProps, defineEmits, watch, nextTick } from "vue";
 import utils from "@/utils/utils";
-const props = defineProps(["rowData"]);
+import Api from "@/api/api";
+const props = defineProps(["rowData", "mainCreatedate"]);
 const open = ref(false);
 
+const getFilteredAttinfos = () => {
+  let attinfos = props.rowData.attinfos || [];
+  const excludedAttachments = [];
+  
+  if (props.mainCreatedate) {
+    const mainDate = new Date(props.mainCreatedate);
+    attinfos = attinfos.filter(attachment => {
+      if (attachment.createdate) {
+        const attachmentDate = new Date(attachment.createdate);
+        if (attachmentDate < mainDate) {
+          excludedAttachments.push({
+            linksid: attachment.linksid,
+            attachmentid: attachment.attachmentid
+          });
+          return false;
+        }
+      }
+      return true;
+    });
+    
+    // 删除被过滤掉的附件
+    if (excludedAttachments.length > 0) {
+      Api.requested({
+        classname: "system.attachment.Attachment",
+        method: "deleteFileLink",
+        id: 10020601,
+        content: {
+          linksids: excludedAttachments.map(item => item.linksid)
+        }
+      }).then(() => {
+      });
+    }
+  }
+  
+  return utils.fileList(attinfos);
+};
+
 watch(
   () => open.value,
   (val) => {

+ 4 - 4
src/components/photoWall/index.vue

@@ -21,7 +21,7 @@
           <a-progress type="circle" :percent="item.progress" :status="item.exception"
             :size="[baseSize - 40, baseSize - 40]" />
         </div>
-        <a-popover v-else :open="hovered == index" @openChange="handleHoverChange($event, index)">
+        <a-popover v-else :open="hovered === item.attachmentid" @openChange="handleHoverChange($event, item.attachmentid)">
           <template #content>
             <div style="width: 200px; padding: 8px;">
               <div style="font-weight: bold; margin-bottom: 4px; word-break: break-word;">{{ item.document || '文件' }}
@@ -68,7 +68,7 @@
             <!-- 删除按钮 -->
             <div v-if="!props.disabled && isDeletable" style="position: absolute; top: 4px; right: 4px; z-index: 10;"
               @click.stop>
-              <a-popconfirm :open="linksid == item.linksid" title="确定删除当前资源吗?" @confirm="confirmDeleteImage"
+              <a-popconfirm :open="linksid === item.linksid" title="确定删除当前资源吗?" @confirm="confirmDeleteImage"
                 @cancel="linksid = null">
                 <DeleteOutlined class="previewMaskIcon" :style="{ fontSize: '18px', color: '#ff4d4f' }"
                   @click.stop="linksid = item.linksid" />
@@ -528,9 +528,9 @@ function setSequenceAll() {
   });
 }
 
-function handleHoverChange(visible, index) {
+function handleHoverChange(visible, attachmentid) {
   if (prohibitHovered) return (hovered.value = null);
-  hovered.value = visible ? index : null;
+  hovered.value = visible ? attachmentid : null;
 }
 defineExpose({
   init,