瀏覽代碼

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

TonyKang 4 年之前
父節點
當前提交
881ea3f18f

+ 20 - 0
app/const/advance.js

@@ -0,0 +1,20 @@
+'use strict';
+
+/**
+ * 预付款相关常量
+ *
+ * @author EllisRan
+ * @date 2021/6/17
+ * @version
+ */
+
+// 预付款类型
+const typeCol = [
+    { key: 'start', type: 0, name: '开工预付款' },
+    { key: 'material', type: 1, name: '材料预付款' },
+    // { key: 'safe', type: 2, name: '安全生产预付款' },
+]
+
+module.exports = {
+    typeCol,
+};

+ 7 - 7
app/const/third_party.js

@@ -9,15 +9,15 @@
  */
  */
 
 
 const gxby = [
 const gxby = [
-    {value: 0, name: '未开始'},
-    {value: 1, name: '进行中'},
-    {value: 2, name: '已完成', color: '#5ACD94'}
+    { value: 0, name: '未开始', limit: false, },
+    { value: 1, name: '进行中', limit: false, },
+    { value: 2, name: '已完成', color: '#5ACD94', limit: true, }
 ];
 ];
 const dagl = [
 const dagl = [
-    {value: 0, name: '未完备'},
-    {value: 1, name: '第一阶段'},
-    {value: 2, name: '第二阶段'},
-    {value: 10, name: '完备', color: '#5ACD94'}
+    { value: 0, name: '未完备', limit: false },
+    { value: 1, name: '第一阶段', limit: true, ratio: 100, },
+    { value: 2, name: '第二阶段', limit: true, ratio: 100, },
+    { value: 10, name: '完备', color: '#5ACD94', limit: true, ratio: 100 }
 ];
 ];
 
 
 module.exports = {
 module.exports = {

+ 1 - 1
app/controller/advance_controller.js

@@ -167,7 +167,7 @@ module.exports = app => {
                     prev_total_amount = ctx.helper.formatMoney(ctx.helper.add(cur_amount, ctx.advance.prev_amount), ',', isLimitMax ? s2.length : 2);
                     prev_total_amount = ctx.helper.formatMoney(ctx.helper.add(cur_amount, ctx.advance.prev_amount), ',', isLimitMax ? s2.length : 2);
                 } else {
                 } else {
                     cur_amount = ctx.advance.cur_amount;
                     cur_amount = ctx.advance.cur_amount;
-                    const s2 = parseFloat(ctx.advance.prev_total_amount).toString().split('.')[1];
+                    const s2 = parseFloat(ctx.advance.prev_total_amount).toString().split('.')[1] || '';
                     prev_total_amount = ctx.helper.formatMoney(ctx.advance.prev_total_amount, ',', isLimitMax ? s2.length : 2);
                     prev_total_amount = ctx.helper.formatMoney(ctx.advance.prev_total_amount, ',', isLimitMax ? s2.length : 2);
                 }
                 }
 
 

+ 4 - 2
app/controller/revise_controller.js

@@ -891,11 +891,13 @@ module.exports = app => {
 
 
                 await ctx.service.reviseAudit.check(revise, checkType, ctx.request.body.opinion, revise.times);
                 await ctx.service.reviseAudit.check(revise, checkType, ctx.request.body.opinion, revise.times);
 
 
-                ctx.redirect('/tender/' + ctx.tender.id + '/revise/info');
+                // ctx.redirect('/tender/' + ctx.tender.id + '/revise/info');
+                ctx.redirect(ctx.request.headers.referer);
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);
                 this.postError(err, '审批失败');
                 this.postError(err, '审批失败');
-                ctx.redirect('/tender/' + ctx.tender.id + '/revise/info');
+                // ctx.redirect('/tender/' + ctx.tender.id + '/revise/info');
+                ctx.redirect(ctx.request.headers.referer);
             }
             }
         }
         }
 
 

+ 35 - 7
app/controller/setting_controller.js

