瀏覽代碼

支付审批调整(导出PDF的签名比例)

Tony Kang 2 年之前
父節點
當前提交
3d830cc439
共有 1 個文件被更改,包括 21 次插入3 次删除
  1. 21 3
      app/view/payment/detail.ejs

+ 21 - 3
app/view/payment/detail.ejs

@@ -223,7 +223,7 @@
     //     iniPage();
     // });
 
-    function _getAdhocDummyCells(srcCell, rstCells) {
+    function _getAdhocDummyCells(srcCell, rstCells, controls = null) {
         if (typeof srcCell.path === 'string') {
             let paths = srcCell.path.split('!;!');
             for (let dtlPathIdx = 0; dtlPathIdx < paths.length; dtlPathIdx++) {
@@ -239,13 +239,30 @@
                         couldCreate = false;
                     }
                     if (couldCreate) {
+                        let area = srcCell.area;
+                        if ((dtlPathIdx === 0) && (srcCell.orgArea)) {
+                            area = JSON.parse(JSON.stringify(srcCell.orgArea));
+                            let control = srcCell[JV.PROP_CONTROL];
+                            if (typeof srcCell[JV.PROP_CONTROL] === "string") {
+                                control = controls[srcCell[JV.PROP_CONTROL]];
+                            }
+                            let tmpArea = srcCell.area;
+                            srcCell.area = area;
+                            let signArea = getProperSignatureArea(srcCell, control, 0, 0, JV);
+                            srcCell.area = tmpArea;
+                            area[JV.PROP_LEFT] = signArea[0];
+                            area[JV.PROP_TOP] = signArea[1];
+                            area[JV.PROP_RIGHT] = signArea[2];
+                            area[JV.PROP_BOTTOM] = signArea[3];
+                        }
                         const newStampCell = {
                             signature_name: 'dummy_pic',
                             control: srcCell.control,
                             style: srcCell.style,
                             path: imgSrc,
                             isStamp: true,
-                            area: srcCell.area,
+                            area,
+                            // isOrgShow: (dtlPathIdx === 0),
                         };
                         rstCells.push(newStampCell);
                     }
@@ -292,9 +309,10 @@
         // 1. 先找有没有dummy
         for (let pageData of pageDataArr) {
             let tmpDummyCells = [];
+            let controls = pageData[JV.NODE_CONTROL_COLLECTION];
             for (let page of pageData.items) {
                 for (let dCell of page.signature_cells) {
-                    _getAdhocDummyCells(dCell, tmpDummyCells);
+                    _getAdhocDummyCells(dCell, tmpDummyCells, controls);
                 }
                 if (tmpDummyCells.length > 0) {
                     page.signature_cells = page.signature_cells.concat(tmpDummyCells);