Forráskód Böngészése

修复报表内容bug

laiguoran 2 éve
szülő
commit
913002ea46
1 módosított fájl, 20 hozzáadás és 6 törlés
  1. 20 6
      app/controller/payment_controller.js

+ 20 - 6
app/controller/payment_controller.js

@@ -693,6 +693,8 @@ module.exports = app => {
                         renderData.rptMsg = pageRst.items[0];
                         // 判断与原有的报表审批人列表是否有区别
                         let difference = false;
+                        let auditDifference = false;
+                        let needChange = false;
                         if (trInfo.report_items_json) {
                             const report_items_json = JSON.parse(trInfo.report_items_json);
                             const items = ['cells', 'signature_audit_cells', 'signature_cells', 'signature_date_cells', 'interact_cells'];
@@ -701,20 +703,32 @@ module.exports = app => {
                                     !ctx.helper._.isEmpty(ctx.helper._.differenceWith(JSON.parse(JSON.stringify(renderData.rptMsg[item])), report_items_json[item], ctx.helper._.isEqual))) {
                                     // 因为interact_cells里存在undefind值,必须先用JSON.parse和JSON.stringify转义才能对比
                                     difference = true;
+                                    needChange = true;
+                                    if (item === 'signature_audit_cells') {
+                                        auditDifference = true;
+                                    }
                                     break;
                                 }
                             }
+                        } else {
+                            difference = true;
                         }
                         if (difference) {
                             // 删除rpt_audit重新配置
-                            await ctx.service.paymentTenderRpt.defaultUpdate({
+                            const updateData = {
                                 id: trInfo.id,
                                 report_items_json: JSON.stringify(ctx.helper._.cloneDeep(renderData.rptMsg)),
-                                rpt_audit: null,
-                                is_change: 1,
-                            });
-                            trInfo.rpt_audit = null;
-                            trInfo.is_change = 1;
+                            };
+                            // 删除rpt_audit重新配置
+                            if (auditDifference) {
+                                updateData.rpt_audit = null;
+                                trInfo.rpt_audit = null;
+                            }
+                            if (needChange) {
+                                updateData.is_change = 1;
+                                trInfo.is_change = 1;
+                            }
+                            await ctx.service.paymentTenderRpt.defaultUpdate(updateData);
                             trInfo.report_items_json = renderData.rptMsg;
                         }
                         if (trInfo.rpt_audit) {