Переглянути джерело

添加、移除审批人相关

MaiXinRong 7 місяців тому
батько
коміт
1ca06b3f96

+ 37 - 37
app/public/js/shares/phase_pay_audit.js

@@ -106,45 +106,45 @@ $(document).ready(function () {
     // 添加到审批流程
     $('#book-list').on('click', 'dd', function () {
         const id = parseInt($(this).data('id'));
-        if (id !== 0) {
-            postData('audit/add', { auditorId: id }, (datas) => {
-                const html = [];
-                // 如果是重新上报,添加到重新上报列表中
-                const auditorshtml = [];
-                for (const [index, data] of datas.entries()) {
-                    if (index !== 0) {
-                        html.push('<li class="list-group-item d-flex" auditorId="'+ data[0].audit_id +'">');
-                        html.push(`<div class="col-auto">${index}</div>`);
-                        html.push('<div class="col">');
-                        for (const auditor of data) {
-                            html.push(`<div class="d-inline-block mx-1"><i class="fa fa-user text-muted"></i> ${auditor.name} <small class="text-muted">${auditor.role}</small></div>`);
-                        }
-                        html.push('</div>');
-                        html.push('<div class="col-auto">');
-                        // todo 添加会签或签时
-                        // html.push('<span class="badge badge-pill badge-primary badge-bg-small"><small></small></span>');
-                        if (shenpi_status === shenpiConst.sp_status.sqspr || (shenpi_status === shenpiConst.sp_status.gdzs && index+1 !== datas.length)) {
-                            html.push('<a href="javascript: void(0)" class="text-danger pull-right">移除</a>');
-                        }
-                        html.push('</div>');
-                        html.push('</li>');
+        if (!id) return;
+
+        postData('audit/add', { auditorId: id }, (datas) => {
+            const html = [];
+            // 如果是重新上报,添加到重新上报列表中
+            const auditorshtml = [];
+            for (const [index, data] of datas.entries()) {
+                if (index !== 0) {
+                    html.push('<li class="list-group-item d-flex" auditorId="'+ data[0].audit_id +'">');
+                    html.push(`<div class="col-auto">${index}</div>`);
+                    html.push('<div class="col">');
+                    for (const auditor of data) {
+                        html.push(`<div class="d-inline-block mx-1"><i class="fa fa-user text-muted"></i> ${auditor.name} <small class="text-muted">${auditor.role}</small></div>`);
                     }
-                    auditorshtml.push('<li class="list-group-item" data-auditorid="' + data.audit_id + '">');
-                    auditorshtml.push('<i class="fa ' + (index+1 === datas.length ? 'fa-stop-circle' : 'fa-chevron-circle-down') + '"></i> ');
-                    auditorshtml.push(data.name + ' <small class="text-muted">' + data.role + '</small>');
-                    if (index === 0) {
-                        auditorshtml.push('<span class="pull-right">原报</span>');
-                    } else if (index+1 === datas.length) {
-                        auditorshtml.push('<span class="pull-right">终审</span>');
-                    } else {
-                        auditorshtml.push('<span class="pull-right">'+ transFormToChinese(index) +'审</span>');
+                    html.push('</div>');
+                    html.push('<div class="col-auto">');
+                    if (data[0].audit_type !== auditType.key.common)
+                        html.push(`<span class="badge badge-pill badge-${auditType.info[data[0].audit_type].class} p-1"><small>${auditType.info[data[0].audit_type].long}</small></span>`);
+                    if (shenpi_status === shenpiConst.sp_status.sqspr || (shenpi_status === shenpiConst.sp_status.gdzs && index+1 !== datas.length)) {
+                        html.push('<a href="javascript: void(0)" class="text-danger pull-right">移除</a>');
                     }
-                    auditorshtml.push('</li>');
+                    html.push('</div>');
+                    html.push('</li>');
                 }
-                $('#auditors').html(html.join(''));
-                $('#auditors-list').html(auditorshtml.join(''));
-            });
-        }
+                auditorshtml.push('<li class="list-group-item" data-auditorid="' + data.audit_id + '">');
+                auditorshtml.push('<i class="fa ' + (index+1 === datas.length ? 'fa-stop-circle' : 'fa-chevron-circle-down') + '"></i> ');
+                auditorshtml.push(data.name + ' <small class="text-muted">' + data.role + '</small>');
+                if (index === 0) {
+                    auditorshtml.push('<span class="pull-right">原报</span>');
+                } else if (index+1 === datas.length) {
+                    auditorshtml.push('<span class="pull-right">终审</span>');
+                } else {
+                    auditorshtml.push('<span class="pull-right">'+ transFormToChinese(index) +'审</span>');
+                }
+                auditorshtml.push('</li>');
+            }
+            $('#auditors').html(html.join(''));
+            $('#auditors-list').html(auditorshtml.join(''));
+        });
     });
     // 删除审批人
     $('body').on('click', '#auditors li a', function () {
@@ -156,7 +156,7 @@ $(document).ready(function () {
             li.remove();
             for (const rst of result) {
                 const aLi = $('li[auditorId=' + rst.audit_id + ']');
-                $('span', aLi).text(rst.order + ' ' + rst.name + ' ');
+                $('div:first', aLi).text(rst.order);
             }
 
             // 如果是重新上报

+ 1 - 0
app/view/phase_pay/audit_modal.ejs

@@ -795,6 +795,7 @@
     const shenpi_status = <%- ctx.tender.info.shenpi.phasePay %>;
     const shenpiConst =  JSON.parse('<%- JSON.stringify(shenpiConst) %>');
     const phaseUserId = parseInt('<%= ctx.phasePay.create_user_id %>');
+    const auditType = JSON.parse(unescape('<%- escape(JSON.stringify(auditType)) %>'));
 </script>
 <script>
     $('[name=phase-start]').submit(function (e) {