Browse Source

fix: 报表页面显示bug

lanjianrong 4 years ago
parent
commit
ff1cd89fdd
3 changed files with 12 additions and 10 deletions
  1. 1 0
      app/controller/report_controller.js
  2. 10 10
      app/view/stage/audit_modal.ejs
  3. 1 0
      config/web.js

+ 1 - 0
app/controller/report_controller.js

@@ -31,6 +31,7 @@ module.exports = app => {
          * @private
          */
         async _getStageAuditViewData(ctx) {
+            if (!ctx.stage) return;
             const times = ctx.stage.status === auditConst.stage.status.checkNo ? ctx.stage.times - 1 : ctx.stage.times;
 
             ctx.stage.user = await ctx.service.projectAccount.getAccountInfoById(ctx.stage.user_id);

+ 10 - 10
app/view/stage/audit_modal.ejs

@@ -1,4 +1,4 @@
-<% if (ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo) { %>
+<% if (ctx.stage && (ctx.stage.status === auditConst.status.uncheck || ctx.stage.status === auditConst.status.checkNo)) { %>
     <% if (ctx.session.sessionUser.accountId === ctx.stage.user_id) {%>
         <!--上报审批-->
         <div class="modal fade" id="sub-sp" data-backdrop="static">
@@ -75,7 +75,7 @@
         </div>
     <% } %>
 <% } %>
-<% if (ctx.stage.status === auditConst.status.checking) { %>
+<% if (ctx.stage && (ctx.stage.status === auditConst.status.checking)) { %>
     <% if (ctx.stage.curAuditor && ctx.stage.curAuditor.aid === ctx.session.sessionUser.accountId) { %>
         <!--审批通过-->
         <div class="modal fade sp-location-list" id="sp-done" data-backdrop="static">
@@ -565,7 +565,7 @@
             </div>
         </div>
     <% } %>
-<% } else if (ctx.stage.status === auditConst.status.checked) { %>
+<% } else if (ctx.stage && (ctx.stage.status === auditConst.status.checked)) { %>
     <!--审批流程/结果-->
     <div class="modal fade" id="sp-list" data-backdrop="static">
         <div class="modal-dialog modal-lg" role="document">
@@ -718,7 +718,7 @@
             </div>
         </div>
     </div>
-<% } else if (ctx.stage.status === auditConst.status.checkNo) { %>
+<% } else if (ctx.stage && (ctx.stage.status === auditConst.status.checkNo)) { %>
     <!--审批流程/结果-->
     <div class="modal fade" id="sp-list" data-backdrop="static">
         <div class="modal-dialog modal-lg" role="document">
@@ -948,7 +948,7 @@
             </div>
         </div>
     <% } %>
-<% } else if (ctx.stage.status === auditConst.status.checkNoPre) { %>
+<% } else if (ctx.stage && (ctx.stage.status === auditConst.status.checkNoPre)) { %>
     <!--审批流程/结果-->
     <div class="modal fade" id="sp-list" data-backdrop="static">
         <div class="modal-dialog modal-lg" role="document">
@@ -1435,7 +1435,7 @@
         </div>
     <% } %>
 <% } %>
-<% if (ctx.stage.auditors !== undefined && ctx.stage.auditors.length !== 0 && ctx.stage.auditors[ctx.stage.auditors.length-1].aid === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) { %>
+<% if (ctx.stage && ctx.stage.auditors !== undefined && ctx.stage.auditors.length !== 0 && ctx.stage.auditors[ctx.stage.auditors.length-1].aid === ctx.session.sessionUser.accountId && ctx.stage.status === auditConst.status.checked && ctx.stage.order === ctx.stage.highOrder) { %>
     <% if (ctx.stage.hadMaterial) { %>
     <div class="modal fade" id="sp-down-back" data-backdrop="static">
         <div class="modal-dialog" role="document">
@@ -1452,7 +1452,7 @@
             </div>
         </div>
     </div>
-    <% } else if (!authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
+    <% } else if (ctx.stage && !authMobile && ctx.session.sessionUser.loginStatus === 0) { %>
         <!--终审重新审批-->
         <div class="modal fade" id="sp-down-back" data-backdrop="static">
             <div class="modal-dialog" role="document">
@@ -1471,7 +1471,7 @@
                 </div>
             </div>
         </div>
-    <% } else { %>
+    <% } else if(ctx.stage) { %>
     <div class="modal fade" id="sp-down-back" data-backdrop="static">
         <div class="modal-dialog" role="document">
             <div class="modal-content">
@@ -1502,7 +1502,7 @@
     </div>
     <% } %>
 <% } %>
-<% if (ctx.stage.user_id === ctx.session.sessionUser.accountId && ctx.stage.order === ctx.stage.highOrder && (ctx.stage.status === auditConst.status.checkNo || ctx.stage.status === auditConst.status.uncheck)) { %>
+<% if (ctx.stage && ctx.stage.user_id === ctx.session.sessionUser.accountId && ctx.stage.order === ctx.stage.highOrder && (ctx.stage.status === auditConst.status.checkNo || ctx.stage.status === auditConst.status.uncheck)) { %>
     <!--删除期-->
     <% if (ctx.stage.hadMaterial) { %>
         <div class="modal fade" id="del-qi" data-backdrop="static">
@@ -1548,7 +1548,7 @@
     const authMobile = '<%= authMobile %>';
 </script>
 <script>
-    <% if (ctx.url !== '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.stage.order) { %>
+    <% if (ctx.stage && ctx.url !== '/tender/' + ctx.tender.id + '/measure/stage/' + ctx.stage.order) { %>
     const dataChecker = DataChecker({
         checkUrl: '/tender/<%- ctx.tender.id %>/measure/stage/<%- ctx.stage.order %>/check',
         errorList: $.cs_errorList({

+ 1 - 0
config/web.js

@@ -657,6 +657,7 @@ const JsFiles = {
                     '/public/js/spreadjs_rela/spreadjs_zh.js',
                     '/public/js/shares/tenders2tree.js',
                     '/public/report/js/rpt_custom.js',
+                    '/public/js/stage_audit.js',
                 ],
                 mergeFile: 'report_main',
             },