소스 검색

非标段创建人新增变更令功能

ellisran 9 달 전
부모
커밋
063db49c86

+ 7 - 0
app/controller/change_controller.js

@@ -78,6 +78,8 @@ module.exports = app => {
                             await ctx.service.change.defaultUpdate({ final_auditor_str }, { where: { cid: c.cid } });
                         }
                     }
+                    const user = await ctx.service.projectAccount.getDataById(c.uid);
+                    c.username = user ? user.name : '';
                     page_total = ctx.helper.add(page_total, c.total_price);
                 }
             }
@@ -133,6 +135,10 @@ module.exports = app => {
             const apLists = allPlanCodes.length > 0 ? ctx.app._.uniq(ctx.app._.map(allPlanCodes, 'plan_code')) : [];
             const need_checking = await ctx.service.change.getCheckingList(ctx.tender.id, ctx.session.sessionUser.accountId, true);
 
+            const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
+            const userPermission = pa && pa.permission ? JSON.parse(pa.permission) : null;
+            const addPermission = !!(userPermission && userPermission.change !== undefined && userPermission.change.indexOf('3') !== -1);
+
             const renderData = {
                 moment,
                 tender,
@@ -159,6 +165,7 @@ module.exports = app => {
                 auditType,
                 precision: ctx.tender.info.precision,
                 need_checking,
+                addPermission,
             };
 
             if (ctx.session.sessionProject.page_show.openChangeState) {

+ 1 - 0
app/public/js/change.js

@@ -153,6 +153,7 @@ const getAuditTypeText = function (type) {
 };
 $(document).ready(() => {
     if (openChangePlan) {
+        console.log(getLocalCache('change_add_plan_list'));
         $('#add_plan_list').prop('checked', getLocalCache('change_add_plan_list'));
     }
     // 获取审批流程

+ 4 - 1
app/public/js/change_information_approval.js

@@ -63,8 +63,11 @@ $(document).ready(() => {
     };
     for (const aid of aidList) {
         // const userinfo = _.find(auditList2, { 'uid': aid });
+        const audit = _.find(auditors2, function(item){
+            return _.findIndex(item, { audit_order: aid }) !== -1;
+        });
         const newColcount = {
-            title: (auditors2[aid - 1] && auditors2[aid - 1].length > 1 ? (aid + '审') : auditors2[aid - 1][0].name) + ' 审批|数量',
+            title: (audit && audit.length > 1 ? (aid + '审') : audit[0].name) + ' 审批|数量',
             colSpan: '2|1', rowSpan: '1|1',
             field: 'audit_amount_' + aid,
             hAlign: 2, width: 60, type: 'Number', readOnly: _.findIndex(auditors2[aid - 1], { uid: parseInt(accountId) }) === -1 ? true : 'readOnly.isSettle' ,

+ 4 - 1
app/public/js/change_information_show.js

@@ -56,8 +56,11 @@ $(document).ready(() => {
     };
     for (const aid of aidList) {
         // const userinfo = _.find(auditList2, { 'uid': aid });
+        const audit = _.find(auditors2, function(item){
+            return _.findIndex(item, { audit_order: aid }) !== -1;
+        });
         const newColcount = {
-            title: (auditors2[aid - 1] && auditors2[aid - 1].length > 1 ? (aid + '审') : auditors2[aid - 1][0].name) + ' 审批|数量',
+            title: (audit && audit.length > 1 ? (aid + '审') : audit[0].name) + ' 审批|数量',
             colSpan: '2|1', rowSpan: '1|1',
             field: 'audit_amount_' + aid,
             hAlign: 2, width: 60, type: 'Number',

+ 5 - 4
app/view/change/index.ejs

@@ -69,7 +69,7 @@
                 </div>
             </div>
             <div class="ml-auto">
-                <% if (tender.user_id === ctx.session.sessionUser.accountId) { %>
+                <% if (tender.user_id === ctx.session.sessionUser.accountId || addPermission) { %>
                     <a href="#add-bj" data-toggle="modal" data-target="#add-bj" class="btn btn-sm btn-primary pull-right ml-1">新建变更令</a>
                     <a href="#setting" data-toggle="modal" data-target="#setting" class="btn btn-sm btn-outline-primary pull-right ml-2"><i class="fa fa-cog"></i></a>
                     <a href="#batch-sb" data-toggle="modal" data-target="#batch-sb" class="btn btn-sm btn-primary pull-right ml-2">批量上报</a>
@@ -89,11 +89,11 @@
                 <table class="table table-bordered" id="change-table">
                     <thead class="text-center">
                     <tr><th width="3%">序号</th>
-                        <th width="18%" id="sort_change">申请编号/变更令号</th><th width="24%">变更工程名称</th>
+                        <th width="16%" id="sort_change">申请编号/变更令号</th><th width="22%">变更工程名称</th>
                         <th width="7%">变更性质</th><% if (ctx.session.sessionProject.page_show.openChangeState) { %><th width="7%">变更令状态</th><% } %>
                         <th width="7%">变更金额</th><th width="7%">计价金额</th>
-                        <th width="7%">不计价金额</th><th width="7%">审批状态</th>
-                        <th width="14%">审批进度</th><th width="4%">操作</th>
+                        <th width="7%">不计价金额</th><th width="6%">创建人</th><th width="7%">审批状态</th>
+                        <th width="12%">审批进度</th><th width="4%">操作</th>
                     </tr>
                     </thead>
                     <tbody id="changeList">
@@ -115,6 +115,7 @@
                         <td style="text-align: right"><%= ctx.helper.roundNum(c.total_price, tpUnit) %></td>
                         <td style="text-align: right"><%= ctx.helper.roundNum(c.valuation_tp, tpUnit) %></td>
                         <td style="text-align: right"><%= ctx.helper.roundNum(c.unvaluation_tp, tpUnit) %></td>
+                        <td style="text-align: center"><%- c.username %></td>
                         <td class="text-center">
                             <% if (c.status === auditConst.status.uncheck && c.uid === ctx.session.sessionUser.accountId) { %>
                                 <a href="<%- '/tender/' + ctx.tender.id + '/change/' + c.cid %>/information" class="btn <%- auditConst.statusButtonClass[c.status] %> btn-sm"><%- auditConst.statusButton[c.status] %></a>

+ 1 - 1
app/view/change/modal.ejs

@@ -42,7 +42,7 @@
         </div>
     </div>
 </div>
-<% if (tender.user_id === ctx.session.sessionUser.accountId) { %>
+<% if (tender.user_id === ctx.session.sessionUser.accountId || addPermission) { %>
 <!--弹出添加变更令-->
 <div class="modal fade" id="add-bj-modal" data-backdrop="static">
     <div class="modal-dialog" role="document">