Parcourir la source

1. 删除本次审批相关
2. 审批管理页面问题

MaiXinRong il y a 1 an
Parent
commit
1796f05a13
3 fichiers modifiés avec 38 ajouts et 1 suppressions
  1. 1 1
      app/controller/stage_controller.js
  2. 1 0
      app/service/stage_audit.js
  3. 36 0
      app/service/tender_cache.js

+ 1 - 1
app/controller/stage_controller.js

@@ -2029,7 +2029,7 @@ module.exports = app => {
                     auditList = await ctx.service.stageAudit.getAuditorHistory(lastStage.id, times, true);
                 }
                 renderData.lastStage = lastStage;
-                renderData.lastAuditList = auditList;
+                renderData.lastAuditList = auditList.reverse();
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.manager);
                 await this.layout('stage/manager.ejs', renderData, 'stage/manager_modal.ejs');
             } catch (err) {

+ 1 - 0
app/service/stage_audit.js

@@ -1803,6 +1803,7 @@ module.exports = app => {
                 });
                 // 同步 期信息
                 const time = new Date();
+                await this.ctx.service.tenderCache.updateStageCache4DelTimes(transaction, this.ctx.stage, nowTimes);
                 await transaction.update(this.ctx.service.stage.tableName, {
                     id: this.ctx.stage.id,
                     status: auditConst.status.checkNo,

+ 36 - 0
app/service/tender_cache.js

@@ -188,6 +188,42 @@ module.exports = app => {
             }
         }
 
+        async updateStageCache4DelTimes(transaction, stage, times) {
+            const data = { id: stage.tid };
+            const tp = {
+                contract_tp: stage.contract_tp || 0, qc_tp: stage.qc_tp || 0, contract_pc_tp: stage.contract_pc_tp, qc_pc_tp: stage.qc_pc_tp, pc_tp: stage.pc_tp,
+                positive_qc_tp: stage.positive_qc_tp, positive_qc_pc_tp: stage.positive_qc_pc_tp, negative_qc_tp: stage.negative_qc_pc_tp, negative_qc_pc_tp: stage.negative_qc_pc_tp,
+                yf_tp: stage.yf_tp, sf_tp: stage.sf_tp,
+                pre_contract_tp: stage.pre_contract_tp, pre_qc_tp: stage.pre_qc_tp,
+                pre_positive_qc_tp: stage.pre_positive_qc_tp, pre_negative_qc_tp: stage.pre_positive_qc_tp,
+                pre_yf_tp: stage.pre_yf_tp, pre_sf_tp: stage.pre_sf_tp,
+            };
+            data.stage_flow_cur_uid = stage.user_id;
+            const curInfo = await this.ctx.service.projectAccount.getAccountCacheData(stage.user_id,
+                { order: stage.order, audit_order: 0, audit_type: auditConst.auditType.key.common, status: auditConst.stage.status.uncheck });
+            data.stage_flow_cur_info = JSON.stringify(curInfo);
+            const preAuditors = await this.ctx.service.stageAudit.getLastestAuditors(stage.id, times, auditConst.stage.status.checkNo);
+            const preAuditorIds = preAuditors.map(x => { return x.aid; });
+            data.stage_flow_pre_uid = preAuditorIds.join(',');
+            data.stage_flow_pre_info = preAuditors.length > 0 ? JSON.stringify(preAuditors.map(preAuditor => { return {
+                order: stage.order, audit_type: preAuditor.audit_type, audit_order: preAuditor.order, status: preAuditor.status, time: preAuditor.end_time,
+                name: preAuditor.name, company: preAuditor.company, role: preAuditor.role, mobile: preAuditor.mobile, telephone: preAuditor.telephone,
+            }})) : '';
+            const his = stage.tp_history.find(x => { return x.times === times && x.order === preAuditors[0].order; });
+            if (his) {
+                tp.contract_tp = his.contract_tp;
+                tp.qc_tp = his.qc_tp;
+                tp.positive_qc_tp = his.positive_qc_tp;
+                tp.negative_qc_tp = his.negative_qc_tp;
+                tp.yf_tp = his.yf_tp;
+                tp.sf_tp = his.sf_tp;
+            }
+
+            data.stage_flow_cur_tp = JSON.stringify(tp);
+            data.stage_flow_pre_tp = JSON.stringify(tp);
+            await transaction.update(this.tableName, data);
+        }
+
         async updateStageCache4Start(transaction, stage, status, auditors, ledgerTp, stageTp) {
             const orgCache = await this.getDataById(stage.tid);
             const data = { id: stage.tid, stage_status: status };