@@ -34,11 +34,10 @@ module.exports = app => {
         }
         }
 
 
         async _checkMenu(pid) {
         async _checkMenu(pid) {
-            const s2bData = new S2b(this.ctx);
-            const s2bProj = await s2bData.getS2bProj(pid);
-            // this.ctx.subMenu.s2b.display = !!s2bProj && (!!s2bProj.gxby || !!s2bProj.dagl);
-            this.ctx.subMenu.s2b.display = false;
-            return s2bProj;
+            const ctx = this.ctx;
+            await this.ctx.service.s2bProj.refreshSessionS2b(pid);
+            ctx.subMenu.s2b.display = !!ctx.session.sessionProject.gxby || !!ctx.session.sessionProject.dagl;
+            // this.ctx.subMenu.s2b.display = false;
         }
         }
 
 
         /**
         /**
@@ -770,7 +769,7 @@ module.exports = app => {
                 for (const t of tenders) {
                 for (const t of tenders) {
                     t.measure_type_str = t.measure_type === measureType.tz.value ? measureType.tz.title : measureType.gcl.title;
                     t.measure_type_str = t.measure_type === measureType.tz.value ? measureType.tz.title : measureType.gcl.title;
                     const stages = await ctx.service.stage.getAllDataByCondition({ where: { tid: t.id } });
                     const stages = await ctx.service.stage.getAllDataByCondition({ where: { tid: t.id } });
-                    t.stage_count_str = `第${stages.count || 0}期`;
+                    t.stage_count_str = `第${stages.length || 0}期`;
                     const user = await ctx.service.projectAccount.getAccountInfoById(t.user_id);
                     const user = await ctx.service.projectAccount.getAccountInfoById(t.user_id);
                     t.user_str = user.name + '-' + user.company;
                     t.user_str = user.name + '-' + user.company;
                     t.show_time = stages.length > 0 ? stages[stages.length - 1].cache_time_r || stages[stages.length - 1].in_time : t.create_time;
                     t.show_time = stages.length > 0 ? stages[stages.length - 1].cache_time_r || stages[stages.length - 1].in_time : t.create_time;
@@ -804,7 +803,36 @@ module.exports = app => {
                 ctx.body = { err: 0, msg: '', data: null };
                 ctx.body = { err: 0, msg: '', data: null };
             } catch (error) {
             } catch (error) {
                 ctx.helper.log(error);
                 ctx.helper.log(error);
-                ctx.ajaxError(error, '保存数据错误');
+                this.ajaxErrorBody(error, '保存数据失败');
+            }
+        }
+
+        async s2bUpdateStatus(ctx) {
+            try {
+                const projectId = ctx.session.sessionProject.id;
+                const projectData = await ctx.service.project.getDataById(projectId);
+                if (projectData === null) throw '没有对应的项目数据';
+                if (ctx.session.sessionUser.is_admin === 0) throw '没有访问权限';
+
+                const data = JSON.parse(ctx.request.body.data);
+                console.log(data);
+                if (!data.type || data.status === undefined) throw '提交数据错误';
+
+                const responseData = { err: 0, msg: '', data: null };
+                switch (data.type) {
+                    case 'gxby':
+                        responseData.data = await this.ctx.service.s2bProj.updateGxbyStatus(projectId, data.status, data.limit);
+                        break;
+                    case 'dagl':
+                        responseData.data = await this.ctx.service.s2bProj.updateDaglStatus(projectId, data.status, data.limit, data.ratio);
+                        break;
+                    default: throw '提交数据错误';
+                }
+                ctx.body = responseData;
+            } catch (error) {
+                console.log(error);
+                ctx.helper.log(error);
+                this.ajaxErrorBody(error, '保存数据失败');
             }
             }
         }
         }
     }
     }

+ 2 - 0
app/controller/stage_controller.js

@@ -365,7 +365,9 @@ module.exports = app => {
                 const checkDataModel = require('../lib/ledger').checkData;
                 const checkDataModel = require('../lib/ledger').checkData;
                 const checkData = new checkDataModel(ctx);
                 const checkData = new checkDataModel(ctx);
                 checkData.loadData(ledgerData, posData);
                 checkData.loadData(ledgerData, posData);
+                await this.ctx.service.s2bProj.refreshSessionS2b();
                 const check3fResult = checkData.check3fLimit(ctx.tender.data);
                 const check3fResult = checkData.check3fLimit(ctx.tender.data);
+
                 const [qtyData, overData] = ctx.helper.checkBillsWithPos2(ledgerData, posData,
                 const [qtyData, overData] = ctx.helper.checkBillsWithPos2(ledgerData, posData,
                     ['contract_qty', 'qc_qty'], projRela.banOver, this.ctx.tender.data.measure_type === measureType.tz.value);
                     ['contract_qty', 'qc_qty'], projRela.banOver, this.ctx.tender.data.measure_type === measureType.tz.value);
                 qtyData.error.forEach(x => { x.errorType = 'qty'; });
                 qtyData.error.forEach(x => { x.errorType = 'qty'; });

+ 114 - 0
app/controller/wap_controller.js

@@ -11,6 +11,7 @@ const URL = require('url');
 const maintainConst = require('../const/maintain');
 const maintainConst = require('../const/maintain');
 const auditConst = require('../const/audit');
 const auditConst = require('../const/audit');
 const changeConst = require('../const/change');
 const changeConst = require('../const/change');
+const advanceConst = require('../const/advance');
 
 
 module.exports = app => {
 module.exports = app => {
 
 
@@ -124,10 +125,21 @@ module.exports = app => {
             }
             }
             // 获取待审批的变更期
             // 获取待审批的变更期
             const auditChanges = await ctx.service.changeAudit.getAuditChangeByWap(ctx.session.sessionUser.accountId);
             const auditChanges = await ctx.service.changeAudit.getAuditChangeByWap(ctx.session.sessionUser.accountId);
+            // 获取待审批的台账修订
+            const auditRevise = await ctx.service.reviseAudit.getAuditReviseByWap(ctx.session.sessionUser.accountId);
+            for (const revise of auditRevise) {
+                const yb_audit = await ctx.service.projectAccount.getAccountInfoById(revise.audit_id);
+                revise.yb_name = yb_audit.name;
+            }
+            // 获取待审批的预付款
+            const auditAdvance = await ctx.service.advanceAudit.getAuditAdvanceByWap(ctx.session.sessionUser.accountId);
             const renderData = {
             const renderData = {
                 auditStages,
                 auditStages,
                 auditChanges,
                 auditChanges,
+                auditRevise,
+                auditAdvance,
                 changeConst,
                 changeConst,
+                advanceConst,
                 tpUnit: 2,
                 tpUnit: 2,
             };
             };
             await ctx.render('wap/dashboard.ejs', renderData);
             await ctx.render('wap/dashboard.ejs', renderData);
@@ -246,13 +258,32 @@ module.exports = app => {
                     c.curAuditor = await ctx.service.changeAudit.getLastUser(c.cid, c.times);
                     c.curAuditor = await ctx.service.changeAudit.getLastUser(c.cid, c.times);
                 }
                 }
 
 
+                // 台账修订列表
+                const revises = await ctx.service.ledgerRevise.getReviseList(ctx.tender.id);
+                for (const lr of revises) {
+                    if (lr.valid) {
+                        lr.curAuditor = await ctx.service.reviseAudit.getAuditorByStatus(lr.id, lr.status, lr.times);
+                    }
+                }
+
+                // 预付款期数获取
+                const advanceList = [];
+                for (const t of advanceConst.typeCol) {
+                    const advance = await ctx.service.advance.getLastestAdvance(ctx.tender.id, t.type, true);
+                    advanceList.push(advance);
+                }
+
                 const renderData = {
                 const renderData = {
                     tender,
                     tender,
                     stages,
                     stages,
                     changes,
                     changes,
+                    revises,
+                    advanceList,
                     auditConst: auditConst.stage,
                     auditConst: auditConst.stage,
                     auditChangeConst: auditConst.flow,
                     auditChangeConst: auditConst.flow,
+                    auditReviseConst: auditConst.revise,
                     changeConst,
                     changeConst,
+                    advanceConst,
                     tpUnit: ctx.tender.info.decimal.tp,
                     tpUnit: ctx.tender.info.decimal.tp,
                     monthProgress,
                     monthProgress,
                     stagesEcharts: JSON.parse(JSON.stringify(stages)).reverse(),
                     stagesEcharts: JSON.parse(JSON.stringify(stages)).reverse(),
@@ -342,6 +373,89 @@ module.exports = app => {
         }
         }
 
 
         /**
         /**
+         * 修订审批详细页
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        async revise(ctx) {
+            try {
+                const tender = ctx.tender.data;
+                const revise = await ctx.service.ledgerRevise.getDataByCondition({ id: ctx.params.rid });
+                revise.user = await ctx.service.projectAccount.getAccountInfoById(revise.uid);
+                const times = revise.status === auditConst.revise.status.checkNo ? revise.times - 1 : revise.times;
+                revise.curAuditor = await ctx.service.reviseAudit.getAuditorByStatus(revise.id, revise.status, times);
+                revise.auditors = await ctx.service.reviseAudit.getAuditors(revise.id, times);
+                console.log(times, revise.auditors);
+                const renderData = {
+                    tender,
+                    revise,
+                    auditConst: auditConst.revise,
+                };
+                await ctx.render('wap/shenpi_revise.ejs', renderData);
+            } catch (err) {
+                this.log(err);
+                ctx.redirect('/wap/list');
+            }
+        }
+
+        /**
+         * 预付款列表页
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        async advance(ctx) {
+            try {
+                const tender = ctx.tender.data;
+                const { decimal } = ctx.tender.info;
+                this.decimal = decimal.pay ? decimal.payTp : decimal.tp;
+                const advancePayTotalList = [];
+                const advanceList = [];
+                for (const t of advanceConst.typeCol) {
+                    const advancePayTotal = ctx.tender.info.deal_param[t.key + 'Advance'];
+                    advancePayTotalList.push(advancePayTotal);
+                    const advances = await ctx.service.advance.getAdvanceList(ctx.tender.id, t.type, this.decimal, advancePayTotal);
+                    advanceList.push(advances);
+                }
+                const renderData = {
+                    tender,
+                    advancePayTotalList,
+                    advanceList,
+                    auditConst: auditConst.advance,
+                    advanceConst,
+                };
+                await ctx.render('wap/shenpi_advance.ejs', renderData);
+            } catch (err) {
+                this.log(err);
+                ctx.redirect('/wap/list');
+            }
+        }
+
+        /**
+         * 预付款详情页 GET
+         * @param {Object} ctx 全局上下文
+         */
+        async advanceDetail(ctx) {
+            try {
+                const tender = ctx.tender.data;
+                ctx.advance.advancePayTotal = ctx.tender.info.deal_param[ advanceConst.typeCol[ctx.advance.type].key + 'Advance'];
+                // 获取审批流程中左边列表
+                ctx.advance.auditors2 = await ctx.service.advanceAudit.getAuditGroupByList(ctx.advance.id, ctx.advance.times);
+                const renderData = {
+                    tender,
+                    advance: ctx.advance,
+                    auditConst: auditConst.advance,
+                    advanceConst,
+                };
+                await ctx.render('wap/shenpi_advance_detail.ejs', renderData);
+            } catch (error) {
+                this.log(error);
+                ctx.redirect('/wap/tender/' + ctx.tender.id + '/advance');
+            }
+        }
+
+        /**
          * 变更令审批
          * 变更令审批
          * @param {Object} ctx - egg全局变量
          * @param {Object} ctx - egg全局变量
          * @return {void}
          * @return {void}

+ 25 - 10
app/lib/ledger.js

@@ -587,7 +587,7 @@ class checkData {
             if (ratio === 0) {
             if (ratio === 0) {
                 if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
                 if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
             } else {
             } else {
-                const tp = this.ctx.helper.mul(data.total_price, ratio, this.ctx.tender.info.decimal.tp);
+                const tp = this.ctx.helper.mul(data.total_price, this.ctx.helper.div(ratio, 100, 4), this.ctx.tender.info.decimal.tp);
                 const checkTp = this.ctx.helper.add(data.contract_tp, data.pre_contract_tp);
                 const checkTp = this.ctx.helper.add(data.contract_tp, data.pre_contract_tp);
                 if (tp > checkTp) return 1; // 违规
                 if (tp > checkTp) return 1; // 违规
                 if (tp < checkTp) return 2; // 漏计
                 if (tp < checkTp) return 2; // 漏计
@@ -600,11 +600,11 @@ class checkData {
             if (data.contract_qty || data.qc_qty || data.pre_contract_qty || data.pre_qc_qty) return 1; // 违规
             if (data.contract_qty || data.qc_qty || data.pre_contract_qty || data.pre_qc_qty) return 1; // 违规
         }
         }
         if (limit === 1) {
         if (limit === 1) {
-            if (ratio === 0) {
+            if (!ratio || ratio === 0) {
                 if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
                 if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
             } else {
             } else {
                 const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, unit);
                 const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, unit);
-                const checkQty = this.ctx.helper.mul(data.quantity, ratio, precision.value);
+                const checkQty = this.ctx.helper.mul(data.quantity, this.ctx.helper.div(ratio, 100, 4), precision.value);
                 const qty = this.ctx.helper.add(data.contract_qty, data.pre_contract_qty);
                 const qty = this.ctx.helper.add(data.contract_qty, data.pre_contract_qty);
                 if (qty > checkQty) return 1; // 违规
                 if (qty > checkQty) return 1; // 违规
                 if (qty < checkQty) return 2; // 漏计
                 if (qty < checkQty) return 2; // 漏计
@@ -613,6 +613,23 @@ class checkData {
         return 0; // 合法
         return 0; // 合法
     }
     }
 
 
+    _getRatio(type, status) {
+        if (type === 'gxby') return null;
+        const gs = this.ctx.session.sessionProject.dagl_status.find(x => { return x.value === status });
+        return gs ? gs.ratio : null;
+    }
+
+
+    _getValid = function (type, status, limit) {
+        if (limit) {
+            const statusConst = type === 'gxby' ? this.ctx.session.sessionProject.gxby_status : this.ctx.session.sessionProject.dagl_status;
+            const sc = statusConst.find(x => { return x.value === status; });
+            return sc ? (sc.limit ? 1 : 0) : 0;
+        } else {
+            return -1;
+        }
+    };
+
     _checkLeafBills3fLimit(checkType, bills, result, checkInfo) {
     _checkLeafBills3fLimit(checkType, bills, result, checkInfo) {
         const over = [], lost = [];
         const over = [], lost = [];
         const posRange = this.checkPos.getLedgerPos(bills.id);
         const posRange = this.checkPos.getLedgerPos(bills.id);
@@ -620,13 +637,12 @@ class checkData {
             for (const p of posRange) {
             for (const p of posRange) {
                 const posCheckInfo = this.ctx.helper._.assign({}, checkInfo);
                 const posCheckInfo = this.ctx.helper._.assign({}, checkInfo);
                 for (const ct of checkType) {
                 for (const ct of checkType) {
-                    if (p[ct + '_limit'] >= 0) {
+                    if (p[ct + '_limit'] > 0) {
                         posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
                         posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
-                        posCheckInfo[ct + '_ratio'] = p[ct + '_ratio'];
                     }
                     }
                 }
                 }
                 for (const ct of checkType) {
                 for (const ct of checkType) {
-                    const checkResult = this._check3fQty(p, posCheckInfo[ct + '_limit'], posCheckInfo[ct + '_ratio'], bills.unit);
+                    const checkResult = this._check3fQty(p, this._getValid(ct, p[ct + '_status'], posCheckInfo[ct + '_limit']), this._getRatio(ct, p[ct+'_status']), bills.unit);
                     if (checkResult === 1) {
                     if (checkResult === 1) {
                         if (over.indexOf(ct) === -1) over.push(ct);
                         if (over.indexOf(ct) === -1) over.push(ct);
                     }
                     }
@@ -638,8 +654,8 @@ class checkData {
         } else {
         } else {
             for (const ct of checkType) {
             for (const ct of checkType) {
                 const checkResult = bills.is_tp
                 const checkResult = bills.is_tp
-                    ? this._check3f(bills, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'])
-                    : this._check3fQty(bills, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'], bills.unit);
+                    ? this._check3f(bills, this._getValid(ct, bills[ct + '_status'], checkInfo[ct + '_limit']), this._getRatio(ct, bills[ct+'_status']))
+                    : this._check3fQty(bills, this._getValid(ct, bills[ct + '_status'], checkInfo[ct + '_limit']), this._getRatio(ct, bills[ct+'_status']), bills.unit);
                 if (checkResult === 1) {
                 if (checkResult === 1) {
                     if (over.indexOf(ct) === -1) over.push(ct);
                     if (over.indexOf(ct) === -1) over.push(ct);
                 }
                 }
@@ -672,9 +688,8 @@ class checkData {
     _recursiveCheckBills3fLimit(checkType, bills, result, parentCheckInfo) {
     _recursiveCheckBills3fLimit(checkType, bills, result, parentCheckInfo) {
         const checkInfo = this.ctx.helper._.assign({}, parentCheckInfo);
         const checkInfo = this.ctx.helper._.assign({}, parentCheckInfo);
         for (const ct of checkType) {
         for (const ct of checkType) {
-            if (bills[ct + '_limit'] >= 0) {
+            if (bills[ct + '_limit'] > 0) {
                 checkInfo[ct + '_limit'] = bills[ct + '_limit'];
                 checkInfo[ct + '_limit'] = bills[ct + '_limit'];
-                checkInfo[ct + '_ratio'] = bills[ct + '_ratio'];
             }
             }
         }
         }
         if (bills.children && bills.children.length > 0) {
         if (bills.children && bills.children.length > 0) {

+ 7 - 3
app/lib/wechat.js

@@ -36,7 +36,8 @@ class WX {
         try {
         try {
             // const templateId = template;
             // const templateId = template;
             let templateId = '';
             let templateId = '';
-            const sck = 'https://scn.ink/';
+            // const sck = 'https://scn.ink/';
+            const sck = '';
             for (const openid of wx_openid) {
             for (const openid of wx_openid) {
                 let url = '';
                 let url = '';
                 let msgData = '';
                 let msgData = '';
@@ -113,7 +114,8 @@ class WX {
                         break;
                         break;
                     case wxConst.template.revise:
                     case wxConst.template.revise:
                         templateId = wxConst.templateId.revise;
                         templateId = wxConst.templateId.revise;
-                        remark = data.status === wxConst.status.check ? '微信暂无法在线审批' :
+                        url = this.ctx.protocol + '://' + this.ctx.host + '/wx/url2wap?project=' + data.code + '&url=' + sck + data.wap_url;
+                        remark = data.status === wxConst.status.check ? '微信可快速审批,如需进行详细审批' :
                             (data.status === wxConst.status.success ? '审批已通过,查看审批结果' :
                             (data.status === wxConst.status.success ? '审批已通过,查看审批结果' :
                                 (data.status === wxConst.status.back ? '审批被退回,查看退回结果' : '审批已上报,查看审批结果'));
                                 (data.status === wxConst.status.back ? '审批被退回,查看退回结果' : '审批已上报,查看审批结果'));
                         msgData = {
                         msgData = {
@@ -136,6 +138,7 @@ class WX {
                         break;
                         break;
                     case wxConst.template.material:
                     case wxConst.template.material:
                         templateId = wxConst.templateId.material;
                         templateId = wxConst.templateId.material;
+                        url = this.ctx.protocol + '://' + this.ctx.host + '/wx/url2wap?project=' + data.code + '&url=' + sck + data.wap_url;
                         remark = data.status === wxConst.status.check ? '微信暂无法在线审批' :
                         remark = data.status === wxConst.status.check ? '微信暂无法在线审批' :
                             (data.status === wxConst.status.success ? '审批已通过,查看审批结果' : '审批被退回,查看退回结果');
                             (data.status === wxConst.status.success ? '审批已通过,查看审批结果' : '审批被退回,查看退回结果');
                         msgData = {
                         msgData = {
@@ -164,7 +167,8 @@ class WX {
                         break;
                         break;
                     case wxConst.template.advance:
                     case wxConst.template.advance:
                         templateId = wxConst.templateId.advance;
                         templateId = wxConst.templateId.advance;
-                        remark = data.status === wxConst.status.check ? '微信暂无法在线审批' :
+                        url = this.ctx.protocol + '://' + this.ctx.host + '/wx/url2wap?project=' + data.code + '&url=' + sck + data.wap_url;
+                        remark = data.status === wxConst.status.check ? '微信可快速审批,如需进行详细审批' :
                             (data.status === wxConst.status.success ? '审批已通过,查看审批结果' : '审批被退回,查看退回结果');
                             (data.status === wxConst.status.success ? '审批已通过,查看审批结果' : '审批被退回,查看退回结果');
                         msgData = {
                         msgData = {
                             first: {
                             first: {

+ 5 - 0
app/public/js/change_information_set.js

@@ -416,6 +416,10 @@ $(document).ready(() => {
                 return;
                 return;
             });
             });
         },
         },
+        valueChanged(e, info) {
+            // 防止ctrl+z撤销数据
+            SpreadJsObj.reLoadRowData(info.sheet, info.row);
+        }
     };
     };
 
 
     const preUrl = window.location.pathname.split('/').slice(0, 4).join('/');
     const preUrl = window.location.pathname.split('/').slice(0, 4).join('/');
@@ -520,6 +524,7 @@ $(document).ready(() => {
         changeSpread.bind(spreadNS.Events.EditEnded, changeSpreadObj.editEnded);
         changeSpread.bind(spreadNS.Events.EditEnded, changeSpreadObj.editEnded);
         changeSpread.bind(spreadNS.Events.SelectionChanged, changeSpreadObj.selectionChanged);
         changeSpread.bind(spreadNS.Events.SelectionChanged, changeSpreadObj.selectionChanged);
         changeSpread.bind(spreadNS.Events.ClipboardPasted, changeSpreadObj.clipboardPasted);
         changeSpread.bind(spreadNS.Events.ClipboardPasted, changeSpreadObj.clipboardPasted);
+        changeSpread.bind(spreadNS.Events.ValueChanged, changeSpreadObj.valueChanged);
         SpreadJsObj.addDeleteBind(changeSpread, changeSpreadObj.deletePress);
         SpreadJsObj.addDeleteBind(changeSpread, changeSpreadObj.deletePress);
         changeSpreadSheet.getCell(-1, 10).foreColor('#dc3545');
         changeSpreadSheet.getCell(-1, 10).foreColor('#dc3545');
 
 

+ 24 - 11
app/public/js/ledger_check.js

@@ -144,6 +144,20 @@ const ledgerCheckUtil = {
             }
             }
             return list.other;
             return list.other;
         };
         };
+        const getRatio = function (type, status) {
+            if (type === 'gxby') return null;
+            const gs = option.status.dagl.find(x => { return x.value === status });
+            return gs ? gs.ratio : null;
+        };
+        const getValid = function (type, status, limit) {
+            if (limit) {
+                const statusConst = type === 'gxby' ? option.status.gxby : option.status.dagl;
+                const sc = statusConst.find(x => { return x.value === status; });
+                return sc ? (sc.limit ? 1 : 0) : 0;
+            } else {
+                return -1;
+            }
+        };
         const check3f = function (data, limit, ratio) {
         const check3f = function (data, limit, ratio) {
             if (limit === 0) {
             if (limit === 0) {
                 if (data.contract_tp || data.pre_contract_tp) return 1; // 违规
                 if (data.contract_tp || data.pre_contract_tp) return 1; // 违规
@@ -152,7 +166,7 @@ const ledgerCheckUtil = {
                 if (ratio === 0) {
                 if (ratio === 0) {
                     if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
                     if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
                 } else {
                 } else {
-                    const tp = ZhCalc.mul(data.total_price, ratio, this.ctx.tender.info.decimal.tp);
+                    const tp = ZhCalc.mul(data.total_price, ZhCalc.div(ratio, 100, 4), this.ctx.tender.info.decimal.tp);
                     const checkTp = ZhCalc.add(data.contract_tp, data.pre_contract_tp);
                     const checkTp = ZhCalc.add(data.contract_tp, data.pre_contract_tp);
                     if (tp > checkTp) return 1; // 违规
                     if (tp > checkTp) return 1; // 违规
                     if (tp < checkTp) return 2; // 漏计
                     if (tp < checkTp) return 2; // 漏计
@@ -165,12 +179,12 @@ const ledgerCheckUtil = {
                 if (data.contract_qty || data.qc_qty || data.pre_contract_qty || data.pre_qc_qty) return 1; // 违规
                 if (data.contract_qty || data.qc_qty || data.pre_contract_qty || data.pre_qc_qty) return 1; // 违规
             }
             }
             if (limit === 1) {
             if (limit === 1) {
-                if (ratio <= 0) {
+                if (!ratio || ratio === 0) {
                     if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
                     if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
                 } else {
                 } else {
                     const precision = findPrecision(tenderInfo.precision, unit);
                     const precision = findPrecision(tenderInfo.precision, unit);
-                    const checkQty = ZhCalc.mul(data.quantity, ratio, precision.value);
-                    const qty = ZhCalc.add(data.contract_qty, data.pre_contract_qty);
+                    const checkQty = ZhCalc.mul(data.quantity, ZhCalc.div(ratio, 100, 4), precision.value);
+                    const qty = ZhCalc.add(data.contract_qty, data.pre_contract_qty) || 0;
                     if (qty > checkQty) return 1; // 违规
                     if (qty > checkQty) return 1; // 违规
                     if (qty < checkQty) return 2; // 漏计
                     if (qty < checkQty) return 2; // 漏计
                 }
                 }
@@ -184,13 +198,13 @@ const ledgerCheckUtil = {
                 for (const p of posRange) {
                 for (const p of posRange) {
                     const posCheckInfo = _.assign({}, checkInfo);
                     const posCheckInfo = _.assign({}, checkInfo);
                     for (const ct of option.checkType) {
                     for (const ct of option.checkType) {
-                        if (p[ct + '_limit'] >= 0) {
+                        if (p[ct + '_limit'] > 0) {
                             posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
                             posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
-                            posCheckInfo[ct + '_ratio'] = p[ct + '_ratio'];
                         }
                         }
                     }
                     }
                     for (const ct of option.checkType) {
                     for (const ct of option.checkType) {
-                        const checkResult = check3fQty(p, posCheckInfo[ct + '_limit'], posCheckInfo[ct + '_ratio'], bills.unit);
+                        const checkResult = check3fQty(p, getValid(ct, p[ct + '_status'], posCheckInfo[ct + '_limit']),
+                            getRatio(ct, p[ct + '_status']), bills.unit);
                         if (checkResult === 1) {
                         if (checkResult === 1) {
                             if (over.indexOf(ct) === -1) over.push(ct);
                             if (over.indexOf(ct) === -1) over.push(ct);
                         }
                         }
@@ -202,8 +216,8 @@ const ledgerCheckUtil = {
             } else {
             } else {
                 for (const ct of option.checkType) {
                 for (const ct of option.checkType) {
                     const checkResult = bills.is_tp
                     const checkResult = bills.is_tp
-                        ? check3f(bills, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'])
-                        : check3fQty(bills, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'], bills.unit);
+                        ? check3f(bills, getValid(ct, bills[ct + '_status'], checkInfo[ct + '_limit']), getRatio(ct, bills[ct + '_status']))
+                        : check3fQty(bills, getValid(ct, bills[ct + '_status'], checkInfo[ct + '_limit']), getRatio(ct, bills[ct + '_status']), bills.unit);
                     if (checkResult === 1) {
                     if (checkResult === 1) {
                         if (over.indexOf(ct) === -1) over.push(ct);
                         if (over.indexOf(ct) === -1) over.push(ct);
                     }
                     }
@@ -221,9 +235,8 @@ const ledgerCheckUtil = {
         const recursiveCheckBills3fLimit = function (bills, parentCheckInfo) {
         const recursiveCheckBills3fLimit = function (bills, parentCheckInfo) {
             const checkInfo = _.assign({}, parentCheckInfo);
             const checkInfo = _.assign({}, parentCheckInfo);
             for (const ct of option.checkType) {
             for (const ct of option.checkType) {
-                if (bills[ct + '_limit'] >= 0) {
+                if (bills[ct + '_limit'] > 0) {
                     checkInfo[ct + '_limit'] = bills[ct + '_limit'];
                     checkInfo[ct + '_limit'] = bills[ct + '_limit'];
-                    checkInfo[ct + '_ratio'] = bills[ct + '_ratio'];
                 }
                 }
             }
             }
             if (bills.children && bills.children.length > 0) {
             if (bills.children && bills.children.length > 0) {

+ 3 - 1
app/public/js/stage.js

@@ -242,7 +242,7 @@ $(document).ready(() => {
             enable: 1, isTz: checkTzMeasureType(),
             enable: 1, isTz: checkTzMeasureType(),
         },
         },
         limit3f: {
         limit3f: {
-            enable: 1, checkType: [],
+            enable: 1, checkType: [], status: thirdParty,
         }
         }
     };
     };
     if (tender.s2b_gxby_check) checkOption.limit3f.checkType.push('gxby');
     if (tender.s2b_gxby_check) checkOption.limit3f.checkType.push('gxby');
@@ -634,9 +634,11 @@ $(document).ready(() => {
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
     ledgerSpreadSetting.cols.push(
     ledgerSpreadSetting.cols.push(
         {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
         {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
+        {title: '档案限制', colSpan: '1', rowSpan: '2', field: 'dagl_limit', hAlign: 0, width: 80, readOnly: true},
     );
     );
     posSpreadSetting.cols.push(
     posSpreadSetting.cols.push(
         {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
         {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
+        {title: '档案限制', colSpan: '1', rowSpan: '2', field: 'dagl_limit', hAlign: 0, width: 80, readOnly: true},
     );
     );
     // 数量变更列,添加按钮
     // 数量变更列,添加按钮
     const qcCol = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'});
     const qcCol = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'});

+ 4 - 0
app/router.js

@@ -91,6 +91,7 @@ module.exports = app => {
     // 接口设置
     // 接口设置
     app.get('/setting/api', sessionAuth, 'settingController.s2b');
     app.get('/setting/api', sessionAuth, 'settingController.s2b');
     app.post('/setting/api/update', sessionAuth, 'settingController.s2bUpdate');
     app.post('/setting/api/update', sessionAuth, 'settingController.s2bUpdate');
+    app.post('/setting/api/update-status', sessionAuth, 'settingController.s2bUpdateStatus');
 
 
 
 
     // 项目相关
     // 项目相关
@@ -449,6 +450,9 @@ module.exports = app => {
     app.get('/wap/tender/:id/stage/:order', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.stage');
     app.get('/wap/tender/:id/stage/:order', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.stage');
     app.get('/wap/tender/:id/change/:cid/info', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.change');
     app.get('/wap/tender/:id/change/:cid/info', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.change');
     app.post('/wap/tender/:id/change/approval', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.changeApproval');
     app.post('/wap/tender/:id/change/approval', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.changeApproval');
+    app.get('/wap/tender/:id/revise/:rid/info', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.revise');
+    app.get('/wap/tender/:id/advance', sessionAuth, tenderCheck, uncheckTenderCheck, 'wapController.advance');
+    app.get('/wap/tender/:id/advance/:order/detail', sessionAuth, tenderCheck, uncheckTenderCheck, advanceCheck, 'wapController.advanceDetail');
 
 
     // 微信
     // 微信
     app.get('/wx', 'wechatController.index');
     app.get('/wx', 'wechatController.index');

+ 55 - 5
app/service/advance_audit.js

@@ -5,6 +5,7 @@ const shenpiConst = require('../const/shenpi');
 const pushType = require('../const/audit').pushType;
 const pushType = require('../const/audit').pushType;
 const smsTypeConst = require('../const/sms_type');
 const smsTypeConst = require('../const/sms_type');
 const wxConst = require('../const/wechat_template.js');
 const wxConst = require('../const/wechat_template.js');
+const advanceConst = require('../const/advance');
 module.exports = app => {
 module.exports = app => {
     class AdvanceAudit extends app.BaseService {
     class AdvanceAudit extends app.BaseService {
         constructor(ctx) {
         constructor(ctx) {
@@ -234,11 +235,16 @@ module.exports = app => {
 
 
                 // 微信模板通知
                 // 微信模板通知
                 const advanceInfo = await this.ctx.service.advance.getDataById(vid);
                 const advanceInfo = await this.ctx.service.advance.getDataById(vid);
+                const shenpiUrl = await this.ctx.helper.urlToShort(
+                    this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + advanceInfo.tid + '/advance/' + advanceInfo.id + '/detail'
+                );
                 const wechatData = {
                 const wechatData = {
-                    qi: advanceInfo.type === 0 ? '开工预付款第' + advanceInfo.order + '期' : '材料预付款第' + advanceInfo.order + '期',
+                    wap_url: shenpiUrl,
+                    qi: advanceConst.typeCol[advanceInfo.type].name + '第' + advanceInfo.order + '期',
                     status: wxConst.status.check,
                     status: wxConst.status.check,
                     tips: wxConst.tips.check,
                     tips: wxConst.tips.check,
                     tp: parseFloat(advanceInfo.cur_amount),
                     tp: parseFloat(advanceInfo.cur_amount),
+                    code: this.ctx.session.sessionProject.code,
                 };
                 };
                 await this.ctx.helper.sendWechat(audit.audit_id, smsTypeConst.const.YFK, smsTypeConst.judge.approval.toString(), wxConst.template.advance, wechatData);
                 await this.ctx.helper.sendWechat(audit.audit_id, smsTypeConst.const.YFK, smsTypeConst.judge.approval.toString(), wxConst.template.advance, wechatData);
                 await transaction.commit();
                 await transaction.commit();
@@ -279,6 +285,9 @@ module.exports = app => {
                 // 无下一审核人表示,审核结束
                 // 无下一审核人表示,审核结束
 
 
                 const advanceInfo = await this.ctx.service.advance.getDataById(advanceId);
                 const advanceInfo = await this.ctx.service.advance.getDataById(advanceId);
+                const shenpiUrl = await this.ctx.helper.urlToShort(
+                    this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + advanceInfo.tid + '/advance/' + advanceInfo.id + '/detail'
+                );
                 if (nextAudit) {
                 if (nextAudit) {
                     // 流程至下一审批人
                     // 流程至下一审批人
                     await transaction.update(this.tableName, { id: nextAudit.id, status: auditConst.status.checking, create_time: time });
                     await transaction.update(this.tableName, { id: nextAudit.id, status: auditConst.status.checking, create_time: time });
@@ -289,11 +298,14 @@ module.exports = app => {
                         status: auditConst.status.checking,
                         status: auditConst.status.checking,
                     });
                     });
                     // 微信模板通知
                     // 微信模板通知
+
                     const wechatData = {
                     const wechatData = {
-                        qi: advanceInfo.type === 0 ? '开工预付款第' + advanceInfo.order + '期' : '材料预付款第' + advanceInfo.order + '期',
+                        wap_url: shenpiUrl,
+                        qi: advanceConst.typeCol[advanceInfo.type].name + '第' + advanceInfo.order + '期',
                         status: wxConst.status.check,
                         status: wxConst.status.check,
                         tips: wxConst.tips.check,
                         tips: wxConst.tips.check,
                         tp: parseFloat(advanceInfo.cur_amount),
                         tp: parseFloat(advanceInfo.cur_amount),
+                        code: this.ctx.session.sessionProject.code,
                     };
                     };
                     await this.ctx.helper.sendWechat(nextAudit.audit_id, smsTypeConst.const.YFK, smsTypeConst.judge.approval.toString(), wxConst.template.advance, wechatData);
                     await this.ctx.helper.sendWechat(nextAudit.audit_id, smsTypeConst.const.YFK, smsTypeConst.judge.approval.toString(), wxConst.template.advance, wechatData);
                 } else {
                 } else {
@@ -306,10 +318,12 @@ module.exports = app => {
                     // 微信模板通知
                     // 微信模板通知
                     const users = this._.uniq(this._.concat(this._.map(auditors, 'audit_id'), advanceInfo.uid));
                     const users = this._.uniq(this._.concat(this._.map(auditors, 'audit_id'), advanceInfo.uid));
                     const wechatData = {
                     const wechatData = {
-                        qi: advanceInfo.type === 0 ? '开工预付款第' + advanceInfo.order + '期' : '材料预付款第' + advanceInfo.order + '期',
+                        wap_url: shenpiUrl,
+                        qi: advanceConst.typeCol[advanceInfo.type].name + '第' + advanceInfo.order + '期',
                         status: wxConst.status.success,
                         status: wxConst.status.success,
                         tips: wxConst.tips.success,
                         tips: wxConst.tips.success,
                         tp: parseFloat(advanceInfo.cur_amount),
                         tp: parseFloat(advanceInfo.cur_amount),
+                        code: this.ctx.session.sessionProject.code,
                     };
                     };
                     await this.ctx.helper.sendWechat(users, smsTypeConst.const.YFK, smsTypeConst.judge.result.toString(), wxConst.template.advance, wechatData);
                     await this.ctx.helper.sendWechat(users, smsTypeConst.const.YFK, smsTypeConst.judge.result.toString(), wxConst.template.advance, wechatData);
                 }
                 }
@@ -358,11 +372,16 @@ module.exports = app => {
                 // 微信模板通知
                 // 微信模板通知
                 const advanceInfo = await this.ctx.service.advance.getDataById(advanceId);
                 const advanceInfo = await this.ctx.service.advance.getDataById(advanceId);
                 const users = this._.uniq(this._.concat(this._.map(auditors, 'audit_id'), advanceInfo.uid));
                 const users = this._.uniq(this._.concat(this._.map(auditors, 'audit_id'), advanceInfo.uid));
+                const shenpiUrl = await this.ctx.helper.urlToShort(
+                    this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + advanceInfo.tid + '/advance/' + advanceInfo.id + '/detail'
+                );
                 const wechatData = {
                 const wechatData = {
-                    qi: advanceInfo.type === 0 ? '开工预付款第' + advanceInfo.order + '期' : '材料预付款第' + advanceInfo.order + '期',
+                    wap_url: shenpiUrl,
+                    qi: advanceConst.typeCol[advanceInfo.type].name + '第' + advanceInfo.order + '期',
                     status: wxConst.status.back,
                     status: wxConst.status.back,
                     tips: wxConst.tips.back,
                     tips: wxConst.tips.back,
                     tp: parseFloat(advanceInfo.cur_amount),
                     tp: parseFloat(advanceInfo.cur_amount),
+                    code: this.ctx.session.sessionProject.code,
                 };
                 };
                 await this.ctx.helper.sendWechat(users, smsTypeConst.const.YFK, smsTypeConst.judge.result.toString(), wxConst.template.advance, wechatData);
                 await this.ctx.helper.sendWechat(users, smsTypeConst.const.YFK, smsTypeConst.judge.result.toString(), wxConst.template.advance, wechatData);
                 // 拷贝新一次审核流程列表
                 // 拷贝新一次审核流程列表
@@ -424,11 +443,16 @@ module.exports = app => {
                 });
                 });
                 // 微信模板通知
                 // 微信模板通知
                 const advanceInfo = await this.ctx.service.advance.getDataById(advanceId);
                 const advanceInfo = await this.ctx.service.advance.getDataById(advanceId);
+                const shenpiUrl = await this.ctx.helper.urlToShort(
+                    this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + advanceInfo.tid + '/advance/' + advanceInfo.id + '/detail'
+                );
                 const wechatData = {
                 const wechatData = {
-                    qi: advanceInfo.type === 0 ? '开工预付款第' + advanceInfo.order + '期' : '材料预付款第' + advanceInfo.order + '期',
+                    wap_url: shenpiUrl,
+                    qi: advanceConst.typeCol[advanceInfo.type].name + '第' + advanceInfo.order + '期',
                     status: wxConst.status.check,
                     status: wxConst.status.check,
                     tips: wxConst.tips.check,
                     tips: wxConst.tips.check,
                     tp: parseFloat(advanceInfo.cur_amount),
                     tp: parseFloat(advanceInfo.cur_amount),
+                    code: this.ctx.session.sessionProject.code,
                 };
                 };
                 await this.ctx.helper.sendWechat(preAuditor.audit_id, smsTypeConst.const.YFK, smsTypeConst.judge.approval.toString(), wxConst.template.advance, wechatData);
                 await this.ctx.helper.sendWechat(preAuditor.audit_id, smsTypeConst.const.YFK, smsTypeConst.judge.approval.toString(), wxConst.template.advance, wechatData);
                 await transaction.insert(this.tableName, newAuditors);
                 await transaction.insert(this.tableName, newAuditors);
@@ -609,6 +633,32 @@ module.exports = app => {
                 throw err;
                 throw err;
             }
             }
         }
         }
+
+        /**
+         * 取待审批期列表(wap用)
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getAuditAdvanceByWap(auditorId) {
+            const sql =
+                'SELECT ad.`id`, ad.`tid`, ad.`pay_ratio`, ad.`cur_amount`, ad.`prev_amount`, ad.`prev_total_amount`, ad.`type`, ad.`order`, ' +
+                // '    s.`order` As `sorder`, s.`status` As `sstatus`, s.`s_time`, s.`contract_tp`, s.`qc_tp`, s.`pre_contract_tp`, s.`pre_qc_tp`, s.`yf_tp`, s.`pre_yf_tp`, ' +
+                '    t.`name`, t.`project_id`, t.`user_id`,' +
+                '    ti.`deal_info`, ti.`deal_param` ' +
+                '  FROM ?? AS aa, ?? AS ad, ?? As t, ?? AS ti ' +
+                '  WHERE aa.`audit_id` = ? and aa.`status` = ?' +
+                '    and aa.`vid` = ad.`id` and aa.`tid` = t.`id` and ti.`tid` = t.`id`';
+            const sqlParam = [
+                this.tableName,
+                this.ctx.service.advance.tableName,
+                this.ctx.service.tender.tableName,
+                this.ctx.service.tenderInfo.tableName,
+                auditorId,
+                auditConst.status.checking,
+            ];
+            return await this.db.query(sql, sqlParam);
+        }
     }
     }
     return AdvanceAudit;
     return AdvanceAudit;
 };
 };

+ 5 - 5
app/service/ledger_revise.js

@@ -30,7 +30,7 @@ module.exports = app => {
          * @returns {Promise<*>} - ledger_change下所有数据,并关联 project_account(读取提交人名称、单位、公司)
          * @returns {Promise<*>} - ledger_change下所有数据,并关联 project_account(读取提交人名称、单位、公司)
          */
          */
         async getReviseList (tid) {
         async getReviseList (tid) {
-            const sql = 'SELECT lc.id, lc.tid, lc.corder, lc.in_time, lc.uid, lc.begin_time, lc.end_time, lc.times, lc.status, lc.valid,' +
+            const sql = 'SELECT lc.id, lc.tid, lc.corder, lc.in_time, lc.uid, lc.begin_time, lc.end_time, lc.times, lc.status, lc.valid, lc.content,' +
                 '    pa.name As user_name, pa.role As user_role, pa.company As user_company' +
                 '    pa.name As user_name, pa.role As user_role, pa.company As user_company' +
                 '  FROM ' + this.tableName + ' As lc' +
                 '  FROM ' + this.tableName + ' As lc' +
                 '  INNER JOIN ' + this.ctx.service.projectAccount.tableName + ' As pa ON lc.uid = pa.id' +
                 '  INNER JOIN ' + this.ctx.service.projectAccount.tableName + ' As pa ON lc.uid = pa.id' +
@@ -100,12 +100,12 @@ module.exports = app => {
                 '     quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '     quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp,' +
                 '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
-                '     gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio)' +
+                '     gxby_status, dagl_status, dagl_url, gxby_limit, dagl_limit)' +
                 '  Select id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '  Select id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '      quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '      quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp,' +
                 '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp,' +
                 '      sgfh_expr, sjcl_expr, qtcl_expr, 0,' +
                 '      sgfh_expr, sjcl_expr, qtcl_expr, 0,' +
-                '      gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio' +
+                '      gxby_status, dagl_status, dagl_url, gxby_limit, dagl_limit' +
                 '  From ' + this.ctx.service.ledger.tableName +
                 '  From ' + this.ctx.service.ledger.tableName +
                 '  Where `tender_id` = ?';
                 '  Where `tender_id` = ?';
             const sqlParam = [tid];
             const sqlParam = [tid];
@@ -117,11 +117,11 @@ module.exports = app => {
                 '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, in_time, porder, position,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, in_time, porder, position,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                '     gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio)' +
+                '     gxby_status, dagl_status, dagl_url, gxby_limit, dagl_limit)' +
                 '  Select id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '  Select id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, in_time, porder, position,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, in_time, porder, position,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                '     gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio' +
+                '     gxby_status, dagl_status, dagl_url, gxby_limit, dagl_limit' +
                 '  From ' + this.ctx.service.pos.tableName +
                 '  From ' + this.ctx.service.pos.tableName +
                 '  Where `tid` = ?';
                 '  Where `tid` = ?';
             const sqlParam = [tid];
             const sqlParam = [tid];

+ 3 - 3
app/service/pos.js

@@ -29,7 +29,7 @@ module.exports = app => {
                 where: condition,
                 where: condition,
                 columns: ['id', 'tid', 'lid', 'name', 'quantity', 'position', 'drawing_code', 'sgfh_qty', 'sjcl_qty',
                 columns: ['id', 'tid', 'lid', 'name', 'quantity', 'position', 'drawing_code', 'sgfh_qty', 'sjcl_qty',
                     'qtcl_qty', 'in_time', 'porder', 'add_stage', 'sgfh_expr', 'sjcl_expr', 'qtcl_expr', 'real_qty',
                     'qtcl_qty', 'in_time', 'porder', 'add_stage', 'sgfh_expr', 'sjcl_expr', 'qtcl_expr', 'real_qty',
-                    'dagl_status', 'dagl_url', 'gxby_status', 'gxby_limit', 'gxby_ratio', 'dagl_limit', 'dagl_status'],
+                    'dagl_status', 'dagl_url', 'gxby_status', 'gxby_limit', 'dagl_limit', 'dagl_status'],
                 order: [['porder', 'ASC']],
                 order: [['porder', 'ASC']],
             });
             });
         }
         }
