Browse Source

feat: 台账分解审批改版、历史详情页加上审批完成的弹窗

lanjianrong 5 years ago
parent
commit
9d8856ea00

+ 9 - 7
app/controller/ledger_audit_controller.js

@@ -74,7 +74,7 @@ module.exports = app => {
                     throw '审核信息错误';
                     throw '审核信息错误';
                 }
                 }
 
 
-                const auditors = await ctx.service.ledgerAudit.getAuditors(ctx.tender.id, ctx.tender.data.ledger_times);
+                const auditors = await ctx.service.ledgerAudit.getAuditorsWithOwner(ctx.tender.id, ctx.tender.data.ledger_times);
                 if (ctx.tender.data.user_id !== ctx.session.sessionUser.accountId) {
                 if (ctx.tender.data.user_id !== ctx.session.sessionUser.accountId) {
                     if (auditors.length > 0) {
                     if (auditors.length > 0) {
                         const auditor = auditors.find(function(a) { return a.audit_id === ctx.session.sessionUser.accountId; });
                         const auditor = auditors.find(function(a) { return a.audit_id === ctx.session.sessionUser.accountId; });
@@ -86,12 +86,12 @@ module.exports = app => {
 
 
                 renderData.user = await ctx.service.projectAccount.getAccountInfoById(ctx.tender.data.user_id);
                 renderData.user = await ctx.service.projectAccount.getAccountInfoById(ctx.tender.data.user_id);
                 renderData.auditHistory = [];
                 renderData.auditHistory = [];
-                if (ctx.tender.data.ledger_times > 1) {
-                    for (let i = 1; i < ctx.tender.data.ledger_times; i++) {
+                const times = ctx.tender.data.ledger_status === auditConst.status.checkNo ? ctx.tender.data.ledger_times - 1 : ctx.tender.data.ledger_times;
+                if (times >= 1) {
+                    for (let i = 1; i <= times; i++) {
                         renderData.auditHistory.push(await ctx.service.ledgerAudit.getAuditors(ctx.tender.id, i));
                         renderData.auditHistory.push(await ctx.service.ledgerAudit.getAuditors(ctx.tender.id, i));
                     }
                     }
                 }
                 }
-
                 const ledgerData = await ctx.service.ledger.getData(ctx.tender.id);
                 const ledgerData = await ctx.service.ledger.getData(ctx.tender.id);
                 renderData.curAuditor = curAuditor;
                 renderData.curAuditor = curAuditor;
                 renderData.auditConst = auditConst;
                 renderData.auditConst = auditConst;
@@ -104,7 +104,6 @@ module.exports = app => {
                 await this.layout('ledger/audit.ejs', renderData, 'ledger/audit_modal.ejs');
                 await this.layout('ledger/audit.ejs', renderData, 'ledger/audit_modal.ejs');
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);
-                console.log(err);
                 ctx.redirect('/tender/' + ctx.tender.id);
                 ctx.redirect('/tender/' + ctx.tender.id);
             }
             }
         }
         }
@@ -204,10 +203,13 @@ module.exports = app => {
 
 
                 await ctx.service.ledgerAudit.start(ctx.tender.id, ctx.tender.data.ledger_times);
                 await ctx.service.ledgerAudit.start(ctx.tender.id, ctx.tender.data.ledger_times);
 
 
-                ctx.body = {err: 0, msg: '', data: {url: '/tender/' + ctx.tender.id + '/ledger'}}; //ctx.redirect('/tender/' + ctx.tender.id + '/ledger');
+                // ctx.body = { err: 0, msg: '', data: { url: '/tender/' + ctx.tender.id + '/ledger' } };
+                ctx.redirect('/tender/' + ctx.tender.id + '/ledger');
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);
-                ctx.body = this.ajaxErrorBody(err, '上报失败,请刷新页面重试');
+                // ctx.body = this.ajaxErrorBody(err, '上报失败,请刷新页面重试');
+                ctx.session.postError = err.toString();
+                ctx.redirect(ctx.request.header.referer);
             }
             }
         }
         }
 
 

+ 13 - 10
app/controller/ledger_controller.js

