Browse Source

电子签名日期

TonyKang 5 years ago
parent
commit
7518b36b7c

+ 12 - 3
app/public/report/js/rpt_main.js

@@ -274,6 +274,15 @@ let zTreeOprObj = {
             document.getElementById("hrefRptOrientation").innerHTML = "横向";
         }
     },
+    _parseRoleRelList: function(org_rel_content) {
+        const rst = JSON.parse(org_rel_content);
+        for (const role_rel of rst) {
+            if (role_rel.sign_date !== null && role_rel.sign_date !== undefined && role_rel.sign_date.length >= 8) {
+                role_rel.sign_date = new Date(role_rel.sign_date);
+            }
+        }
+        return rst;
+    },
     requestNormalReport: function (params) {
         let me = zTreeOprObj;
         // hintBox.waitBox();
@@ -283,10 +292,10 @@ let zTreeOprObj = {
                 let pageRst = result.data;
                 if (result.signatureRelInfo && result.signatureRelInfo.length > 0) {
                     CURRENT_ROLE_REL_ID = result.signatureRelInfo[0].id;
-                    ROLE_REL_LIST = JSON.parse(result.signatureRelInfo[0].rel_content);
+                    ROLE_REL_LIST = me._parseRoleRelList(result.signatureRelInfo[0].rel_content);
                     STAGE_AUDIT = result.stageAudit;
-                    rptSignatureHelper.originalRoleRelList = JSON.parse(result.signatureRelInfo[0].rel_content);
-                    rptSignatureHelper.mergeSignDate();
+                    rptSignatureHelper.originalRoleRelList = me._parseRoleRelList(result.signatureRelInfo[0].rel_content);
+                    rptSignatureHelper.mergeSignDate(pageRst);
                     rptSignatureHelper.mergeSignature(pageRst);
                 } else {
                     CURRENT_ROLE_REL_ID = -1;

+ 23 - 6
app/public/report/js/rpt_signature.js

@@ -293,11 +293,13 @@ let rptSignatureHelper = {
             let dtDom = $('#' + idSuffixStr);
             if (dtDom.length === 1) {
                 const dtStr = dtDom[0].value;
-                if (dtStr && dtStr !== '' && dtStr.length === 10) {
-                    const year = parseInt(dtStr.slice(0, 4));
-                    const month = parseInt(dtStr.slice(5, 7)) - 1;
-                    const dt = parseInt(dtStr.slice(8, 10));
-                    role_rel.sign_date = new Date(year, month, dt);
+                if (dtStr && dtStr !== '' && dtStr.length >= 8 && dtStr.length <= 10) {
+                    // const tmpDt = new Date(dtStr);
+                    // const year = parseInt(tmpDt.getFullYear());
+                    // const month = parseInt(tmpDt.getMonth());
+                    // const dt = parseInt(tmpDt.getDate());
+                    // role_rel.sign_date = new Date(year, month, dt);
+                    role_rel.sign_date = new Date(dtStr);
                 } else {
                     role_rel.sign_date = '';
                 }
@@ -451,7 +453,7 @@ let rptSignatureHelper = {
             }
         }
     },
-    mergeSignDate: function () {
+    mergeSignDate: function (pageData) {
         if (ROLE_REL_LIST && ROLE_REL_LIST.length > 0 && STAGE_AUDIT && STAGE_AUDIT.length > 0) {
             for (let rridx = 0; rridx < ROLE_REL_LIST.length; rridx++) {
                 const role_rel = ROLE_REL_LIST[rridx];
@@ -466,5 +468,20 @@ let rptSignatureHelper = {
                 }
             }
         }
+        for (const page of pageData.items) {
+            if (page.signature_date_cells) {
+                for (const sCell of page.signature_date_cells) {
+                    for (const role_rel of ROLE_REL_LIST) {
+                        if (sCell.signature_name === role_rel.signature_name + '_签字日期') {
+                            if (role_rel.sign_date !== '') {
+                                sCell.Value = role_rel.sign_date.Format(role_rel.sign_date_format);
+                            } else {
+                                sCell.Value = '';
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
 }

+ 16 - 3
app/reports/rpt_component/helper/jpc_helper_discrete.js

@@ -39,10 +39,21 @@ const JpcDiscreteHelper = {
                                 }
                             } else if (JE.isDynamicParam(df[JV.PROP_PARAM_ID], $CURRENT_RPT)) {
                                 // 这里输出到signatureDateRst
+                                // console.log('current sign date df :');
+                                // console.log(df);
                                 if (Array.isArray(signatureDateRst)) {
-                                    const param = JE.P(df[JV.PROP_PARAM_ID], $CURRENT_RPT);
+                                    let pID = 0;
+                                    if (df.hasOwnProperty(JV.PROP_PARAM_ID)) {
+                                        pID = df[JV.PROP_PARAM_ID];
+                                    } else {
+                                        pID = df[JV.PROP_ID];
+                                    }
+                                    const param = JE.P(pID, $CURRENT_RPT);
                                     const signatureDateItem = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, param[JV.PROP_DFT_VALUE], true);
+                                    // console.log('current sign date $CURRENT_RPT :');
+                                    // console.log($CURRENT_RPT);
                                     signatureDateItem.signature_name = param[JV.PROP_NAME];
+                                    signatureDateItem[JV.PROP_AREA] = JpcAreaHelper.outputArea(df[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);
                                     signatureDateRst.push(signatureDateItem);
                                 }
                             } else {
@@ -88,8 +99,10 @@ const JpcDiscreteHelper = {
                                     } else {
                                         JpcFieldHelper.resetFormat(df, map_data_field, customizeCfg);
                                     }
-                                } else if (df[JV.PROP_PARAM_ID]) {
-                                    const param = JE.P(df[JV.PROP_PARAM_ID], $CURRENT_RPT);
+                                } else if (df[JV.PROP_PARAM_ID] || df[JV.PROP_ID]) {
+                                    let pID = df[JV.PROP_PARAM_ID];
+                                    if (df[JV.PROP_ID]) pID = df[JV.PROP_ID];
+                                    const param = JE.P(pID, $CURRENT_RPT);
                                     value = param[JV.PROP_DFT_VALUE];
                                 }
                                 // console.log(value);

+ 2 - 0
app/reports/rpt_component/jpc_rte.js

@@ -34,6 +34,8 @@ const JE = {
         let rst = null;
         if ($CURRENT_RPT && ($CURRENT_RPT.params[JV.PROP_ID + '_' + pID])) {
             rst = $CURRENT_RPT.params[JV.PROP_ID + '_' + pID];
+        } else if ($CURRENT_RPT && $CURRENT_RPT.params[JV.NODE_DYNAMIC_DATE_PARAMS] && $CURRENT_RPT.params[JV.NODE_DYNAMIC_DATE_PARAMS][JV.PROP_ID + '_' + pID]) {
+            rst = $CURRENT_RPT.params[JV.NODE_DYNAMIC_DATE_PARAMS][JV.PROP_ID + '_' + pID];
         } else {
             rst = { msg: 'the Param-ID is not valid, no result was found!' };
         }