@@ -38,7 +38,7 @@ module.exports = app => {
             const sql = 'SELECT p.id, p.tid, p.lid, p.name, p.quantity, p.position, p.drawing_code,' +
             const sql = 'SELECT p.id, p.tid, p.lid, p.name, p.quantity, p.position, p.drawing_code,' +
                 '    p.sgfh_qty, p.sjcl_qty, p.qtcl_qty, p.porder, p.add_stage, p.add_times, p.add_user, s.order As add_stage_order,' +
                 '    p.sgfh_qty, p.sjcl_qty, p.qtcl_qty, p.porder, p.add_stage, p.add_times, p.add_user, s.order As add_stage_order,' +
                 '    p.sgfh_expr, p.sjcl_expr, p.qtcl_expr, p.real_qty, p.gxby_status, p.dagl_status, p.dagl_url,' +
                 '    p.sgfh_expr, p.sjcl_expr, p.qtcl_expr, p.real_qty, p.gxby_status, p.dagl_status, p.dagl_url,' +
-                '    p.gxby_limit, p.dagl_limit, p.gxby_ratio, p.dagl_ratio' +
+                '    p.gxby_limit, p.dagl_limit' +
                 '  FROM ' + this.tableName + ' p ' +
                 '  FROM ' + this.tableName + ' p ' +
                 '  LEFT JOIN ' + this.ctx.service.stage.tableName + ' s' +
                 '  LEFT JOIN ' + this.ctx.service.stage.tableName + ' s' +
                 '  ON p.add_stage = s.id'
                 '  ON p.add_stage = s.id'
@@ -50,7 +50,7 @@ module.exports = app => {
             if (ids instanceof Array && ids.length > 0) {
             if (ids instanceof Array && ids.length > 0) {
                 const sql = 'SELECT id, tid, lid, name, quantity, position, drawing_code,' +
                 const sql = 'SELECT id, tid, lid, name, quantity, position, drawing_code,' +
                     '    sgfh_qty, sjcl_qty, qtcl_qty, add_stage, add_times, add_user, sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
                     '    sgfh_qty, sjcl_qty, qtcl_qty, add_stage, add_times, add_user, sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                    '    dagl_status, dagl_url, gxby_status, gxby_limit, dagl_limit, gxby_ratio, dagl_ratio' +
+                    '    dagl_status, dagl_url, gxby_status, gxby_limit, dagl_limit' +
                     '  FROM ' + this.tableName +
                     '  FROM ' + this.tableName +
                     '  WHERE id in (' + this.ctx.helper.getInArrStrSqlFilter(ids) + ')';
                     '  WHERE id in (' + this.ctx.helper.getInArrStrSqlFilter(ids) + ')';
                 return await this.db.query(sql, []);
                 return await this.db.query(sql, []);

+ 0 - 1
app/service/project.js

@@ -164,7 +164,6 @@ module.exports = app => {
             });
             });
             return result.affectedRows === 1;
             return result.affectedRows === 1;
         }
         }
