Pārlūkot izejas kodu

批量归档中不显示签名标记问题

Tony Kang 1 gadu atpakaļ
vecāks
revīzija
fb2e39f819

+ 6 - 6
app/public/report/js/rpt_archive.js

@@ -598,7 +598,7 @@ let rptArchiveObj = {
         }
         return psInfo;
     },
-    archiveCurrentReport: function (currentRptPageRst, currentNode, cb) {
+    archiveCurrentReport: function (currentRptPageRst, currentNode, currentRolRel = ROLE_REL_LIST, cb) {
         let picKeys = [], picCells = [], dupPicPath = [], dupPicCell = [];
         // 1. 找草图路径
         if (!PAGE_SHOW.closeArchiveSignature) {
@@ -663,7 +663,7 @@ let rptArchiveObj = {
                 });
             }
         } else {
-            rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode, cb);
+            rptArchiveObj._archiveCurrentReport(currentRptPageRst, currentNode, currentRolRel, cb);
         }
     },
     _getBusinessId: function() {
@@ -683,7 +683,7 @@ let rptArchiveObj = {
         }
         return rst;
     },
-    _archiveCurrentReport: function(currentRptPageRst, currentNode, cb) {
+    _archiveCurrentReport: function(currentRptPageRst, currentNode, currentRolRel, cb) {
         // 归档当前报表
         const bzId = rptArchiveObj._getBusinessId();
         const _prepareEncryptionParam = function(result, pageEncryptInfo) {
@@ -761,7 +761,7 @@ let rptArchiveObj = {
                 } else if (PAGE_SHOW.closeArchiveSignature) {
                     // 这里还有一个场景需要考虑:签名是图片且选择了签名,又不归档输出,
                     const rrSigns = [];
-                    ROLE_REL_LIST.forEach(role_rel => {
+                    currentRolRel.forEach(role_rel => {
                         if (role_rel.sign_output && role_rel.sign_output.includes(NORMAL_SIGN_STR)) {
                             rrSigns.push(role_rel.signature_name);
                         }
@@ -793,7 +793,7 @@ let rptArchiveObj = {
                     }
                 }
                 const pageSize = rptControlObj.getCurrentPageSize();
-                let doc = JpcJsPDFHelper._createPdf(currentRptPageRst, pageSize, ROLE_REL_LIST, STAGE_AUDIT);
+                let doc = JpcJsPDFHelper._createPdf(currentRptPageRst, pageSize, currentRolRel, STAGE_AUDIT);
                 restoreCells(signCells, 'signature_cells');
                 signCells = null;
                 txtSignCells.forEach(txtCellBkObj => {
@@ -816,7 +816,7 @@ let rptArchiveObj = {
                 formData.append('file', doc.output('blob'), 'upload.pdf');
                 // formData.append('size', pFile.size);
                 if (currentRptPageRst.splitArcPages) {
-                    let docs = JpcJsPDFHelper.getChildrenDocs(currentRptPageRst, rptControlObj.getCurrentPageSize(), ROLE_REL_LIST, STAGE_AUDIT);
+                    let docs = JpcJsPDFHelper.getChildrenDocs(currentRptPageRst, rptControlObj.getCurrentPageSize(), currentRolRel, STAGE_AUDIT);
                     for (let docIdx = 0; docIdx < docs.length; docIdx++) {
                         let file = docs[docIdx].output('blob');
                         formData.append('file', file, `upload_child_${docIdx}.pdf`);

+ 15 - 13
app/public/report/js/rpt_indexDb.js

@@ -31,7 +31,7 @@ const indexDbOprObj = {
             }
         }
     },
-    batchAdd: function (tbName, datas, cb) {
+    batchAdd: function (tbName, datas, signatureRelArr, cb) {
         let db =  indexDbOprObj.currentDb;
         let ttlAmt = datas.length;
         // console.log(`已选报表数量:${ttlAmt}`);
@@ -43,7 +43,7 @@ const indexDbOprObj = {
                 cnt++;
                 // console.log(`已选加数量:${cnt}`);
                 if (cnt === ttlAmt && cb) {
-                    cb(datas);
+                    cb(datas, signatureRelArr);
                 }
             };
         }
@@ -93,7 +93,7 @@ const indexDbOprObj = {
                     let data = {id: keyStr, name: node.name, rpt_id: node.refId, stage_id, gather_select, stage_select, pageSize: rptControlObj.getCurrentPageSize(), CFG: CUST_CFG};
                     datas.push(data);
                 }
-                indexDbOprObj.batchAdd(this.tb_name_request, datas, (rstArr)=>{
+                indexDbOprObj.batchAdd(this.tb_name_request, datas, [], (rstArr)=>{
                     console.log('batch add succeeded!');
                     console.log(rstArr);
                     //其他操作
@@ -141,10 +141,10 @@ const indexDbOprObj = {
             await rptCustomObj.getCustomSelect(params);
             // params.customSelect = [];
             params.needWaterMark = needWaterMark;
-            indexDbOprObj._getRptDataForDb(params, rpt_names, stage_id, (records)=>{
+            indexDbOprObj._getRptDataForDb(params, rpt_names, stage_id, (records, rstRoleRel)=>{
                 console.log('the normal type page results have been saved!');
                 // console.log(records);
-                _createPDF(0, records, rptNodes, ()=>{
+                _createPDF(0, records, rptNodes, rstRoleRel, ()=>{
                     console.log('the normal type archive PDFs have been created!');
                     let ids = [];
                     for (let rec of records) {
@@ -156,7 +156,7 @@ const indexDbOprObj = {
                 });
             });
         };
-        const _requestGatherReport = function() {
+        const _requestGatherReport = function(rstRoleRel) {
             if (gather_request.length > 0) {
                 let refRptTplIds = [], rpt_names = [];
                 for (let req of gather_request) {
@@ -167,10 +167,10 @@ const indexDbOprObj = {
                 let params = rptControlObj.creatCommonExportParam(refRptTplIds);
                 params.customSelect = [];
                 params.needWaterMark = needWaterMark;
-                indexDbOprObj._getRptDataForDb(params, rpt_names, stage_id, (records)=>{
+                indexDbOprObj._getRptDataForDb(params, rpt_names, stage_id, (records, rstRoleRel)=>{
                     console.log('the normal type page results have been saved!');
                     // console.log(records);
-                    _createPDF(0, records, rptNodes, ()=>{
+                    _createPDF(0, records, rptNodes, rstRoleRel, ()=>{
                         console.log('the normal type archive PDFs have been created!');
                         let ids = [];
                         for (let rec of records) {
@@ -287,8 +287,8 @@ const indexDbOprObj = {
                     let data = {id: keyStr, rpt_id: params.rpt_ids[idx], rpt_name: rpt_names[idx], stage_id, pageData: multiRptData[idx]};
                     datas.push(data);
                 }
-                indexDbOprObj.batchAdd(indexDbOprObj.tb_name_page, datas, (rstArr)=>{
-                    cb(rstArr);
+                indexDbOprObj.batchAdd(indexDbOprObj.tb_name_page, datas, signatureRelArr, (rstArr, rstRoleRel)=>{
+                    cb(rstArr, rstRoleRel);
                 });
             },
             function(failRst){
@@ -306,19 +306,21 @@ const indexDbOprObj = {
     }
 };
 
-function _createPDF(currentIdx, records, rptNodes, cb) {
+function _createPDF(currentIdx, records, rptNodes, rstRoleRel, cb) {
     if (currentIdx === records.length) {
         if (cb) {
             cb();
         }
     } else {
         let rec = records[currentIdx];
+        let curRoleRel = rstRoleRel[currentIdx];
         let nextIdx = currentIdx + 1;
         indexDbOprObj.getOne(indexDbOprObj.tb_name_page, rec.id, (record)=>{
             for (let node of rptNodes) {
                 if (node.refId === record.rpt_id) {
-                    rptArchiveObj.archiveCurrentReport(record.pageData, node, (err, msg, uuid)=>{
-                        _createPDF(nextIdx, records, rptNodes, cb);
+                    // curRoleRel
+                    rptArchiveObj.archiveCurrentReport(record.pageData, node, curRoleRel, (err, msg, uuid)=>{
+                        _createPDF(nextIdx, records, rptNodes, rstRoleRel, cb);
                     });
                     break;
                 }