xiaohaizhao 2 недель назад
Родитель
Сommit
ae7736bf5d

+ 45 - 1
src/MAR/archivesMag/detail/index.vue

@@ -97,8 +97,52 @@ const mianData = async ()=>{
         "sat_coursewareid": router.currentRoute.value.query.id
     }
   })
+  
+  // 处理附件数据
+  if (res.data.attinfos) {
+    res.data.attinfos = utils.fileList(res.data.attinfos);
+    
+    // 记录创建时间早于主数据的附件信息
+    const mainCreatedate = res.data.createdate;
+    const excludedAttachments = [];
+    
+    // 过滤附件:排除创建时间早于主数据的附件
+    res.data.attinfos = res.data.attinfos.filter(attachment => {
+      if (attachment.createdate && mainCreatedate) {
+        const attachmentDate = new Date(attachment.createdate);
+        const mainDate = new Date(mainCreatedate);
+        if (attachmentDate < mainDate) {
+          excludedAttachments.push({
+            linksid: attachment.linksid,
+            attachmentid: attachment.attachmentid
+          });
+          return false;
+        }
+      }
+      return true;
+    });
+    
+    console.log('Excluded attachments:', excludedAttachments);
+    
+    // 解绑被排除的附件
+    for (const item of excludedAttachments) {
+      try {
+        await Api.requested({
+          classname: "system.attachment.Attachment",
+          method: "deleteFileLink",
+          id: 10020601,
+          content: {
+            linksids: [item.linksid]
+          }
+        });
+        console.log('Unlinked attachment:', item.linksid);
+      } catch (error) {
+        console.error('Error unlinking attachment:', error);
+      }
+    }
+  }
+  
   mainData.value = res.data
-  mainData.value.attinfos = utils.fileList(mainData.value.attinfos)
   console.log(mainData.value);
   changeDataStructure(res.data)
 

+ 45 - 0
src/MAR/noticeManage/detail/index.vue

@@ -59,6 +59,51 @@ const mianData = async () => {
       "sat_noticeid": router.currentRoute.value.query.id
     }
   })
+  
+  // 处理附件数据
+  if (res.data.attinfos) {
+    res.data.attinfos = utils.fileList(res.data.attinfos);
+    
+    // 记录创建时间早于主数据的附件信息
+    const mainCreatedate = res.data.createdate;
+    const excludedAttachments = [];
+    
+    // 过滤附件:排除创建时间早于主数据的附件
+    res.data.attinfos = res.data.attinfos.filter(attachment => {
+      if (attachment.createdate && mainCreatedate) {
+        const attachmentDate = new Date(attachment.createdate);
+        const mainDate = new Date(mainCreatedate);
+        if (attachmentDate < mainDate) {
+          excludedAttachments.push({
+            linksid: attachment.linksid,
+            attachmentid: attachment.attachmentid
+          });
+          return false;
+        }
+      }
+      return true;
+    });
+    
+    console.log('Excluded attachments:', excludedAttachments);
+    
+    // 解绑被排除的附件
+    for (const item of excludedAttachments) {
+      try {
+        await Api.requested({
+          classname: "system.attachment.Attachment",
+          method: "deleteFileLink",
+          id: 10020601,
+          content: {
+            linksids: [item.linksid]
+          }
+        });
+        console.log('Unlinked attachment:', item.linksid);
+      } catch (error) {
+        console.error('Error unlinking attachment:', error);
+      }
+    }
+  }
+  
   mainData.value = res.data
   document.querySelector('#editor-content').innerHTML = mainData.value.content
   console.log(mainData.value);

+ 46 - 2
src/MAR/productManage/detail/index.vue

@@ -93,13 +93,57 @@ const mianData = async () => {
       "sa_fadid": router.currentRoute.value.query.id
     }
   })
-  res.data.attinfos = utils.fileList(res.data.attinfos)
+  
+  // 处理附件数据
+  if (res.data.attinfos) {
+    res.data.attinfos = utils.fileList(res.data.attinfos);
+    
+    // 记录创建时间早于主数据的附件信息
+    const mainCreatedate = res.data.createdate;
+    const excludedAttachments = [];
+    
+    // 过滤附件:排除创建时间早于主数据的附件
+    res.data.attinfos = res.data.attinfos.filter(attachment => {
+      if (attachment.createdate && mainCreatedate) {
+        const attachmentDate = new Date(attachment.createdate);
+        const mainDate = new Date(mainCreatedate);
+        if (attachmentDate < mainDate) {
+          excludedAttachments.push({
+            linksid: attachment.linksid,
+            attachmentid: attachment.attachmentid
+          });
+          return false;
+        }
+      }
+      return true;
+    });
+    
+    console.log('Excluded attachments:', excludedAttachments);
+    
+    // 解绑被排除的附件
+    for (const item of excludedAttachments) {
+      try {
+        await Api.requested({
+          classname: "system.attachment.Attachment",
+          method: "deleteFileLink",
+          id: 10020601,
+          content: {
+            linksids: [item.linksid]
+          }
+        });
+        console.log('Unlinked attachment:', item.linksid);
+      } catch (error) {
+        console.error('Error unlinking attachment:', error);
+      }
+    }
+  }
+  
   mainData.value = res.data
   console.log(mainData.value);
   try {
     photoWall1.value.init(res.data.attinfos_pic)
   } catch (error) {
-
+    console.error('Error initializing photoWall:', error);
   }
   changeDataStructure(res.data)
 

+ 46 - 2
src/MAR/topiceManage/detail/index.vue

@@ -114,9 +114,53 @@ const mianData = async ()=>{
         "sat_courseware_testlibraryid": router.currentRoute.value.query.id
     }
   })
+  
+  // 处理附件数据
+  if (res.data.attinfos) {
+    res.data.attinfos.forEach(item => item.name = item.document)
+    res.data.attinfos = utils.fileList(res.data.attinfos);
+    
+    // 记录创建时间早于主数据的附件信息
+    const mainCreatedate = res.data.createdate;
+    const excludedAttachments = [];
+    
+    // 过滤附件:排除创建时间早于主数据的附件
+    res.data.attinfos = res.data.attinfos.filter(attachment => {
+      if (attachment.createdate && mainCreatedate) {
+        const attachmentDate = new Date(attachment.createdate);
+        const mainDate = new Date(mainCreatedate);
+        if (attachmentDate < mainDate) {
+          excludedAttachments.push({
+            linksid: attachment.linksid,
+            attachmentid: attachment.attachmentid
+          });
+          return false;
+        }
+      }
+      return true;
+    });
+    
+    console.log('Excluded attachments:', excludedAttachments);
+    
+    // 解绑被排除的附件
+    for (const item of excludedAttachments) {
+      try {
+        await Api.requested({
+          classname: "system.attachment.Attachment",
+          method: "deleteFileLink",
+          id: 10020601,
+          content: {
+            linksids: [item.linksid]
+          }
+        });
+        console.log('Unlinked attachment:', item.linksid);
+      } catch (error) {
+        console.error('Error unlinking attachment:', error);
+      }
+    }
+  }
+  
   mainData.value = res.data
-  mainData.value.attinfos.forEach(item => item.name = item.document)
-  mainData.value.attinfos = utils.fileList(mainData.value.attinfos)
   mainData.value.options.forEach((item,index) => {
     item.cover = [{url:item.url}]
     item.sequence = options[index]