|
@@ -467,7 +467,7 @@ let rptArchiveObj = {
|
|
|
return psInfo;
|
|
|
},
|
|
|
archiveCurrentReport: function (currentRptPageRst, currentNode) {
|
|
|
- let picKeys = [], picCells = [];
|
|
|
+ let picKeys = [], picCells = [], dupPicPath = [], dupPicCell = [];
|
|
|
// 1. 找草图路径
|
|
|
for (let pageIdx = 0; pageIdx < currentRptPageRst.items.length; pageIdx++) {
|
|
|
// 每页
|
|
@@ -477,8 +477,19 @@ let rptArchiveObj = {
|
|
|
if (sCell.signature_name === 'dummy_pic') {
|
|
|
//1. 草图就不考虑重复问题,重复就重复吧;
|
|
|
//2. 如果是dummy_pic,也不用判断是否为签名了,因为有其他的逻辑直接选择审核人,不经过签名过程,就当草图一样放过去了
|
|
|
- picKeys.push(sCell.path);
|
|
|
- picCells.push(sCell);
|
|
|
+ let picIdx = picKeys.indexOf(sCell.path);
|
|
|
+ if (picIdx < 0) {
|
|
|
+ picKeys.push(sCell.path);
|
|
|
+ picCells.push(sCell);
|
|
|
+ } else {
|
|
|
+ let dPicIdx = dupPicPath.indexOf(sCell.path);
|
|
|
+ if (dPicIdx < 0) {
|
|
|
+ dupPicPath.push(sCell.path);
|
|
|
+ dupPicCell.push([]);
|
|
|
+ dPicIdx = dupPicPath.length - 1;
|
|
|
+ }
|
|
|
+ dupPicCell[dPicIdx].push(sCell);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -486,39 +497,36 @@ let rptArchiveObj = {
|
|
|
if (picCells.length > 0) {
|
|
|
$.bootstrapLoading.start();
|
|
|
let picAmt = picCells.length, picCnt = 0;
|
|
|
+ let exceptionAmt = 0;
|
|
|
for (let idx = 0; idx < picCells.length; idx++) {
|
|
|
+ let dCell = picKeys[idx];
|
|
|
getBlob(picKeys[idx]).then(blob => {
|
|
|
- // saveAs(blob, filename);
|
|
|
- let oFileReader = new FileReader();
|
|
|
- oFileReader.onloadend = function (e) {
|
|
|
- picCnt++;
|
|
|
- let base64 = e.target.result;
|
|
|
- // console.log("方式一》》》》》》》》》", base64)
|
|
|
- picCells[idx].pic = base64;
|
|
|
- if (picCnt === picAmt) {
|
|
|
+ if (blob === 'not found!') {
|
|
|
+ exceptionAmt++;
|
|
|
+ if ((picCnt + exceptionAmt) === picAmt) {
|
|
|
$.bootstrapLoading.end();
|
|
|
rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode);
|
|
|
}
|
|
|
- };
|
|
|
- oFileReader.readAsDataURL(blob);
|
|
|
+ } else {
|
|
|
+ let oFileReader = new FileReader();
|
|
|
+ oFileReader.onloadend = function (e) {
|
|
|
+ picCnt++;
|
|
|
+ let base64 = e.target.result;
|
|
|
+ picCells[idx].pic = base64;
|
|
|
+ let pPathIdx = dupPicPath.indexOf(dCell.path);
|
|
|
+ if (pPathIdx >= 0) {
|
|
|
+ for (let dupCell of dupPicCell[pPathIdx]) {
|
|
|
+ dupCell.pic = base64;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((picCnt + exceptionAmt) === picAmt) {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ oFileReader.readAsDataURL(blob);
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
- // 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);
|
|
@@ -649,6 +657,8 @@ function getBlob(url) {
|
|
|
xhr.onload = () => {
|
|
|
if (xhr.status === 200) {
|
|
|
resolve(xhr.response);
|
|
|
+ } else {
|
|
|
+ resolve('not found!');
|
|
|
}
|
|
|
};
|
|
|
|