Browse Source

期计量,缓存审批进度列值

MaiXinRong 1 year ago
parent
commit
6c45f58c74
3 changed files with 24 additions and 9 deletions
  1. 12 4
      app/controller/measure_controller.js
  2. 9 5
      app/view/measure/stage.ejs
  3. 3 0
      sql/update.sql

+ 12 - 4
app/controller/measure_controller.js

@@ -49,10 +49,18 @@ module.exports = app => {
                 };
                 renderData.stages = await ctx.service.stage.getValidStages(ctx.tender.id, this.ctx.session.sessionUser.is_admin);
                 for (const s of renderData.stages) {
-                    // 根据期状态返回展示用户
-                    s.curAuditors = await ctx.service.stageAudit.getAuditorsByStatus(s.id, s.status, s.times);
-                    if (s.status === auditConst.status.checkNoPre) {
-                        s.curAuditors2 = await ctx.service.stageAudit.getAuditorsByStatus(s.id, auditConst.status.checking, s.times);
+                    if (!s.final_auditor_str || s.status !== auditConst.status.checked) {
+                        // 根据期状态返回展示用户
+                        s.curAuditors = await ctx.service.stageAudit.getAuditorsByStatus(s.id, s.status, s.times);
+                        if (s.status === auditConst.status.checkNoPre) {
+                            s.curAuditors2 = await ctx.service.stageAudit.getAuditorsByStatus(s.id, auditConst.status.checking, s.times);
+                        }
+                        if (s.status === auditConst.status.checked) {
+                            const final_auditor_str = (s.curAuditors[0].audit_type === auditType.key.common)
+                                ? `${s.curAuditors[0].name}${(s.curAuditors[0].role ? '-' + s.curAuditors[0].role : '')}`
+                                : ctx.helper.transFormToChinese(s.curAuditors[0].audit_order) + '审';
+                            await ctx.service.stage.defaultUpdate({ id: s.id, final_auditor_str});
+                        }
                     }
                 }
                 renderData.unCompleteStageCount = renderData.stages.filter(s => { return s.status !== auditConst.status.checked; }).length;

+ 9 - 5
app/view/measure/stage.ejs

@@ -86,12 +86,16 @@
                         <td class="text-right"><%- (s.sf_tp ? s.sf_tp : '') %></td>
                         <% } %>
                         <td class="<%- auditConst.auditProgressClass[s.status] %>">
-                            <% if (s.curAuditors.length > 0) { %>
-                            <% if (s.curAuditors[0].audit_type === auditType.key.common) { %>
-                            <a href="#sp-list" data-toggle="modal" data-target="#sp-list" s-order="<%- s.order %>"><%- s.curAuditors[0].name %><%if (s.curAuditors[0].role !== '' && s.curAuditors[0].role !== null) { %>-<%- s.curAuditors[0].role %><% } %></a>
+                            <% if (s.status === auditConst.status.checked && s.final_auditor_str) { %>
+                                <a href="#sp-list" data-toggle="modal" data-target="#sp-list" s-order="<%- s.order %>"><%- s.final_auditor_str %></a>
                             <% } else { %>
-                            <a href="#sp-list" data-toggle="modal" data-target="#sp-list" s-order="<%- s.order %>"><%- ctx.helper.transFormToChinese(s.curAuditors[0].audit_order) + '审' %></a>
-                            <% } %>
+                                <% if (s.curAuditors.length > 0) { %>
+                                    <% if (s.curAuditors[0].audit_type === auditType.key.common) { %>
+                                        <a href="#sp-list" data-toggle="modal" data-target="#sp-list" s-order="<%- s.order %>"><%- s.curAuditors[0].name %><%if (s.curAuditors[0].role !== '' && s.curAuditors[0].role !== null) { %>-<%- s.curAuditors[0].role %><% } %></a>
+                                    <% } else { %>
+                                        <a href="#sp-list" data-toggle="modal" data-target="#sp-list" s-order="<%- s.order %>"><%- ctx.helper.transFormToChinese(s.curAuditors[0].audit_order) + '审' %></a>
+                                    <% } %>
+                                <% } %>
                             <% } %>
                             <%- auditConst.auditProgress[s.status] %>
                         </td>

+ 3 - 0
sql/update.sql

@@ -14,3 +14,6 @@ ADD COLUMN `sp_group` int(11) NULL DEFAULT 0 COMMENT '审批组id' AFTER `audit_
 
 ALTER TABLE `zh_change`
 ADD COLUMN `sp_group` int(11) NULL DEFAULT 0 COMMENT '固定审批组id' AFTER `delimit`;
+
+ALTER TABLE `calculation`.`zh_stage`
+ADD COLUMN `final_auditor_str` varchar(50) NOT NULL DEFAULT '' COMMENT '终审人相关' AFTER `pre_negative_qc_tp`;