Pārlūkot izejas kodu

签名日期默认值处理

TonyKang 5 gadi atpakaļ
vecāks
revīzija
59b6865dfa

+ 58 - 26
app/public/report/js/rpt_signature.js

@@ -287,31 +287,62 @@ let rptSignatureHelper = {
         zTreeOprObj.showPage(zTreeOprObj.currentPage, zTreeOprObj.canvas);
     },
     resetSignDate: function() {
-        for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
-            const role_rel = ROLE_REL_LIST[idx];
-            const idSuffixStr = 'dtp_' + role_rel.signature_name;
-            let dtDom = $('#' + idSuffixStr);
-            if (dtDom.length === 1) {
-                const dtStr = dtDom[0].value;
-                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 = '';
-                }
-                // 要处理相关签名Cell属性(默认跟普通cell一样,就多了个signature_name)
-                for (const page of zTreeOprObj.currentRptPageRst.items) {
-                    if (page.signature_date_cells) {
-                        for (const sCell of page.signature_date_cells) {
+        // for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
+        //     const role_rel = ROLE_REL_LIST[idx];
+        //     const idSuffixStr = 'dtp_' + role_rel.signature_name;
+        //     let dtDom = $('#' + idSuffixStr);
+        //     if (dtDom.length === 1) {
+        //         const dtStr = dtDom[0].value;
+        //         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 = '';
+        //         }
+        //         // 要处理相关签名Cell属性(默认跟普通cell一样,就多了个signature_name)
+        //         for (const page of zTreeOprObj.currentRptPageRst.items) {
+        //             if (page.signature_date_cells) {
+        //                 for (const sCell of page.signature_date_cells) {
+        //                     sCell.Value = _getSignDateDftName();
+        //                     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 {
+        //                         }
+        //                     }
+        //                 }
+        //             }
+        //         }
+        //     }
+        // }
+        for (const page of zTreeOprObj.currentRptPageRst.items) {
+            if (page.signature_date_cells) {
+                for (const sCell of page.signature_date_cells) {
+                    sCell.Value = _getSignDateDftName();
+                    for (let idx = 0; idx < ROLE_REL_LIST.length; idx++) {
+                        const role_rel = ROLE_REL_LIST[idx];
+                        const idSuffixStr = 'dtp_' + role_rel.signature_name;
+                        let dtDom = $('#' + idSuffixStr);
+                        if (dtDom.length === 1) {
+                            const dtStr = dtDom[0].value;
+                            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 = '';
+                            }
+                            // 要处理相关签名Cell属性(默认跟普通cell一样,就多了个signature_name)
                             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 = '';
                                 }
                             }
                         }
@@ -319,8 +350,6 @@ let rptSignatureHelper = {
                 }
             }
         }
-        // 还有ROLE_REL_LIST
-        // rptSignatureHelper.cleanOldSignature(accTxtName);
 
     },
     setupAfterSelectSignature: function () {
@@ -471,12 +500,11 @@ let rptSignatureHelper = {
         for (const page of pageData.items) {
             if (page.signature_date_cells) {
                 for (const sCell of page.signature_date_cells) {
+                    sCell.Value = _getSignDateDftName();
                     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 = '';
                             }
                         }
                     }
@@ -484,4 +512,8 @@ let rptSignatureHelper = {
             }
         }
     }
+}
+
+function _getSignDateDftName() {
+    return '    年  月  日';
 }

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

@@ -49,9 +49,10 @@ const JpcDiscreteHelper = {
                                         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);
+                                    // const signatureDateItem = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, param[JV.PROP_DFT_VALUE], true);
+                                    const signatureDateItem = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, df[JV.PROP_DFT_VALUE], true);
+                                    // console.log('param :');
+                                    // console.log(param);
                                     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);