Browse Source

短信模板和期审批管理页更新

laiguoran 5 years ago
parent
commit
1ab5f98e71

+ 2 - 2
app/const/sms_alitemplate.js

@@ -17,9 +17,9 @@ const smsTemplate = {
     mmcz: 'SMS_192825318', // 账号:${account},密码重置为:${password}
     ledger_check: 'SMS_192825164', // 项目:${project},标段:${number},台帐需要您审批,请登录系统处理。
     ledger_result: 'SMS_192830156', // 项目:${project},标段:${number},台帐审批${status},请登录系统处理。
-    stage_check: 'SMS_192820179', // 项目:${project},标段:${number},第${qi}期,需要您审批。
+    stage_check: 'SMS_193244645', // 项目:${project},标段:${number},第${qi}期,需要您审批。在线审批https://scn.ink/${code}
     stage_result: 'SMS_192835176', // 项目:${project},标段:${number},第${qi}期,审批${status}。
-    change_check: 'SMS_192820171', // 项目:${project},标段:${number},变更:${biangeng},需要您审批。
+    change_check: 'SMS_193239611', // 项目:${project},标段:${number},变更:${biangeng},需要您审批。在线审批https://scn.ink/${code}
     change_result: 'SMS_192830143', // 项目:${project},标段:${number},变更:${biangeng},审批${status}。
     revise_check: 'SMS_193145529', // 项目:${project},标段:${number},台帐修订需要您审批,请登录系统处理。
     revise_result: 'SMS_193140537', // 项目:${project},标段:${number},台帐修订审批${status},请登录系统处理。

+ 13 - 1
app/controller/stage_controller.js

@@ -1571,9 +1571,21 @@ module.exports = app => {
          */
         async manager(ctx) {
             try {
+
+                await this._getStageAuditViewData(ctx);
                 const renderData = await this._getDefaultRenderData(ctx);
                 // 获取已完成期审批列表
-                const auditList = await ctx.service.stageAudit.getAllDataByCondition({ tid: ctx.tender.id });
+                const lastStage = await ctx.service.stage.getLastestStage(ctx.tender.id);
+                const auditList = [];
+                if (lastStage && lastStage.status === auditConst.status.checked) {
+                    renderData.lastStageUser = await ctx.service.projectAccount.getDataById(lastStage.user_id);
+                    for (let i = lastStage.times; i > 0; i--) {
+                        const timeAuditList = await ctx.service.stageAudit.getAuditors(lastStage.id, i, 'desc');
+                        auditList.push(timeAuditList);
+                    }
+                }
+                renderData.lastStage = lastStage;
+                renderData.lastAuditList = auditList;
                 await this.layout('stage/manager.ejs', renderData, 'stage/manager_modal.ejs');
             } catch (err) {
                 this.log(err);

+ 6 - 7
app/extend/helper.js

@@ -992,13 +992,12 @@ module.exports = {
      * @returns {*}
      */
     async urlToShort(url) {
-        // const apiUrl = 'http://zhzdjg.com/api/shorturl';
-        // const data = {
-        //     url: encodeURI(url),
-        // };
-        // const result = await this.sendRequest(apiUrl, data, 'get');
-        // return result && result.code === 200 && result.url ? result.url : url;
-        return url;
+        const apiUrl = 'http://scn.ink/api/shorturl';
+        const data = {
+            url: encodeURI(url),
+        };
+        const result = await this.sendRequest(apiUrl, data, 'get');
+        return result && result.code === 200 && result.url ? result.url : url;
     },
 
     /**

+ 2 - 1
app/lib/sms.js

@@ -133,7 +133,7 @@ class SMS {
     // }
 
     /**
-     * 关键字转换
+     * 关键字转换,并限制20个字以内
      *
      * @param {String} content - 内容
      * @return {Object} - 解析结果
@@ -142,6 +142,7 @@ class SMS {
         let str = content.replace(/【/g, '(');
         str = str.replace(/】/g, ')');
         str = str.replace(/工程款/g, '***');
+        str = str.length > 20 ? str.substring(0, 17) + '...' : str;
         return str;
     }
 }

+ 20 - 0
app/public/js/global.js

@@ -149,6 +149,11 @@ const postData = function (url, data, successCallback, errorCallBack, showWaitin
                 if (successCallback) {
                     successCallback(result.data);
                 }
+            } else if (result.err === 2) {
+                toastr.error('error: ' + result.msg);
+                setTimeout(function () {
+                    window.location.href = '/login';
+                },1000);
             } else {
                 toastr.error('error: ' + result.msg);
                 if (errorCallBack) {
@@ -194,6 +199,11 @@ const postDataCompress = function (url, data, successCallback, errorCallBack, ht
                 if (successCallback) {
                     successCallback(result.data);
                 }
+            } else if (result.err === 2) {
+                toastr.error('error: ' + result.msg);
+                setTimeout(function () {
+                    window.location.href = '/login';
+                },1000);
             } else {
                 toastr.error('error: ' + result.msg);
                 if (errorCallBack) {
@@ -248,6 +258,11 @@ const postDataWithFile = function (url, formData, successCallback, errorCallBack
                 if (successCallback) {
                     successCallback(result.data);
                 }
+            } else if (result.err === 2) {
+                toastr.error('error: ' + result.msg);
+                setTimeout(function () {
+                    window.location.href = '/login';
+                },1000);
             } else {
                 toastr.error('error: ' + result.msg);
                 if (errorCallBack) {
@@ -288,6 +303,11 @@ const postDataWithFileProgress = function (url, formData, successCallback, error
                 if (successCallback) {
                     successCallback(result.data);
                 }
+            } else if (result.err === 2) {
+                toastr.error('error: ' + result.msg);
+                setTimeout(function () {
+                    window.location.href = '/login';
+                },1000);
             } else {
                 toastr.error('error: ' + result.msg);
                 if (errorCallBack) {

+ 5 - 0
app/public/js/wap/global.js

@@ -32,6 +32,11 @@ const postData = function (url, data, successCallback, errorCallBack, showWaitin
                 if (successCallback) {
                     successCallback(result.data);
                 }
+            } else if (result.err === 2) {
+                toastr.error('error: ' + result.msg);
+                setTimeout(function () {
+                    window.location.href = '/wap/login';
+                },1000);
             } else {
                 toastr.error('error: ' + result.msg);
                 if (errorCallBack) {

+ 24 - 16
app/service/change.js

@@ -384,8 +384,9 @@ module.exports = app => {
                             // }
                             const sms = new SMS(this.ctx);
                             const code = await sms.contentChange(changeInfo.code);
+                            const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + changeInfo.tid + '/change/' + changeInfo.cid + '/info#shenpi');
                             await this.ctx.helper.sendAliSms(auditInfo[0], smsTypeConst.const.BG,
-                                smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code });
+                                smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code, code: shenpiUrl });
                         }
                     }
                     await this.transaction.insert(this.ctx.service.changeAudit.tableName, insertCA);
@@ -546,7 +547,7 @@ module.exports = app => {
                     const sms = new SMS(this.ctx);
                     const code = await sms.contentChange(changeData.code);
                     await this.ctx.helper.sendAliSms(users, smsTypeConst.const.BG,
-                        smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_result, { biangeng: code, status: SmsAliConst.status.success });
+                        smsTypeConst.judge.result.toString(), SmsAliConst.template.change_result, { biangeng: code, status: SmsAliConst.status.success });
                 } else {
                     // 设置下一个审批人为审批状态
                     const nextAudit_update = {
@@ -570,8 +571,9 @@ module.exports = app => {
                     //         sms.send(smsUser.auth_mobile, content);
                     //     }
                     // }
+                    const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + changeData.tid + '/change/' + changeData.cid + '/info#shenpi');
                     await this.ctx.helper.sendAliSms(nextAuditData.uid, smsTypeConst.const.BG,
-                        smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code });
+                        smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code, code: shenpiUrl });
                 }
                 change_update.total_price = total_price;
                 const options = {
@@ -719,7 +721,7 @@ module.exports = app => {
                 const sms = new SMS(this.ctx);
                 const code = await sms.contentChange(changeData.code);
                 await this.ctx.helper.sendAliSms(users, smsTypeConst.const.BG,
-                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_result, { biangeng: code, status: SmsAliConst.status.back });
+                    smsTypeConst.judge.result.toString(), SmsAliConst.template.change_result, { biangeng: code, status: SmsAliConst.status.back });
             } catch (error) {
                 await this.transaction.rollback();
                 result = false;
@@ -845,8 +847,9 @@ module.exports = app => {
                 // }
                 const sms = new SMS(this.ctx);
                 const code = await sms.contentChange(changeData.code);
+                const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + changeData.tid + '/change/' + changeData.cid + '/info#shenpi');
                 await this.ctx.helper.sendAliSms(lastauditInfo.uid, smsTypeConst.const.BG,
-                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code });
+                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code, code: shenpiUrl });
             } catch (error) {
                 await this.transaction.rollback();
                 result = false;
@@ -1063,17 +1066,22 @@ module.exports = app => {
                 result = true;
 
                 // 添加短信通知-需要审批提醒功能
-                const smsUser = await this.ctx.service.projectAccount.getDataById(auditInfo.uid);
-                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
-                    const smsType = JSON.parse(smsUser.sms_type);
-                    if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
-                        const sms = new SMS(this.ctx);
-                        const code = await sms.contentChange(changeInfo.code);
-                        const result = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + changeInfo.tid + '/change/' + changeInfo.cid + '/info#shenpi');
-                        const content = '【纵横计量支付】' + code + '变更需要您审批。' + result;
-                        sms.send(smsUser.auth_mobile, content);
-                    }
-                }
+                // const smsUser = await this.ctx.service.projectAccount.getDataById(auditInfo.uid);
+                // if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
+                //     const smsType = JSON.parse(smsUser.sms_type);
+                //     if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
+                //         const sms = new SMS(this.ctx);
+                //         const code = await sms.contentChange(changeInfo.code);
+                //         const result = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + changeInfo.tid + '/change/' + changeInfo.cid + '/info#shenpi');
+                //         const content = '【纵横计量支付】' + code + '变更需要您审批。' + result;
+                //         sms.send(smsUser.auth_mobile, content);
+                //     }
+                // }
+                const sms = new SMS(this.ctx);
+                const code = await sms.contentChange(changeInfo.code);
+                const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + changeInfo.tid + '/change/' + changeInfo.cid + '/info#shenpi');
+                await this.ctx.helper.sendAliSms(auditInfo.uid, smsTypeConst.const.BG,
+                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.change_check, { biangeng: code, code: shenpiUrl });
             } catch (error) {
                 await this.transaction.rollback();
                 result = false;

+ 11 - 6
app/service/stage_audit.js

@@ -48,12 +48,13 @@ module.exports = app => {
          *
          * @param {Number} stageId - 期id
          * @param {Number} times - 第几次审批
+         * @param {Number} order_sort - 列表排序方式
          * @returns {Promise<*>}
          */
-        async getAuditors(stageId, times = 1) {
+        async getAuditors(stageId, times = 1, order_sort = 'asc') {
             const sql = 'SELECT la.`aid`, pa.`name`, pa.`company`, pa.`role`, pa.`mobile`, pa.`telephone`, la.`times`, la.`order`, la.`status`, la.`opinion`, la.`begin_time`, la.`end_time`, g.`sort` ' +
                 'FROM ?? AS la, ?? AS pa, (SELECT `aid`,(@i:=@i+1) as `sort` FROM ??, (select @i:=0) as it WHERE `sid` = ? AND `times` = ? GROUP BY `aid`) as g ' +
-                'WHERE la.`sid` = ? and la.`times` = ? and la.`aid` = pa.`id` and g.`aid` = la.`aid` order by la.`order`';
+                'WHERE la.`sid` = ? and la.`times` = ? and la.`aid` = pa.`id` and g.`aid` = la.`aid` order by la.`order` ' + order_sort;
             const sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, this.tableName, stageId, times, stageId, times];
             const result = await this.db.query(sql, sqlParam);
             const sql2 = 'SELECT COUNT(a.`aid`) as num FROM (SELECT `aid` FROM ?? WHERE `sid` = ? AND `times` = ? GROUP BY `aid`) as a';
@@ -261,8 +262,9 @@ module.exports = app => {
                 //     }
                 // }
                 const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
+                const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                 await this.ctx.helper.sendAliSms(audit.aid, smsTypeConst.const.JL,
-                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
+                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order, code: shenpiUrl });
 
                 // todo 更新标段tender状态 ?
                 await transaction.commit();
@@ -333,8 +335,9 @@ module.exports = app => {
                     //     }
                     // }
                     const stageInfo = await this.ctx.service.stage.getDataById(nextAudit.sid);
+                    const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                     await this.ctx.helper.sendAliSms(nextAudit.aid, smsTypeConst.const.JL,
-                        smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
+                        smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order, code: shenpiUrl });
                 } else {
                     // 本期结束
                     // 生成截止本期数据 final数据
@@ -574,8 +577,9 @@ module.exports = app => {
                 //     }
                 // }
                 const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
+                const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                 await this.ctx.helper.sendAliSms(preAuditor.aid, smsTypeConst.const.JL,
-                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
+                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order, code: shenpiUrl });
 
                 await transaction.commit();
             } catch (err) {
@@ -794,8 +798,9 @@ module.exports = app => {
                 //     }
                 // }
                 const stageInfo = await this.ctx.service.stage.getDataById(audit.sid);
+                const shenpiUrl = await this.ctx.helper.urlToShort('http://' + this.ctx.request.header.host + '/wap/tender/' + this.ctx.tender.id + '/stage/' + stageInfo.order);
                 await this.ctx.helper.sendAliSms(audit.aid, smsTypeConst.const.JL,
-                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order });
+                    smsTypeConst.judge.approval.toString(), SmsAliConst.template.stage_check, { qi: stageInfo.order, code: shenpiUrl });
                 await transaction.commit();
             } catch (err) {
                 await transaction.rollback();

+ 60 - 187
app/view/stage/manager.ejs

@@ -4,203 +4,76 @@
         <div class="title-main d-flex">
             <% include ./stage_sub_mini_menu.ejs %>
             <div>
-                第5
+                第<%- ctx.stage.order %>
             </div>
         </div>
     </div>
     <div class="content-wrap">
         <div class="sjs-height-0">
             <div class="c-body">
-                <!--第5期-->
-                <table class="table table-bordered">
-                    <thead>
-                    <tr><th>第5期</th></tr>
-                    </thead>
-                    <tr>
-                        <td>
-                            <table class="table table-bordered table-hover">
-                                <thead>
-                                <tr><th colspan="5">2#<a href="#del" data-toggle="modal" class="btn btn-sm btn-light pull-right text-danger">删除本次审批</a><a href="#pass" data-toggle="modal" class="btn btn-sm btn-warning pull-right mr-2">设置终审审批</a></th></tr>
-                                </thead>
-                                <tbody>
-                                <tr>
-                                    <th width="10%">审批流程</th>
-                                    <th width="25%">审批人</th>
-                                    <th width="15%">审批状态</th>
-                                    <th>审批意见</th>
-                                </tr>
-                                <tr>
-                                    <td>终审</td>
-                                    <td>孙鸿福(总工程师)<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="text-success">审批通过</span><p class="text-muted m-0">2019-08-02</p></td>
-                                    <td></td>
-                                </tr>
-                                <tr>
-                                    <td>3审</td>
-                                    <td>王泰鸿(副工程师)<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="text-success">审批通过</span><p class="text-muted m-0">2019-08-01</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                <tr>
-                                    <td>2审</td>
-                                    <td>张立轩(工程师)<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="text-success">审批通过</span><p class="text-muted m-0">2019-07-30</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                <tr>
-                                    <td>1审</td>
-                                    <td>吕烨华(监理)<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="text-success">审批通过</span><p class="text-muted m-0">2019-07-28</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                <tr>
-                                    <td>原报</td>
-                                    <td>池元化<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="">上报</span><p class="text-muted m-0">2019-07-27</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                </tbody>
-                            </table>
-                            <table class="table table-bordered table-hover">
-                                <thead>
-                                <tr><th colspan="5">1#</th></tr>
-                                </thead>
-                                <tbody>
-                                <tr>
-                                    <th width="10%">审批流程</th>
-                                    <th width="25%">审批人</th>
-                                    <th width="15%">审批状态</th>
-                                    <th>审批意见</th>
-                                </tr>
-                                <tr>
-                                    <td>2审</td>
-                                    <td>张立轩(工程师)<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="text-danger">退回原报</span><p class="text-muted m-0">2019-07-26</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                <tr>
-                                    <td>1审</td>
-                                    <td>吕烨华(监理)<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="text-success">审批通过</span><p class="text-muted m-0">2019-07-25</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                <tr>
-                                    <td>原报</td>
-                                    <td>池元化<p class="text-muted m-0">XXX公司</p></td>
-                                    <td><span class="">上报</span><p class="text-muted m-0">2019-07-24</p></td>
-                                    <td>审批意见内容在这显示</td>
-                                </tr>
-                                </tbody>
-                            </table>
-                        </td>
-                    </tr>
-                </table>
-                <!--第5期 为上报-->
-                <table class="table table-bordered">
-                    <thead>
-                    <tr><th>第5期</th></tr>
-                    </thead>
-                    <tr><td class="text-center text-muted">未上报</td></tr>
-                </table>
-                <!--第4期-->
-                <table class="table table-bordered">
-                    <thead>
-                    <tr><th>第4期</th></tr>
-                    </thead>
-                    <tr><td class="text-center text-muted">需处理前一期后,再进行管理</td></tr>
-                </table>
-                <!--第3期-->
-                <table class="table table-bordered">
-                    <thead>
-                    <tr><th>第3期</th></tr>
-                    </thead>
-                    <tr><td class="text-center text-muted">需处理前一期后,再进行管理</td></tr>
-                </table>
-                <!--第2期-->
-                <table class="table table-bordered">
-                    <thead>
-                    <tr><th>第2期</th></tr>
-                    </thead>
-                    <tr><td class="text-center text-muted">需处理前一期后,再进行管理</td></tr>
-                </table>
-                <!--第1期-->
-                <table class="table table-bordered">
-                    <thead>
-                    <tr><th>第1期</th></tr>
-                    </thead>
-                    <tr><td class="text-center text-muted">需处理前一期后,再进行管理</td></tr>
-                </table>
+                <% if (lastStage) { %>
+                <% for (let i = lastStage.order; i > 0; i--) { %>
+                    <% if (i === lastStage.order && lastStage.status === auditConst.status.checked) { %>
+                    <table class="table table-bordered">
+                        <thead>
+                        <tr><th>第<%- lastStage.order %>期</th></tr>
+                        </thead>
+                        <tr>
+                            <td>
+                                <% for (const la in lastAuditList) { %>
+                                <table class="table table-bordered table-hover">
+                                    <thead>
+                                    <tr><th colspan="5"><%- lastAuditList[la][0].times %>#
+                                            <% if (parseInt(la) === 0) { %><a href="#del" data-toggle="modal" class="btn btn-sm btn-light pull-right text-danger">删除本次审批</a><a href="#pass" data-toggle="modal" class="btn btn-sm btn-warning pull-right mr-2">设置终审审批</a><% } %>
+                                        </th></tr>
+                                    </thead>
+                                    <tbody>
+                                    <tr>
+                                        <th width="10%">审批流程</th>
+                                        <th width="25%">审批人</th>
+                                        <th width="15%">审批状态</th>
+                                        <th>审批意见</th>
+                                    </tr>
+                                    <% for (const audit of lastAuditList[la]) { %>
+                                    <tr>
+                                        <td><% if (audit.max_sort === audit.sort) { %>终<% } else { %><%- audit.sort %><% } %>审</td>
+                                        <td><%- audit.name %><% if (audit.role) { %>(<%- audit.role %>)<% } %><p class="text-muted m-0"><%- audit.company %></p></td>
+                                        <td>
+                                            <% if (audit.status === auditConst.status.checkNo) { %>
+                                            <span class="text-danger">退回原报</span>
+                                            <% } else { %>
+                                            <span class="<%- auditConst.auditStringClass[audit.status] %>"><% if (audit.status !== auditConst.status.uncheck) { %><%- auditConst.auditProgress[audit.status] %><% } %></span>
+                                            <% } %>
+                                            <p class="text-muted m-0"><% if (audit.status !== auditConst.status.uncheck) { %><%- audit.end_time.toLocaleDateString() %><% } %></p></td>
+                                        <td><%- audit.opinion %></td>
+                                    </tr>
+                                    <% } %>
+                                    <tr>
+                                        <td>原报</td>
+                                        <td><%- lastStageUser.name %><% if (lastStageUser.role) { %>(<%- lastStageUser.role %>)<% } %><p class="text-muted m-0"><%- lastStageUser.company %></p></td>
+                                        <td><span>上报</span><p class="text-muted m-0"><%- lastAuditList[la][lastAuditList[la].length - 1].begin_time.toLocaleDateString() %></p></td>
+                                        <td></td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                                <% } %>
+                            </td>
+                        </tr>
+                    </table>
+                    <% } else { %>
+                    <table class="table table-bordered">
+                        <thead>
+                        <tr><th>第<%- i %>期</th></tr>
+                        </thead>
+                        <tr><td class="text-center text-muted"><% if (i === lastStage.order && lastStage.status !== auditConst.status.checked) { %><%- auditConst.statusString[lastStage.status] %><% } else { %>需处理前一期后,再进行管理<% } %></td></tr>
+                    </table>
+                    <% } %>
+                <% } %>
+                <% } %>
             </div>
         </div>
     </div>
 </div>
-<script type="text/javascript" src="/public/js/ztree/jquery.ztree.core.js"></script>
-<script type="text/javascript" src="/public/js/ztree/jquery.ztree.excheck.js"></script>
-<script type="text/javascript">
-    <!--
-    var setting = {
-        view: {
-            selectedMulti: false
-        },
-        data: {
-            simpleData: {
-                enable: true
-            }
-        },
-        callback: {
-            onCheck: onCheck
-        }
-    };
-
-    var zNodes =[
-        { id:1, pId:0, name:"通用报表", open:true},
-        { id:11, pId:1, name:"XXX表 1-1"},
-        { id:122, pId:11, name:"报表 1-2-2"},
-        { id:123, pId:11, name:"报表 1-2-3"},
-        { id:12, pId:1, name:"YYY表", open:true},
-        { id:124, pId:12, name:"报表 1-2-1"},
-        { id:125, pId:12, name:"报表 1-2-2"},
-        { id:126, pId:12, name:"报表 1-2-3"},
-        { id:2, pId:0, name:"定制报表", open:true},
-        { id:21, pId:2, name:"AA报表 2-1"},
-        { id:221, pId:21, name:"报表 2-2-1"},
-        { id:222, pId:21, name:"报表 2-2-2"},
-        { id:223, pId:21, name:"报表 2-2-3"},
-        { id:22, pId:2, name:"BB报表 2-2", open:true},
-        { id:224, pId:22, name:"报表 2-2-1"},
-        { id:225, pId:22, name:"报表 2-2-2"},
-        { id:226, pId:22, name:"报表 2-2-3"}
-    ];
-
-    var clearFlag = false;
-    function onCheck(e, treeId, treeNode) {
-        count();
-        if (clearFlag) {
-            clearCheckedOldNodes();
-        }
-    }
-    function clearCheckedOldNodes() {
-        var zTree = $.fn.zTree.getZTreeObj("treeDemo2"),
-            nodes = zTree.getChangeCheckedNodes();
-        for (var i=0, l=nodes.length; i<l; i++) {
-            nodes[i].checkedOld = nodes[i].checked;
-        }
-    }
-    function count() {
-        var zTree = $.fn.zTree.getZTreeObj("treeDemo2"),
-            checkCount = zTree.getCheckedNodes(true).length;
-        $("#checkCount2").text(checkCount);
-
-    }
-    function createTree() {
-        $.fn.zTree.init($("#treeDemo2"), setting, zNodes);
-        count();
-    }
-    $(document).ready(function(){
-        createTree();
-    });
-    //-->
-</script>
 <script type="text/javascript">
     autoFlashHeight();
 </script>

+ 1 - 0
app/view/stage/manager_modal.ejs

@@ -37,3 +37,4 @@
         </div>
     </div>
 </div>
+<% include ./audit_modal.ejs %>