|
|
@@ -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]
|