|
|
@@ -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) => {
|