Browse Source

标段列表增加审批流程展示,修改文字

laiguoran 2 years ago
parent
commit
3108a57637

+ 7 - 0
app/controller/tender_controller.js

@@ -50,12 +50,14 @@ module.exports = app => {
             };
             if (tender.ledger_status === auditConst.ledger.status.uncheck) {
                 tender.cur_flow.name = tender.user_name;
+                tender.cur_flow.role = tender.user_role;
             } else {
                 const cur = tender.ledger_status === auditConst.ledger.status.checkNo
                     ? await this.ctx.service.ledgerAudit.getLastestAuditor(tender.id, tender.ledger_times - 1, auditConst.ledger.status.checkNo)
                     : await this.ctx.service.ledgerAudit.getLastestAuditor(tender.id, tender.ledger_times, tender.ledger_status);
                 if (cur) {
                     tender.cur_flow.name = cur.name;
+                    tender.cur_flow.role = cur.role;
                     if (cur.audit_order === 1) {
                         tender.pre_flow = { name: tender.user_name, time: cur.begin_time };
                     } else {
@@ -64,6 +66,7 @@ module.exports = app => {
                     }
                 } else {
                     tender.cur_flow.name = '';
+                    tender.cur_flow.role = '';
                 }
             }
         }
@@ -77,9 +80,11 @@ module.exports = app => {
             if (stage.status === auditConst.stage.status.uncheck) {
                 if (tender.user_id === stage.user_id) {
                     tender.cur_flow.name = tender.user_name;
+                    tender.cur_flow.role = tender.user_role;
                 } else {
                     const user = await this.ctx.service.projectAccount.getDataById(stage.user_id);
                     tender.cur_flow.name = user.name;
+                    tender.cur_flow.role = user.role;
                 }
                 if (stage.order > 1) {
                     const preStage = await this.ctx.service.stage.getDataByCondition({ tid: tender.id, order: stage.order - 1 });
@@ -99,6 +104,7 @@ module.exports = app => {
                 }
                 if (cur) {
                     tender.cur_flow.name = cur.name;
+                    tender.cur_flow.role = cur.role;
                     if (cur.order === 1) {
                         tender.pre_flow = {};
                         if (tender.user_id === stage.user_id) {
@@ -114,6 +120,7 @@ module.exports = app => {
                     }
                 } else {
                     tender.cur_flow.name = '';
+                    tender.cur_flow.role = '';
                 }
             }
         }

+ 8 - 2
app/public/js/tender_list_info.js

@@ -302,7 +302,7 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
     const html = [];
     html.push('<tr pid="' + pid + '">');
     // 名称
-    html.push('<td style="width: 14%" class="in-' + node.level + '">');
+    html.push('<td style="width: 10%" class="in-' + node.level + '">');
     if (node.cid) {
         html.push('<span onselectstart="return false" style="{-moz-user-select:none}" class="fold-switch mr-1" title="收起" cid="'+ node.sort_id +'"><i class="fa fa-minus-square-o"></i></span> <i class="fa fa-folder-o"></i> ', node.name);
     } else {
@@ -328,7 +328,13 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
     // 当前流程
     html.push('<td style="width: 6%">');
     if (!node.cid && node.cur_flow) {
-        html.push(node.cur_flow.name + ' ' + '<span class="' + node.cur_flow.status_class +'">' + node.cur_flow.status + '</span>');
+        html.push((node.lastStage && node.lastStage.status === auditConst.stage.status.uncheck) || (!node.lastStage && node.ledger_status === auditConst.ledger.status.uncheck ) ? '' :
+            '<a href="#sp-list" data-toggle="modal" data-target="#sp-list"  data-type="'+ (node.lastStage ? 'stage' : 'ledger') +'"' +
+            ' data-tender="'+ node.id +'" data-order="'+ (node.lastStage ? node.lastStage.order : '') +'">');
+        html.push(node.cur_flow.name+ (node.cur_flow.role ? '-'+node.cur_flow.role  : ''));
+        html.push((node.lastStage && node.lastStage.status === auditConst.stage.status.uncheck) || (!node.lastStage && node.ledger_status === auditConst.ledger.status.uncheck ) ? ' ':
+                '</a> ');
+        html.push('<span class="' + node.cur_flow.status_class +'">' + node.cur_flow.status + '</span>');
     }
     html.push('</td>');
     // 上一流程审批时间

+ 9 - 3
app/public/js/tender_list_progress.js

@@ -312,7 +312,7 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
     const html = [];
     html.push('<tr pid="' + pid + '">');
     // 名称
-    html.push('<td width="25%" class="in-' + node.level + '">');
+    html.push('<td width="20%" class="in-' + node.level + '">');
     if (node.cid) {
         html.push('<span onselectstart="return false" style="{-moz-user-select:none}" class="fold-switch mr-1" title="收起" cid="'+ node.sort_id +'"><i class="fa fa-minus-square-o"></i></span> <i class="fa fa-folder-o"></i> ', node.name);
     } else {
@@ -330,9 +330,15 @@ function recursiveGetTenderNodeHtml (node, arr, pid) {
     }
     html.push('</td>');
     // 当前流程
-    html.push('<td style="width: 8%">');
+    html.push('<td style="width: 13%">');
     if (!node.cid && node.cur_flow) {
-        html.push(node.cur_flow.name + ' ' + '<span class="' + node.cur_flow.status_class +'">' + node.cur_flow.status + '</span>');
+        html.push((node.lastStage && node.lastStage.status === auditConst.stage.status.uncheck) || (!node.lastStage && node.ledger_status === auditConst.ledger.status.uncheck ) ? '' :
+            '<a href="#sp-list" data-toggle="modal" data-target="#sp-list"  data-type="'+ (node.lastStage ? 'stage' : 'ledger') +'"' +
+            ' data-tender="'+ node.id +'" data-order="'+ (node.lastStage ? node.lastStage.order : '') +'">');
+        html.push(node.cur_flow.name+ (node.cur_flow.role ? '-'+node.cur_flow.role  : ''));
+        html.push((node.lastStage && node.lastStage.status === auditConst.stage.status.uncheck) || (!node.lastStage && node.ledger_status === auditConst.ledger.status.uncheck ) ? ' ':
+            '</a> ');
+        html.push('<span class="' + node.cur_flow.status_class +'">' + node.cur_flow.status + '</span>');
     }
     html.push('</td>');
     // 上一流程审批时间

+ 1 - 1
app/service/material_stage.js

@@ -31,7 +31,7 @@ module.exports = app => {
                 m_tp: tp.total_price,
                 m_tax_tp: tp.tax_total_price,
             };
-            return await transaction.update(this.ctx.service.materialStage.tableName, updateData2);
+            return await transaction.update(this.tableName, updateData2);
         }
     }
     return MaterialStage;

+ 1 - 1
app/view/setting/fun.ejs

@@ -67,7 +67,7 @@
                                     <div>
                                         <div class="form-check form-check-inline">
                                             <input class="form-check-input" type="checkbox" id="lockPayExpr" name="lockPayExpr" <% if (funRela.lockPayExpr) { %>checked<% } %> onchange="updateSetting();">
-                                            <label class="form-check-label" for="lockPayExpr">锁定往期带技术计算的合同支付项</label>
+                                            <label class="form-check-label" for="lockPayExpr">锁定往期带基数计算的合同支付项</label>
                                         </div>
                                     </div>
                                 </div>

+ 221 - 1
app/view/tender/modal.ejs

@@ -80,4 +80,224 @@
             </div>
         </div>
     </div>
-</div>
+</div>
+<div class="modal fade" id="sp-list" 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">
+                <div class="modal-height-500" style="overflow: auto" id="audit-list">
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    $(document).ready(function () {
+        // 获取审批流程
+        $('a[data-target="#sp-list" ]').on('click', function () {
+            const type = $(this).attr('data-type');
+            const data = {
+                order: $(this).attr('data-order'),
+            };
+            const tenderId = $(this).attr('data-tender');
+            let url = '';
+            let auditConst2 = '';
+            if (type === 'stage') {
+                url = '/tender/' + tenderId + '/measure/stage/auditors';
+                auditConst2 = JSON.parse('<%- JSON.stringify(auditConst.stage) %>');
+            } else if (type === 'ledger') {
+                url = '/tender/' + tenderId + '/measure/ledger/auditors';
+                auditConst2 = JSON.parse('<%- JSON.stringify(auditConst.ledger) %>');
+            } else if (type === 'material') {
+                url = '/tender/' + tenderId + '/measure/material/auditors';
+                auditConst2 = JSON.parse('<%- JSON.stringify(auditConst.material) %>');
+            }
+            const dayMode = true;
+            postData(url, data, function (result) {
+                const { auditHistory, auditors, user } = result
+                let historyHTML = ''
+                const leftAuditors = auditors;
+                const darkHTML = !dayMode ? 'bg-dark border-secondary text-white' : '';
+                auditHistory.forEach((auditors, idx) => {
+                    if(idx === auditHistory.length - 1 && auditHistory.length !== 1) {
+                        historyHTML += `<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
+                    >展开历史审批流程</a></div>`
+                    }
+                    historyHTML += `<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">
+                <div class="text-center text-muted">${idx + 1}#</div>
+                <ul class="timeline-list list-unstyled mt-2">`
+                    auditors.forEach((auditor, index) => {
+                        if (index === 0) {
+                            historyHTML += `<li class="timeline-list-item pb-2">
+                            <div class="timeline-item-date">
+                                ${formatDate(auditor.begin_time, !dayMode)}
+                            </div>
+                            <div class="timeline-item-tail"></div>
+                            <div class="timeline-item-icon bg-success text-light">
+                                <i class="fa fa-caret-down"></i>
+                            </div>
+                            <div class="timeline-item-content">
+                                <div class="card ${darkHTML}">
+                                    <div class="card-body p-3">
+                                        <div class="card-text">
+                                            <p class="mb-1"><span
+                                                    class="h5">${user.name}</span><span
+                                                    class="pull-right text-success">${idx !== 0 ? '重新' : ''}上报审批</span>
+                                            </p>
+                                            <p class="text-muted mb-0">${user.role}</p>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </li>
+                        <li class="timeline-list-item pb-2">
+                            <div class="timeline-item-date">
+                                ${formatDate(auditor.end_time, !dayMode)}
+                            </div>`
+
+                            if(index < auditors.length - 1) {
+                                historyHTML += `<div class="timeline-item-tail"></div>`
+                            }
+                            if(auditor.status === auditConst2.status.checked) {
+                                historyHTML += `<div class="timeline-item-icon bg-success text-light">
+                                    <i class="fa fa-check"></i>
+                                </div>`
+
+                            } else if(auditor.status === auditConst2.status.checkNo || auditor.status === auditConst2.status.checkNoPre) {
+                                historyHTML += `<div class="timeline-item-icon bg-warning text-light">
+                                    <i class="fa fa-level-up"></i>
+                                </div>`
+                            } else if(auditor.status === auditConst2.status.checking) {
+                                historyHTML += `<div class="timeline-item-icon bg-warning text-light">
+                                    <i class="fa fa-ellipsis-h"></i>
+                                </div>`
+                            } else {
+                                historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
+
+                            }
+                            historyHTML += `<div class="timeline-item-content">
+                                <div class="card ${darkHTML}">
+                                    <div class="card-body p-3">
+                                        <div class="card-text">
+                                            <p class="mb-1"><span class="h5">${auditor.name}</span><span
+                                                    class="pull-right ${auditConst2.statusClass[auditor.status]}">${auditConst2.statusString[auditor.status]}</span>
+                                            </p>
+                                            <p class="text-muted mb-0">${auditor.role}</p>
+                                        </div>
+                                    </div>`
+                            if (auditor.opinion) {
+                                historyHTML += `<div class="card-body p-3 border-top">
+                                    <p style="margin: 0;">${auditor.opinion}</p>
+                                </div>`
+                            }
+                            historyHTML += `</div></div></li>`
+                        } else {
+                            historyHTML += `<li class="timeline-list-item pb-2">
+                        <div class="timeline-item-date">
+                            ${formatDate(auditor.end_time, !dayMode)}
+                        </div>`
+
+                            if(index < auditors.length - 1) {
+                                historyHTML += `<div class="timeline-item-tail"></div>`
+                            }
+                            if(auditor.status === auditConst2.status.checked) {
+                                historyHTML += `<div class="timeline-item-icon bg-success text-light">
+                                <i class="fa fa-check"></i>
+                            </div>`
+                            } else if(auditor.status === auditConst2.status.checkNo || auditor.status === auditConst2.status.checkNoPre) {
+                                historyHTML += `<div class="timeline-item-icon bg-warning text-light">
+                                <i class="fa fa-level-up"></i>
+                            </div>`
+
+                            } else if(auditor.status === auditConst2.status.checking) {
+                                historyHTML += `<div class="timeline-item-icon bg-warning text-light">
+                                <i class="fa fa-ellipsis-h"></i>
+                            </div>`
+                            } else {
+                                historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
+                            }
+                            historyHTML += `<div class="timeline-item-content">
+                        <div class="card ${darkHTML}">
+                            <div class="card-body p-3">
+                                <div class="card-text">
+                                    <p class="mb-1"><span class="h5">${auditor.name}</span>
+                                        <span
+                                            class="pull-right
+                                                            ${auditConst2.statusClass[auditor.status]}">${auditor.status !== auditConst2.status.uncheck ? auditConst2.statusString[auditor.status] : ''}
+                                            ${auditor.status === auditConst2.status.checkNo ? user.name : ''}
+                                            ${auditor.status === auditConst2.status.checkNoPre ? (leftAuditors.find(item => item.order === auditor.sort-1) ? leftAuditors.find(item => item.order === auditor.sort-1).name : '') : ''}
+                                        </span>
+                                    </p>
+                                    <p class="text-muted mb-0">${auditor.role}</p>
+                                </div>
+                            </div>`
+
+                            if (auditor.opinion) {
+                                historyHTML += `<div class="card-body p-3 border-top">
+                            <p style="margin: 0;">${auditor.opinion} </p>
+                        </div>`
+                            }
+                            historyHTML += `</div></div></li>`
+                        }
+                    })
+                    historyHTML += '</ul></div>'
+
+                })
+                $('#audit-list').empty()
+                $('#audit-list').append(historyHTML)
+            });
+        });
+
+        // 展开/收起历史审核记录
+        $('#audit-list').on('click', 'a', function() {
+            const type = $(this).data('target')
+            const auditCard = $(this).parent().parent()
+            if (type === 'show') {
+                $(this).data('target', 'hide')
+                auditCard.find('.fold-card').slideDown('swing', () => {
+                    auditCard.find('#end-target').text($(this).data('idx') + '#')
+                    auditCard.find('#fold-btn').text('收起历史审核记录')
+                })
+            } else {
+                $(this).data('target', 'show')
+                auditCard.find('.fold-card').slideUp('swing', () => {
+                    auditCard.find('#end-target').text('1#')
+                    auditCard.find('#fold-btn').text('展开历史审核记录')
+                })
+            }
+        });
+
+        function formatDate(date, dayMode) {
+            if (!date) return '';
+            date = new Date(date)
+            const year = date.getFullYear();
+            let mon = date.getMonth() + 1;
+            let day = date.getDate();
+            let hour = date.getHours();
+            let minute = date.getMinutes();
+            let scond = date.getSeconds();
+            if (mon < 10) {
+                mon = '0' + mon.toString();
+            }
+            if (day < 10) {
+                day = '0' + day.toString();
+            }
+            if (hour < 10) {
+                hour = '0' + hour.toString();
+            }
+            if (minute < 10) {
+                minute = '0' + minute.toString();
+            }
+            if (scond < 10) {
+                scond = '0' + scond.toString();
+            }
+            return `${year}<span class="${dayMode ? 'text-light' : ''}">${mon}-${day}</span><span class="${dayMode ? 'text-light' : ''}">${hour}:${minute}:${scond}</span>`;
+        };
+    })
+</script>