MaiXinRong 5 vuotta sitten
vanhempi
commit
068a26c2f2
1 muutettua tiedostoa jossa 7 lisäystä ja 10 poistoa
  1. 7 10
      app/service/stage_audit.js

+ 7 - 10
app/service/stage_audit.js

@@ -225,8 +225,7 @@ module.exports = app => {
                 await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
                 // 更新期数据
                 const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
-                const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
-                tpHistory.push({
+                this.ctx.stage.tp_history.push({
                     times: this.ctx.stage.curTimes, order: 0,
                     contract_tp: tpData.contract_tp,
                     qc_tp: tpData.qc_tp,
@@ -239,7 +238,7 @@ module.exports = app => {
                     qc_tp: tpData.qc_tp,
                     yf_tp: yfPay.tp,
                     sf_tp: sfPay.tp,
-                    tp_history: JSON.stringify(tpHistory),
+                    tp_history: JSON.stringify(this.ctx.stage.tp_history),
                     cache_time_r: this.ctx.stage.cache_time_l,
                 });
 
@@ -284,8 +283,7 @@ module.exports = app => {
                 await transaction.update(this.tableName, {id: audit.id, status: checkData.checkType, opinion: checkData.opinion, end_time: time});
                 // 计算并合同支付最终数据
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
-                const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
-                tpHistory.push({
+                this.ctx.stage.tp_history.push({
                     times: times, order: audit.order,
                     contract_tp: tpData.contract_tp,
                     qc_tp: tpData.qc_tp,
@@ -308,7 +306,7 @@ module.exports = app => {
                         qc_tp: tpData.qc_tp,
                         yf_tp: yfPay.tp,
                         sf_tp: sfPay.tp,
-                        tp_history: JSON.stringify(tpHistory),
+                        tp_history: JSON.stringify(this.ctx.stage.tp_history),
                         cache_time_r: this.ctx.stage.cache_time_l,
                     });
 
@@ -343,7 +341,7 @@ module.exports = app => {
                         qc_tp: tpData.qc_tp,
                         yf_tp: yfPay.tp,
                         sf_tp: sfPay.tp,
-                        tp_history: JSON.stringify(tpHistory),
+                        tp_history: JSON.stringify(this.ctx.stage.tp_history),
                         cache_time_r: this.ctx.stage.cache_time_l,
                     });
 
@@ -407,8 +405,7 @@ module.exports = app => {
             try {
                 // 计算并合同支付最终数据
                 const [yfPay, sfPay] = await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
-                const tpHistory = this.ctx.stage.tp_history ? JSON.parse(this.ctx.stage.tp_history) : [];
-                tpHistory.push({
+                this.ctx.stage.tp_history.push({
                     times: times + 1, order: 0,
                     contract_tp: tpData.contract_tp,
                     qc_tp: tpData.qc_tp,
@@ -424,7 +421,7 @@ module.exports = app => {
                     times: times + 1,
                     yf_tp: yfPay.tp,
                     sf_tp: sfPay.tp,
-                    tp_history: JSON.stringify(tpHistory),
+                    tp_history: JSON.stringify(this.ctx.stage.tp_history),
                     cache_time_r: this.ctx.stage.cache_time_l,
                 });
                 // 拷贝新一次审核流程列表