@@ -116,14 +116,14 @@ module.exports = app => {
             try {
             try {
                 const tender = ctx.tender;
                 const tender = ctx.tender;
                 const [ledgerSpread, posSpread] = this._getSpreadSetting();
                 const [ledgerSpread, posSpread] = this._getSpreadSetting();
+                const times = tender.data.ledger_status === auditConst.status.checkNo ? tender.data.ledger_times - 1 : tender.data.ledger_times;
 
 
                 const curAuditor = await ctx.service.ledgerAudit.getCurAuditor(tender.id, tender.data.ledger_times);
                 const curAuditor = await ctx.service.ledgerAudit.getCurAuditor(tender.id, tender.data.ledger_times);
-                const times = tender.data.ledger_status === auditConst.status.checkNo ? tender.data.ledger_times - 1 : tender.data.ledger_times;
-                const auditors = await ctx.service.ledgerAudit.getAuditors(tender.id, times);
+                const auditors = await ctx.service.ledgerAudit.getAuditorsWithOwner(tender.id, times);
                 const user = await ctx.service.projectAccount.getAccountInfoById(ctx.tender.data.user_id);
                 const user = await ctx.service.projectAccount.getAccountInfoById(ctx.tender.data.user_id);
                 const auditHistory = [];
                 const auditHistory = [];
-                if (ctx.tender.data.ledger_times > 1) {
-                    for (let i = 1; i < ctx.tender.data.ledger_times; i++) {
+                if (times >= 1) {
+                    for (let i = 1; i <= times; i++) {
                         auditHistory.push(await ctx.service.ledgerAudit.getAuditors(ctx.tender.id, i));
                         auditHistory.push(await ctx.service.ledgerAudit.getAuditors(ctx.tender.id, i));
                     }
                     }
                 }
                 }
@@ -147,13 +147,17 @@ module.exports = app => {
                     stdChapters,
                     stdChapters,
                 };
                 };
                 if ((tender.data.ledger_status === auditConst.status.uncheck || tender.data.ledger_status === auditConst.status.checkNo) && tender.data.user_id === ctx.session.sessionUser.accountId) {
                 if ((tender.data.ledger_status === auditConst.status.uncheck || tender.data.ledger_status === auditConst.status.checkNo) && tender.data.user_id === ctx.session.sessionUser.accountId) {
-                    renderData.accountGroup = accountGroup;
+                    // renderData.accountGroup = accountGroup;
                     // 获取所有项目参与者
                     // 获取所有项目参与者
                     const accountList = await ctx.service.projectAccount.getAllDataByCondition({
                     const accountList = await ctx.service.projectAccount.getAllDataByCondition({
                         where: { project_id: ctx.session.sessionProject.id, enable: 1 },
                         where: { project_id: ctx.session.sessionProject.id, enable: 1 },
-                        columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group'],
+                        columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
                     });
                     });
                     renderData.accountList = accountList;
                     renderData.accountList = accountList;
+                    renderData.accountGroup = accountGroup.map((item, idx) => {
+                        const groupList = accountList.filter(item => item.account_group === idx);
+                        return { groupName: item, groupList };
+                    });
                     renderData.auditorList = await ctx.service.ledgerAudit.getAuditors(tender.id, tender.data.ledger_times);
                     renderData.auditorList = await ctx.service.ledgerAudit.getAuditors(tender.id, tender.data.ledger_times);
                 }
                 }
 
 
@@ -260,7 +264,6 @@ module.exports = app => {
             switch (addType) {
             switch (addType) {
                 case stdDataAddType.child:
                 case stdDataAddType.child:
                     return await ctx.service.ledger.addStdNodeAsChild(ctx.tender.id, data.id, stdData);
                     return await ctx.service.ledger.addStdNodeAsChild(ctx.tender.id, data.id, stdData);
-                    break;
                 case stdDataAddType.next:
                 case stdDataAddType.next:
                     return await ctx.service.ledger.addStdNode(ctx.tender.id, data.id, stdData);
                     return await ctx.service.ledger.addStdNode(ctx.tender.id, data.id, stdData);
                 case stdDataAddType.withParent:
                 case stdDataAddType.withParent:
@@ -448,7 +451,7 @@ module.exports = app => {
                     ? await ctx.service.pos.getPosData({ tid: ctx.tender.id }) : [];
                     ? await ctx.service.pos.getPosData({ tid: ctx.tender.id }) : [];
                 const data = ctx.helper.checkBillsWithPos(ledgerData, posData,
                 const data = ctx.helper.checkBillsWithPos(ledgerData, posData,
                     ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
                     ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity']);
-                ctx.body = { err: 0, msg: '', data: data };
+                ctx.body = { err: 0, msg: '', data };
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);
                 ctx.body = this.ajaxErrorBody(err, '检查数据错误');
                 ctx.body = this.ajaxErrorBody(err, '检查数据错误');
@@ -649,8 +652,8 @@ module.exports = app => {
                 //     await ctx.service.externalData.saveExValue(ctx.tender.id, -1,
                 //     await ctx.service.externalData.saveExValue(ctx.tender.id, -1,
                 //         externalDataConst.FuLong.exType, externalDataConst.FuLong.exFields.wbsCode, wbsCodeHis);
                 //         externalDataConst.FuLong.exType, externalDataConst.FuLong.exFields.wbsCode, wbsCodeHis);
                 // }
                 // }
-                ctx.body = {err: 0, msg: '', data: result};
-            } catch(err) {
+                ctx.body = { err: 0, msg: '', data: result };
+            } catch (err) {
                 this.log(err);
                 this.log(err);
                 ctx.body = this.ajaxErrorBody(err, '加载合同支付数据错误');
                 ctx.body = this.ajaxErrorBody(err, '加载合同支付数据错误');
             }
             }

+ 16 - 1
app/controller/revise_controller.js

@@ -478,15 +478,30 @@ module.exports = app => {
                 ledgerSpread.readOnly = true;
                 ledgerSpread.readOnly = true;
                 posSpread.readOnly = true;
                 posSpread.readOnly = true;
                 const historyRevise = await ctx.service.ledgerRevise.getReviseList(ctx.tender.id);
                 const historyRevise = await ctx.service.ledgerRevise.getReviseList(ctx.tender.id);
+                // 获取审批流程中右边列表
+                const auditHistory = [];
+                const times = revise.status === audit.revise.status.checkNo ? revise.times - 1 : revise.times;
+                if (times >= 1) {
+                    for (let i = 1; i <= times; i++) {
+                        auditHistory.push(await ctx.service.reviseAudit.getAuditors2ReviseList(revise.id, i));
+                    }
+                }
+                const user = await ctx.service.projectAccount.getAccountInfoById(revise.uid);
+                // 获取审批流程中左边列表
+                const auditors = await ctx.service.reviseAudit.getAuditorsWithOwner(revise.id, times);
                 const renderData = {
                 const renderData = {
                     measureType, audit, revise,
                     measureType, audit, revise,
                     ledgerSpread, posSpread,
                     ledgerSpread, posSpread,
                     // reviseBills, revisePos,
                     // reviseBills, revisePos,
                     readOnly: true,
                     readOnly: true,
                     historyRevise,
                     historyRevise,
+                    auditHistory,
+                    auditors,
+                    auditConst: audit.revise,
+                    user,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.history),
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.history),
                 };
                 };
-                await this.layout('revise/history.ejs', renderData);
+                await this.layout('revise/history.ejs', renderData, 'revise/history_modal.ejs');
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);
                 ctx.redirect(ctx.request.header.referer);
                 ctx.redirect(ctx.request.header.referer);

+ 100 - 40
app/public/js/ledger.js

@@ -1389,7 +1389,7 @@ $(document).ready(function() {
                         hint: '0号台账',
                         hint: '0号台账',
                         url: '/template/导入分项清单EXCEL格式.xls',
                         url: '/template/导入分项清单EXCEL格式.xls',
                     },
                     },
-                    callback: function (sheet) {     
+                    callback: function (sheet) {
                         postDataCompress(window.location.pathname + '/upload-excel/tz', sheet, function (result) {
                         postDataCompress(window.location.pathname + '/upload-excel/tz', sheet, function (result) {
                             ledgerTree.loadDatas(result.bills);
                             ledgerTree.loadDatas(result.bills);
                             treeCalc.calculateAll(ledgerTree);
                             treeCalc.calculateAll(ledgerTree);
@@ -1400,7 +1400,7 @@ $(document).ready(function() {
                     },
                     },
                     // callback: function (file, select) {
                     // callback: function (file, select) {
                     //     const formData = new FormData();
                     //     const formData = new FormData();
-                    //     formData.append('file', file.files[0]);     
+                    //     formData.append('file', file.files[0]);
                     //     postDataWithFileProgress(window.location.pathname + '/upload-excel?ueType=tz&sheetName=' + select, formData, function (result) {
                     //     postDataWithFileProgress(window.location.pathname + '/upload-excel?ueType=tz&sheetName=' + select, formData, function (result) {
                     //         ledgerTree.loadDatas(result.bills);
                     //         ledgerTree.loadDatas(result.bills);
                     //         treeCalc.calculateAll(ledgerTree);
                     //         treeCalc.calculateAll(ledgerTree);
@@ -2637,47 +2637,107 @@ $(document).ready(function() {
         }
         }
      }
      }
 
 
-    $('#searchAccount').click(() => {
-        const data = {
-            keyword: $('#searchName').val(),
-        };
-        postData('/search/user', data, (data) => {
-            const resultDiv = $('#searchResult');
-            if (data) {
-                $('h5>span', resultDiv).text(data.name);
-                $('#addAuditor').attr('auditorId', data.id);
-                $('h6', resultDiv).text(data.role);
-                $('p', resultDiv).text(data.company);
-                resultDiv.show();
+    // $('#searchAccount').click(() => {
+    //     const data = {
+    //         keyword: $('#searchName').val(),
+    //     };
+    //     postData('/search/user', data, (data) => {
+    //         const resultDiv = $('#searchResult');
+    //         if (data) {
+    //             $('h5>span', resultDiv).text(data.name);
+    //             $('#addAuditor').attr('auditorId', data.id);
+    //             $('h6', resultDiv).text(data.role);
+    //             $('p', resultDiv).text(data.company);
+    //             resultDiv.show();
+    //         } else {
+    //             toastr.info('未查询到该审核人');
+    //             resultDiv.hide();
+    //         }
+    //     }, () => {
+    //         $('#searchResult').hide();
+    //     });
+    // });
+    // // 审批人分组选择
+    // $('#account_group').change(function () {
+    //     let account_html = '<option value="0">选择审批人</option>';
+    //     for (const account of accountList) {
+    //         if (parseInt($(this).val()) === 0 || parseInt($(this).val()) === account.account_group) {
+    //             const role = account.role !== '' ? '(' + account.role + ')' : '';
+    //             const company = account.company !== '' ? ' -' + account.company : '';
+    //             account_html += '<option value="' + account.id + '">' + account.name + role + company + '</option>';
+    //         }
+    //     }
+    //     $('#account_list').html(account_html);
+    // });
+
+    let timer = null
+    let oldSearchVal = null
+
+    $('#gr-search').bind('input propertychange', function(e) {
+        oldSearchVal = e.target.value
+        timer && clearTimeout(timer)
+        timer = setTimeout(() => {
+            const newVal = $('#gr-search').val()
+            let html = ''
+            if (newVal && newVal === oldSearchVal) {
+                accountList.filter(item => item && cur_uid !== item.id && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
+                    html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
+                        <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
+                                class="ml-auto">${item.mobile || ''}</span></p>
+                        <span class="text-muted">${item.role || ''}</span>
+                    </dd>`
+                })
+                $('.book-list').empty()
+                $('.book-list').append(html)
             } else {
             } else {
-                toastr.info('未查询到该审核人');
-                resultDiv.hide();
-            }
-        }, () => {
-            $('#searchResult').hide();
-        });
-    });
-    // 审批人分组选择
-    $('#account_group').change(function () {
-        let account_html = '<option value="0">选择审批人</option>';
-        for (const account of accountList) {
-            if (parseInt($(this).val()) === 0 || parseInt($(this).val()) === account.account_group) {
-                const role = account.role !== '' ? '(' + account.role + ')' : '';
-                const company = account.company !== '' ? ' -' + account.company : '';
-                account_html += '<option value="' + account.id + '">' + account.name + role + company + '</option>';
+                if (!$('.acc-btn').length) {
+                    accountGroup.forEach((group, idx) => {
+                        if (!group) return
+                        html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
+                        </a> ${group.groupName}</dt>
+                        <div class="dd-content" data-toggleid="${idx}">`
+                        group.groupList.forEach(item => {
+                            if (item.id !== cur_uid) {
+                                html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
+                                    <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
+                                            class="ml-auto">${item.mobile || ''}</span></p>
+                                    <span class="text-muted">${item.role || ''}</span>
+                                </dd>`
+                            }
+                        });
+                        html += '</div>'
+                    })
+                    $('.book-list').empty()
+                    $('.book-list').append(html)
+                }
             }
             }
+        }, 400);
+    })
+
+    // 添加审批流程按钮逻辑
+    $('.book-list').on('click', '.acc-btn', function () {
+        const idx = $(this).attr('data-groupid')
+        const type = $(this).attr('data-type')
+        if (type === 'hide') {
+            $(this).parent().parent().find(`div[data-toggleid="${idx}"]`).show(() => {
+                $(this).children().removeClass('fa-plus-square').addClass('fa-minus-square-o')
+                $(this).attr('data-type', 'show')
+
+            })
+        } else {
+            $(this).parent().parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
+                $(this).children().removeClass('fa-minus-square-o').addClass('fa-plus-square')
+                $(this).attr('data-type', 'hide')
+            })
         }
         }
-        $('#account_list').html(account_html);
-    });
+        return false
+    })
+
     // 添加到审批流程中
     // 添加到审批流程中
-    $('body').on('change', '#account_list', function () {
-        let id = $(this).val();
-        id = parseInt(id);
-        if (id !== 0) {
-            const data = {
-                auditorId: $(this).val(),
-            };
-            postData('/tender/' + getTenderId() + '/ledger/audit/add', data, (data) => {
+    $('dl').on('click', 'dd', function () {
+        const auditorId = parseInt($(this).data('id'))
+        if (auditorId) {
+            postData('/tender/' + getTenderId() + '/ledger/audit/add', { auditorId }, (data) => {
                 const html = [];
                 const html = [];
                 html.push('<li class="list-group-item" auditorId="' + data.audit_id + '"><a href="javascript: void(0)" class="text-danger pull-right">移除</a>');
                 html.push('<li class="list-group-item" auditorId="' + data.audit_id + '"><a href="javascript: void(0)" class="text-danger pull-right">移除</a>');
                 html.push('<span>');
                 html.push('<span>');
@@ -2892,4 +2952,4 @@ function checkAuditorFrom () {
         $('#hide-all').show();
         $('#hide-all').show();
         return true;
         return true;
     }
     }
-}
+}

+ 39 - 0
app/service/ledger_audit.js

@@ -450,6 +450,45 @@ module.exports = app => {
             const content = await this.db.query(noticeSql, noticeSqlParam);
             const content = await this.db.query(noticeSql, noticeSqlParam);
             return content.length ? JSON.stringify(content[0]) : '';
             return content.length ? JSON.stringify(content[0]) : '';
         }
         }
+
+        /**
+         * 获取审核人流程列表
+         * @param {Number} tender_id - 标段id
+         * @param {Number} times 审核次数
+         * @return {Promise<Array>} 查询结果集
+         */
+        async getAuditGroupByList(tender_id, times = 1) {
+            const sql =
+                'SELECT la.`audit_id`, pa.`name`, pa.`company`, pa.`role`, la.`times`, la.`tender_id`, la.`audit_order` ' +
+                'FROM ?? AS la, ?? AS pa ' +
+                'WHERE la.`tender_id` = ? and la.`times` = ? and la.`audit_id` = pa.`id` GROUP BY la.`audit_id` ORDER BY la.`audit_order`';
+            const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, tender_id, times];
+            return await this.db.query(sql, sqlParam);
+        }
+
+        /**
+         * 获取审核人流程列表(包括原报)
+         * @param {Number} tender_id - 标段id
+         * @param {Number} times 审核次数
+         * @return {Promise<Array>} 查询结果集(包括原报)
+         */
+        async getAuditorsWithOwner(tender_id, times = 1) {
+            const result = await this.getAuditGroupByList(tender_id, times);
+            const sql =
+                'SELECT pa.`id` As audit_id, pa.`name`, pa.`company`, pa.`role`, ? As times, ? As tender_id, 0 As `audit_order`' +
+                '  FROM ' +
+                this.ctx.service.tender.tableName +
+                ' As s' +
+                '  LEFT JOIN ' +
+                this.ctx.service.projectAccount.tableName +
+                ' As pa' +
+                '  ON s.user_id = pa.id' +
+                '  WHERE s.id = ?';
+            const sqlParam = [times, tender_id, tender_id];
+            const user = await this.db.queryOne(sql, sqlParam);
+            result.unshift(user);
+            return result;
+        }
     }
     }
 
 
     return LedgerAudit;
     return LedgerAudit;

+ 14 - 4
app/view/ledger/audit.ejs

@@ -22,16 +22,16 @@
             <div></div>
             <div></div>
             <div class="ml-auto">
             <div class="ml-auto">
                 <% if (tender.ledger_status === auditConst.status.checkNo) { %>
                 <% if (tender.ledger_status === auditConst.status.checkNo) { %>
-                    <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark mr-1">退回意见</a>
+                    <a href="#sp-list"  data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark mr-1 sp-list-btn">退回意见</a>
                 <% } else if (tender.ledger_status === auditConst.status.checking) { %>
                 <% } else if (tender.ledger_status === auditConst.status.checking) { %>
                     <% if (curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
                     <% if (curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
                         <a href="#sp-done" data-toggle="modal" data-target="#sp-done" class="btn btn-success btn-sm pull-right mr-1">审批通过</a>
                         <a href="#sp-done" data-toggle="modal" data-target="#sp-done" class="btn btn-success btn-sm pull-right mr-1">审批通过</a>
                         <a href="#sp-back" data-toggle="modal" data-target="#sp-back" class="btn btn-warning btn-sm pull-right mr-1">审批退回</a>
                         <a href="#sp-back" data-toggle="modal" data-target="#sp-back" class="btn btn-warning btn-sm pull-right mr-1">审批退回</a>
                     <% } else {%>
                     <% } else {%>
-                        <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark mr-1">审批中</a>
+                        <a href="#sp-list"  data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark mr-1 sp-list-btn">审批中</a>
                     <% } %>
                     <% } %>
                 <% } else if (tender.ledger_status === auditConst.status.checked) { %>
                 <% } else if (tender.ledger_status === auditConst.status.checked) { %>
-                <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-success btn-sm pull-right text-dark mr-1">审批通过</a>
+                <a href="#sp-list" data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-success btn-sm pull-right text-dark mr-1 sp-list-btn">审批通过</a>
                 <% } %>
                 <% } %>
             </div>
             </div>
         </div>
         </div>
@@ -108,4 +108,14 @@
         key: 'ledger-pos',
         key: 'ledger-pos',
         colWidth: true,
         colWidth: true,
     };
     };
-</script>
+    $('.sp-list-btn').click(function () {
+        const type = $(this).data('type')
+        if (type === 'hide') {
+            $('.sp-list-item').hide()
+            $('.modal-title').text('审批流程')
+        } else {
+            $('.sp-list-item').show()
+            $('.modal-title').text('重新上报')
+        }
+    });
+</script>

+ 504 - 317
app/view/ledger/audit_modal.ejs

@@ -1,8 +1,8 @@
 <% if (tender.ledger_status === auditConst.status.checking && curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
 <% if (tender.ledger_status === auditConst.status.checking && curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
 <!--审批通过-->
 <!--审批通过-->
-<div class="modal fade" id="sp-done" data-backdrop="static">
+<div class="modal fade sp-location-list" id="sp-done" data-backdrop="static">
     <div class="modal-dialog modal-lg" role="document">
     <div class="modal-dialog modal-lg" role="document">
-        <form class="modal-content" action="/tender/<%- tender.id %>/ledger/audit/check" method="post" onsubmit="return auditCheck(0);">
+        <form class="modal-content" action="<%- preUrl %>/ledger/audit/check" method="post" onsubmit="return auditCheck(0);">
             <div class="modal-header">
             <div class="modal-header">
                 <h5 class="modal-title">审批通过</h5>
                 <h5 class="modal-title">审批通过</h5>
             </div>
             </div>
@@ -11,122 +11,173 @@
                     <div class="col-4">
                     <div class="col-4">
                         <div class="card mt-3">
                         <div class="card mt-3">
                             <ul class="list-group list-group-flush">
                             <ul class="list-group list-group-flush">
-                                <li class="list-group-item">
-                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- user.name %>  <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
+                                <% auditors.forEach((item, idx) => { %>
+                                <% if (idx === 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">原报</span>
+                                </li>
+                                <% } else if(idx === auditors.length -1 && idx !== 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-stop-circle"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">终审</span>
+                                </li>
+                                <% } else {%>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
                                 </li>
                                 </li>
-                                <% for (let i = 0; i < auditors.length; i++) { %>
-                                    <li class="list-group-item">
-                                        <% if (i < auditors.length - 1) { %>
-                                            <i class="fa fa-chevron-circle-down"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right"><%= ctx.helper.transFormToChinese(i+1)%>审</span>
-                                        <% } else {%>
-                                            <i class="fa fa fa-stop-circle"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right">终审</span>
-                                        <% } %>
-                                    </li>
                                 <% } %>
                                 <% } %>
+                                <% }) %>
                             </ul>
                             </ul>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="col-8 modal-height-500" style="overflow: auto">
                     <div class="col-8 modal-height-500" style="overflow: auto">
-                        <% for (const ah of auditHistory) { %>
-                            <div class="card mt-3">
-                                <ul class="list-group list-group-flush">
-                                    <% for (let iA = 0; iA < ah.length; iA++) { %>
-                                        <% if (iA === 0) { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span class="text-success"><small><%- ah[iA].begin_time.toLocaleDateString() %></small> <% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
-                                                </div>
-                                            </li>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa <%if (iA === ah.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } else if (iA === ah.length - 1) { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right">终审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
+                        <% auditHistory.forEach((auditors, idx) => { %>
+                        <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
+                            <div class="text-center text-muted"
+                                <%- idx === auditHistory.length - 1 ? `id="end-target"` : "" %>>
+                                <%- idx === auditHistory.length - 1 ? 1 : idx+1 %>#</div>
+                            <ul class="timeline-list list-unstyled mt-2">
+                                <% auditors.forEach((auditor, index) => { %>
+                                <% if (index === 0) { %>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.begin_time) %>
+                                    </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">
+                                            <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>
-                                            </li>
-                                        <% } else { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } %>
-                                    <% } %>
-                                </ul>
-                            </div>
-                        <% } %>
-                        <% if (tender.ledger_status === auditConst.status.checking || tender.ledger_status === auditConst.status.checked) {%>
-                            <div class="card mt-3">
-                                <ul class="list-group list-group-flush">
-                                    <li class="list-group-item">
-                                        <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span></h5>
-                                        <div class="ml-3">
-                                            <span class="text-success"><small><%- auditors[0].begin_time.toLocaleDateString() %></small> <% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
+                                            </div>
                                         </div>
                                         </div>
-                                    </li>
-                                    <% for (let iA = 0; iA < auditors.length; iA++) { %>
-                                        <li class="list-group-item">
-                                            <% if (auditors[iA].status === auditConst.status.checked) { %>
-                                                <h5 class="card-title">
-                                                    <i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down text-success' : 'fa fa-stop-circle text-success') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%= auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span class="text-success"><small><%- auditors[iA].end_time.toLocaleDateString() %></small> 审批通过</span>
-                                                    <p class="card-text"><%- auditors[iA].opinion %></p>
-                                                </div>
-                                            <% } else if (auditors[iA].stauts == auditConst.status.checking) { %>
-                                                <h5 class="card-title">
-                                                    <i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down' : 'fa fa-stop-circle') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%= auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span>审批中</span>
-                                                    <p class="card-text"><%- auditors[iA].opinion %></p>
-                                                </div>
-                                            <% } else { %>
-                                                <h5 class="card-title">
-                                                    <i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down' : 'fa fa-stop-circle') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%= auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <p class="card-text"><%- auditors[iA].opinion %></p>
+                                    </div>
+                                </li>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else {%>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
+                                                            class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
                                                 </div>
                                                 </div>
+                                            </div>
+                                            <!--审批意见-->
+                                            <% if(auditor.status !== auditConst.status.uncheck) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
+                                                <label>审批意见<b class="text-danger">*</b></label>
+                                                <textarea class="form-control form-control-sm"
+                                                    name="opinion">同意</textarea>
+                                                <% } else { %>
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                                <% } %>
+                                            </div>
                                             <% } %>
                                             <% } %>
-                                            <% if (auditors[iA].status === auditConst.status.checked) { %>
-                                            <% } else if (auditors[iA].status === auditConst.status.checking) { %>
-                                                <div class="form-group">
-                                                    <label>审批意见<b class="text-danger">*</b></label>
-                                                    <textarea class="form-control form-control-sm" name="opinion">同意</textarea>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } else {%>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else { %>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span>
+                                                        <span
+                                                            class="pull-right
+                                                                            <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
+                                                            <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
+                                                            <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                        </span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
                                                 </div>
                                                 </div>
+                                            </div>
+                                            <!--审批意见-->
+                                            <% if(auditor.status !== auditConst.status.uncheck) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
+                                                <label>审批意见<b class="text-danger">*</b></label>
+                                                <textarea class="form-control form-control-sm"
+                                                    name="opinion">同意</textarea>
+                                                <% } else { %>
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                                <% } %>
+                                            </div>
                                             <% } %>
                                             <% } %>
-                                        </li>
-                                    <% } %>
-                                </ul>
-                            </div>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } %>
+                                <% }) %>
+                            </ul>
+                        </div>
+                        <!-- 展开/收起历史流程 -->
+                        <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
+                        <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
+                                data-idx="<%- idx + 1 %>">展开历史审批流程</a></div>
                         <% } %>
                         <% } %>
+                        <% }) %>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
@@ -134,15 +185,16 @@
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
                 <input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
                 <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
                 <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
-                <button type="submit" class="btn btn-success btn-sm" >确认通过</button>
+                <button type="submit" class="btn btn-success btn-sm">确认通过</button>
             </div>
             </div>
         </form>
         </form>
     </div>
     </div>
 </div>
 </div>
 <!--审批退回-->
 <!--审批退回-->
-<div class="modal fade" id="sp-back" data-backdrop="static">
+<div class="modal fade sp-location-list" id="sp-back" data-backdrop="static">
     <div class="modal-dialog modal-lg" role="document">
     <div class="modal-dialog modal-lg" role="document">
-        <form class="modal-content" action="/tender/<%- tender.id %>/ledger/audit/check" method="post" onsubmit="return auditCheck(1);">
+        <form class="modal-content modal-lg" action="<%- preUrl %>/ledger/audit/check" method="post"
+            onsubmit="return auditCheck(1);">
             <div class="modal-header">
             <div class="modal-header">
                 <h5 class="modal-title">审批退回</h5>
                 <h5 class="modal-title">审批退回</h5>
             </div>
             </div>
@@ -151,123 +203,176 @@
                     <div class="col-4">
                     <div class="col-4">
                         <div class="card mt-3">
                         <div class="card mt-3">
                             <ul class="list-group list-group-flush">
                             <ul class="list-group list-group-flush">
-                                <li class="list-group-item">
-                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- user.name %>  <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
+                                <% auditors.forEach((item, idx) => { %>
+                                <% if (idx === 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">原报</span>
+                                </li>
+                                <% } else if(idx === auditors.length -1 && idx !== 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-stop-circle"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">终审</span>
+                                </li>
+                                <% } else {%>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
                                 </li>
                                 </li>
-                                <% for (let i = 0; i < auditors.length; i++) { %>
-                                    <li class="list-group-item">
-                                        <% if (i < auditors.length - 1) { %>
-                                            <i class="fa fa-chevron-circle-down"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right"><%= ctx.helper.transFormToChinese(i+1)%>审</span>
-                                        <% } else {%>
-                                            <i class="fa fa fa-stop-circle"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right">终审</span>
-                                        <% } %>
-                                    </li>
                                 <% } %>
                                 <% } %>
+                                <% }) %>
                             </ul>
                             </ul>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="col-8 modal-height-500" style="overflow: auto">
                     <div class="col-8 modal-height-500" style="overflow: auto">
-                        <% for (const ah of auditHistory) { %>
-                            <div class="card mt-3">
-                                <ul class="list-group list-group-flush">
-                                    <% for (let iA = 0; iA < ah.length; iA++) { %>
-                                        <% if (iA === 0) { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span class="text-success"><small><%- ah[iA].begin_time.toLocaleDateString() %></small> <% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
-                                                </div>
-                                            </li>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa <%if (iA === ah.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } else if (iA === ah.length - 1) { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right">终审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
+                        <% auditHistory.forEach((auditors, idx) => { %>
+                        <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
+                            <div class="text-center text-muted"
+                                <%- idx === auditHistory.length - 1 ? `id="end-target"` : "" %>>
+                                <%- idx === auditHistory.length - 1 ? 1 : idx+1 %>#</div>
+                            <ul class="timeline-list list-unstyled mt-2">
+                                <% auditors.forEach((auditor, index) => { %>
+                                <% if (index === 0) { %>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.begin_time) %>
+                                    </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">
+                                            <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>
-                                            </li>
-                                        <% } else { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } %>
-                                    <% } %>
-                                </ul>
-                            </div>
-                        <% } %>
-                        <% if (tender.ledger_status === auditConst.status.checking || tender.ledger_status === auditConst.status.checked) {%>
-                            <div class="card mt-3">
-                                <ul class="list-group list-group-flush">
-                                    <li class="list-group-item">
-                                        <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span></h5>
-                                        <div class="ml-3">
-                                            <span class="text-success"><small><%- auditors[0].begin_time.toLocaleDateString() %></small> <% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
+                                            </div>
                                         </div>
                                         </div>
-                                    </li>
-                                    <% for (let iA = 0; iA < auditors.length; iA++) { %>
-                                        <li class="list-group-item">
-                                            <% if (auditors[iA].status === auditConst.status.checked) { %>
-                                                <h5 class="card-title">
-                                                    <i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down text-success' : 'fa fa-stop-circle text-success') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%= auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span class="text-success"><small><%- auditors[iA].end_time.toLocaleDateString() %></small> 审批通过</span>
-                                                    <p class="card-text"><%- auditors[iA].opinion %></p>
-                                                </div>
-                                            <% } else if (auditors[iA].stauts == auditConst.status.checking) { %>
-                                                <h5 class="card-title">
-                                                    <i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down' : 'fa fa-stop-circle') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%= auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span>审批中</span>
-                                                    <p class="card-text"><%- auditors[iA].opinion %></p>
-                                                </div>
-                                            <% } else { %>
-                                                <h5 class="card-title">
-                                                    <i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down' : 'fa fa-stop-circle') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%= auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <p class="card-text"><%- auditors[iA].opinion %></p>
+                                    </div>
+                                </li>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else {%>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
+                                                            class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
                                                 </div>
                                                 </div>
+                                            </div>
+
+                                            <!--审批意见-->
+                                            <% if(auditor.times === tender.ledger_times && auditor.status !== auditConst.status.uncheck) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
+                                                <label>审批意见<b class="text-danger">*</b></label>
+                                                <textarea class="form-control form-control-sm"
+                                                    name="opinion">不同意</textarea>
+                                                <% } else if(auditor.status === auditConst.status.checked){ %>
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                                <% } %>
+                                            </div>
                                             <% } %>
                                             <% } %>
-                                            <% if (auditors[iA].status === auditConst.status.checked) { %>
-                                            <% } else if (auditors[iA].status === auditConst.status.checking) { %>
-                                                <div class="form-group">
-                                                    <label>审批意见<b class="text-danger">*</b></label>
-                                                    <textarea class="form-control form-control-sm" name="opinion">不同意</textarea>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } else {%>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else { %>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span>
+                                                        <span
+                                                            class="pull-right
+                                                                            <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
+                                                            <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
+                                                            <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                        </span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
                                                 </div>
                                                 </div>
-                                                <div class="alert alert-warning">审批退回,将直接退回给原报人。</div>
+                                            </div>
+                                            <!--审批意见-->
+                                            <% if(auditor.times === tender.ledger_times && auditor.status !== auditConst.status.uncheck) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <% if (tender.ledger_times === idx + 1 && auditor.status === auditConst.status.checking) { %>
+                                                <label>审批意见<b class="text-danger">*</b></label>
+                                                <textarea class="form-control form-control-sm"
+                                                    name="opinion">不同意</textarea>
+                                                <% } else { %>
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                                <% } %>
+
+                                            </div>
+
                                             <% } %>
                                             <% } %>
-                                        </li>
-                                    <% } %>
-                                </ul>
-                            </div>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } %>
+                                <% }) %>
+                            </ul>
+                        </div>
+                        <!-- 展开/收起历史流程 -->
+                        <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
+                        <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
+                                data-idx="<%- idx + 1 %>">展开历史审批流程</a></div>
                         <% } %>
                         <% } %>
+                        <% }) %>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
@@ -275,7 +380,7 @@
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
                 <input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
                 <input type="hidden" name="checkType" value="<%= auditConst.status.checkNo %>" />
                 <input type="hidden" name="checkType" value="<%= auditConst.status.checkNo %>" />
-                <button type="submit" class="btn btn-warning btn-sm" >确认退回</button>
+                <button type="submit" class="btn btn-warning btn-sm">确认退回</button>
             </div>
             </div>
         </form>
         </form>
     </div>
     </div>
@@ -286,140 +391,222 @@
     <div class="modal-dialog modal-lg" role="document">
     <div class="modal-dialog modal-lg" role="document">
         <div class="modal-content">
         <div class="modal-content">
             <div class="modal-header">
             <div class="modal-header">
-                <h5 class="modal-title">审批流程</h5>
+                <h5 class="modal-title"><%- tender.ledger_status === auditConst.status.checked ? '审批流程' : '重新上报' %></h5>
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">
                 <div class="row">
                 <div class="row">
                     <div class="col-4">
                     <div class="col-4">
+                        <% if(tender.ledger_status === auditConst.status.checkNo) { %>
+                            <a class="sp-list-item" href="#sub-sp" data-toggle="modal" data-target="#sub-sp" id="hideSp">修改审批流程</a>
+                        <% } %>
                         <div class="card mt-3">
                         <div class="card mt-3">
                             <ul class="list-group list-group-flush">
                             <ul class="list-group list-group-flush">
-                                <li class="list-group-item">
-                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- user.name %>  <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
+                                <% auditors.forEach((item, idx) => { %>
+                                <% if (idx === 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">原报</span>
                                 </li>
                                 </li>
-                                <% for (let i = 0; i < auditors.length; i++) { %>
-                                <li class="list-group-item">
-                                    <% if (i < auditors.length - 1) { %>
-                                    <i class="fa fa-chevron-circle-down"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right"><%= ctx.helper.transFormToChinese(i+1)%>审</span>
-                                    <% } else {%>
-                                    <i class="fa fa fa-stop-circle"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right">终审</span>
-                                    <% } %>
+                                <% } else if(idx === auditors.length -1 && idx !== 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-stop-circle"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">终审</span>
+                                </li>
+                                <% } else {%>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
                                 </li>
                                 </li>
                                 <% } %>
                                 <% } %>
+                                <% }) %>
                             </ul>
                             </ul>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="col-8 modal-height-500" style="overflow: auto">
                     <div class="col-8 modal-height-500" style="overflow: auto">
-                        <% for (const ah of auditHistory) { %>
-                        <div class="card mt-3">
-                            <ul class="list-group list-group-flush">
-                                <% for (let iA = 0; iA < ah.length; iA++) { %>
-                                    <% if (iA === 0) { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <span class="text-success"><small><%- ah[iA].begin_time.toLocaleDateString() %></small> <% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
-                                            </div>
-                                        </li>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa <%if (iA === ah.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- ah[iA].opinion %></p>
+                        <% auditHistory.forEach((auditors, idx) => { %>
+                        <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
+                            <div class="text-center text-muted"
+                                <%- idx === auditHistory.length - 1 ? `id="end-target"` : "" %>>
+                                <%- idx === auditHistory.length - 1 ? 1 : idx+1 %>#</div>
+                            <ul class="timeline-list list-unstyled mt-2">
+                                <% auditors.forEach((auditor, index) => { %>
+                                <% if (index === 0) { %>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.begin_time) %>
+                                    </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">
+                                            <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>
-                                        </li>
-                                    <% } else if (iA === ah.length - 1) { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right">终审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- ah[iA].opinion %></p>
+                                        </div>
+                                    </div>
+                                </li>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else {%>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
+                                                            class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
+                                                </div>
                                             </div>
                                             </div>
-                                        </li>
-                                    <% } else { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- ah[iA].opinion %></p>
+
+                                            <!--审批意见-->
+                                            <% if (auditor.opinion) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
                                             </div>
                                             </div>
-                                        </li>
-                                    <% } %>
-                                <% } %>
-                            </ul>
-                        </div>
-                        <% } %>
-                        <% if (tender.ledger_status === auditConst.status.checking || tender.ledger_status === auditConst.status.checked) {%>
-                        <div class="card mt-3">
-                            <ul class="list-group list-group-flush">
-                                <% for (let iA = 0; iA < auditors.length; iA++) { %>
-                                    <% if (iA === 0) { %>
-                                    <li class="list-group-item">
-                                        <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span></h5>
-                                        <div class="ml-3">
-                                            <span class="text-success"><small><%- auditors[iA].begin_time.toLocaleDateString() %></small> <% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
-                                        </div>
-                                    </li>
-                                    <li class="list-group-item">
-                                        <h5 class="card-title">
-                                            <i class="fa <%if (iA === auditors.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%- auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                        </h5>
-                                        <div class="ml-3">
-                                            <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
-                                                <span class="<%- auditConst.statusClass[auditors[iA].status] %>"> <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %><small><%- auditors[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
                                             <% } %>
                                             <% } %>
-                                            <p class="card-text"><%- auditors[iA].opinion %></p>
                                         </div>
                                         </div>
-                                    </li>
-                                    <% } else if (iA === auditors.length - 1) { %>
-                                    <li class="list-group-item">
-                                        <h5 class="card-title">
-                                            <i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right">终审</span>
-                                        </h5>
-                                        <div class="ml-3">
-                                            <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
-                                                <span class="<%- auditConst.statusClass[auditors[iA].status] %>"> <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %><small><%- auditors[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                            <% } %>
-                                            <p class="card-text"><%- auditors[iA].opinion %></p>
-                                        </div>
-                                    </li>
+                                    </div>
+                                </li>
+                                <% } else {%>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
                                     <% } else { %>
                                     <% } else { %>
-                                    <li class="list-group-item">
-                                        <h5 class="card-title">
-                                            <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%- auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                        </h5>
-                                        <div class="ml-3">
-                                            <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
-                                                <span class="<%- auditConst.statusClass[auditors[iA].status] %>"> <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %><small><%- auditors[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span>
+                                                        <span
+                                                            class="pull-right
+                                                                            <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
+                                                            <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
+                                                            <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                        </span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
+                                                </div>
+                                            </div>
+                                            <!--审批意见-->
+                                            <% if (auditor.opinion) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                            </div>
                                             <% } %>
                                             <% } %>
-                                            <p class="card-text"><%- auditors[iA].opinion %></p>
                                         </div>
                                         </div>
-                                    </li>
-                                    <% } %>
+                                    </div>
+                                </li>
                                 <% } %>
                                 <% } %>
+                                <% }) %>
                             </ul>
                             </ul>
                         </div>
                         </div>
+                        <!-- 展开/收起历史流程 -->
+                        <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
+                            <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
+                                    data-idx="<%- idx + 1 %>">展开历史审批流程</a>
+                            </div>
                         <% } %>
                         <% } %>
+                        <% }) %>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
-            <div class="modal-footer">
+            <form class="modal-footer" method="post" action="<%- preUrl %>/ledger/audit/start" onsubmit="return checkAuditorFrom()">
+                <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
-            </div>
+                <% if(tender.ledger_status === auditConst.status.checkNo && ctx.session.sessionUser.accountId === tender.user_id) { %>
+                    <button class="btn btn-primary btn-sm sp-list-item" type="submit">确认上报</button>
+                <% } %>
+            </form>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
 <% } %>
 <% } %>
+<script>
+    const cur_uid  = parseInt('<%- ctx.session.sessionUser.accountId %>');
+    $('.sp-location-list').on('shown.bs.modal', function () {
+        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
+        const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
+        scrollBox.scrollTop(0);
+        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+        const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
+        if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 390 && hdheight - bdiv > 390) {
+            scrollBox.scrollTop(hdheight - bdiv);
+        }
+    });
+    function divSearch(div) {
+        if (div.length > 0) {
+            return true;
+        }
+        return false;
+    }
+
+    // 展开历史审核记录
+    $('.modal-body #fold-btn').click(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('展开历史审核记录')
+            })
+        }
+    });
+</script>

+ 15 - 4
app/view/ledger/explode.ejs

@@ -46,17 +46,17 @@
             </div>
             </div>
             <div class="ml-auto">
             <div class="ml-auto">
                 <% if (tender.ledger_status === auditConst.status.checkNo) { %>
                 <% if (tender.ledger_status === auditConst.status.checkNo) { %>
-                    <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark">审批退回</a>
+                    <a href="#sp-list" data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark sp-list-btn">审批退回</a>
                 <% } else if (tender.ledger_status === auditConst.status.checking) { %>
                 <% } else if (tender.ledger_status === auditConst.status.checking) { %>
-                    <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark">审批中</a>
+                    <a href="#sp-list" data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-warning btn-sm pull-right text-dark sp-list-btn">审批中</a>
                 <% } else if (tender.ledger_status === auditConst.status.checked) { %>
                 <% } else if (tender.ledger_status === auditConst.status.checked) { %>
-                    <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-secondary btn-sm pull-right">审批完成</a>
+                    <a href="#sp-list" data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-secondary btn-sm pull-right sp-list-btn">审批完成</a>
                 <% } %>
                 <% } %>
                 <% if (ctx.session.sessionUser.accountId === tender.user_id) { %>
                 <% if (ctx.session.sessionUser.accountId === tender.user_id) { %>
                     <% if (tender.ledger_status === auditConst.status.uncheck) { %>
                     <% if (tender.ledger_status === auditConst.status.uncheck) { %>
                         <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm pull-right">上报审批</a>
                         <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" class="btn btn-primary btn-sm pull-right">上报审批</a>
                     <% } else if (tender.ledger_status === auditConst.status.checkNo) { %>
                     <% } else if (tender.ledger_status === auditConst.status.checkNo) { %>
-                        <a href="#sp-list2" data-toggle="modal" data-target="#sp-list2" class="btn btn-primary btn-sm pull-right">重新上报</a>
+                        <a href="#sp-list" data-type="show" data-toggle="modal" data-target="#sp-list" class="btn btn-primary btn-sm pull-right sp-list-btn" style="margin-right: 5px;">重新上报</a>
                     <% } %>
                     <% } %>
                 <% } %>
                 <% } %>
             </div>
             </div>
@@ -194,9 +194,20 @@
         key: 'ledger-pos',
         key: 'ledger-pos',
         colWidth: true,
         colWidth: true,
     };
     };
+    $('.sp-list-btn').click(function () {
+        const type = $(this).data('type')
+        if (type === 'hide') {
+            $('.sp-list-item').hide()
+            $('.modal-title').text('审批流程')
+        } else {
+            $('.sp-list-item').show()
+            $('.modal-title').text('重新上报')
+        }
+    });
 </script>
 </script>
 <% if ((tender.ledger_status === auditConst.status.uncheck || tender.ledger_status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === tender.user_id) { %>
 <% if ((tender.ledger_status === auditConst.status.uncheck || tender.ledger_status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === tender.user_id) { %>
 <script>
 <script>
     const accountList = JSON.parse('<%- JSON.stringify(accountList) %>');
     const accountList = JSON.parse('<%- JSON.stringify(accountList) %>');
+    const accountGroup = JSON.parse('<%- JSON.stringify(accountGroup) %>');
 </script>
 </script>
 <% } %>
 <% } %>

+ 235 - 251
app/view/ledger/explode_modal.ejs

@@ -93,23 +93,32 @@
                 <h5 class="modal-title">上报审批</h5>
                 <h5 class="modal-title">上报审批</h5>
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">
-                <div class="form-group">
-                    <label>选择审批人</label>
-                    <div class="input-group">
-                        <div class="input-group-prepend">
-                            <select class="form-control form-control-sm" id="account_group">
-                                <option value="0">所有分组</option>
-                                <% for (const dw in accountGroup) { %>
-                                    <option value="<%= dw %>"><%= accountGroup[dw] %></option>
-                                <% } %>
-                            </select>
-                        </div>
-                        <select class="form-control form-control-sm" id="account_list">
-                            <option value="0">选择审批人</option>
-                            <% for (const account of accountList) { %>
-                                <option value="<%= account.id %>"><%= account.name %><% if (account.role !== '') { %>(<%= account.role %>)<% } %><% if (account.company !== '') { %> -<%= account.company %><% } %></option>
-                            <% } %>
-                        </select>
+                <div class="dropdown">
+                    <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button"
+                        id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true"
+                        aria-expanded="false">
+                        添加审批流程
+                    </button>
+                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"
+                        style="width:220px">
+                        <div class="mb-2 p-2"><input class="form-control form-control-sm"
+                                placeholder="姓名/手机 检索" id="gr-search"></div>
+                        <dl class="list-unstyled book-list">
+                            <% accountGroup.forEach((group, idx) => { %>
+                                <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>" data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
+                                <div class="dd-content" data-toggleid="<%- idx %>">
+                                    <% group.groupList.forEach(item => { %>
+                                        <% if (item.id !== ctx.session.sessionUser.accountId) { %>
+                                            <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>" >
+                                                <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
+                                                        class="ml-auto"><%- item.mobile %></span></p>
+                                                <span class="text-muted"><%- item.role %></span>
+                                            </dd>
+                                        <% } %>
+                                    <% });%>
+                                </div>
+                            <% }) %>
+                        </dl>
                     </div>
                     </div>
                 </div>
                 </div>
                 <div class="card mt-3">
                 <div class="card mt-3">
@@ -129,7 +138,7 @@
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
-            <form class="modal-footer" method="post" action="/tender/<%- tender.id %>/ledger/audit/start" name="audit-start">
+            <form class="modal-footer" method="post" action="<%- preUrl %>/ledger/audit/start" onsubmit="return checkAuditorFrom()">
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
                 <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
                 <button class="btn btn-primary btn-sm" type="submit" >确认上报</button>
                 <button class="btn btn-primary btn-sm" type="submit" >确认上报</button>
@@ -138,276 +147,251 @@
     </div>
     </div>
 </div>
 </div>
 <% } %>
 <% } %>
-<% if (tender.ledger_status === auditConst.status.checkNo && ctx.session.sessionUser.accountId === tender.user_id) { %>
-<!--审批流程/结果-->
-<div class="modal fade" id="sp-list2" data-backdrop="static">
-    <div class="modal-dialog modal-lg" role="document">
-        <div class="modal-content">
-            <div class="modal-header">
-                <h5 class="modal-title">重新上报</h5>
-            </div>
-            <div class="modal-body">
-                <div class="row">
-                    <div class="col-4 modal-height-500" style="overflow: auto">
-                        <a href="#sub-sp" data-toggle="modal" data-target="#sub-sp" id="hideSp">修改审批流程</a>
-                        <div class="card mt-3">
-                            <ul class="list-group list-group-flush">
-                                <li class="list-group-item">
-                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- user.name %>  <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                </li>
-                            </ul>
-                            <ul class="list-group list-group-flush" id="auditors-list">
-                                <% for (let i = 0; i < auditorList.length; i++) { %>
-                                    <li class="list-group-item" data-auditid="<%- auditorList[i].audit_id %>">
-                                        <% if (i < auditorList.length - 1) { %>
-                                            <i class="fa fa-chevron-circle-down"></i> <%- auditorList[i].name %>  <small class="text-muted"><%- auditorList[i].role %></small><span class="pull-right"><%= ctx.helper.transFormToChinese(i+1)%>审</span>
-                                        <% } else {%>
-                                            <i class="fa fa fa-stop-circle"></i> <%- auditorList[i].name %>  <small class="text-muted"><%- auditorList[i].role %></small><span class="pull-right">终审</span>
-                                        <% } %>
-                                    </li>
-                                <% } %>
-                            </ul>
-                        </div>
-                    </div>
-                    <div class="col-8 modal-height-500" style="overflow: auto">
-                        <% for (const ah of auditHistory) { %>
-                            <div class="card mt-3">
-                                <ul class="list-group list-group-flush">
-                                    <% for (let iA = 0; iA < ah.length; iA++) { %>
-                                        <% if (iA === 0) { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <span class="text-success"><small><%- ah[iA].begin_time.toLocaleDateString() %></small> <% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
-                                                </div>
-                                            </li>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa <%if (iA === ah.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } else if (iA === ah.length - 1) { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right">终审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } else { %>
-                                            <li class="list-group-item">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                                </h5>
-                                                <div class="ml-3">
-                                                    <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                        <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                    <% } %>
-                                                    <p class="card-text"><%- ah[iA].opinion %></p>
-                                                </div>
-                                            </li>
-                                        <% } %>
-                                    <% } %>
-                                </ul>
-                            </div>
-                        <% } %>
-                        <% if (tender.ledger_status === auditConst.status.checkNo) {%>
-                            <div class="card mt-3">
-                                <ul class="list-group list-group-flush">
-                                    <li class="list-group-item">
-                                        <h5 class="card-title">
-                                            <i class="fa fa-play-circle fa-rotate-90"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                        </h5>
-                                        <div class="ml-3">
-                                            <span>重新上报中</span>
-                                        </div>
-                                    </li>
-                                </ul>
-                                <ul class="list-group list-group-flush" id="auditors-list2">
-                                    <% for (let iA = 0; iA < auditorList.length; iA++) { %>
-                                        <% if (iA === auditorList.length - 1) { %>
-                                            <li class="list-group-item" data-auditid="<%- auditorList[iA].audit_id %>">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-stop-circle"></i> <%- auditorList[iA].name %> <small class="text-muted"><%- auditorList[iA].role %></small><span class="pull-right">终审</span>
-                                                </h5>
-                                            </li>
-                                        <% } else { %>
-                                            <li class="list-group-item" data-auditid="<%- auditorList[iA].audit_id %>">
-                                                <h5 class="card-title">
-                                                    <i class="fa fa-chevron-circle-down"></i> <%- auditorList[iA].name %> <small class="text-muted"><%- auditorList[iA].role %></small><span class="pull-right"><%= ctx.helper.transFormToChinese(iA+1) %>审</span>
-                                                </h5>
-                                            </li>
-                                        <% } %>
-                                    <% } %>
-                                </ul>
-                            </div>
-                        <% } %>
-                    </div>
-                </div>
-            </div>
-            <form class="modal-footer" action="/tender/<%- tender.id %>/ledger/audit/start" method="post" name="audit-start">
-                <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
-                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
-                <button type="submit" class="btn btn-primary btn-sm">确认上报</button>
-            </form>
-        </div>
-    </div>
-</div>
-<% } %>
 <% if ((tender.ledger_status !== auditConst.status.unCheck) || (tender.ledger_times > 1)) { %>
 <% if ((tender.ledger_status !== auditConst.status.unCheck) || (tender.ledger_times > 1)) { %>
 <!--审批流程/结果-->
 <!--审批流程/结果-->
 <div class="modal fade" id="sp-list" data-backdrop="static">
 <div class="modal fade" id="sp-list" data-backdrop="static">
     <div class="modal-dialog modal-lg" role="document">
     <div class="modal-dialog modal-lg" role="document">
         <div class="modal-content">
         <div class="modal-content">
             <div class="modal-header">
             <div class="modal-header">
-                <h5 class="modal-title">审批流程</h5>
+                <h5 class="modal-title"><%- tender.ledger_status === auditConst.status.checking ? '审批流程' : '重新上报' %></h5>
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">
                 <div class="row">
                 <div class="row">
                     <div class="col-4">
                     <div class="col-4">
+                        <% if(tender.ledger_status === auditConst.status.checkNo) { %>
+                            <a class="sp-list-item" href="#sub-sp" data-toggle="modal" data-target="#sub-sp" id="hideSp">修改审批流程</a>
+                        <% } %>
                         <div class="card mt-3">
                         <div class="card mt-3">
                             <ul class="list-group list-group-flush">
                             <ul class="list-group list-group-flush">
-                                <li class="list-group-item">
-                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- user.name %>  <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
+                                <% auditors.forEach((item, idx) => { %>
+                                <% if (idx === 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">原报</span>
                                 </li>
                                 </li>
-                                <% for (let i = 0; i < auditors.length; i++) { %>
-                                <li class="list-group-item">
-                                    <% if (i < auditors.length - 1) { %>
-                                    <i class="fa fa-chevron-circle-down"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right"><%= ctx.helper.transFormToChinese(i+1) %>审</span>
-                                    <% } else {%>
-                                    <i class="fa fa fa-stop-circle"></i> <%- auditors[i].name %>  <small class="text-muted"><%- auditors[i].role %></small><span class="pull-right">终审</span>
-                                    <% } %>
+                                <% } else if(idx === auditors.length -1 && idx !== 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-stop-circle"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">终审</span>
+                                </li>
+                                <% } else {%>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
                                 </li>
                                 </li>
                                 <% } %>
                                 <% } %>
+                                <% }) %>
                             </ul>
                             </ul>
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="col-8 modal-height-500" style="overflow: auto">
                     <div class="col-8 modal-height-500" style="overflow: auto">
-                        <% for (const ah of auditHistory) { %>
-                        <div class="card mt-3">
-                            <ul class="list-group list-group-flush">
-                                <% for (let iA = 0; iA < ah.length; iA++) { %>
-                                    <% if (iA === 0) { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <span class="text-success"><small><%- ah[iA].begin_time.toLocaleDateString() %></small> <% if (auditHistory.indexOf(ah) > 0) { %>重新<% } %>上报</span>
+                        <% auditHistory.forEach((auditors, idx) => { %>
+                        <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
+                            <div class="text-center text-muted"
+                                <%- idx === auditHistory.length - 1 ? `id="end-target"` : "" %>>
+                                <%- idx === auditHistory.length - 1 ? 1 : idx+1 %>#</div>
+                            <ul class="timeline-list list-unstyled mt-2">
+                                <% auditors.forEach((auditor, index) => { %>
+                                <% if (index === 0) { %>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.begin_time) %>
+                                    </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">
+                                            <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>
-                                        </li>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa <%if (iA === ah.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- ah[iA].opinion %></p>
+                                        </div>
+                                    </div>
+                                </li>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else {%>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
+                                                            class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
+                                                </div>
                                             </div>
                                             </div>
-                                        </li>
-                                    <% } else if (iA === ah.length - 1) { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-stop-circle <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right">终审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- ah[iA].opinion %></p>
+
+                                            <!--审批意见-->
+                                            <% if (auditor.opinion) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
                                             </div>
                                             </div>
-                                        </li>
+                                            <% } %>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } else {%>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
                                     <% } else { %>
                                     <% } else { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[ah[iA].status] %>"></i> <%- ah[iA].name %> <small class="text-muted"><%- ah[iA].role %></small><span class="pull-right"><%= ah[iA].sort === ah[iA].max_sort ? '终' : ctx.helper.transFormToChinese(ah[iA].sort) %>审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (ah[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[ah[iA].status] %>"><% if (ah[iA].status === auditConst.status.checked || ah[iA].status === auditConst.status.checkNo) { %><small><%- ah[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[ah[iA].status]%><% if (ah[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- ah[iA].opinion %></p>
-                                            </div>
-                                        </li>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
                                     <% } %>
                                     <% } %>
-                                <% } %>
-                            </ul>
-                        </div>
-                        <% } %>
-                        <% if (tender.ledger_status === auditConst.status.checking || tender.ledger_status === auditConst.status.checked) {%>
-                        <div class="card mt-3">
-                            <ul class="list-group list-group-flush">
-                                <% for (let iA = 0; iA < auditors.length; iA++) { %>
-                                    <% if (iA === 0) { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- user.name %> <small class="text-muted"><%- user.role %></small><span class="pull-right">原报</span></h5>
-                                            <div class="ml-3">
-                                                <span class="text-success"><small><%- auditors[iA].begin_time.toLocaleDateString() %></small> <% if (tender.ledger_times > 1) { %>重新<% } %>上报</span>
-                                            </div>
-                                        </li>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa <%if (iA === auditors.length - 1) { %>fa-stop-circle<% } else { %>fa-chevron-circle-down<% } %> <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%- auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[auditors[iA].status] %>"> <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %><small><%- auditors[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span>
+                                                        <span
+                                                            class="pull-right
+                                                                            <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
+                                                            <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
+                                                            <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                        </span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
+                                                </div>
                                             </div>
                                             </div>
-                                        </li>
-                                    <% } else if (iA === auditors.length - 1) { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-stop-circle <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right">终审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[auditors[iA].status] %>"> <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %><small><%- auditors[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                                            <!--审批意见-->
+                                            <% if (auditor.opinion) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
                                             </div>
                                             </div>
-                                        </li>
-                                    <% } else { %>
-                                        <li class="list-group-item">
-                                            <h5 class="card-title">
-                                                <i class="fa fa-chevron-circle-down <%- auditConst.statusClass[auditors[iA].status] %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small><span class="pull-right"><%- auditors[iA].sort === auditors[iA].max_sort ? '终' : ctx.helper.transFormToChinese(auditors[iA].sort) %>审</span>
-                                            </h5>
-                                            <div class="ml-3">
-                                                <% if (auditors[iA].status !== auditConst.status.uncheck) { %>
-                                                    <span class="<%- auditConst.statusClass[auditors[iA].status] %>"> <% if (auditors[iA].status === auditConst.status.checked || auditors[iA].status === auditConst.status.checkNo) { %><small><%- auditors[iA].end_time.toLocaleDateString() %></small> <% } %><%- auditConst.statusString[auditors[iA].status]%><% if (auditors[iA].status === auditConst.status.checkNo) { %> <%- user.name %><% } %></span>
-                                                <% } %>
-                                                <p class="card-text"><%- auditors[iA].opinion %></p>
-                                            </div>
-                                        </li>
-                                    <% } %>
+                                            <% } %>
+                                        </div>
+                                    </div>
+                                </li>
                                 <% } %>
                                 <% } %>
+                                <% }) %>
                             </ul>
                             </ul>
                         </div>
                         </div>
+                        <!-- 展开/收起历史流程 -->
+                        <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
+                            <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
+                                    data-idx="<%- idx + 1 %>">展开历史审批流程</a>
+                            </div>
                         <% } %>
                         <% } %>
+                        <% }) %>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
-            <div class="modal-footer">
+            <form class="modal-footer" method="post" action="<%- preUrl %>/ledger/audit/start" onsubmit="return checkAuditorFrom()">
+                <input type="hidden" name="_csrf" value="<%= ctx.csrf %>">
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
-            </div>
+                <% if(tender.ledger_status === auditConst.status.checkNo && ctx.session.sessionUser.accountId === tender.user_id) { %>
+                    <button class="btn btn-primary btn-sm sp-list-item" type="submit">确认上报</button>
+                <% } %>
+            </form>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
+<script>
+    const cur_uid  = parseInt('<%- ctx.session.sessionUser.accountId %>');
+    $('.sp-location-list').on('shown.bs.modal', function () {
+        const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
+        const bdiv = (scrollBox.offset() && scrollBox.offset().top) || 0;
+        scrollBox.scrollTop(0);
+        const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
+        const hdheight = hdiv ? hdiv.parents('.timeline-item-content').offset().top : null;
+        if (hdiv && scrollBox.length && scrollBox[0].scrollHeight > 390 && hdheight - bdiv > 390) {
+            scrollBox.scrollTop(hdheight - bdiv);
+        }
+    });
+    function divSearch(div) {
+        if (div.length > 0) {
+            return true;
+        }
+        return false;
+    }
+
+    // 检查上报情况
+    function checkAuditorFrom () {
+        if ($('#auditors li').length === 0) {
+            toast('请先选择审批人,再上报数据', 'error', 'exclamation-circle');
+            return false;
+        }
+        $('#hide-all').show();
+    }
+
+    $('#hideSp').click(function () {
+        $('#sp-list').modal('hide');
+    });
+    $('a[f-target]').click(function () {
+        $($(this).attr('f-target')).modal('show');
+    });
+
+    // 多层modal关闭后的滚动bug修复
+    $('#sp-list').on('hidden.bs.modal', function (e) {
+        $(document.body).addClass('modal-open');
+    });
+
+    // 展开历史审核记录
+    $('.modal-body #fold-btn').click(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('展开历史审核记录')
+            })
+        }
+    });
+</script>
 <% } %>
 <% } %>
 <% include ../shares/merge_peg_modal.ejs %>
 <% include ../shares/merge_peg_modal.ejs %>
 <% include ../shares/import_excel_modal.ejs %>
 <% include ../shares/import_excel_modal.ejs %>

+ 2 - 2
app/view/revise/history.ejs

@@ -105,9 +105,9 @@
     </div>
     </div>
 </div>
 </div>
 <script>
 <script>
-    const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');   
+    const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');
     const readOnly = <%- readOnly %>;
     const readOnly = <%- readOnly %>;
     const isTz = <%- ctx.tender.data.measure_type === measureType.tz.value %>;
     const isTz = <%- ctx.tender.data.measure_type === measureType.tz.value %>;
     const billsSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');
     const billsSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
-</script>
+</script>

+ 198 - 0
app/view/revise/history_modal.ejs

@@ -0,0 +1,198 @@
+<!--审批流程/结果-->
+<div class="modal fade" id="sp-list" data-backdrop="static">
+    <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">审批流程</h5>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-4">
+                        <div class="card mt-3">
+                            <ul class="list-group list-group-flush">
+                                <% auditors.forEach((item, idx) => { %>
+                                <% if (idx === 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-play-circle fa-rotate-90"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">原报</span>
+                                </li>
+                                <% } else if(idx === auditors.length -1 && idx !== 0) { %>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa fa-stop-circle"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right">终审</span>
+                                </li>
+                                <% } else {%>
+                                <li class="list-group-item" data-auditorId="<%- item.audit_id %>">
+                                    <i class="fa fa-chevron-circle-down"></i> <%- item.name %>
+                                    <small class="text-muted"><%- item.role %></small>
+                                    <span class="pull-right"><%= ctx.helper.transFormToChinese(idx) %>审</span>
+                                </li>
+                                <% } %>
+                                <% }) %>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="col-8 modal-height-500" style="overflow: auto">
+                        <% auditHistory.forEach((auditors, idx) => { %>
+                        <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
+                            <div class="text-center text-muted"
+                                <%- idx === auditHistory.length - 1 ? `id="end-target"` : "" %>>
+                                <%- idx === auditHistory.length - 1 ? 1 : idx+1 %>#</div>
+                            <ul class="timeline-list list-unstyled mt-2">
+                                <% auditors.forEach((auditor, index) => { %>
+                                <% if (index === 0) { %>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.begin_time) %>
+                                    </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">
+                                            <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">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else {%>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span><span
+                                                            class="pull-right <%- auditConst.statusClass[auditor.status] %>"><%- auditConst.statusString[auditor.status] %></span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
+                                                </div>
+                                            </div>
+
+                                            <!--审批意见-->
+                                            <% if (auditor.opinion) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                            </div>
+                                            <% } %>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } else {%>
+                                <li class="timeline-list-item pb-2">
+                                    <div class="timeline-item-date">
+                                        <%- ctx.helper.formatDate(auditor.end_time) %>
+                                    </div>
+                                    <% if(index < auditors.length - 1) { %>
+                                    <div class="timeline-item-tail"></div>
+                                    <% } %>
+                                    <% if(auditor.status === auditConst.status.checked) { %>
+                                    <div class="timeline-item-icon bg-success text-light">
+                                        <i class="fa fa-check"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {%>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-level-up"></i>
+                                    </div>
+                                    <% } else if(auditor.status === auditConst.status.checking) { %>
+                                    <div class="timeline-item-icon bg-warning text-light">
+                                        <i class="fa fa-ellipsis-h"></i>
+                                    </div>
+                                    <% } else { %>
+                                    <div class="timeline-item-icon bg-secondary text-light">
+                                    </div>
+                                    <% } %>
+                                    <div class="timeline-item-content">
+                                        <div class="card">
+                                            <div class="card-body p-3">
+                                                <div class="card-text">
+                                                    <p class="mb-1"><span class="h5"><%- auditor.name %></span>
+                                                        <span
+                                                            class="pull-right
+                                                                            <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
+                                                            <%- auditor.status === auditConst.status.checkNo ? user.name : '' %>
+                                                            <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                        </span>
+                                                    </p>
+                                                    <p class="text-muted mb-0"><%- auditor.role %></p>
+                                                </div>
+                                            </div>
+                                            <!--审批意见-->
+                                            <% if (auditor.opinion) { %>
+                                            <div class="card-body p-3 border-top">
+                                                <p style="margin: 0;"><%- auditor.opinion %></p>
+                                            </div>
+                                            <% } %>
+                                        </div>
+                                    </div>
+                                </li>
+                                <% } %>
+                                <% }) %>
+                            </ul>
+                        </div>
+                        <!-- 展开/收起历史流程 -->
+                        <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
+                            <div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
+                                    data-idx="<%- idx + 1 %>">展开历史审批流程</a>
+                            </div>
+                        <% } %>
+                        <% }) %>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    // 展开历史审核记录
+    $('.modal-body #fold-btn').click(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('展开历史审核记录')
+            })
+        }
+    });
+</script>

+ 3 - 1
app/view/revise/info.ejs

@@ -64,7 +64,7 @@
                     <% } %>
                     <% } %>
                 <% } %>
                 <% } %>
                 <% if (revise.status === audit.status.checked) { %>
                 <% if (revise.status === audit.status.checked) { %>
-                <a href="#sp-list" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-secondary btn-sm pull-right mr-1">审批完成</a>
+                <a href="#sp-list" data-type="hide" data-toggle="modal" data-target="#sp-list" class="btn btn-outline-secondary btn-sm pull-right mr-1 sp-list-btn">审批完成</a>
                 <% } %>
                 <% } %>
             </div>
             </div>
         </div>
         </div>
@@ -229,8 +229,10 @@
         const type = $(this).data('type')
         const type = $(this).data('type')
         if (type === 'hide') {
         if (type === 'hide') {
             $('.sp-list-item').hide()
             $('.sp-list-item').hide()
+            $('.modal-title').text('审批流程')
         } else {
         } else {
             $('.sp-list-item').show()
             $('.sp-list-item').show()
+            $('.modal-title').text('重新上报')
         }
         }
     });
     });
 </script>
 </script>

+ 2 - 0
app/view/revise/info_modal.ejs

@@ -875,8 +875,10 @@
         const type = $(this).data('type')
         const type = $(this).data('type')
         if (type === 'hide') {
         if (type === 'hide') {
             $('.sp-list-item').hide()
             $('.sp-list-item').hide()
+            $('.modal-title').text('审批流程')
         } else {
         } else {
             $('.sp-list-item').show()
             $('.sp-list-item').show()
+            $('.modal-title').text('重新上报')
         }
         }
     });
     });
     // 检查上报情况
     // 检查上报情况

+ 2 - 0
app/view/stage/audit_btn.ejs

@@ -34,8 +34,10 @@
         const type = $(this).data('type')
         const type = $(this).data('type')
         if (type === 'hide') {
         if (type === 'hide') {
             $('.sp-list-item').hide()
             $('.sp-list-item').hide()
+            $('.modal-title').text('审批流程')
         } else {
         } else {
             $('.sp-list-item').show()
             $('.sp-list-item').show()
+            $('.modal-title').text('重新上报')
         }
         }
     });
     });
 </script>
 </script>