Browse Source

新增审批提示

laiguoran 2 năm trước cách đây
mục cha
commit
b3fd146580

+ 9 - 6
app/controller/payment_controller.js

@@ -714,12 +714,15 @@ module.exports = app => {
                     where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                     columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                 });
-                for (const s of trDetailList) {
-                    // s.curAuditor = null;
-                    // 根据期状态返回展示用户
-                    s.curAuditor = await ctx.service.paymentDetailAudit.getAuditorByStatus(s.id, s.status, s.times);
-                    const userInfo = ctx.helper._.find(accountList, { id: s.uid });
-                    s.user_name = userInfo ? userInfo.name : '';
+                if (trDetailList.length > 0) {
+                    for (const s of trDetailList) {
+                        // s.curAuditor = null;
+                        // 根据期状态返回展示用户
+                        s.curAuditor = await ctx.service.paymentDetailAudit.getAuditorByStatus(s.id, s.status, s.times);
+                        const userInfo = ctx.helper._.find(accountList, { id: s.uid });
+                        s.user_name = userInfo ? userInfo.name : '';
+                    }
+                    trDetailList[0].emptySign = await ctx.service.paymentRptAudit.haveEmptySign(trDetailList[0].id);
                 }
                 const renderData = {
                     tender: ctx.tender,

+ 5 - 1
app/public/js/payment_list.js

@@ -136,7 +136,11 @@ $(function () {
             toastr.error('未配置好表单角色无法新建表单');
             $('#set-bdjs').modal('show');
         } else {
-            $('#add-catalogue').modal('show');
+            if (emptySign) {
+                $('#add-tips').modal('show');
+            } else {
+                $('#add-catalogue').modal('show');
+            }
         }
     });
 

+ 5 - 0
app/service/payment_rpt_audit.js

@@ -82,6 +82,11 @@ module.exports = app => {
             }
             return list;
         }
+
+        async haveEmptySign(td_id) {
+            const count = await this.count({ td_id, signature_msg: null });
+            return count > 0;
+        }
     }
 
     return PaymentRptAudit;

+ 1 - 0
app/view/payment/list.ejs

@@ -93,5 +93,6 @@
     let rpt_audit = JSON.parse(unescape('<%- escape(JSON.stringify(trInfo.rpt_audit)) %>'));
     let old_rpt_audit = _.cloneDeep(rpt_audit);
     const is_first = parseInt('<%- trInfo.is_first %>');
+    const emptySign = <%- trDetailList && trDetailList[0] ? trDetailList[0].emptySign : false %>
     console.log(rpt_audit);
 </script>

+ 16 - 0
app/view/payment/list_modal.ejs

@@ -64,6 +64,22 @@
 </div>
 
 <!-- 弹窗新建目录 -->
+<div class="modal fade" id="add-tips" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">新建审批</h5>
+            </div>
+            <div class="modal-body">
+                <h5>第<%= trDetailList && trDetailList[0] ? trDetailList[0].order : 1 %>期存在人员报表未签署,新增期后将无法进行签署,请确认是否新增?</h5>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
+                <a class="btn btn-sm btn-primary" data-dismiss="modal" href="#add-catalogue" data-toggle="modal" data-target="#add-catalogue">确定</a>
+            </div>
+        </div>
+    </div>
+</div>
 <div class="modal fade" id="add-catalogue" data-backdrop="static">
     <div class="modal-dialog" role="document">
         <div class="modal-content">