-
     }
     }
 
 
     return Project;
     return Project;

+ 1 - 13
app/service/project_account.js

@@ -13,7 +13,6 @@ const crypto = require('crypto');
 const SSO = require('../lib/sso');
 const SSO = require('../lib/sso');
 const SMS = require('../lib/sms');
 const SMS = require('../lib/sms');
 const SmsAliConst = require('../const/sms_alitemplate');
 const SmsAliConst = require('../const/sms_alitemplate');
-const thirdPartyConst = require('../const/third_party');
 const loginWay = require('../const/setting').loginWay;
 const loginWay = require('../const/setting').loginWay;
 const smsTypeConst = require('../const/sms_type').type;
 const smsTypeConst = require('../const/sms_type').type;
 module.exports = app => {
 module.exports = app => {
@@ -229,19 +228,8 @@ module.exports = app => {
                         // cooperation,
                         // cooperation,
                     };
                     };
 
 
-                    const thirdParty = await this.db.get('zh_s2b_proj', { pid: projectInfo.id });
-                    if (thirdParty) {
-                        thirdParty.gxby_option = thirdParty.gxby_option ? JSON.parse(thirdParty.gxby_option) : null;
-                        projectInfo.gxby = thirdParty.gxby;
-                        projectInfo.gxby_status = thirdParty.gxby_option && thirdParty.gxby_option.status
-                            ? thirdParty.gxby_option.status : thirdPartyConst.gxby;
-
-                        thirdParty.dagl_option = thirdParty.dagl_option ? JSON.parse(thirdParty.dagl_option) : null;
-                        projectInfo.dagl = thirdParty.dagl;
-                        projectInfo.dagl_status = thirdParty.dagl_option && thirdParty.dagl_option.status
-                            ? thirdParty.dagl_option.status : thirdPartyConst.dagl;
-                    }
                     this.ctx.session.sessionProject = projectInfo;
                     this.ctx.session.sessionProject = projectInfo;
+                    await this.ctx.service.s2bProj.refreshSessionS2b();
                     this.ctx.session.sessionProjectList = projectList;
                     this.ctx.session.sessionProjectList = projectList;
                     // 记录登录日志
                     // 记录登录日志
                     await this.ctx.service.loginLogging.addLoginLog(loginType, loginStatus);
                     await this.ctx.service.loginLogging.addLoginLog(loginType, loginStatus);

+ 52 - 4
app/service/revise_audit.js

@@ -267,9 +267,14 @@ module.exports = app => {
                 //     smsTypeConst.judge.approval.toString(), '台账修订需要您审批,请登录系统处理。');
                 //     smsTypeConst.judge.approval.toString(), '台账修订需要您审批,请登录系统处理。');
                 await this.ctx.helper.sendAliSms(audit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), SmsAliConst.template.revise_check);
                 await this.ctx.helper.sendAliSms(audit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), SmsAliConst.template.revise_check);
                 // 微信模板通知
                 // 微信模板通知
+                const shenpiUrl = await this.ctx.helper.urlToShort(
+                    this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
+                );
                 const wechatData = {
                 const wechatData = {
+                    wap_url: shenpiUrl,
                     status: wxConst.status.check,
                     status: wxConst.status.check,
                     tips: wxConst.tips.check,
                     tips: wxConst.tips.check,
+                    code: this.ctx.session.sessionProject.code,
                     begin_time: Date.parse(time),
                     begin_time: Date.parse(time),
                 };
                 };
                 await this.ctx.helper.sendWechat(audit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), wxConst.template.revise, wechatData);
                 await this.ctx.helper.sendWechat(audit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), wxConst.template.revise, wechatData);
@@ -281,9 +286,11 @@ module.exports = app => {
                 await this.ctx.helper.sendAliSms(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_report);
                 await this.ctx.helper.sendAliSms(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), SmsAliConst.template.revise_report);
                 // 微信模板通知
                 // 微信模板通知
                 const wechatData2 = {
                 const wechatData2 = {
+                    wap_url: shenpiUrl,
                     status: wxConst.status.report,
                     status: wxConst.status.report,
                     tips: wxConst.tips.report,
                     tips: wxConst.tips.report,
                     begin_time: Date.parse(time),
                     begin_time: Date.parse(time),
+                    code: this.ctx.session.sessionProject.code,
                 };
                 };
                 await this.ctx.helper.sendWechat(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
                 await this.ctx.helper.sendWechat(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
                 await transaction.commit();
                 await transaction.commit();
@@ -304,12 +311,12 @@ module.exports = app => {
                 '     quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '     quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp,' +
                 '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
-                '     gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio)' +
+                '     gxby_status, dagl_status, dagl_url, gxby_limit,  dagl_limit)' +
                 '  Select id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '  Select id, code, b_code, name, unit, source, remark, ledger_id, ledger_pid, level, `order`, full_path, is_leaf,' +
                 '      quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '      quantity, total_price, unit_price, drawing_code, memo, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                 '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp, ' +
                 '      sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, tender_id, is_tp, ' +
                 '      sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
                 '      sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
-                '      gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio' +
+                '      gxby_status, dagl_status, dagl_url, gxby_limit,  dagl_limit' +
                 '  From ' +
                 '  From ' +
                 this.ctx.service.reviseBills.tableName +
                 this.ctx.service.reviseBills.tableName +
                 '  Where `tender_id` = ?';
                 '  Where `tender_id` = ?';
@@ -321,11 +328,11 @@ module.exports = app => {
                 '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder, position, ' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder, position, ' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                '     gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio)' +
+                '     gxby_status, dagl_status, dagl_url, gxby_limit,  dagl_limit)' +
                 '  Select id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '  Select id, tid, lid, name, drawing_code, quantity, add_stage, add_times, add_user,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder, position,' +
                 '     sgfh_qty, sjcl_qty, qtcl_qty, crid, porder, position,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
                 '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                '     gxby_status, dagl_status, dagl_url, gxby_limit, gxby_ratio, dagl_limit, dagl_ratio' +
+                '     gxby_status, dagl_status, dagl_url, gxby_limit,  dagl_limit' +
                 '  From ' +
                 '  From ' +
                 this.ctx.service.revisePos.tableName +
                 this.ctx.service.revisePos.tableName +
                 '  Where `tid` = ?';
                 '  Where `tid` = ?';
@@ -403,9 +410,14 @@ module.exports = app => {
                         //     smsTypeConst.judge.approval.toString(), '台账修订需要您审批,请登录系统处理。');
                         //     smsTypeConst.judge.approval.toString(), '台账修订需要您审批,请登录系统处理。');
                         await this.ctx.helper.sendAliSms(nextAudit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), SmsAliConst.template.revise_check);
                         await this.ctx.helper.sendAliSms(nextAudit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), SmsAliConst.template.revise_check);
                         // 微信模板通知
                         // 微信模板通知
+                        const shenpiUrl = await this.ctx.helper.urlToShort(
+                            this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
+                        );
                         const wechatData = {
                         const wechatData = {
+                            wap_url: shenpiUrl,
                             status: wxConst.status.check,
                             status: wxConst.status.check,
                             tips: wxConst.tips.check,
                             tips: wxConst.tips.check,
+                            code: this.ctx.session.sessionProject.code,
                             begin_time: Date.parse(revise.begin_time),
                             begin_time: Date.parse(revise.begin_time),
                         };
                         };
                         await this.ctx.helper.sendWechat(nextAudit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), wxConst.template.revise, wechatData);
                         await this.ctx.helper.sendWechat(nextAudit.audit_id, smsTypeConst.const.XD, smsTypeConst.judge.approval.toString(), wxConst.template.revise, wechatData);
@@ -471,10 +483,15 @@ module.exports = app => {
                         users.push(revise.uid);
                         users.push(revise.uid);
 
 
                         // 微信模板通知
                         // 微信模板通知
+                        const shenpiUrl = await this.ctx.helper.urlToShort(
+                            this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
+                        );
                         const wechatData2 = {
                         const wechatData2 = {
+                            wap_url: shenpiUrl,
                             status: wxConst.status.success,
                             status: wxConst.status.success,
                             tips: wxConst.tips.success,
                             tips: wxConst.tips.success,
                             begin_time: Date.parse(revise.begin_time),
                             begin_time: Date.parse(revise.begin_time),
+                            code: this.ctx.session.sessionProject.code,
                         };
                         };
                         await this.ctx.helper.sendWechat(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
                         await this.ctx.helper.sendWechat(users, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
                     }
                     }
@@ -505,10 +522,15 @@ module.exports = app => {
                         status: SmsAliConst.status.back,
                         status: SmsAliConst.status.back,
                     });
                     });
                     // 微信模板通知
                     // 微信模板通知
+                    const shenpiUrl = await this.ctx.helper.urlToShort(
+                        this.ctx.protocol + '://' + this.ctx.host + '/wap/tender/' + revise.tid + '/revise/' + revise.id + '/info'
+                    );
                     const wechatData = {
                     const wechatData = {
+                        wap_url: shenpiUrl,
                         status: wxConst.status.back,
                         status: wxConst.status.back,
                         tips: wxConst.tips.back,
                         tips: wxConst.tips.back,
                         begin_time: Date.parse(revise.begin_time),
                         begin_time: Date.parse(revise.begin_time),
+                        code: this.ctx.session.sessionProject.code,
                     };
                     };
                     await this.ctx.helper.sendWechat(revise.uid, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData);
                     await this.ctx.helper.sendWechat(revise.uid, smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData);
                     // 其他参与人
                     // 其他参与人
@@ -525,9 +547,11 @@ module.exports = app => {
                     );
                     );
                     // 微信模板通知
                     // 微信模板通知
                     const wechatData2 = {
                     const wechatData2 = {
+                        wap_url: shenpiUrl,
                         status: wxConst.status.back,
                         status: wxConst.status.back,
                         tips: wxConst.tips.back,
                         tips: wxConst.tips.back,
                         begin_time: Date.parse(revise.begin_time),
                         begin_time: Date.parse(revise.begin_time),
+                        code: this.ctx.session.sessionProject.code,
                     };
                     };
                     await this.ctx.helper.sendWechat(this._.map(auditors, 'user_id'), smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
                     await this.ctx.helper.sendWechat(this._.map(auditors, 'user_id'), smsTypeConst.const.XD, smsTypeConst.judge.result.toString(), wxConst.template.revise, wechatData2);
                 }
                 }
