TonyKang 3 лет назад
Родитель
Сommit
f417386346
1 измененных файлов с 33 добавлено и 3 удалено
  1. 33 3
      app/public/report/js/rpt_archive.js

+ 33 - 3
app/public/report/js/rpt_archive.js

@@ -446,18 +446,48 @@ let rptArchiveObj = {
         }
         return psInfo;
     },
-    archiveCurrentReportBefore: function (currentRptPageRst) {
+    archiveCurrentReport: function (currentRptPageRst, currentNode) {
+        let picKeys = [], picCells = [];
+        // 1. 找草图路径
         for (let pageIdx = 0; pageIdx < currentRptPageRst.items.length; pageIdx++) {
             // 每页
             for (let sCellIdx = 0; sCellIdx < currentRptPageRst.items[pageIdx].signature_cells.length; sCellIdx++) {
                 let sCell = currentRptPageRst.items[pageIdx].signature_cells[sCellIdx];
                 if (sCell.signature_name === 'dummy_pic') {
-                    //
+                    if (picKeys.indexOf(sCell.path) < 0) {
+                        picKeys.push(sCell.path);
+                        picCells.push(sCell);
+                    }
                 }
             }
         }
+        // 2. 下载草图,下载完毕后upload
+        if (picCells.length > 0) {
+            $.bootstrapLoading.start();
+            let picAmt = picCells.length, picCnt = 0;
+            for (let idx = 0; idx < picCells.length; idx++) {
+                const img = new Image();
+                img.src = picKeys[idx];
+                img.onload = function() {
+                    picCnt++;
+                    if (picCnt === picAmt) {
+                        $.bootstrapLoading.end();
+                        rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode);
+                    }
+                };
+                img.onerror = function() {
+                    picCnt++;
+                    if (picCnt === picAmt) {
+                        $.bootstrapLoading.end();
+                        rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode);
+                    }
+                }
+            }
+        } else {
+            rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode);
+        }
     },
-    archiveCurrentReport: function(currentRptPageRst, currentNode) {
+    _archiveCurrentReport: function(currentRptPageRst, currentNode) {
         // 归档当前报表
         if (currentRptPageRst !== null) {
             try {