Sfoglia il codice sorgente

工程量进度展示和切换

laiguoran 4 anni fa
parent
commit
026f24079e

+ 66 - 2
app/controller/schedule_controller.js

@@ -105,8 +105,9 @@ module.exports = app => {
                 }), 'yearmonth');
                 yearSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, yearConllection);
                 // 获取本年完成计量数据
+                const curStage = _.find(stageOrderList, { order: curScheduleStage.order });
                 const stageList = _.filter(stageOrderList, function(item) {
-                    return item.s_time.indexOf(curScheduleStage.yearmonth.split('-')[0]) !== -1;
+                    return item.s_time.indexOf(curStage.s_time.split('-')[0]) !== -1;
                 });
                 const stageIdList = _.map(_.filter(stageList, function(item) {
                     return _.find(newSS, { order: item.order });
@@ -137,12 +138,16 @@ module.exports = app => {
             const tender = ctx.tender;
             const schedule = await ctx.service.schedule.getDataByCondition({ tid: tender.id });
             const scheduleMonth = await ctx.service.scheduleMonth.getAllDataByCondition({ where: { tid: tender.id }, orders: [['yearmonth', 'asc']] });
+            const scheduleStage = await ctx.service.scheduleStage.getAllDataByCondition({ where: { tid: tender.id }, orders: [['order', 'desc']] });
+            const curScheduleStage = scheduleStage.length > 0 ? _.maxBy(scheduleStage, 'order') : null;
             const renderData = {
                 tender: tender.data,
                 tenderInfo: tender.info,
                 schedule,
                 scheduleMonth,
                 measureType,
+                scheduleStage,
+                curScheduleStage,
                 scheduleLedgerList: await this._getSelectedLedgerList(ctx),
                 jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.schedule.stageGcl),
             };
@@ -150,7 +155,66 @@ module.exports = app => {
         }
 
         /**
-         * 获取部位明细数据(Ajax)
+         * 获取金额模式下台账数据(Ajax)
+         *
+         * @param ctx
+         * @return {Promise<void>}
+         */
+        async loadTpLedgerData(ctx) {
+            try {
+                const tender = ctx.tender;
+                // const ledgerData = await ctx.controller.stage._getStageLedgerData(ctx);
+                // console.log(ledgerData);
+                const stageOrderList = await ctx.service.stage.getAllDataByCondition({ columns: ['id', 's_time', 'order'], where: { tid: tender.id } });
+                const scheduleStage = await ctx.service.scheduleStage.getAllDataByCondition({ where: { tid: tender.id }, orders: [['order', 'desc']] });
+                const curScheduleStage = _.find(scheduleStage, { order: parseInt(ctx.params.order) });
+                let slmList = [];
+                let nextSlmList = [];
+                let endSlmList = [];
+                let yearSlmList = [];
+                let curYearStageData = [];
+                if (curScheduleStage) {
+                    const newSS = _.sortBy(scheduleStage, 'yearmonth');
+                    const nowScheduleStage = _.findIndex(newSS, { yearmonth: curScheduleStage.yearmonth });
+                    slmList = await ctx.service.scheduleLedgerMonth.getAllDataByCondition({ where: { tid: tender.id, yearmonth: curScheduleStage.yearmonth } });
+                    const nextScheduleStage = nowScheduleStage >= 0 && nowScheduleStage + 1 <= newSS.length - 1 ? newSS[nowScheduleStage + 1] : null;
+                    if (nextScheduleStage) nextSlmList = await ctx.service.scheduleLedgerMonth.getAllDataByCondition({ where: { tid: tender.id, yearmonth: nextScheduleStage.yearmonth } });
+                    if (nowScheduleStage === 0) {
+                        endSlmList = slmList;
+                    } else if (nowScheduleStage > 0) {
+                        const endYearmonthCollection = _.map(_.take(newSS, nowScheduleStage + 1), 'yearmonth');
+                        endSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, endYearmonthCollection);
+                    }
+                    const yearConllection = _.map(_.filter(newSS, function(item) {
+                        return item.yearmonth.indexOf(curScheduleStage.yearmonth.split('-')[0]) !== -1;
+                    }), 'yearmonth');
+                    yearSlmList = await ctx.service.scheduleLedgerMonth.getConllectionList(tender.id, yearConllection);
+                    // 获取本年完成计量数据
+                    const curStage = _.find(stageOrderList, { order: curScheduleStage.order });
+                    const stageList = _.filter(stageOrderList, function(item) {
+                        return item.s_time.indexOf(curStage.s_time.split('-')[0]) !== -1;
+                    });
+                    const stageIdList = _.map(_.filter(stageList, function(item) {
+                        return _.find(newSS, { order: item.order });
+                    }), 'id');
+                    curYearStageData = await ctx.service.stageBills.getStagesData(tender.id, stageIdList.join(','));
+                }
+                ctx.body = { err: 0, msg: '', data: {
+                    // ledgerData,
+                    slmList,
+                    nextSlmList,
+                    endSlmList,
+                    yearSlmList,
+                    curYearStageData,
+                } };
+            } catch (err) {
+                this.log(err);
+                ctx.body = { err: 1, msg: err.toString(), data: [] };
+            }
+        }
+
+        /**
+         * 获取台账数据(Ajax)
          *
          * @param ctx
          * @return {Promise<void>}

+ 196 - 3
app/public/js/schedule_stage_gcl.js

@@ -289,6 +289,149 @@ $(function () {
     SpreadJsObj.addDeleteBind(ledgerSpread, ledgerSpreadObj.deletePress);
     ledgerSpread.bind(spreadNS.Events.ClipboardPasted, ledgerSpreadObj.clipboardPasted);
 
+
+    // 下方金额模式的sjs
+    const huizongSpread = SpreadJsObj.createNewSpread($('#huizong-spread')[0]);
+    const huizongTreeSetting = {
+        id: 'ledger_id',
+        pid: 'ledger_pid',
+        order: 'order',
+        level: 'level',
+        rootId: -1,
+        fullPath: 'full_path',
+        calcFields: ['plan_gcl', 'plan_tp', 'next_plan_gcl', 'next_plan_tp', 'end_plan_gcl', 'end_plan_tp', 'year_plan_gcl', 'year_plan_tp'],
+    };
+
+    const huizong_static_cols = [
+        {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', readOnly: true, cellType: 'tree'},
+        {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@', readOnly: true},
+        {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
+        {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
+        {title: '总设计|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '自开工至本月计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'end_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'end_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '截止本月完成计量|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '本年计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'year_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'year_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '本年累计完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'year_contract_qty', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'year_gather_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '本月计划完成|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '下月计划|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'next_plan_gcl', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+        {title: '|金额(万元)', colSpan: '|1', rowSpan: '|1', field: 'next_plan_tp', hAlign: 2, width: 70, type: 'Number', readOnly: true},
+    ];
+
+    const huizongSpreadSetting = {
+        emptyRows: 0,
+        headRows: 2,
+        headRowHeight: [25, 25],
+        defaultRowHeight: 21,
+        headerFont: '12px 微软雅黑',
+        font: '12px 微软雅黑',
+        // readOnly: true,
+        localCache: {
+            key: 'ledger-bills',
+            colWidth: true,
+        }
+    };
+    huizongSpreadSetting.cols = huizong_static_cols;
+
+    sjsSettingObj.setFxTreeStyle(huizongSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
+    if (thousandth) sjsSettingObj.setTpThousandthFormat(huizongSpreadSetting);
+    SpreadJsObj.initSheet(huizongSpread.getActiveSheet(), huizongSpreadSetting);
+    SpreadJsObj.selChangedRefreshBackColor(huizongSpread.getActiveSheet());
+
+    const huizongObj = {
+        setSjs: function (order) {
+            postData('/tender/' + getTenderId() + '/measure/stage/' + order + '/load', { filter: 'ledger' }, function (data) {
+                postData('/tender/' + getTenderId() + '/schedule/stage/' + order + '/load', {}, function (data2) {
+                    const calcList = ['year_contract_qty', 'year_gather_tp',
+                        'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
+                        'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp'];
+                    const showList = ['plan_gcl', 'plan_tp', 'next_plan_gcl', 'next_plan_tp', 'end_plan_gcl', 'end_plan_tp', 'year_plan_gcl', 'year_plan_tp',
+                        'year_contract_qty', 'year_gather_tp',
+                        'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'ledger_id', 'ledger_pid', 'order', 'level', 'tender_id', 'full_path',
+                        'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'dgn_price', 'quantity', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
+                        'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp'];
+                    const baseLedgerTreeSetting = {
+                        id: 'ledger_id',
+                        pid: 'ledger_pid',
+                        order: 'order',
+                        level: 'level',
+                        rootId: -1,
+                        fullPath: 'full_path',
+                        calcFields: calcList,
+                    };
+                    baseLedgerTreeSetting.updateFields = ['year_contract_qty', 'year_gather_tp', 'contract_qty', 'end_gather_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr'];
+                    baseLedgerTreeSetting.calcFun = function (node) {
+                        if (!node.children || node.children.length === 0) {
+                            node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
+                            node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
+                            node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
+                            node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
+                            node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
+                        }
+                        node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
+                        node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
+                        node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
+                        node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
+                        node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
+                        node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
+                        if (!node.children || node.children.length === 0) {
+                            if (node.end_contract_qty) {
+                                node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
+                            } else {
+                                node.end_correct_tp = node.end_gather_tp;
+                            }
+                        }
+                        node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
+                        node.end_correct_percent = ZhCalc.mul(ZhCalc.div(node.end_correct_tp, node.end_final_tp), 100, 2);
+                        node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up);
+                        node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
+                    };
+                    const baseLedgerTree = createNewPathTree('base', baseLedgerTreeSetting);
+                    const newLedgerList = setTpMonthToLedger(data.ledgerData, data2.slmList, data2.nextSlmList, data2.endSlmList, data2.yearSlmList, data2.curYearStageData);
+                    baseLedgerTree.loadDatas(newLedgerList);
+                    treeCalc.calculateAll(baseLedgerTree);
+                    const huizongTree = createNewPathTree('filter', huizongTreeSetting);
+                    for (const d of baseLedgerTree.nodes) {
+                        if (!d.b_code) {
+                            const one = _.find(selectedLedgerList, function (item) {
+                                return item === d.ledger_id;
+                            });
+                            if (one) {
+                                huizongTree.addData(d, showList);
+                            }
+                        }
+                    }
+                    huizongTree.sortTreeNode(true);
+                    treeCalc.calculateAll(huizongTree);
+                    console.log(huizongTree);
+                    SpreadJsObj.loadSheetData(huizongSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, huizongTree);
+                }, null, true);
+            }, null, true);
+        }
+    };
+
+    if (curScheduleStage && curScheduleStage.order) {
+        huizongObj.setSjs(curScheduleStage.order);
+    }
+
+    // 汇总切换
+    $('body').on('click', '.change-tp', function () {
+        const order = parseInt($(this).data('order'));
+        $('#dropdownMenuButton').text($(this).text());
+        let html = '';
+        for (const ss of scheduleStage) {
+            if (ss.order !== order)
+            html += '<a class="dropdown-item change-tp" data-order="'+ ss.order +'" href="javascript:void(0);">'+ ss.yearmonth.split('-')[0] + '年' + parseInt(ss.yearmonth.split('-')[1]) +'月(第'+ ss.order +'期)</a>';
+        }
+        $('.dropdown-menu').html(html);
+        huizongObj.setSjs(order);
+    });
+
     // 月份添加
     $('#add-month').click(function () {
         const id = parseInt($('#month-select').val());
@@ -354,8 +497,9 @@ $(function () {
                 $('.panel-title').removeClass('fluid');
                 $('#sub-menu').addClass('panel-sidebar');
             }
-            ledgerSpread.refresh();
             autoFlashHeight();
+            ledgerSpread.refresh();
+            huizongSpread.refresh();
         }
     });
 
@@ -364,8 +508,9 @@ $(function () {
         callback: function () {
             ledgerSpread.refresh();
             let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
-            $(".tab-content").height(bcontent-30);
-            // posSpread.refresh();
+            $(".sp-wrap").height(bcontent-30);
+            huizongSpread.refresh();
+            window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
         }
     });
 });
@@ -396,6 +541,54 @@ function setMonthToLedger(ledgerList, slm) {
     }
     return ledgerList;
 }
+function setTpMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm, yearLedgerData) {
+    if (slm.length > 0) {
+        for(const s of slm) {
+            const index = _.findIndex(ledgerList, { 'ledger_id': s.lid });
+            if (index && index !== -1) {
+                ledgerList[index].plan_tp = s.plan_tp;
+                ledgerList[index].plan_gcl = s.plan_gcl;
+            }
+        }
+    }
+    if (nextSlm.length > 0) {
+        for (const ns of nextSlm) {
+            const index = _.findIndex(ledgerList, {'ledger_id': ns.lid});
+            if (index && index !== -1) {
+                ledgerList[index].next_plan_tp = ns.plan_tp;
+                ledgerList[index].next_plan_gcl = ns.plan_gcl;
+            }
+        }
+    }
+    if (endSlm.length > 0) {
+        for (const es of endSlm) {
+            const index = _.findIndex(ledgerList, {'ledger_id': es.lid});
+            if (index && index !== -1) {
+                ledgerList[index].end_plan_tp = es.plan_tp;
+                ledgerList[index].end_plan_gcl = es.plan_gcl;
+            }
+        }
+    }
+    if (yearSlm.length > 0) {
+        for (const ys of yearSlm) {
+            const index = _.findIndex(ledgerList, {'ledger_id': ys.lid});
+            if (index && index !== -1) {
+                ledgerList[index].year_plan_tp = ys.plan_tp;
+                ledgerList[index].year_plan_gcl = ys.plan_gcl;
+            }
+        }
+    }
+    if (yearLedgerData.length > 0) {
+        for (const yl of yearLedgerData) {
+            const index = _.findIndex(ledgerList, {'id': yl.lid});
+            if (index && index !== -1) {
+                ledgerList[index].year_contract_qty = ZhCalc.add(yl.contract_qty, yl.qc_qty);
+                ledgerList[index].year_gather_tp = ZhCalc.add(yl.contract_tp, yl.qc_tp);
+            }
+        }
+    }
+    return ledgerList;
+}
 const is_numeric = (value) => {
     if (typeof(value) === 'object') {
         return false;

+ 0 - 70
app/public/js/schedule_stage_tp.js

@@ -135,58 +135,6 @@ $(function () {
         }, null, true);
     }
 
-    const ledgerSpreadObj = {
-        refreshTree: function (sheet, data) {
-            SpreadJsObj.massOperationSheet(sheet, function () {
-                const tree = sheet.zh_tree;
-                // 处理删除
-                if (data.delete) {
-                    data.delete.sort(function (x, y) {
-                        return y.deleteIndex - x.deleteIndex;
-                    });
-                    for (const d of data.delete) {
-                        sheet.deleteRows(d.deleteIndex, 1);
-                    }
-                }
-                // 处理新增
-                if (data.create) {
-                    const newNodes = data.create;
-                    if (newNodes) {
-                        newNodes.sort(function (a, b) {
-                            return a.index - b.index;
-                        });
-
-                        for (const node of newNodes) {
-                            sheet.addRows(node.index, 1);
-                            SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
-                        }
-                    }
-                }
-                // 处理更新
-                if (data.update) {
-                    const rows = [];
-                    for (const u of data.update) {
-                        rows.push(tree.nodes.indexOf(u));
-                    }
-                    SpreadJsObj.reLoadRowsData(sheet, rows);
-                }
-                // 处理展开
-                if (data.expand) {
-                    const expanded = [];
-                    for (const e of data.expand) {
-                        if (expanded.indexOf(e) === -1) {
-                            const posterity = tree.getPosterity(e);
-                            for (const p of posterity) {
-                                sheet.setRowVisible(tree.nodes.indexOf(p), p.visible);
-                                expanded.push(p);
-                            }
-                        }
-                    }
-                }
-            });
-        },
-    };
-
     $('#add-stage').click(function () {
         const yearmonth = $('#month_list').val();
         const order = parseInt($('#stage_list').val());
@@ -255,17 +203,6 @@ $(function () {
         }
     });
 });
-function setLeafData(tree) {
-    const newtree = [];
-    for (const t of tree) {
-        const child = _.find(tree, { 'ledger_pid': t.ledger_id });
-        if (!child && !t.is_leaf) {
-            t.is_leaf = true;
-        }
-        newtree.push(t);
-    }
-    return newtree;
-}
 
 function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm, yearLedgerData) {
     if (slm.length > 0) {
@@ -315,10 +252,3 @@ function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm, yearLedgerD
     }
     return ledgerList;
 }
-const is_numeric = (value) => {
-    if (typeof(value) === 'object') {
-        return false;
-    } else {
-        return !Number.isNaN(Number(value)) && value.toString().trim() !== '';
-    }
-};

+ 1 - 0
app/router.js

@@ -449,6 +449,7 @@ module.exports = app => {
     app.post('/tender/:id/schedule/stage/save', sessionAuth, tenderCheck, uncheckTenderCheck, 'scheduleController.saveStageTp');
     app.get('/tender/:id/schedule/stage/gcl', sessionAuth, tenderCheck, uncheckTenderCheck, 'scheduleController.stageGcl');
     app.post('/tender/:id/schedule/stage/gcl/save', sessionAuth, tenderCheck, uncheckTenderCheck, 'scheduleController.saveStageGcl');
+    app.post('/tender/:id/schedule/stage/:order/load', sessionAuth, tenderCheck, uncheckTenderCheck, stageCheck, 'scheduleController.loadTpLedgerData');
 
     // 书签
     app.post('/tender/:id/ledger/tag', sessionAuth, tenderCheck, uncheckTenderCheck, 'tenderController.billsTag');

+ 19 - 35
app/view/schedule/stage_gcl.ejs

@@ -25,52 +25,34 @@
         <div class="c-body">
             <div class="sjs-height-1" style="overflow: auto;" id="ledger-spread">
             </div>
-            <div class="bcontent-wrap">
-                <div id="main-resize" class="resize-y" id="top-spr" r-Type="height" div1=".sjs-height-1" div2=".bcontent-wrap" title="调整大小"><!--调整上下高度条--></div>
+            <div class="bcontent-wrap" id="main-bottom">
+                <div id="main-resize" class="resize-y" r-Type="height" div1="#ledger-spread" div2="#main-bottom" title="调整大小"><!--调整上下高度条--></div>
                 <div class="bc-bar mb-1">
                     <ul class="nav nav-tabs">
                         <li class="nav-item">
                             <a class="nav-link active" data-toggle="tab" href="#huizong" role="tab">汇总</a>
                         </li>
                         <li class="nav-item">
-                            <div class="d-inline-block ml-2">
-                                <div class="dropdown">
-                                    <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                        2020年
-                                    </button>
-                                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start">
-                                        <a class="dropdown-item" href="#">2019年</a>
+                            <% if (scheduleStage.length > 0) { %>
+                                <div class="d-inline-block ml-2">
+                                    <div class="dropdown">
+                                        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                            <%- curScheduleStage.yearmonth.split('-')[0] %>年<%- parseInt(curScheduleStage.yearmonth.split('-')[1]) %>月(第<%- curScheduleStage.order %>期)
+                                        </button>
+                                        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 26px, 0px); top: 0px; left: 0px; will-change: transform;">
+                                            <% for (const s of scheduleStage) { %>
+                                                <% if (s.id !== curScheduleStage.id) { %>
+                                                    <a class="dropdown-item change-tp" data-order="<%- s.order %>" href="javascript:void(0);"><%- s.yearmonth.split('-')[0] %>年<%- parseInt(s.yearmonth.split('-')[1]) %>月(第<%- s.order %>期)</a>
+                                                <% } %>
+                                            <% } %>
+                                        </div>
                                     </div>
                                 </div>
-                            </div>
-                            <div class="d-inline-block">
-                                <div class="dropdown">
-                                    <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                                        1月
-                                    </button>
-                                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start">
-                                        <a class="dropdown-item" href="#">2月</a>
-                                        <a class="dropdown-item" href="#">3月</a>
-                                        <a class="dropdown-item" href="#">4月</a>
-                                    </div>
-                                </div>
-                            </div>
+                            <% } %>
                         </li>
                     </ul>
                 </div>
-                <div class="tab-content">
-                    <div class="tab-pane active" id="huizong-spread">
-                        <table class="table table-bordered table-sm">
-                            <thead>
-                            <tr class="text-center"><th rowspan="2">项目节编号</th><th rowspan="2">名称</th><th rowspan="2">单位</th><th rowspan="2">经济指标</th><th colspan="2">总设计</th><th colspan="2">自开工至本月计划完成</th><th colspan="2">截止本月完成计量</th><th colspan="2">本年计划完成</th><th colspan="2">本年累计完成</th><th colspan="2">本月计划完成</th><th colspan="2">本月完成计量</th><th colspan="2">下月计划</th></tr>
-                            <tr class="text-center"><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th><th>工程量</th><th>金额(万元)</th></tr>
-                            </thead>
-                            <tr><td>1-2</td><td>路基工程</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
-                            <tr><td>1-2-2</td><td>挖方</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
-                            <tr><td>1-2-2-1</td><td>挖土方</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
-                            <tr><td>1-2-2-1-1</td><td>挖路基土方</td><td></td><td></td><td></td><td></td><td>11111</td><td>11111</td><td>22222</td><td>22222</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
-                        </table>
-                    </div>
+                <div class="sp-wrap" id="huizong-spread">
                 </div>
             </div>
         </div>
@@ -84,4 +66,6 @@
     const schedule = JSON.parse('<%- JSON.stringify(schedule) %>');
     const scheduleMonth = JSON.parse('<%- JSON.stringify(scheduleMonth) %>');
     const monthList = _.map(scheduleMonth, 'yearmonth');
+    const scheduleStage = JSON.parse('<%- JSON.stringify(scheduleStage) %>');
+    const curScheduleStage = JSON.parse('<%- JSON.stringify(curScheduleStage) %>');
 </script>