瀏覽代碼

code sync

Tony Kang 1 年之前
父節點
當前提交
55a9930b41
共有 2 個文件被更改,包括 31 次插入5 次删除
  1. 6 3
      app/controller/report_archive_controller.js
  2. 25 2
      app/public/report/js/rpt_archive.js

+ 6 - 3
app/controller/report_archive_controller.js

@@ -342,10 +342,10 @@ module.exports = app => {
                     await ctx.helper.saveStreamFile(stream, path.join(this.app.baseDir, 'app/public/upload/', stream.filename));
                     await sendToWormhole(stream);
                     //*/
-                    let fileName = parentUuid;
+                    let fileName = parentUuid + '.PDF';
                     if (index > 0) {
-                        fileName = uuidV1();
-                        childUuids.push(fileName);
+                        childUuids.push(uuidV1());
+                        fileName = childUuids[childUuids.length - 1] + '.PDF';
                     }
                     const oss_result = await ctx.app.signPdfOss.put('archive/' + fileName, stream);
                     if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
@@ -486,6 +486,9 @@ module.exports = app => {
                             if (item.items && item.items.length > 0) {
                                 for (const subIdx in item.items) {
                                     if (item.items[subIdx].uuid === orgUuidName) {
+                                        if (item.items[subIdx].childUuids && item.items[subIdx].childUuids.length > 0) {
+                                            // 如果有子分页,也得删除!
+                                        }
                                         item.items.splice(subIdx, 1);
                                         break;
                                     }

+ 25 - 2
app/public/report/js/rpt_archive.js

@@ -6,6 +6,7 @@ let rptArchiveObj = {
     treeObj: null,
     currentNode: null,
     currentArchiveUuid: null,
+    currentChildArchiveUuids: null,
     currentArchiveDateStr: null,
     currentEncryptionList: null,
     currentArchivePdfPath: null,
@@ -14,6 +15,7 @@ let rptArchiveObj = {
         let me = rptArchiveObj;
         me.currentNode = null;
         me.currentArchiveUuid = null;
+        me.currentChildArchiveUuids = null;
         me.currentArchiveDateStr = null;
         me.currentEncryptionList = null;
         me.currentArchivePdfPath = null;
@@ -116,11 +118,13 @@ let rptArchiveObj = {
                         // me.currentArchiveDateStr = aItem.items[0].updateDate_time;
                         const newItems = _.orderBy(aItem.items, ['updateDate_time'], ['desc']);
                         me.currentArchiveUuid = newItems[0].uuid;
+                        me.currentChildArchiveUuids = newItems[0].childUuids;
                         me.currentArchiveDateStr = '#' + (_.findIndex(aItem.items, { updateDate_time: newItems[0].updateDate_time})+1) + ' ' + newItems[0].updateDate_time;
                         if (can_netcasign) {
                             for (const [i,item] of aItem.items.entries()) {
                                 if (_.find(signLogList, { uuid: item.uuid })) {
                                     me.currentArchiveUuid = item.uuid;
+                                    me.currentChildArchiveUuids = item.childUuids;
                                     me.currentArchiveDateStr = '#' + (i+1) + ' ' + item.updateDate_time;
                                     break;
                                 }
@@ -214,10 +218,29 @@ let rptArchiveObj = {
         }
     },
 
-    _changeArchiveDateSelect: function (dom) {
+    _setChildUuidsByCurUuid: () => {
+        let me = rptArchiveObj;
+        me.currentChildArchiveUuids = null;
+        if (me.currentNode && me.currentArchiveUuid) {
+            for (let aItem of ARCHIVE_LIST) {
+                if (me.currentNode.refId === parseInt(aItem.rpt_id)) {
+                    for (let [index,item] of aItem.items.entries()) {
+                        if (item.uuid === me.currentArchiveUuid) {
+                            me.currentChildArchiveUuids = item.childUuids;
+                            break;
+                        }
+                    }
+                    break;
+                }
+            }
+        }
+    },
+
+    _changeArchiveDateSelect: function (dom, archiveIdx) {
         let me = rptArchiveObj;
         // me.currentArchiveUuid = dom.uuid; //在dom的onclick时已经设置过了
         me.currentArchiveDateStr = dom.innerHTML;
+        me._setChildUuidsByCurUuid();
         if(can_netcasign) {
             postData('/tender/'+ TENDER_ID +'/signReport/post', {type: 'pdfIsExist', uuid: me.currentArchiveUuid}, function (result) {
                 const uSignLogList = _.filter(signLogList, { uuid: me.currentArchiveUuid });
@@ -251,7 +274,7 @@ let rptArchiveObj = {
                 if (me.currentNode.refId === parseInt(aItem.rpt_id)) {
                     for (let [index,item] of aItem.items.entries()) {
                         if (item.uuid !== me.currentArchiveUuid) {
-                            const str = '<a class="dropdown-item" href="javascript: void(0);" onclick="rptArchiveObj.currentArchiveUuid = \'' + item.uuid + '\'; rptArchiveObj._changeArchiveDateSelect(this)">' + '#' + (index+1) + ' ' + item.updateDate_time + '</a>';
+                            const str = `<a class="dropdown-item" href="javascript: void(0);" onclick="rptArchiveObj.currentArchiveUuid = '${item.uuid}'; rptArchiveObj._changeArchiveDateSelect(this)">#${index+1} ${item.updateDate_time}</a>`
                             drpDom.append(str);
                         }
                     }