@@ -540,6 +564,30 @@ module.exports = app => {
         }
         }
 
 
         /**
         /**
+         * 取待审批修订列表(wap用)
+         *
+         * @param auditorId
+         * @return {Promise<*>}
+         */
+        async getAuditReviseByWap(auditorId) {
+            const sql =
+                'SELECT ra.`audit_id`, ra.`times`, ra.`audit_order`, ra.`begin_time`, ra.`end_time`,' +
+                '    r.id, r.corder, r.uid, r.status, r.content, r.in_time, ' +
+                '    t.id As t_id, t.`name` As t_name, t.`project_id` As t_pid, t.`type` As t_type, t.`user_id` As t_uid, t.`status` As t_status, ' +
+                '    ti.`deal_info`, ' +
+                '    p.name As audit_name, p.role As audit_role, p.company As audit_company' +
+                '  FROM ' + this.tableName + ' AS ra' +
+                '  Left Join ' + this.ctx.service.ledgerRevise.tableName + ' As r On ra.rid = r.id' +
+                '  Left Join ' + this.ctx.service.tender.tableName + ' AS t On r.tid = t.id' +
+                '  Left Join ' + this.ctx.service.tenderInfo.tableName + ' AS ti On r.tid = ti.tid' +
+                '  Left Join ' + this.ctx.service.projectAccount.tableName + ' As p On ra.audit_id = p.id' +
+                '  WHERE r.`valid` != 0 and ra.`audit_id` = ? and ra.`status` = ?' +
+                '  ORDER BY ra.`begin_time` DESC';
+            const sqlParam = [auditorId, auditConst.status.checking];
+            return await this.db.query(sql, sqlParam);
+        }
+
+        /**
          * 获取审核人需要审核的标段列表
          * 获取审核人需要审核的标段列表
          *
          *
          * @param auditorId
          * @param auditorId

+ 68 - 0
app/service/s2b_proj.js

@@ -0,0 +1,68 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date 2021/6/17
+ * @version
+ */
+const thirdPartyConst = require('../const/third_party');
+
+module.exports = app => {
+
+    class S2bProj extends app.BaseService {
+
+        /**
+         * 构造函数
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        constructor(ctx) {
+            super(ctx);
+            this.tableName = 's2b_proj';
+        }
+
+        async getDataByPid(pid) {
+            const sp = await this.getDataByCondition({ pid });
+            if (sp) {
+                sp.gxby_option = sp.gxby_option ? JSON.parse(sp.gxby_option) : null;
+                sp.dagl_option = sp.dagl_option ? JSON.parse(sp.dagl_option) : null;
+                sp.gxby_status = sp.gxby_status ? JSON.parse(sp.gxby_status) : thirdPartyConst.gxby;
+                sp.dagl_status = sp.dagl_status ? JSON.parse(sp.dagl_status) : thirdPartyConst.dagl;
+            }
+            return sp;
+        }
+
+        async refreshSessionS2b() {
+            const s2bProj = await this.getDataByPid(this.ctx.session.sessionProject.id);
+            this.ctx.session.sessionProject.gxby = s2bProj ? s2bProj.gxby : false;
+            this.ctx.session.sessionProject.gxby_status = s2bProj ? s2bProj.gxby_status : thirdPartyConst.gxby;
+            this.ctx.session.sessionProject.dagl = s2bProj ? s2bProj.dagl : false;
+            this.ctx.session.sessionProject.dagl_status = s2bProj ? s2bProj.dagl_status : thirdPartyConst.dagl;
+        }
+
+        async updateGxbyStatus(pid, status, limit) {
+            const sp = await this.getDataByPid(pid);
+            const gs = sp.gxby_status.find(x => { return x.value === status; });
+            if (!gs) throw '提交数据错误';
+            gs.limit = limit;
+            await this.db.update(this.tableName, { gxby_status: JSON.stringify(sp.gxby_status) }, { where: { pid } });
+            return gs;
+        }
+
+        async updateDaglStatus(pid, status, limit, ratio) {
+            const sp = await this.getDataByPid(pid);
+            const ds = sp.dagl_status.find(x => { return x.value === status; });
+            if (!ds) throw '提交数据错误';
+            if (limit !== undefined && limit !== null) ds.limit = limit;
+            if (ratio !== undefined && ratio !== null) ds.ratio = this.ctx.helper.round(ratio, 2);
+            await this.db.update(this.tableName, { dagl_status: JSON.stringify(sp.dagl_status) }, { where: { pid } });
+            return ds;
+        }
+
+    }
+
+    return S2bProj;
+};

+ 19 - 19
app/view/advance/modal_audit.ejs

@@ -74,7 +74,7 @@
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="col-8 modal-height-500" style="overflow: auto">
                     <div class="col-8 modal-height-500" style="overflow: auto">
-                        <% auditHistory.forEach((auditors, idx) => { %>
+                        <% auditHistory.forEach((history, idx) => { %>
                             <!-- 展开/收起历史流程 -->
                             <!-- 展开/收起历史流程 -->
                         <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
                         <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
                             <div class="text-right">
                             <div class="text-right">
@@ -84,7 +84,7 @@
                         <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
                         <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
                             <div class="text-center text-muted"><%- idx+1 %>#</div>
                             <div class="text-center text-muted"><%- idx+1 %>#</div>
                             <ul class="timeline-list list-unstyled mt-2">
                             <ul class="timeline-list list-unstyled mt-2">
-                                <% auditors.forEach((auditor, index) => { %>
+                                <% history.forEach((auditor, index) => { %>
                                 <% if (index === 0) { %>
                                 <% if (index === 0) { %>
                                 <li class="timeline-list-item pb-2">
                                 <li class="timeline-list-item pb-2">
                                     <div class="timeline-item-date">
                                     <div class="timeline-item-date">
@@ -112,7 +112,7 @@
                                     <div class="timeline-item-date">
                                     <div class="timeline-item-date">
                                         <%- ctx.helper.formatDate(auditor.end_time) %>
                                         <%- ctx.helper.formatDate(auditor.end_time) %>
                                     </div>
                                     </div>
-                                    <% if(index < auditors.length - 1) { %>
+                                    <% if(index < history.length - 1) { %>
                                     <div class="timeline-item-tail"></div>
                                     <div class="timeline-item-tail"></div>
                                     <% } %>
                                     <% } %>
                                     <% if(auditor.status === auditConst.status.checked) { %>
                                     <% if(auditor.status === auditConst.status.checked) { %>
@@ -156,7 +156,7 @@
                                     <div class="timeline-item-date">
                                     <div class="timeline-item-date">
                                         <%- ctx.helper.formatDate(auditor.end_time) %>
                                         <%- ctx.helper.formatDate(auditor.end_time) %>
                                     </div>
                                     </div>
-                                    <% if(index < auditors.length - 1) { %>
+                                    <% if(index < history.length - 1) { %>
                                     <div class="timeline-item-tail"></div>
                                     <div class="timeline-item-tail"></div>
                                     <% } %>
                                     <% } %>
                                     <% if(auditor.status === auditConst.status.checked) { %>
                                     <% if(auditor.status === auditConst.status.checked) { %>
@@ -184,7 +184,7 @@
                                                             class="pull-right
                                                             class="pull-right
                                                                             <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
                                                                             <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
                                                             <%- auditor.status === auditConst.status.checkNo ? advance.user.name : '' %>
                                                             <%- auditor.status === auditConst.status.checkNo ? advance.user.name : '' %>
-                                                            <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                            <%- auditor.status === auditConst.status.checkNoPre ? history[index-1].name : '' %>
                                                         </span>
                                                         </span>
                                                     </p>
                                                     </p>
                                                     <p class="text-muted mb-0"><%- auditor.role %></p>
                                                     <p class="text-muted mb-0"><%- auditor.role %></p>
@@ -253,7 +253,7 @@
                                 </div>
                                 </div>
                             </div>
                             </div>
                             <div class="col-8 modal-height-500" style="overflow: auto">
                             <div class="col-8 modal-height-500" style="overflow: auto">
-                                <% auditHistory.forEach((auditors, idx) => { %>
+                                <% auditHistory.forEach((history, idx) => { %>
                                     <!-- 展开/收起历史流程 -->
                                     <!-- 展开/收起历史流程 -->
                                 <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
                                 <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
                                     <div class="text-right">
                                     <div class="text-right">
@@ -263,7 +263,7 @@
                                 <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
                                 <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
                                     <div class="text-center text-muted"><%- idx+1 %>#</div>
                                     <div class="text-center text-muted"><%- idx+1 %>#</div>
                                     <ul class="timeline-list list-unstyled mt-2">
                                     <ul class="timeline-list list-unstyled mt-2">
-                                        <% auditors.forEach((auditor, index) => { %>
+                                        <% history.forEach((auditor, index) => { %>
                                         <% if (index === 0) { %>
                                         <% if (index === 0) { %>
                                         <li class="timeline-list-item pb-2">
                                         <li class="timeline-list-item pb-2">
                                             <div class="timeline-item-date">
                                             <div class="timeline-item-date">
@@ -291,7 +291,7 @@
                                             <div class="timeline-item-date">
                                             <div class="timeline-item-date">
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                             </div>
                                             </div>
-                                            <% if(index < auditors.length - 1) { %>
+                                            <% if(index < history.length - 1) { %>
                                             <div class="timeline-item-tail"></div>
                                             <div class="timeline-item-tail"></div>
                                             <% } %>
                                             <% } %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
@@ -340,7 +340,7 @@
                                             <div class="timeline-item-date">
                                             <div class="timeline-item-date">
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                             </div>
                                             </div>
-                                            <% if(index < auditors.length - 1) { %>
+                                            <% if(index < history.length - 1) { %>
                                             <div class="timeline-item-tail"></div>
                                             <div class="timeline-item-tail"></div>
                                             <% } %>
                                             <% } %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
@@ -368,7 +368,7 @@
                                                                     class="pull-right
                                                                     class="pull-right
                                                                                     <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
                                                                                     <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
                                                                     <%- auditor.status === auditConst.status.checkNo ? advance.user.name : '' %>
                                                                     <%- auditor.status === auditConst.status.checkNo ? advance.user.name : '' %>
-                                                                    <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                                    <%- auditor.status === auditConst.status.checkNoPre ? history[index-1].name : '' %>
                                                                 </span>
                                                                 </span>
                                                             </p>
                                                             </p>
                                                             <p class="text-muted mb-0"><%- auditor.role %></p>
                                                             <p class="text-muted mb-0"><%- auditor.role %></p>
@@ -445,7 +445,7 @@
                                 </div>
                                 </div>
                             </div>
                             </div>
                             <div class="col-8 modal-height-500" style="overflow: auto">
                             <div class="col-8 modal-height-500" style="overflow: auto">
-                                <% auditHistory.forEach((auditors, idx) => { %>
+                                <% auditHistory.forEach((history, idx) => { %>
                                     <!-- 展开/收起历史流程 -->
                                     <!-- 展开/收起历史流程 -->
                                 <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
                                 <% if(idx === auditHistory.length - 1 && auditHistory.length !== 1) { %>
                                     <div class="text-right">
                                     <div class="text-right">
@@ -455,7 +455,7 @@
                                 <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
                                 <div class="<%- idx < auditHistory.length - 1 ? 'fold-card' : '' %>">
                                     <div class="text-center text-muted"><%- idx+1 %>#</div>
                                     <div class="text-center text-muted"><%- idx+1 %>#</div>
                                     <ul class="timeline-list list-unstyled mt-2">
                                     <ul class="timeline-list list-unstyled mt-2">
-                                        <% auditors.forEach((auditor, index) => { %>
+                                        <% history.forEach((auditor, index) => { %>
                                         <% if (index === 0) { %>
                                         <% if (index === 0) { %>
                                         <li class="timeline-list-item pb-2">
                                         <li class="timeline-list-item pb-2">
                                             <div class="timeline-item-date">
                                             <div class="timeline-item-date">
@@ -483,7 +483,7 @@
                                             <div class="timeline-item-date">
                                             <div class="timeline-item-date">
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                             </div>
                                             </div>
-                                            <% if(index < auditors.length - 1) { %>
+                                            <% if(index < history.length - 1) { %>
                                             <div class="timeline-item-tail"></div>
                                             <div class="timeline-item-tail"></div>
                                             <% } %>
                                             <% } %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
@@ -529,13 +529,13 @@
                                                                 <label class="form-check-label" for="inlineRadio1">退回原报
                                                                 <label class="form-check-label" for="inlineRadio1">退回原报
                                                                     <%- ctx.advance.user.name %></label>
                                                                     <%- ctx.advance.user.name %></label>
                                                             </div>
                                                             </div>
-                                                            <% if (auditor.order > 1 && auditor.audit_id !== auditors[0].audit_id) { %>
+                                                            <% if (auditor.sort > 1 && auditor.audit_id !== history[0].audit_id) { %>
                                                             <div class="form-check form-check-inline">
                                                             <div class="form-check form-check-inline">
                                                                 <input class="form-check-input" type="radio" name="checkType"
                                                                 <input class="form-check-input" type="radio" name="checkType"
                                                                     id="inlineRadio2"
                                                                     id="inlineRadio2"
                                                                     value="<%- auditConst.status.checkNoPre %>">
                                                                     value="<%- auditConst.status.checkNoPre %>">
                                                                 <label class="form-check-label" for="inlineRadio2">退回上一审批人
                                                                 <label class="form-check-label" for="inlineRadio2">退回上一审批人
-                                                                    <%- auditors[index-1].name %></label>
+                                                                    <%- auditors.find(item => item.order === auditor.sort-1).name %></label>
                                                             </div>
                                                             </div>
                                                             <% } %>
                                                             <% } %>
                                                         </div>
                                                         </div>
@@ -553,7 +553,7 @@
                                             <div class="timeline-item-date">
                                             <div class="timeline-item-date">
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                                 <%- ctx.helper.formatDate(auditor.end_time) %>
                                             </div>
                                             </div>
-                                            <% if(index < auditors.length - 1) { %>
+                                            <% if(index < history.length - 1) { %>
                                             <div class="timeline-item-tail"></div>
                                             <div class="timeline-item-tail"></div>
                                             <% } %>
                                             <% } %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
                                             <% if(auditor.status === auditConst.status.checked) { %>
@@ -581,7 +581,7 @@
                                                                     class="pull-right
                                                                     class="pull-right
                                                                                     <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
                                                                                     <%- auditConst.statusClass[auditor.status] %>"><%- auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''%>
                                                                     <%- auditor.status === auditConst.status.checkNo ? advance.user.name : '' %>
                                                                     <%- auditor.status === auditConst.status.checkNo ? advance.user.name : '' %>
-                                                                    <%- auditor.status === auditConst.status.checkNoPre ? auditors[index-1].name : '' %>
+                                                                    <%- auditor.status === auditConst.status.checkNoPre ? history[index-1].name : '' %>
                                                                 </span>
                                                                 </span>
                                                             </p>
                                                             </p>
                                                             <p class="text-muted mb-0"><%- auditor.role %></p>
                                                             <p class="text-muted mb-0"><%- auditor.role %></p>
@@ -603,13 +603,13 @@
                                                                         <label class="form-check-label" for="inlineRadio1">退回原报
                                                                         <label class="form-check-label" for="inlineRadio1">退回原报
                                                                             <%- ctx.advance.user.name %></label>
                                                                             <%- ctx.advance.user.name %></label>
                                                                     </div>
                                                                     </div>
-                                                                    <% if (auditor.order > 1 && auditor.audit_id !== auditors[0].audit_id) { %>
+                                                                    <% if (auditor.sort > 1 && auditor.audit_id !== history[0].audit_id) { %>
                                                                     <div class="form-check form-check-inline">
                                                                     <div class="form-check form-check-inline">
                                                                         <input class="form-check-input" type="radio" name="checkType"
                                                                         <input class="form-check-input" type="radio" name="checkType"
                                                                             id="inlineRadio2"
                                                                             id="inlineRadio2"
                                                                             value="<%- auditConst.status.checkNoPre %>">
                                                                             value="<%- auditConst.status.checkNoPre %>">
                                                                         <label class="form-check-label" for="inlineRadio2">退回上一审批人
                                                                         <label class="form-check-label" for="inlineRadio2">退回上一审批人
-                                                                            <%- auditors[index-1].name %></label>
+                                                                            <%- auditors.find(item => item.order === auditor.sort-1).name %></label>
                                                                     </div>
                                                                     </div>
                                                                     <% } %>
                                                                     <% } %>
                                                                 </div>
                                                                 </div>

+ 140 - 52
app/view/setting/s2b.ejs

@@ -8,65 +8,153 @@
     <div class="content-wrap">
     <div class="content-wrap">
         <div class="c-body">
         <div class="c-body">
             <div class="sjs-height-0">
             <div class="sjs-height-0">
-                <% if (tenders.length === 0) { %>
-                <div class="jumbotron m-3">
-                    <h3 class="display-6">没有标段数据</h3>
-                </div>
-                <% } else { %>
+                <nav class="nav nav-tabs m-3" role="tablist">
+                    <a class="nav-item nav-link active" data-toggle="tab" href="#user-purview" role="tab">业务配置</a>
+                    <a class="nav-item nav-link" data-toggle="tab" href="#user-list" role="tab">标段列表</a>
+                </nav>
                 <div class="m-3">
                 <div class="m-3">
-                    <table class="table table-hover table-bordered">
-                        <thead>
-                        <tr>
-                            <th class="text-center" >名称</th>
-                            <th class="text-center" >计量模式</th>
-                            <th class="text-center" >计量期数</th>
-                            <th class="text-center" >创建人</th>
-                            <th class="text-center" >标段创建时间/期审批时间</th>
-                            <th class="text-center">工序报验</th>
-                            <th class="text-center">档案管理</th>
-                        </tr>
-                        </thead>
-                        <% for (const t of tenders) { %>
-                        <tr tid="<%- t.id %>">
-                            <td><%- t.name %></td>
-                            <td><%- t.measure_type_str %></td>
-                            <td><%- t.stage_count_str %></td>
-                            <td><%- t.user_str %></td>
-                            <td><%- ctx.moment(t.show_time).format('YYYY-MM-DD HH:mm:ss') %></td>
-                            <td class="text-center">
-                                <div class="form-check form-check-inline">
-                                    <input class="form-check-input" type="checkbox" id="inlineCheckbox1" <% if (t.s2b_gxby_check) { %>checked<% } %> name="gxby_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_check %>">
-                                    <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
-                                    <label class="form-check-label" for="inlineCheckbox1">检查计量</label>
-                                </div>
-                                <div class="form-check form-check-inline">
-                                    <input class="form-check-input" type="checkbox" id="inlineCheckbox2" <% if (t.s2b_gxby_limit) { %>checked<% } %> name="gxby_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_limit %>">
-                                    <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
-                                    <label class="form-check-label" for="inlineCheckbox2">限制上报</label>
-                                </div>
-                            </td>
-                            <td class="text-center">
-                                <div class="form-check form-check-inline">
-                                    <input class="form-check-input" type="checkbox" id="inlineCheckbox3" <% if (t.s2b_dagl_check) { %>checked<% } %> name="dagl_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_check %>">
-                                    <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
-                                    <label class="form-check-label" for="inlineCheckbox3">检查计量</label>
-                                </div>
-                                <div class="form-check form-check-inline">
-                                    <input class="form-check-input" type="checkbox" id="inlineCheckbox4" <% if (t.s2b_dagl_limit) { %>checked<% } %> name="dagl_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_limit %>">
-                                    <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
-                                    <label class="form-check-label" for="inlineCheckbox4">限制上报</label>
-                                </div>
-                            </td>
-                        </tr>
-                        <% } %>
-                    </table>
+                    <div class="tab-content">
+                        <div class="tab-pane active" id="user-purview">
+                            <div class="col-4">
+                                <legend>工序报验</legend>
+                                <table class="table table-hover table-bordered">
+                                    <thead><tr><th>值</th><th>名称</th><th>允许计量</th></tr></thead>
+                                    <tbody id="gxby_list">
+                                    <% for (const s of ctx.session.sessionProject.gxby_status) { %>
+                                    <tr>
+                                        <td><%- s.value %></td>
+                                        <td><%- s.name %></td>
+                                        <td>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" id="inlineCheckbox-g<%- s.value %>" <% if (s.limit) { %>checked<% } %> status="<%- s.value %>" onchange="updateStatusLimit(this, 'gxby');">
+                                                <label class="form-check-label" for="inlineCheckbox-g<%- s.value %>"></label>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                    <% } %>
+                                    </tbody>
+                                </table>
+
+                                <legend>档案管理</legend>
+                                <table class="table table-hover table-bordered">
+                                    <thead><tr><th>值</th><th>名称</th><th>允许计量</th><th>计量比例</th></tr></thead>
+                                    <% for (const s of ctx.session.sessionProject.dagl_status) { %>
+                                    <tbody id="dagl_list">
+                                    <tr>
+                                        <td><%- s.value %></td>
+                                        <td><%- s.name %></td>
+                                        <td>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" id="inlineCheckbox-d<%- s.value %>" <% if (s.limit) { %>checked<% } %> status="<%- s.value %>" onchange="updateStatusLimit(this, 'dagl');">
+                                                <label class="form-check-label" for="inlineCheckbox-d<%- s.value %>"></label>
+                                            </div>
+                                        </td>
+                                        <% if (s.value === 0) { %>
+                                        <td>-</td>
+                                        <% } else { %>
+                                        <td>
+                                            <div class="input-group input-group-sm" style="width:90px">
+                                                <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 100 %>" status="<%- s.value %>" onchange="updateStatusRatio(this);">
+                                                <div class="input-group-append">
+                                                    <span class="input-group-text">%</span>
+                                                </div>
+                                            </div>
+                                        </td>
+                                        <% } %>
+                                    </tr>
+                                    <% } %>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                        <div class="tab-pane" id="user-list">
+                            <!--没有标段数据-->
+                            <% if (tenders.length === 0) { %>
+                            <div class="jumbotron m-3">
+                                <h3 class="display-6">没有标段数据</h3>
+                            </div>
+                            <% } else { %>
+                            <table class="table table-hover table-bordered">
+                                <thead>
+                                <tr>
+                                    <th class="text-center" >名称</th>
+                                    <th class="text-center" >计量模式</th>
+                                    <th class="text-center" >计量期数</th>
+                                    <th class="text-center" >创建人</th>
+                                    <th class="text-center" >标段创建时间/期审批时间</th>
+                                    <th class="text-center">工序报验</th>
+                                    <th class="text-center">档案管理</th>
+                                </tr>
+                                </thead>
+                                <% for (const t of tenders) { %>
+                                <tr tid="<%- t.id %>">
+                                    <td><%- t.name %></td>
+                                    <td><%- t.measure_type_str %></td>
+                                    <td><%- t.stage_count_str %></td>
+                                    <td><%- t.user_str %></td>
+                                    <td><%- ctx.moment(t.show_time).format('YYYY-MM-DD HH:mm:ss') %></td>
+                                    <td class="text-center">
+                                        <div class="form-check form-check-inline">
+                                            <input class="form-check-input" type="checkbox" id="inlineCheckbox1" <% if (t.s2b_gxby_check) { %>checked<% } %> name="gxby_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_check %>">
+                                            <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
+                                            <label class="form-check-label" for="inlineCheckbox1">检查计量</label>
+                                        </div>
+                                        <div class="form-check form-check-inline">
+                                            <input class="form-check-input" type="checkbox" id="inlineCheckbox2" <% if (t.s2b_gxby_limit) { %>checked<% } %> name="gxby_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_gxby_limit %>">
+                                            <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
+                                            <label class="form-check-label" for="inlineCheckbox2">限制上报</label>
+                                        </div>
+                                    </td>
+                                    <td class="text-center">
+                                        <div class="form-check form-check-inline">
+                                            <input class="form-check-input" type="checkbox" id="inlineCheckbox3" <% if (t.s2b_dagl_check) { %>checked<% } %> name="dagl_check" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_check %>">
+                                            <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
+                                            <label class="form-check-label" for="inlineCheckbox3">检查计量</label>
+                                        </div>
+                                        <div class="form-check form-check-inline">
+                                            <input class="form-check-input" type="checkbox" id="inlineCheckbox4" <% if (t.s2b_dagl_limit) { %>checked<% } %> name="dagl_limit" onchange="updateS2bSetting(this);" value="<%- t.s2b_dagl_limit %>">
+                                            <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>">
+                                            <label class="form-check-label" for="inlineCheckbox4">限制上报</label>
+                                        </div>
+                                    </td>
+                                </tr>
+                                <% } %>
+                            </table>
+                            <% } %>
+                        </div>
+                    </div>
                 </div>
                 </div>
-                <% } %>
             </div>
             </div>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
 <script>
 <script>
+    const updateStatusLimit = function (obj, type) {
+        const data = { type };
+        data.status = parseInt(obj.getAttribute('status'));
+        data.limit = obj.checked;
+        postData('api/update-status', data, function(result) {
+        }, function () {
+            obj.checked = !obj.checked;
+        });
+    }
+    const updateStatusRatio = function (obj) {
+
+        const data = { type: 'dagl' };
+        data.status = parseInt(obj.getAttribute('status'));
+        try {
+            data.ratio = parseFloat(obj.value);
+        } catch (error) {
+            toastr.warning('请输入0-100间的数字');
+            return;
+        }
+        postData('api/update-status', data, function(result) {
+            obj.org = result.ratio;
+            obj.value = result.ratio;
+        }, function () {
+            obj.value = obj.org;
+        });
+    }
     const updateS2bSetting = function (obj) {
     const updateS2bSetting = function (obj) {
         try {
         try {
             const name = obj.getAttribute('name');
             const name = obj.getAttribute('name');

+ 54 - 1
app/view/wap/dashboard.ejs

@@ -36,7 +36,7 @@
         </nav>
         </nav>
         <!--待审批期列表-->
         <!--待审批期列表-->
         <div class="py-6">
         <div class="py-6">
-            <% if (auditStages.length !== 0 || auditChanges.length !== 0) { %>
+            <% if (auditStages.length !== 0 || auditChanges.length !== 0 || auditRevise.length !== 0 || auditAdvance.length !== 0) { %>
                 <% for (const audit of auditStages) { %>
                 <% for (const audit of auditStages) { %>
                 <div class="card mb-3">
                 <div class="card mb-3">
                     <div class="card-header d-flex justify-content-between">
                     <div class="card-header d-flex justify-content-between">
@@ -62,6 +62,28 @@
                     </div>
                     </div>
                 </div>
                 </div>
                 <% } %>
                 <% } %>
+                <% for (const revise of auditRevise) { %>
+                    <div class="card mb-3">
+                        <div class="card-header d-flex justify-content-between">
+                            <span><%- JSON.parse(revise.deal_info).buildName %></span>
+                            <span class="badge badge-pill badge-info">台帐修订</span>
+                        </div>
+                        <div class="bg-light p-2 px-3"><b><%- revise.t_name %></b></div>
+                        <div class="card-body">
+                            <div class="d-flex justify-content-between"><span>第<%- revise.corder %>次修订</span></div>
+                            <div class="my-2">
+                                <table class="table table-sm table-bordered">
+                                    <tr><th width="90">修订时间</th><td class="text-right"><%- ctx.moment(revise.in_time).format('YYYY-MM-DD') %></td></tr>
+                                    <tr><th>修订人</th><td class="text-right"><%- revise.yb_name %></td></tr>
+                                    <tr><th>修订详情</th><td class=""><% if (revise.content.length <= 22) { %><%- revise.content %><% } else { %><%- revise.content.substring(0,22) %><a class="show-content" data-content="<%- revise.content %>" href="javascript:void(0);">展开更多</a><% } %></td></tr>
+                                </table>
+                            </div>
+                            <div class="">
+                                <a href="/wap/tender/<%- revise.t_id %>/revise/<%- revise.id %>/info" class="btn btn-block btn-success">审批</a>
+                            </div>
+                        </div>
+                    </div>
+                <% } %>
                 <% for (const change of auditChanges) { %>
                 <% for (const change of auditChanges) { %>
                     <div class="card mb-3">
                     <div class="card mb-3">
                         <div class="card-header d-flex justify-content-between">
                         <div class="card-header d-flex justify-content-between">
@@ -85,6 +107,30 @@
                         </div>
                         </div>
                     </div>
                     </div>
                 <% } %>
                 <% } %>
+                <% for (const advance of auditAdvance) { %>
+                    <div class="card mb-3">
+                        <div class="card-header d-flex justify-content-between">
+                            <span><%- JSON.parse(advance.deal_info).buildName %></span>
+                            <span class="badge badge-pill badge-warning">预付款</span>
+                        </div>
+                        <div class="bg-light p-2 px-3"><b><%- advance.name %></b></div>
+                        <div class="card-body">
+                            <div class="d-flex justify-content-between"><span><%- advanceConst.typeCol[advance.type].name %>-第<%- advance.order %>期</span><span></span></div>
+                            <div class="my-2">
+                                <table class="table table-sm table-bordered">
+                                    <% const advancePayTotal = JSON.parse(advance.deal_param)[advanceConst.typeCol[advance.type].key + 'Advance']; %>
+                                    <tr><th>签约预付款</th><td class="text-right"><%- ctx.helper.formatMoney(advancePayTotal, ',', parseFloat(advancePayTotal).toString().split('.')[1] && parseFloat(advancePayTotal).toString().split('.')[1].length || 0) %></td></tr>
+                                    <tr><th>本期支付比例</th><td class="text-right"><%- advance.pay_ratio %>%</td></tr>
+                                    <tr><th>本期金额</th><td class="text-right"><%- advance.cur_amount %></td></tr>
+                                    <tr><th>截止本期金额</th><td class="text-right"><%- advance.prev_total_amount %></td></tr>
+                                </table>
+                            </div>
+                            <div class="">
+                                <a href="/wap/tender/<%- advance.tid %>/advance/<%- advance.id %>/detail" class="btn btn-block btn-success">审批</a>
+                            </div>
+                        </div>
+                    </div>
+                <% } %>
             <% } else { %>
             <% } else { %>
                 <h3 class="text-center text-muted">暂无待审批期计量</h3>
                 <h3 class="text-center text-muted">暂无待审批期计量</h3>
             <% } %>
             <% } %>
@@ -108,6 +154,13 @@
     <script src="/public/js/bootstrap/bootstrap.min.js"></script>
     <script src="/public/js/bootstrap/bootstrap.min.js"></script>
     <script src="/public/js/cookies.js"></script>
     <script src="/public/js/cookies.js"></script>
     <script src="/public/js/wap/global.js"></script>
     <script src="/public/js/wap/global.js"></script>
+<script>
+    $(function () {
+        $('.show-content').on('click', function () {
+            $(this).parents('td').html($(this).data('content'));
+        });
+    })
+</script>
 </body>
 </body>
 
 
 </html>
 </html>

+ 145 - 0
app/view/wap/shenpi_advance.ejs

@@ -0,0 +1,145 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
+    <meta http-equiv="x-ua-compatible" content="ie=edge">
+    <title>标段概况-计量支付</title>
+    <link rel="stylesheet" href="/public/css/bootstrap/bootstrap.min.css">
+    <link rel="stylesheet" href="/public/css/wap/main.css">
+    <link rel="stylesheet" href="/public/css/toast.css">
+    <link rel="stylesheet" href="/public/css/font-awesome/font-awesome.min.css">
+    <script src=/public/js/echarts/echarts.min.js></script>
+    <link rel="shortcut icon" href="/public/images/favicon.ico">
+    <style>
+        body {
+            padding: 0;
+        }
+    </style>
+</head>
+<body>
+<div class="container">
+    <!--顶部-->
+    <nav class="fixed-top bg-dark">
+        <div class="my-2 d-flex justify-content-between">
+            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>#yufukuan" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i>预付款</a></span>
+            <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
+               style="width:150px" data-toggle="popover" data-placement="top"
+               data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>
+            <div class="mr-3">
+                <div class="dropdown">
+                    <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-toggle="dropdown">
+                        <%- ctx.session.sessionUser.name.substr(ctx.session.sessionUser.name.length > 2 ? ctx.session.sessionUser.name.length - 2 : 0) %>
+                    </button>
+                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
+                        <a class="dropdown-item" href="/wap/logout">退出登录</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </nav>
+    <!--标段概况-->
+    <div class="py-6">
+        <ul class="nav nav-tabs nav-fill">
+            <% for (const t of advanceConst.typeCol) { %>
+            <li class="nav-item">
+                <a class="px-1 nav-link <% if (t.key === advanceConst.typeCol[0].key) {  %>active<% } %>" data-toggle="tab" href="#<%- t.key %>" role="tab"><%- t.name %></a>
+            </li>
+            <% } %>
+        </ul>
+        <div class="tab-content">
+            <% for (const t of advanceConst.typeCol) { %>
+            <div class="tab-pane <% if (t.key === advanceConst.typeCol[0].key) {  %>active<% } %>" id="<%- t.key %>">
+                <dl class="mb-2 mt-3">
+                    <% for (const advance of advanceList[t.type]) { %>
+                    <dt class="bg-light p-2 d-flex justify-content-between"><span><%- t.name %>-第<%- advance.order %>期</span>
+                        <span class="<%- auditConst.statusClass[advance.status] %>">
+                            <% if (advance.curAuditor) { %>
+                                <%- advance.curAuditor.name %><%if (advance.curAuditor.role !== '' && advance.curAuditor.role !== null) { %>-<%- advance.curAuditor.role %><% } %>
+                            <% } %>
+                            <%- auditConst.statusString[advance.status] %>
+                        </span>
+                    </dt>
+                    <dd>
+                        <table class="table table-hover">
+                            <tbody>
+                            <tr>
+                                <td>
+                                    <p class="mb-0">签约预付款</p>
+                                </td>
+                                <td class="text-right">
+                                    <b><%- advancePayTotalList[t.type] %></b>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <p class="mb-0">本期支付比例</p>
+                                </td>
+                                <td class="text-right">
+                                    <b><%- advance.pay_ratio %>%</b>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <p class="mb-0">本期金额</p>
+                                </td>
+                                <td class="text-right">
+                                    <b><%- advance.cur_amount %></b>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <p class="mb-0">截止本期金额</p>
+                                </td>
+                                <td class="text-right">
+                                    <b><%- advance.prev_total_amount %></b>
+                                </td>
+                            </tr>
+                            <% if (advance.curAuditor && advance.status == auditConst.status.checking && advance.curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
+                            <tr>
+                                <td colspan="2">
+                                    <a class="btn btn-block btn-success" href="/wap/tender/<%- tender.id %>/advance/<%- advance.id %>/detail">审批</a>
+                                </td>
+                            </tr>
+                            <% } %>
+                            </tbody></table>
+                    </dd>
+                    <% } %>
+                </dl>
+            </div>
+            <% } %>
+        </div>
+    </div>
+    <!--底栏菜单-->
+    <nav class="fixed-bottom navbar-dark bg-light border-top">
+        <ul class="nav nav-fill my-2">
+            <li class="nav-item">
+                <a class="nav-link text-muted show-loading" href="/wap/dashboard"><i class="fa fa-check-square-o"></i> 待审批</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link active show-loading" href="/wap/list"><i class="fa fa-list-ul"></i> 项目</a>
+            </li>
+        </ul>
+    </nav>
+</div>
+<!-- JS. -->
+<script src="/public/js/jquery/jquery-3.2.1.min.js"></script>
+<script src="/public/js/popper/popper.min.js"></script>
+<script src="/public/js/bootstrap/bootstrap.min.js"></script>
+<script src="/public/js/cookies.js"></script>
+<script src="/public/js/wap/global.js"></script>
+<script>
+    $(document).ready(function () {
+        <% for (const t of advanceConst.typeCol) { %>
+        if (window.location.hash && window.location.hash === '#<%- t.key %>') {
+            $('#start').removeClass('active');
+            $('.nav-item a[href="#start"]').removeClass('active');
+
+            $('#<%- t.key %>').addClass('active');
+            $('.nav-item a[href="#<%- t.key %>"]').addClass('active');
+        }
+        <% } %>
+    });
+</script>
+</body>
+</html>

+ 259 - 0
app/view/wap/shenpi_advance_detail.ejs

@@ -0,0 +1,259 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
+    <meta http-equiv="x-ua-compatible" content="ie=edge">
+    <title>标段概况-计量支付</title>
+    <link rel="stylesheet" href="/public/css/bootstrap/bootstrap.min.css">
+    <link rel="stylesheet" href="/public/css/wap/main.css">
+    <link rel="stylesheet" href="/public/css/toast.css">
+    <link rel="stylesheet" href="/public/css/font-awesome/font-awesome.min.css">
+    <script src=/public/js/echarts/echarts.min.js></script>
+    <link rel="shortcut icon" href="/public/images/favicon.ico">
+    <style>
+        body {
+            padding: 0;
+        }
+    </style>
+</head>
+<body>
+<div class="container">
+    <!--顶部-->
+    <nav class="fixed-top bg-dark">
+        <div class="my-2 d-flex justify-content-between">
+            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>/advance#<%- advanceConst.typeCol[advance.type].key %>" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i><%- advanceConst.typeCol[advance.type].name %></a></span>
+            <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
+               style="width:150px" data-toggle="popover" data-placement="top"
+               data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>
+            <div class="mr-3">
+                <div class="dropdown">
+                    <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-toggle="dropdown">
+                        <%- ctx.session.sessionUser.name.substr(ctx.session.sessionUser.name.length > 2 ? ctx.session.sessionUser.name.length - 2 : 0) %>
+                    </button>
+                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
+                        <a class="dropdown-item" href="/wap/logout">退出登录</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </nav>
+    <!--标段概况-->
+    <div class="py-6">
+        <!--最新期-->
+        <% let audit = 0; %>
+        <% if (advance) { %>
+            <dl class="mb-2 mt-3">
+                <dt class="bg-light p-2 d-flex justify-content-between"><span><%- advanceConst.typeCol[advance.type].name %>-第<%- advance.order %>期</span>
+                    <span class="<%- auditConst.statusClass[advance.status] %>">
+                        <% if (advance.curAuditor) { %>
+                            <%- advance.curAuditor.name %><%if (advance.curAuditor.role !== '' && advance.curAuditor.role !== null) { %>-<%- advance.curAuditor.role %><% } %>
+                        <% } %>
+                        <%- auditConst.statusString[advance.status] %>
+                        </span>
+                </dt>
+                <dd>
+                    <table class="table table-hover">
+                        <tbody>
+                        <tr>
+                            <td>
+                                <p class="mb-0">签约预付款</p>
+                            </td>
+                            <td class="text-right">
+                                <b><%- advance.advancePayTotal %></b>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <p class="mb-0">本期支付比例</p>
+                            </td>
+                            <td class="text-right">
+                                <b><%- advance.pay_ratio %>%</b>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <p class="mb-0">本期金额</p>
+                            </td>
+                            <td class="text-right">
+                                <b><%- advance.cur_amount %></b>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                <p class="mb-0">截止本期金额</p>
+                            </td>
+                            <td class="text-right">
+                                <b><%- advance.prev_total_amount %></b>
+                            </td>
+                        </tr>
+                        </tbody></table>
+                </dd>
+            </dl>
+            <!--审批流程-->
+            <div class="card mt-3">
+                <ul class="list-group list-group-flush">
+                    <li class="list-group-item">
+                        <% if (advance.status === auditConst.status.uncheck) { %>
+                            <span class="pull-right"> 上报中</span>
+                        <% } else { %>
+                            <span class="text-success pull-right"><small><%- advance.auditors[0].create_time.toLocaleDateString() %></small> 上报</span>
+                        <% } %>
+                        <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- advance.user.name %><small class="text-muted"><%- advance.user.role %></small></h5>
+                    </li>
+                    <% for (let iA = 0; iA < advance.auditors.length; iA++) { %>
+                        <% const auditors = advance.auditors; %>
+                        <li class="list-group-item">
+                            <% if (auditors[iA].status === auditConst.status.checked) { %>
+                                <span class="text-success pull-right"><small><%- auditors[iA].end_time.toLocaleDateString() %></small> 审批通过</span>
+                                <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></h5>
+                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                            <% } else if (auditors[iA].status == auditConst.status.checking) { %>
+                                <span class="pull-right">审批中</span>
+                                <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></h5>
+                                <% if (auditors[iA].audit_id === ctx.session.sessionUser.accountId) { %>
+                                    <% audit = auditors[iA]; %>
+                                    <div class="form-group">
+                                        <div class="text-center">
+                                            <button class="btn btn-success" data-toggle="modal" data-target="#sp-done" >审批通过</button>
+                                            <button class="btn btn-warning" data-toggle="modal" data-target="#sp-back" >审批退回</button>
+                                        </div>
+                                    </div>
+                                <% } %>
+                            <% } else if (auditors[iA].status === auditConst.status.checkNoPre) { %>
+                                <% const auditorIndex = advance.auditors2.findIndex(function (item) { return item.audit_id === auditors[iA].audit_id }) %>
+                                <span class="text-warning pull-right"><small><%- auditors[iA].end_time.toLocaleDateString() %></small>审批退回 <%- advance.auditors2[auditorIndex-1].name %></span>
+                                <h5 class="card-title"><i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down text-warning' : 'fa fa-stop-circle text-warning') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
+                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                            <% } else if (auditors[iA].status === auditConst.status.checkNo) { %>
+                                <span class="text-warning pull-right"><small><%- auditors[iA].end_time.toLocaleDateString() %></small>审批退回</span>
+                                <h5 class="card-title"><i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down text-warning' : 'fa fa-stop-circle text-warning') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
+                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                            <% } 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></h5>
+                            <% } %>
+                        </li>
+                    <% } %>
+                </ul>
+            </div>
+        <% } %>
+    </div>
+    <!--底栏菜单-->
+    <nav class="fixed-bottom navbar-dark bg-light border-top">
+        <ul class="nav nav-fill my-2">
+            <li class="nav-item">
+                <a class="nav-link text-muted show-loading" href="/wap/dashboard"><i class="fa fa-check-square-o"></i> 待审批</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link active show-loading" href="/wap/list"><i class="fa fa-list-ul"></i> 项目</a>
+            </li>
+        </ul>
+    </nav>
+</div>
+<!--审批通过弹窗-->
+<div class="modal" tabindex="-1" role="dialog" id="sp-done">
+    <div class="modal-dialog" role="document">
+        <form class="modal-content" action="/tender/<%- tender.id %>/advance/<%- advance.id %>/audit/check" method="post" id="audit-check0" onsubmit="auditCheck(0)">
+            <div class="modal-header">
+                <h5 class="modal-title">审批通过</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label>审批意见</label>
+                    <textarea class="form-control" rows="8" name="opinion">同意</textarea>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
+                <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
+                <button type="submit" class="btn btn-success">审批通过</button>
+            </div>
+        </form>
+    </div>
+</div>
+<!--审批退回弹窗-->
+<div class="modal" tabindex="-1" role="dialog" id="sp-back">
+    <div class="modal-dialog" role="document">
+        <form class="modal-content" action="/tender/<%- advance.tid %>/advance/<%- advance.id %>/audit/check" method="post" id="audit-check1" onsubmit="auditCheck(1)">
+            <div class="modal-header">
+                <h5 class="modal-title">审批退回</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label>审批意见</label>
+                    <textarea class="form-control" rows="8" name="opinion">不同意</textarea>
+                </div>
+                <div class="alert alert-warning">
+                    <div class="custom-control custom-radio custom-control-inline">
+                        <input type="radio" id="customRadioInline1" name="checkType" class="custom-control-input" value="<%- auditConst.status.checkNo %>" <% if (audit.order === 1 || audit.audit_id === advance.auditors[0].audit_id) { %>checked<% } %>>
+                        <label class="custom-control-label" for="customRadioInline1">退回原报 <%- advance.user.name %></label>
+                    </div>
+                    <% if (audit.order > 1 && audit.audit_id !== advance.auditors[0].audit_id) { %>
+                        <% const auditorIndex = advance.auditors2.findIndex(function (item) { return item.audit_id === audit.audit_id }) %>
+                        <div class="custom-control custom-radio custom-control-inline">
+                            <input class="custom-control-input" type="radio" name="checkType" id="customRadioInline2" value="<%- auditConst.status.checkNoPre %>" checked>
+                            <label class="custom-control-label" for="customRadioInline2">退回上一审批人 <%- advance.auditors2[auditorIndex-1].name %></label>
+                        </div>
+                    <% } %>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
+                <button type="submit" class="btn btn-warning">确认退回</button>
+            </div>
+        </form>
+    </div>
+</div>
+<!-- JS. -->
+<script src="/public/js/jquery/jquery-3.2.1.min.js"></script>
+<script src="/public/js/popper/popper.min.js"></script>
+<script src="/public/js/bootstrap/bootstrap.min.js"></script>
+<script src="/public/js/cookies.js"></script>
+<script src="/public/js/wap/global.js"></script>
+<script>
+    // $(document).ready(function () {
+    //     $('#audit-check0').submit(function (e) {
+    //         if (auditCheck(0)) {
+    //             const data = {
+    //                 opinion: $('[name=opinion]', this).val(),
+    //                 checkType: parseInt($('[name=checkType]', this).val()),
+    //             };
+    //             postData(this.action, data, function () {
+    //                 window.location.reload();
+    //             });
+    //         }
+    //         return false;
+    //     });
+    //     $('#audit-check1').submit(function (e) {
+    //         if (auditCheck(1)) {
+    //             const data = {
+    //                 opinion: $('[name=opinion]', this).val(),
+    //                 checkType: parseInt($('[name=checkType]:checked', this).val()),
+    //             };
+    //             postData(this.action, data, function () {
+    //                 window.location.reload();
+    //             });
+    //         }
+    //         return false;
+    //     });
+    // })
+
+    // texterea换行
+
+    function auditCheck(i) {
+        const opinion = $('textarea[name="opinion"]').eq(i).val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ');
+        $('textarea[name="opinion"]').eq(i).val(opinion);
+        return true;
+    }
+</script>
+</body>
+
+</html>

+ 1 - 1
app/view/wap/shenpi_change.ejs

@@ -21,7 +21,7 @@
     <!--顶部-->
     <!--顶部-->
     <nav class="fixed-top bg-dark">
     <nav class="fixed-top bg-dark">
         <div class="my-2 d-flex justify-content-between">
         <div class="my-2 d-flex justify-content-between">
-            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i>工程变更</a></span>
+            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>#biangeng" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i>工程变更</a></span>
             <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
             <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
                style="width:150px" data-toggle="popover" data-placement="top"
                style="width:150px" data-toggle="popover" data-placement="top"
                data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>
                data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>

+ 225 - 0
app/view/wap/shenpi_revise.ejs

@@ -0,0 +1,225 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
+    <meta http-equiv="x-ua-compatible" content="ie=edge">
+    <title>标段概况-计量支付</title>
+    <link rel="stylesheet" href="/public/css/bootstrap/bootstrap.min.css">
+    <link rel="stylesheet" href="/public/css/wap/main.css">
+    <link rel="stylesheet" href="/public/css/toast.css">
+    <link rel="stylesheet" href="/public/css/font-awesome/font-awesome.min.css">
+    <script src=/public/js/echarts/echarts.min.js></script>
+    <link rel="shortcut icon" href="/public/images/favicon.ico">
+    <style>
+        body {
+            padding: 0;
+        }
+    </style>
+</head>
+<body>
+<div class="container">
+    <!--顶部-->
+    <nav class="fixed-top bg-dark">
+        <div class="my-2 d-flex justify-content-between">
+            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>#tzxiuding" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i>台账修订</a></span>
+            <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
+               style="width:150px" data-toggle="popover" data-placement="top"
+               data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>
+            <div class="mr-3">
+                <div class="dropdown">
+                    <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-toggle="dropdown">
+                        <%- ctx.session.sessionUser.name.substr(ctx.session.sessionUser.name.length > 2 ? ctx.session.sessionUser.name.length - 2 : 0) %>
+                    </button>
+                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
+                        <a class="dropdown-item" href="/wap/logout">退出登录</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </nav>
+    <!--标段概况-->
+    <div class="py-6">
+        <!--最新期-->
+        <% let audit = 0; %>
+        <% if (revise) { %>
+            <dl class="mb-2 mt-3">
+                <dt class="bg-light p-2 d-flex justify-content-between"><span>第<%- revise.corder %>次修订</span>
+                    <% if (!revise.valid) {%>
+                    <span class="text-danger">
+                        作废
+                    </span>
+                    <% } else { %>
+                    <span class="<%- auditConst.auditStringClass[revise.status] %>">
+                        <% if (revise.curAuditor && revise.status !== auditConst.status.checked) { %>
+                            <%- revise.curAuditor.name %><%if (revise.curAuditor.role !== '' && revise.curAuditor.role !== null) { %>-<%- revise.curAuditor.role %><% } %>
+                        <% } %>
+                        <%- revise.status === auditConst.status.checked ? '审批完成' : auditConst.auditProgress[revise.status] %>
+                    </span>
+                    <% } %>
+                </dt>
+                <dd>
+                    <table class="table table-hover">
+                        <tr><td width="90">修订时间</td><td><%- ctx.moment(revise.in_time).format('YYYY-MM-DD') %></td></tr>
+                        <tr><td>修订人</td><td><%- revise.user.name %></td></tr>
+                        <tr><td>修订详情</td><td><%- revise.content %></td></tr>
+                    </table>
+                </dd>
+            </dl>
+            <!--审批流程-->
+            <div class="card mt-3">
+                <ul class="list-group list-group-flush">
+                    <li class="list-group-item">
+                        <% if (!revise.valid) { %>
+                            <span class="text-danger pull-right"> 作废</span>
+                        <% } else if (revise.status === auditConst.status.uncheck) { %>
+                            <span class="pull-right"> 上报中</span>
+                        <% } else { %>
+                            <span class="text-success pull-right"><small><%- revise.auditors[0].begin_time.toLocaleDateString() %></small> 上报</span>
+                        <% } %>
+                        <h5 class="card-title"><i class="fa fa-play-circle fa-rotate-90 text-success"></i> <%- revise.user.name %><small class="text-muted"><%- revise.user.role %></small></h5>
+                    </li>
+                    <% for (let iA = 0; iA < revise.auditors.length; iA++) { %>
+                        <% const auditors = revise.auditors; %>
+                        <li class="list-group-item">
+                            <% if (auditors[iA].status === auditConst.status.checked) { %>
+                                <span class="text-success pull-right"><small><%- auditors[iA].end_time.toLocaleDateString() %></small> 审批通过</span>
+                                <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></h5>
+                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                            <% } else if (auditors[iA].status == auditConst.status.checking) { %>
+                                <span class="pull-right">审批中</span>
+                                <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></h5>
+                                <% if (auditors[iA].audit_id === ctx.session.sessionUser.accountId) { %>
+                                    <% audit = auditors[iA]; %>
+                                    <div class="form-group">
+                                        <div class="text-center">
+                                            <button class="btn btn-success" data-toggle="modal" data-target="#sp-done" >审批通过</button>
+                                            <button class="btn btn-warning" data-toggle="modal" data-target="#sp-back" >审批退回</button>
+                                        </div>
+                                    </div>
+                                <% } %>
+                            <% } else if (auditors[iA].status === auditConst.status.checkNo) { %>
+                                <span class="text-warning pull-right"><small><%- auditors[iA].end_time.toLocaleDateString() %></small>审批退回</span>
+                                <h5 class="card-title"><i class="<%- (iA < auditors.length - 1 ? 'fa fa-chevron-circle-down text-warning' : 'fa fa-stop-circle text-warning') %>"></i> <%- auditors[iA].name %> <small class="text-muted"><%- auditors[iA].role %></small></h5>
+                                <p class="card-text"><%- auditors[iA].opinion %></p>
+                            <% } 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></h5>
+                            <% } %>
+                        </li>
+                    <% } %>
+                </ul>
+            </div>
+        <% } %>
+    </div>
+    <!--底栏菜单-->
+    <nav class="fixed-bottom navbar-dark bg-light border-top">
+        <ul class="nav nav-fill my-2">
+            <li class="nav-item">
+                <a class="nav-link text-muted show-loading" href="/wap/dashboard"><i class="fa fa-check-square-o"></i> 待审批</a>
+            </li>
+            <li class="nav-item">
+                <a class="nav-link active show-loading" href="/wap/list"><i class="fa fa-list-ul"></i> 项目</a>
+            </li>
+        </ul>
+    </nav>
+</div>
+<!--审批通过弹窗-->
+<div class="modal" tabindex="-1" role="dialog" id="sp-done">
+    <div class="modal-dialog" role="document">
+        <form class="modal-content" action="/tender/<%- tender.id %>/revise/audit/check" method="post" id="audit-check0" onsubmit="auditCheck(0)">
+            <div class="modal-header">
+                <h5 class="modal-title">审批通过</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label>审批意见</label>
+                    <textarea class="form-control" rows="8" name="opinion">同意</textarea>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
+                <input type="hidden" name="checkType" value="<%= auditConst.status.checked %>" />
+                <button type="submit" class="btn btn-success">审批通过</button>
+            </div>
+        </form>
+    </div>
+</div>
+<!--审批退回弹窗-->
+<div class="modal" tabindex="-1" role="dialog" id="sp-back">
+    <div class="modal-dialog" role="document">
+        <form class="modal-content" action="/tender/<%- revise.tid %>/revise/audit/check" method="post" id="audit-check1" onsubmit="auditCheck(1)">
+            <div class="modal-header">
+                <h5 class="modal-title">审批退回</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label>审批意见</label>
+                    <textarea class="form-control" rows="8" name="opinion">不同意</textarea>
+                </div>
+                <div class="alert alert-warning">
+                    <div class="custom-control custom-radio custom-control-inline">
+                        <input type="radio" id="customRadioInline1" name="checkType" checked class="custom-control-input" value="<%- auditConst.status.checkNo %>" <% if (audit.order === 1 || audit.audit_id === revise.auditors[0].audit_id) { %>checked<% } %>>
+                        <label class="custom-control-label" for="customRadioInline1">退回原报 <%- revise.user.name %></label>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+                <input type="hidden" name="_csrf_j" value="<%= ctx.csrf %>" />
+                <button type="submit" class="btn btn-warning">确认退回</button>
+            </div>
+        </form>
+    </div>
+</div>
+<!-- JS. -->
+<script src="/public/js/jquery/jquery-3.2.1.min.js"></script>
+<script src="/public/js/popper/popper.min.js"></script>
+<script src="/public/js/bootstrap/bootstrap.min.js"></script>
+<script src="/public/js/cookies.js"></script>
+<script src="/public/js/wap/global.js"></script>
+<script>
+    // $(document).ready(function () {
+    //     $('#audit-check0').submit(function (e) {
+    //         if (auditCheck(0)) {
+    //             const data = {
+    //                 opinion: $('[name=opinion]', this).val(),
+    //                 checkType: parseInt($('[name=checkType]', this).val()),
+    //             };
+    //             postData(this.action, data, function () {
+    //                 window.location.reload();
+    //             });
+    //         }
+    //         return false;
+    //     });
+    //     $('#audit-check1').submit(function (e) {
+    //         if (auditCheck(1)) {
+    //             const data = {
+    //                 opinion: $('[name=opinion]', this).val(),
+    //                 checkType: parseInt($('[name=checkType]:checked', this).val()),
+    //             };
+    //             postData(this.action, data, function () {
+    //                 window.location.reload();
+    //             });
+    //         }
+    //         return false;
+    //     });
+    // })
+
+    // texterea换行
+
+    function auditCheck(i) {
+        const opinion = $('textarea[name="opinion"]').eq(i).val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' ');
+        $('textarea[name="opinion"]').eq(i).val(opinion);
+        return true;
+    }
+</script>
+</body>
+
+</html>

+ 1 - 1
app/view/wap/shenpi_stage.ejs

@@ -22,7 +22,7 @@
     <!--顶部-->
     <!--顶部-->
     <nav class="fixed-top bg-dark">
     <nav class="fixed-top bg-dark">
         <div class="my-2 d-flex justify-content-between">
         <div class="my-2 d-flex justify-content-between">
-            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i>计量期</a></span>
+            <span class="text-white ml-3"><a href="/wap/tender/<%- tender.id %>#jlqi" class="mr-2 text-white show-loading"><i class="fa fa-chevron-left"></i>计量期</a></span>
             <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
             <a tabindex="0" href="javascript:void(0)" class="text-white text-truncate text-center"
                style="width:150px" data-toggle="popover" data-placement="top"
                style="width:150px" data-toggle="popover" data-placement="top"
                data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>
                data-content="<%- tender.name %>" data-trigger="focus"><%- tender.name %></a>

+ 95 - 3
app/view/wap/tender.ejs

@@ -15,6 +15,15 @@
         body {
         body {
             padding: 0;
             padding: 0;
         }
         }
+        .tab-content > .tab-pane,.pill-content > .pill-pane {
+            display: block;
+            height: 0;
+            overflow-y: hidden;
+        }
+
+        .tab-content > .active,.pill-content > .active {
+            height: auto;
+        }
     </style>
     </style>
 </head>
 </head>
 <body>
 <body>
@@ -43,13 +52,19 @@
         <!--标签-->
         <!--标签-->
         <ul class="nav nav-tabs nav-fill">
         <ul class="nav nav-tabs nav-fill">
             <li class="nav-item">
             <li class="nav-item">
-                <a class="nav-link active" data-toggle="tab" href="#gaikuang" role="tab">概况</a>
+                <a class="px-1 nav-link active" data-toggle="tab" href="#gaikuang" role="tab">概况</a>
+            </li>
+            <li class="nav-item">
+                <a class="px-1 nav-link" data-toggle="tab" href="#yufukuan" role="tab">预付款</a>
             </li>
             </li>
             <li class="nav-item">
             <li class="nav-item">
-                <a class="nav-link" data-toggle="tab" href="#jlqi" role="tab">计量期</a>
+                <a class="px-1 nav-link" data-toggle="tab" href="#tzxiuding" role="tab">台帐修订</a>
             </li>
             </li>
             <li class="nav-item">
             <li class="nav-item">
-                <a class="nav-link" data-toggle="tab" href="#biangeng" role="tab">工程变更</a>
+                <a class="px-1 nav-link" data-toggle="tab" href="#jlqi" role="tab">计量期</a>
+            </li>
+            <li class="nav-item">
+                <a class="px-1 nav-link" data-toggle="tab" href="#biangeng" role="tab">工程变更</a>
             </li>
             </li>
         </ul>
         </ul>
         <div class="tab-content">
         <div class="tab-content">
@@ -76,6 +91,49 @@
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
+            <div class="tab-pane" id="yufukuan">
+                <% for (const t of advanceConst.typeCol) { %>
+                <div class="card my-3">
+                    <div class="card-body">
+                        <a href="/wap/tender/<%- tender.id %>/advance#<%- t.key %>"><h5 class="card-title d-flex justify-content-between"><%- t.name %><span><% if (advanceList[t.type]) { %>第<%- advanceList[t.type].order %>期<% } %></span></h5></a>
+                    </div>
+                </div>
+                <% } %>
+            </div>
+            <div class="tab-pane" id="tzxiuding">
+                <dl class="mb-2 mt-3">
+                    <% for (const lr of revises) { %>
+                    <dt class="bg-light p-2 d-flex justify-content-between"><span>第<%- lr.corder %>次修订</span>
+                        <% if (!lr.valid) {%>
+                        <span class="text-danger">
+                            作废
+                        </span>
+                        <% } else { %>
+                        <span class="<%- auditReviseConst.auditStringClass[lr.status] %>">
+                            <% if (lr.curAuditor && lr.status !== auditReviseConst.status.checked) { %>
+                                <%- lr.curAuditor.name %><%if (lr.curAuditor.role !== '' && lr.curAuditor.role !== null) { %>-<%- lr.curAuditor.role %><% } %>
+                            <% } %>
+                            <%- lr.status === auditReviseConst.status.checked ? '审批完成' : auditReviseConst.auditProgress[lr.status] %>
+                        </span>
+                        <% } %>
+                    </dt>
+                    <dd>
+                        <table class="table table-hover">
+                            <tr><td width="90">修订时间</td><td><%- ctx.moment(lr.in_time).format('YYYY-MM-DD') %></td></tr>
+                            <tr><td>修订人</td><td><%- lr.user_name %></td></tr>
+                            <tr><td>修订详情</td><td><% if (lr.content) { %><% if (lr.content.length <= 22) { %><%- lr.content %><% } else { %><%- lr.content.substring(0,22) %><a class="show-content" data-content="<%- lr.content %>" href="javascript:void(0);">展开更多</a><% } %><% } %></td></tr>
+                            <% if (lr.curAuditor && lr.status == auditReviseConst.status.checking && lr.curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
+                            <tr>
+                                <td colspan="2">
+                                    <a class="btn btn-block btn-success" href="/wap/tender/<%- tender.id %>/revise/<%- lr.id %>/info">审批</a>
+                                </td>
+                            </tr>
+                            <% } %>
+                        </table>
+                    </dd>
+                    <% } %>
+                </dl>
+            </div>
             <div class="tab-pane" id="jlqi">
             <div class="tab-pane" id="jlqi">
                 <!--期列表-->
                 <!--期列表-->
                 <dl class="mb-2 mt-3">
                 <dl class="mb-2 mt-3">
@@ -418,6 +476,40 @@
     myChart.setOption(option);
     myChart.setOption(option);
     //3 标段月进度//
     //3 标段月进度//
 </script>
 </script>
+<script>
+    $(document).ready(function () {
+        if (window.location.hash && window.location.hash === '#yufukuan') {
+            $('#gaikuang').removeClass('active');
+            $('.nav-item a[href="#gaikuang"]').removeClass('active');
+
+            $('#yufukuan').addClass('active');
+            $('.nav-item a[href="#yufukuan"]').addClass('active');
+        } else if (window.location.hash && window.location.hash === '#tzxiuding') {
+            $('#gaikuang').removeClass('active');
+            $('.nav-item a[href="#gaikuang"]').removeClass('active');
+
+            $('#tzxiuding').addClass('active');
+            $('.nav-item a[href="#tzxiuding"]').addClass('active');
+        } else if (window.location.hash && window.location.hash === '#jlqi') {
+            $('#gaikuang').removeClass('active');
+            $('.nav-item a[href="#gaikuang"]').removeClass('active');
+
+            $('#jlqi').addClass('active');
+            $('.nav-item a[href="#jlqi"]').addClass('active');
+        } else if (window.location.hash && window.location.hash === '#biangeng') {
+            $('#gaikuang').removeClass('active');
+            $('.nav-item a[href="#gaikuang"]').removeClass('active');
+
+            $('#biangeng').addClass('active');
+            $('.nav-item a[href="#biangeng"]').addClass('active');
+        }
+
+        $('.show-content').on('click', function () {
+            $(this).parents('td').html($(this).data('content'));
+        });
+
+    });
+</script>
 </body>
 </body>
 
 
 </html>
 </html>