瀏覽代碼

修复游客bug

laiguoran 4 年之前
父節點
當前提交
1eaee1ca12

+ 0 - 1
app/controller/ledger_controller.js

@@ -145,7 +145,6 @@ module.exports = app => {
                 }
                 const [stdBills, stdChapters] = await this.ctx.service.valuation.getValuationStdList(
                     ctx.tender.data.valuation, ctx.tender.data.measure_type);
-                console.log(tender.data, auditors);
                 const renderData = {
                     tender: tender.data,
                     tenderInfo: tender.info,

+ 11 - 1
app/service/stage.js

@@ -90,6 +90,16 @@ module.exports = app => {
                 } else {
                     stage.curOrder = stage.curAuditor.aid === accountId ? stage.curAuditor.order : stage.curAuditor.order - 1;
                 }
+            } else if (this.ctx.tender.isTourist) { // 游客
+                stage.readOnly = true;
+                stage.curTimes = stage.times;
+                if (stage.status === status.uncheck || stage.status === status.checkNo) {
+                    stage.curOrder = 0;
+                } else if (stage.status === status.checked) {
+                    stage.curOrder = this._.max(this._.map(stage.auditors, 'order'));
+                } else {
+                    stage.curOrder = stage.curAuditor.order;
+                }
             } else if (auditorIds.indexOf(accountId) !== -1) { // 审批人
                 if (stage.status === status.uncheck) {
                     throw '您无权查看该数据';
@@ -257,7 +267,7 @@ module.exports = app => {
             }
             if (stages.length !== 0) {
                 const lastStage = stages[0];
-                if (lastStage.status === auditConst.status.uncheck && !(this.ctx.tender.isTourist || lastStage.user_id === this.ctx.session.sessionUser.accountId)) {
+                if (lastStage.status === auditConst.status.uncheck && lastStage.user_id === this.ctx.session.sessionUser.accountId && !this.ctx.tender.isTourist) {
                     stages.splice(0, 1);
                 }
             }

+ 3 - 1
app/view/material/audit_btn.ejs

@@ -1,7 +1,9 @@
 <div class="contarl-box">
     <% if (ctx.material.status === auditConst.status.uncheck) { %>
-        <% if (ctx.session.sessionUser.accountId === ctx.material.user_id || ctx.tender.isTourist) { %>
+        <% if (ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
             <a id="sub-sp-btn" href="javascript: void(0);" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm btn-block">上报审批</a>
+        <% } else { %>
+            <a id="sub-sp-btn" href="javascript: void(0);" data-toggle="modal" data-target="#sub-sp" class="btn btn-outline-secondary btn-sm btn-block">上报中</a>
         <% } %>
     <% } else if (ctx.material.status === auditConst.status.checking) { %>
         <% if (ctx.material.curAuditor && ctx.material.curAuditor.aid === ctx.session.sessionUser.accountId) { %>

+ 1 - 1
app/view/material/audit_modal.ejs

@@ -46,7 +46,7 @@
                         <% for (let i = 0, iLen = ctx.material.auditorList.length; i < iLen; i++) { %>
                         <li class="list-group-item" auditorId="<%- ctx.material.auditorList[i].aid %>">
                             <% if ((ctx.tender.info.shenpi.material === shenpiConst.sp_status.sqspr ||
-                                    (ctx.tender.info.shenpi.material === shenpiConst.sp_status.gdzs && i+1 !== iLen)) && ctx.session.sessionUser.accountId === ctx.material.user_id) { %>
+                                    (ctx.tender.info.shenpi.material === shenpiConst.sp_status.gdzs && i+1 !== iLen)) && ctx.session.sessionUser.accountId === ctx.material.user_id && !ctx.tender.isTourist) { %>
                             <a href="javascript: void(0)" class="text-danger pull-right">移除</a>
                             <% } %>
                             <span><%- ctx.material.auditorList[i].order %> <%- ctx.material.auditorList[i].name %></span>

+ 4 - 0
app/view/stage/audit_btn.ejs

@@ -1,6 +1,10 @@
 <div class="contarl-box">
     <% if (ctx.stage.status === auditConst.status.uncheck) { %>
+    <% if (ctx.session.sessionUser.accountId === ctx.stage.user_id) { %>
     <a id="sub-sp-btn" href="javascript: void(0);" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm btn-block">上报审批</a>
+    <% } else { %>
+    <a id="sub-sp-btn" href="javascript: void(0);" data-toggle="modal" data-target="#sub-sp" class="btn btn-outline-secondary btn-sm btn-block">上报中</a>
+    <% } %>
     <% } else if (ctx.stage.status === auditConst.status.checking) { %>
         <% if (ctx.stage.curAuditor && ctx.stage.curAuditor.aid === ctx.session.sessionUser.accountId) { %>
             <a id="sp-done-btn" href="javascript: void(0);" data-toggle="modal" data-target="#sp-done" class="btn btn-success btn-sm btn-block">审批通过</a>

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

@@ -46,7 +46,7 @@
                                 <% for (let i = 0, iLen = ctx.stage.auditorList.length; i < iLen; i++) { %>
                                 <li class="list-group-item" auditorId="<%- ctx.stage.auditorList[i].aid %>">
                                     <% if (ctx.tender.info.shenpi.stage === shenpiConst.sp_status.sqspr ||
-                                            (ctx.tender.info.shenpi.stage === shenpiConst.sp_status.gdzs && i+1 !== iLen) && ctx.session.sessionUser.accountId === ctx.stage.user_id) { %>
+                                            (ctx.tender.info.shenpi.stage === shenpiConst.sp_status.gdzs && i+1 !== iLen) && ctx.session.sessionUser.accountId === ctx.stage.user_id && !ctx.tender.isTourist) { %>
                                     <a href="javascript: void(0)" class="text-danger pull-right">移除</a>
                                     <% } %>
                                     <span><%- ctx.stage.auditorList[i].order %> <%- ctx.stage.auditorList[i].name %></span>