Browse Source

日期转换成年月日

laiguoran 2 years ago
parent
commit
ff7f7b81e8

+ 8 - 10
app/controller/payment_controller.js

@@ -388,16 +388,14 @@ module.exports = app => {
                     }
                     const numberList = ctx.helper._.filter(report_json.items[0].interact_cells, { DataType: 'intact_type_number' });
                     for (const [i, cell] of report_json.items[0].interact_cells.entries()) {
-                        if (cell.Label === '大写') {
-                            if (cell.link === undefined) {
-                                if (numberList.length > 0) {
-                                    const numberInfo = ctx.helper._.find(ctx.helper._.orderBy(numberList, ['index'], ['desc']), function(item) {
-                                        return item.index < i;
-                                    });
-                                    cell.link = numberInfo ? numberInfo.index : '';
-                                } else {
-                                    cell.link = '';
-                                }
+                        if (cell.Label === '大写' && cell.link === undefined) {
+                            if (numberList.length > 0) {
+                                const numberInfo = ctx.helper._.find(ctx.helper._.orderBy(numberList, ['index'], ['desc']), function(item) {
+                                    return item.index < i;
+                                });
+                                cell.link = numberInfo ? numberInfo.index : '';
+                            } else {
+                                cell.link = '';
                             }
                         }
                         const push_item = {

+ 5 - 0
app/extend/helper.js

@@ -1009,6 +1009,11 @@ module.exports = {
         return moment(time).format(style);
     },
 
+    dateTranChinese(day) {
+        const dateParts = day.split('-');
+        return dateParts[0] + '年' + dateParts[1] + '月' + dateParts[2] + '日';
+    },
+
     // 审批日期格式:2020-5-7 9:40:30
     formatFullDate(time) {
         return moment(time).format('YYYY-MM-DD HH:mm:ss');

+ 6 - 1
app/public/js/payment_detail.js

@@ -170,7 +170,7 @@ $(function () {
             tesRpttData.items[0].signature_cells[rptAudit.signature_index].path = signArray.length > 0 ? signArray.join('!;!') : null;
             const date_index = _.findIndex(tesRpttData.items[0].signature_date_cells, { signature_name: rptAudit.signature_name + '_签字日期' });
             if (date_index !== -1) {
-                tesRpttData.items[0].signature_date_cells[date_index].Value = rptAudit.signature_msg.date ? rptAudit.signature_msg.date : '';
+                tesRpttData.items[0].signature_date_cells[date_index].Value = rptAudit.signature_msg.date ? dateTranChinese(rptAudit.signature_msg.date) : '';
             }
             const content_index = _.findIndex(tesRpttData.items[0].signature_audit_cells, { signature_name: rptAudit.signature_name + '_审核意见' });
             if (content_index !== -1) {
@@ -454,3 +454,8 @@ var numberToChinese = function (n) {
     );
 };
 
+function dateTranChinese(day) {
+    const dateParts = day.split('-');
+    return dateParts[0] + '年' + dateParts[1] + '月' + dateParts[2] + '日';
+}
+

+ 1 - 1
app/service/payment_detail.js

@@ -129,7 +129,7 @@ module.exports = app => {
             // 日期
             const dateCells = this._.find(report_json.items[0].signature_date_cells, { signature_name: signature_name + '_签字日期' });
             if (dateCells && sign_msg.date) {
-                dateCells.Value = sign_msg.date;
+                dateCells.Value = this.ctx.helper._.dateTranChinese(sign_msg.date);
             }
             // 意见
             const contentCells = this._.find(report_json.items[0].signature_audit_cells, { signature_name: signature_name + '_审核意见' });