瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 7 月之前
父節點
當前提交
d81a937eb2

+ 22 - 16
app/controller/report_controller.js

@@ -1721,27 +1721,33 @@ function fillWaterMark(pageRstArray) {
 
 async function encodeSignatureDataUri(roleRel, baseDir) {
     if (roleRel) {
+        const _setImage = async role => {
+            if (role.sign_path !== '') {
+                const filePath = baseDir + '/app' + role.sign_path;
+                try {
+                    const res = await isFileExisted(filePath);
+                    if (res) {
+                        const bData = fs.readFileSync(filePath);
+                        const base64Str = bData.toString('base64');
+                        const datauri = 'data:image/png;base64,' + base64Str;
+                        role.sign_pic = datauri;
+                    } else {
+                        console.log('文件不存在:' + filePath);
+                    }
+                } catch (err) {
+                    console.error(err);
+                }
+            }
+        };
         for (const singleRoleRel of roleRel) {
             if (singleRoleRel.rel_content !== null && singleRoleRel.rel_content !== undefined && singleRoleRel.rel_content !== '') {
                 const roleRelContent = JSON.parse(singleRoleRel.rel_content);
                 for (const role of roleRelContent) {
-                    // console.log(role);
-                    if (role.sign_path !== '') {
-                        const filePath = baseDir + '/app' + role.sign_path;
-                        try {
-                            const res = await isFileExisted(filePath);
-                            if (res) {
-                                const bData = fs.readFileSync(filePath);
-                                const base64Str = bData.toString('base64');
-                                const datauri = 'data:image/png;base64,' + base64Str;
-                                role.sign_pic = datauri;
-                            } else {
-                                console.log('文件不存在:' + filePath);
-                            }
-                        } catch (err) {
-                            console.error(err);
+                    if (role.type === '流程') {
+                        for (const flowRole of role.assFlowInfos) {
+                            await _setImage(flowRole);
                         }
-                    }
+                    } else await _setImage(role);
                 }
                 singleRoleRel.rel_content = JSON.stringify(roleRelContent);
             } else {

+ 10 - 3
app/public/js/change_revise.js

@@ -730,7 +730,7 @@ $(document).ready(() => {
                         postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'add-change-list', postData: [data]}, function (result) {
                             changeList = result.changeList;
                             select.is_change = 1;
-                            select.is_valuation = data.is_valuation;
+                            select.is_valuation = data.is_valuation !== undefined ? data.is_valuation : 1;
                             if (oldCInfo) {
                                 select.camount = data.camount;
                                 const refreshNode = billsTree.loadPostData({ update: [select] });
@@ -759,9 +759,16 @@ $(document).ready(() => {
                             postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id] }, function (result) {
                                 changeList = result.changeList;
                                 select.is_change = 0;
+                                select.is_valuation = 0;
+                                select.camount = null;
+                                const billsNode = select;
+                                billsTreeSpreadObj.reCalcCamount(billsNode);
+                                const loadResult = { update: [billsNode] };
+                                const refreshNode = billsTree.loadPostData(loadResult);
+                                billsTreeSpreadObj.refreshTree(billsSheet, refreshNode);
                                 // 重算申请数量金额
-                                const refreshNode = billsTree.loadPostData(result);
-                                billsTreeSpreadObj.refreshTree(info.sheet, refreshNode);
+                                // const refreshNode = billsTree.loadPostData(result);
+                                // billsTreeSpreadObj.refreshTree(info.sheet, refreshNode);
                                 SpreadJsObj.reLoadRowData(info.sheet, info.row);
                             }, function () {
                                 info.sheet.setValue(info.row, info.col, 1);

+ 2 - 1
app/public/report/js/rpt_jsexcel.js

@@ -1343,7 +1343,8 @@ function _checkAndSetSignatureCache(pageData, signKeyArr, signPathArr, roleRel,
                                             rst = true;
                                             signSheetIdxArr[pageIdx] = true;
                                         }
-                                    } else if (role.sign_pic) {
+                                    } else if (role.sign_pic && role_rel.type !== '流程') {
+                                        // 非流程的sign_pic才需要这里处理
                                         const signPath = { signature_name: signatureCell.signature_name, path: null, pic: null };
                                         signPathArr.push(signPath);
                                         signPath.pic = role.sign_pic;

+ 20 - 11
app/public/report/js/rpt_jspdf.js

@@ -89,7 +89,7 @@ const JpcJsPDFHelper = {
         }
         // let signatureCounter = {"allAmt": 0, "picAmt": 0};
         if (pageObj && pageObj.items.length > 0 ) {
-            for(let i = 0; i < pageObj.items.length; i++) {
+            for (let i = 0; i < pageObj.items.length; i++) {
                 if (i > 0) {
                     doc.addPage(actPageSize.toLowerCase(), orientation);
                 }
@@ -129,9 +129,9 @@ const JpcJsPDFHelper = {
                 // let ppStatus = zTreeOprObj._chkPrePayStatus();
                 for (let cell of page.signature_cells) {
                     if (auditStatus === 3) {
-                        private_drawSignature(doc, ctx, cell, styles, controls, newPageMergeBand, false, signatureRelArr);
+                        private_drawSignature(doc, ctx, cell, styles, controls, newPageMergeBand, false, signatureRelArr, i);
                     } else {
-                        private_drawSignature(doc, ctx, cell, styles, controls, newPageMergeBand, true, signatureRelArr);
+                        private_drawSignature(doc, ctx, cell, styles, controls, newPageMergeBand, true, signatureRelArr, i);
                     }
                 }
                 if (PAGE_SHOW['closeWatermark'] === 0) {
@@ -164,7 +164,7 @@ const JpcJsPDFHelper = {
             private_drawImage(doc, ctx, cell, control, cell.pic, (!!cell.isStamp), [1, 1, 1, 1]);
         }
 
-        function private_drawSignature(doc, ctx, cell, styles, controls, mergedBand, onlyShowBorder, signatureRelArr) {
+        function private_drawSignature(doc, ctx, cell, styles, controls, mergedBand, onlyShowBorder, signatureRelArr, pageIdx) {
             ctx.beginPath();
             let style = styles[cell[JV.PROP_STYLE]];
              // 印章的cell表框都要去掉
@@ -179,18 +179,18 @@ const JpcJsPDFHelper = {
             ctx.closePath();
             if (PAGE_SHOW.isTextSignature === 0 || cell.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) >= 0) {
                 if (!onlyShowBorder || cell.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) >= 0) {
-                    private_drawSignatureCellText(doc, ctx, cell, controls, signatureRelArr);
+                    private_drawSignatureCellText(doc, ctx, cell, controls, signatureRelArr, pageIdx);
                 } else {
                     for (const signRel of signatureRelArr) {
                         if (cell.signature_name === signRel.signature_name && rptSignatureHelper._chkIfAudit(signRel)) {
-                            private_drawSignatureCellText(doc, ctx, cell, controls, signatureRelArr);
+                            private_drawSignatureCellText(doc, ctx, cell, controls, signatureRelArr, pageIdx);
                         }
                     }
                 }
             }
         }
 
-        function private_drawSignatureCellText(doc, ctx, cell, controls, signatureRelArr) {
+        function private_drawSignatureCellText(doc, ctx, cell, controls, signatureRelArr, pageIdx) {
             let control = null;
             if (typeof cell[JV.PROP_CONTROL] === "string") {
                 control = controls[cell[JV.PROP_CONTROL]];
@@ -207,11 +207,20 @@ const JpcJsPDFHelper = {
             } else {
                 // 导出PDF时,根本不需要判断cell.path是不是null or undefined
                 for (const signRel of signatureRelArr) {
-                    if (cell.signature_name === signRel.signature_name && signRel.sign_pic !== null && signRel.sign_pic !== undefined) {
-                        if (!(signRel.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) < 0 && signRel.sign_output.indexOf('normal_sign') < 0)) {
-                            private_drawImage(doc, ctx, cell, control, signRel.sign_pic);
+                    if (cell.signature_name === signRel.signature_name) {
+                        if (signRel.type === '流程') {
+                            if (signRel.flowAccList[pageIdx] >= 0 && signRel.assFlowInfos[signRel.flowAccList[pageIdx]].sign_pic) {
+                                private_drawImage(doc, ctx, cell, control, signRel.assFlowInfos[signRel.flowAccList[pageIdx]].sign_pic);
+                                break;
+                            }
+                        } else {
+                            if (signRel.sign_pic !== null && signRel.sign_pic !== undefined) {
+                                if (!(signRel.signature_name.indexOf(JV.SIGNATURE_NAME_DUMMY) < 0 && signRel.sign_output.indexOf('normal_sign') < 0)) {
+                                    private_drawImage(doc, ctx, cell, control, signRel.sign_pic);
+                                }
+                                break;
+                            }
                         }
-                        break;
                     }
                 }
             }

+ 10 - 7
app/public/report/js/rpt_main.js

@@ -1114,13 +1114,16 @@ let rptControlObj = {
         //这里尝试下异步加载字体文件
         let me = rptControlObj;
         me.isLoading = true;
-        // dynamicLoadJs('/public/jspdf/SmartSimsun-normal.js', 'normal', me.getPdfFontCallbackLight);
-        // dynamicLoadJs('/public/jspdf/SmartSimsun-normal2.js', 'normal', me.getPdfFontCallbackLight);
-        // dynamicLoadJs('/public/jspdf/SmartSimsun-bold.js', 'bold', me.getPdfFontCallbackLight);
-
-        // dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', me.getPdfFontCallbackLight);
-        dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal2.js', 'normal', me.getPdfFontCallbackLight);
-        dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', me.getPdfFontCallbackLight);
+        const urlStr = window.location.href;
+        if (urlStr.includes('localhost') || urlStr.includes('jlqa')) {
+            // dynamicLoadJs('/public/jspdf/SmartSimsun-normal.js', 'normal', me.getPdfFontCallbackLight);
+            dynamicLoadJs('/public/jspdf/SmartSimsun-normal2.js', 'normal', me.getPdfFontCallbackLight);
+            dynamicLoadJs('/public/jspdf/SmartSimsun-bold.js', 'bold', me.getPdfFontCallbackLight);
+        } else {
+            // dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal.js', 'normal', me.getPdfFontCallbackLight);
+            dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-normal2.js', 'normal', me.getPdfFontCallbackLight);
+            dynamicLoadJs('https://d2.smartcost.com.cn/cach/SmartSimsun-bold.js', 'bold', me.getPdfFontCallbackLight);
+        }
     },
     getPDFPre: function () {
         let me = rptControlObj;