laiguoran 2 gadi atpakaļ
vecāks
revīzija
324762dda2
1 mainītis faili ar 10 papildinājumiem un 4 dzēšanām
  1. 10 4
      app/service/payment_detail_audit.js

+ 10 - 4
app/service/payment_detail_audit.js

@@ -426,6 +426,7 @@ module.exports = app => {
         async _checkNo(pid, detailId, checkData, times) {
             const time = new Date();
             const detailInfo = await this.ctx.service.paymentDetail.getDataById(detailId);
+            const trInfo = await this.ctx.service.paymentTenderRpt.getDataById(detailInfo.tr_id);
             // 整理当前流程审核人状态更新
             const audit = await this.getDataByCondition({ td_id: detailId, times, status: auditConst.status.checking });
             if (!audit) {
@@ -442,7 +443,7 @@ module.exports = app => {
                 order++;
             }
             // 可能更换了上报人且存在于审批流程中,需要删除
-            const userIndex = this._.findIndex(auditors, { aid: detailInfo.uid });
+            const userIndex = this._.findIndex(auditors, { aid: trInfo.uid });
             if (userIndex !== -1) {
                 auditors.splice(userIndex, 1);
             }
@@ -452,12 +453,17 @@ module.exports = app => {
                 // 清空所有签名数据
                 let report_json = JSON.parse(this.ctx.detail.report_json);
                 report_json = await this.ctx.service.paymentDetail.clearAllSignatureData(report_json);
-                // 同步期信息
-                await transaction.update(this.ctx.service.paymentDetail.tableName, {
+                const detailUpdateData = {
                     id: detailId, status: checkData.checkType,
                     times: times + 1,
                     report_json: JSON.stringify(report_json),
-                });
+                };
+                // 可能存在更换了上报人的情况,需要替换
+                if (detailInfo.uid !== trInfo.uid) {
+                    detailUpdateData.uid = trInfo.uid;
+                }
+                // 同步期信息
+                await transaction.update(this.ctx.service.paymentDetail.tableName, detailUpdateData);
                 // 清空签名
                 await transaction.update(this.ctx.service.paymentRptAudit.tableName, {
                     signature_msg: null,