فهرست منبع

修复资金测试bug

ellisran 7 ماه پیش
والد
کامیت
39eaffbe8b
4فایلهای تغییر یافته به همراه9 افزوده شده و 8 حذف شده
  1. 2 1
      app/controller/financial_controller.js
  2. 3 3
      app/public/js/financial_pay.js
  3. 2 2
      app/view/financial/pay.ejs
  4. 2 2
      app/view/financial/pay_modal.ejs

+ 2 - 1
app/controller/financial_controller.js

@@ -598,6 +598,7 @@ module.exports = app => {
             }
             const fptAudits = await ctx.service.financialPayTenderAudit.getAllDataByCondition({ where: { spid: ctx.subProject.id, uid: ctx.session.sessionUser.accountId } });
             const fptAuditTids = ctx.helper._.map(fptAudits, 'tid');
+            const fptReportTids = ctx.helper._.map(ctx.helper._.filter(fptAudits, { is_report: 1 }), 'tid');
             const filterTids = tid === null ? (ctx.session.sessionUser.is_admin ? null : fptAuditTids) : [tid];
             const tenderCondition = { spid: ctx.subProject.id };
             let hadTender = false;
@@ -625,7 +626,6 @@ module.exports = app => {
             });
             const payTenders = await ctx.service.financialPayTender.getAllDataByCondition({ where: { spid: ctx.subProject.id } });
             for (const t of tenders) {
-                const fptReportTids = ctx.helper._.map(ctx.helper._.filter(fptAudits, { is_report: 1 }), 'tid');
                 const info = await ctx.service.tenderInfo.getDataByCondition({ tid: t.id });
                 t.pay_account = info && info.pay_account ? JSON.parse(info.pay_account).project : '';
                 const pt = ctx.helper._.find(payTenders, { tid: t.id });
@@ -675,6 +675,7 @@ module.exports = app => {
                 used,
                 payList,
                 fptAuditTids,
+                fptReportTids,
                 moment,
                 auditType: auditConst.auditType,
                 preUrl: '/financial',

+ 3 - 3
app/public/js/financial_pay.js

@@ -573,7 +573,7 @@ $(function () {
             if (is_admin) {
                 t = tenders[0];
             } else {
-                const filterTender = tenders.filter(t => _.includes(fptAuditTids, t.id));
+                const filterTender = tenders.filter(t => _.includes(fptReportTids, t.id));
                 if (filterTender.length > 0) {
                     t = filterTender[0];
                 }
@@ -650,7 +650,7 @@ $(function () {
             $('#payaccount input[name="bank_account"]').val(tender.pt.bank_account);
             $('#payaccount input[name="contact"]').val(tender.pt.contact);
             $('#payaccount input[name="phone"]').val(tender.pt.phone);
-            if (is_admin || (fptAuditTids && _.includes(fptAuditTids, tid))) {
+            if (is_admin || (fptReportTids && _.includes(fptReportTids, tid))) {
                 $('#payaccount table input').attr('readonly', false);
                 $('#get-form-tender').show();
                 $('#set-pay-btn').show();
@@ -687,7 +687,7 @@ $(function () {
             toastr.error('标段不存在');
             return;
         }
-        if (is_admin || (fptAuditTids && _.includes(fptAuditTids, tender.id))) {
+        if (is_admin || (fptReportTids && _.includes(fptReportTids, tender.id))) {
             const data = {
                 id: parseInt($('#payaccount input[name="id"]').val()),
                 tid: tender.id,

+ 2 - 2
app/view/financial/pay.ejs

@@ -52,7 +52,7 @@
                 </div>
             </div>
             <div class="d-inline-block ml-auto">
-                <% if (ctx.session.sessionUser.is_admin || fptAuditTids.length > 0) { %>
+                <% if (ctx.session.sessionUser.is_admin || fptReportTids.length > 0) { %>
                 <a href="#add-pay" data-toggle="modal" data-target="#add-pay" class="btn btn-primary btn-sm pull-right">申请支付</a>
                 <% } %>
 <!--                <a href="#batch-sp" data-toggle="modal" data-target="#batch-sp" class="btn btn-success btn-sm pull-right mr-2">批量审批</a>-->
@@ -128,7 +128,7 @@
     const is_admin = <%- ctx.session.sessionUser.is_admin %>;
     const spid = '<%- ctx.subProject.id %>';
     const tenders = JSON.parse(unescape('<%- escape(JSON.stringify(tenders)) %>'));
-    const fptAuditTids = JSON.parse(unescape('<%- escape(JSON.stringify(fptAuditTids)) %>'));
+    const fptReportTids = JSON.parse(unescape('<%- escape(JSON.stringify(fptReportTids)) %>'));
     const auditConst = JSON.parse(unescape('<%- escape(JSON.stringify(auditConst)) %>'));
     const auditType = JSON.parse(unescape('<%- escape(JSON.stringify(auditType)) %>'));
 </script>

+ 2 - 2
app/view/financial/pay_modal.ejs

@@ -1,5 +1,5 @@
 <% include ../shares/delete_hint_modal.ejs %>
-<% if (ctx.session.sessionUser.is_admin || fptAuditTids.length > 0) { %>
+<% if (ctx.session.sessionUser.is_admin || fptReportTids.length > 0) { %>
 <!-- 申请支付 -->
 <div class="modal fade show" id="add-pay" data-backdrop="static">
     <div class="modal-dialog" role="document">
@@ -12,7 +12,7 @@
                     <label>支付标段<strong class="text-danger">*</strong></label>
                     <select class="form-control form-control-sm" id="add-pay-tender">
                         <% for (const t of tenders) { %>
-                        <% if (ctx.session.sessionUser.is_admin || ctx.helper._.includes(fptAuditTids, t.id)) { %>
+                        <% if (ctx.session.sessionUser.is_admin || ctx.helper._.includes(fptReportTids, t.id)) { %>
                             <option value="<%- t.id %>"><%- t.name %></option>
                         <% } %>
                         <% } %>