Browse Source

1. 新增标段列表标签,并默认显示
2. 计量台账,清单,无部位明细时,点击变更数量列,不应显示变更令窗口

MaiXinRong 5 years ago
parent
commit
ad5311bd1e

+ 67 - 26
app/controller/tender_controller.js

@@ -31,7 +31,7 @@ module.exports = app => {
             ctx.showTitle = true;
         }
 
-        async _list(view, modal = '') {
+        async _listDetail(view, modal = '') {
             try {
                 // 获取用户新建标段权利
                 const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
@@ -73,6 +73,41 @@ module.exports = app => {
             }
         }
 
+        async _list(view, renderData, modal = '') {
+            try {
+                renderData.tenderList = await this.ctx.service.tender.getList('', renderData.userPermission);
+
+                for (const t of renderData.tenderList) {
+                    if (t.ledger_status === auditConst.ledger.status.checked) {
+                        t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
+                        t.completeStage = await this.ctx.service.stage.getLastestCompleteStage(t.id);
+                    }
+                }
+                renderData.categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
+                renderData.valuations = await this.ctx.service.valuation.getProjectValidValuation(this.ctx.session.sessionProject.id);
+                renderData.tenderConst = tenderConst;
+                renderData.settingConst = settingConst;
+                renderData.measureType = tenderConst.measureType;
+                renderData.jsFiles = this.app.jsFiles.common.concat(this.jsFiles);
+                renderData.auditConst = auditConst;
+                await this.layout(view, renderData, modal);
+            } catch (err) {
+                this.log(err);
+                this.ctx.redirect('/dashboard')
+            }
+        }
+
+        async listDefault(ctx) {
+            this.jsFiles = this.app.jsFiles.tender.list;
+            const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
+            const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
+            const renderData = {
+                accountInfo,
+                userPermission,
+            };
+            await this._list('tender/index.ejs', renderData, 'tender/modal.ejs');
+        }
+
         /**
          * 标段概况(Get)
          *
@@ -80,8 +115,8 @@ module.exports = app => {
          * @return {void}
          */
         async listInfo(ctx) {
-            this.jsFiles = this.app.jsFiles.tender.list;
-            await this._list('tender/index.ejs', 'tender/modal.ejs');
+            this.jsFiles = this.app.jsFiles.tender.info;
+            await this._listDetail('tender/info.ejs', 'tender/modal.ejs');
         }
 
         /**
@@ -92,7 +127,7 @@ module.exports = app => {
          */
         async listProgress(ctx) {
             this.jsFiles = this.app.jsFiles.tender.progress;
-            await this._list('tender/progress.ejs', 'tender/modal.ejs');
+            await this._listDetail('tender/progress.ejs', 'tender/modal.ejs');
         }
 
         /**
@@ -102,34 +137,40 @@ module.exports = app => {
          * @return {Promise<void>}
          */
         async listManage(ctx) {
+            this.jsFiles = this.app.jsFiles.tender.manage;
             // 先判断权限
             // 获取用户新建标段权利
             const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
             const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
             if (userPermission !== null && userPermission.tender !== undefined && userPermission.tender.indexOf('1') !== -1) {
-                // 获取用户新建标段权利
-                const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
-                const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
-
-                const tenderList = await this.ctx.service.tender.getList('manage', userPermission);
-                for (const t of tenderList) {
-                    t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
-                    t.completeStage = await this.ctx.service.stage.getLastestCompleteStage(t.id);
-                }
-                const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
-                const valuations = await this.ctx.service.valuation.getProjectValidValuation(this.ctx.session.sessionProject.id);
                 const renderData = {
-                    tenderList,
-                    tenderConst,
-                    settingConst,
-                    categoryData,
-                    measureType: tenderConst.measureType,
-                    jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.tender.manage),
-                    auditConst,
-                    userPermission,
-                    valuations,
+                    accountInfo,
+                    userPermission
                 };
-                await this.layout('tender/manage.ejs', renderData, 'tender/manage_modal.ejs');
+                await this._list('tender/manage.ejs', renderData, 'tender/manage_modal.ejs')
+                // 获取用户新建标段权利
+                // const accountInfo = await this.ctx.service.projectAccount.getDataById(this.ctx.session.sessionUser.accountId);
+                // const userPermission = accountInfo !== undefined && accountInfo.permission !== '' ? JSON.parse(accountInfo.permission) : null;
+                //
+                // const tenderList = await this.ctx.service.tender.getList('manage', userPermission);
+                // for (const t of tenderList) {
+                //     t.lastStage = await this.ctx.service.stage.getLastestStage(t.id, true);
+                //     t.completeStage = await this.ctx.service.stage.getLastestCompleteStage(t.id);
+                // }
+                // const categoryData = await this.ctx.service.category.getAllCategory(this.ctx.session.sessionProject.id);
+                // const valuations = await this.ctx.service.valuation.getProjectValidValuation(this.ctx.session.sessionProject.id);
+                // const renderData = {
+                //     tenderList,
+                //     tenderConst,
+                //     settingConst,
+                //     categoryData,
+                //     measureType: tenderConst.measureType,
+                //     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.tender.manage),
+                //     auditConst,
+                //     userPermission,
+                //     valuations,
+                // };
+                // await this.layout('tender/manage.ejs', renderData, 'tender/manage_modal.ejs');
             } else {
                 this.ctx.redirect(ctx.request.header.referer);
             }
@@ -281,7 +322,7 @@ module.exports = app => {
                     stages: stages.reverse(),
                     monthProgress,
                     audit: auditConst,
-                    jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.tender.info),
+                    jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.tender.tenderInfo),
                 };
                 await this.layout('tender/detail.ejs', renderData);
             } catch (error) {

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

@@ -448,6 +448,9 @@ $(document).ready(() => {
         }
     };
     ledgerSpreadSetting.imageClick = function (data) {
+        const nodePos = stagePos.getLedgerPos(data.id);
+        if (nodePos && nodePos.length > 0) return;
+
         changesObj.loadChanges({bills: data});
     };
     ledgerSpreadSetting.dgnUpFields = ['deal_dgn_qty1', 'deal_dgn_qty2', 'c_dgn_qty1', 'c_dgn_qty2'];

+ 12 - 48
app/public/js/tender_list.js

@@ -258,12 +258,16 @@ function recursiveGetTenderNodeHtml (node, arr) {
         html.push('<a href="javascript: void(0)" id="' + node.id + '">', node.name, '</a>');
     }
     html.push('</td>');
+    // 创建人
+    html.push('<td>', node.user_name ? node.user_name : '', '</td>');
+    // 创建时间
+    html.push('<td>', node.create_time ? moment(node.create_time).format('YYYY-MM-DD HH:mm:ss') : '', '</td>');
     // 计量模式
-    html.push('<td>');
-    if (node.measure_type) {
-        html.push(node.measure_type === measureType.tz.value ? '0号台账' : '工程量清单');
-    }
-    html.push('</td>');
+    // html.push('<td>');
+    // if (node.measure_type) {
+    //     html.push(node.measure_type === measureType.tz.value ? '0号台账' : '工程量清单');
+    // }
+    // html.push('</td>');
     // 计量期数
     html.push('<td>');
     if (!node.cid) {
@@ -274,39 +278,6 @@ function recursiveGetTenderNodeHtml (node, arr) {
     html.push('<td>');
     html.push(node.lastStage ? auditConst.stage.statusString[node.lastStage.status] : auditConst.ledger.statusString[node.ledger_status]);
     html.push('</td>');
-    // 0号台账合同
-    html.push('<td class="text-right">');
-    html.push(node.total_price);
-    console.log(node);
-    html.push('</td>');
-    // 本期完成
-    html.push('<td class="text-right">');
-    html.push(node.gather_tp);
-    html.push('</td>');
-    // 截止本期合同
-    html.push('<td class="text-right">');
-    html.push(node.end_contract_tp);
-    html.push('</td>');
-    // 截止本期变更
-    html.push('<td class="text-right">');
-    html.push(node.end_qc_tp);
-    html.push('</td>');
-    // 截止本期完成
-    html.push('<td class="text-right">');
-    html.push(node.end_gather_tp);
-    html.push('</td>');
-    // 截止上期完成
-    html.push('<td class="text-right">');
-    html.push(node.pre_gather_tp);
-    html.push('</td>');
-    // 本期应付
-    html.push('<td class="text-right">');
-    html.push(node.yf_tp);
-    html.push('</td>');
-    // 截止本期应付
-    html.push('<td class="text-right">');
-    html.push(node.end_yf_tp);
-    html.push('</td>');
     html.push('</tr>');
     if (node.children) {
         for (const c of node.children) {
@@ -321,18 +292,11 @@ function getTenderTreeHtml () {
         const html = [];
         html.push('<table class="table table-hover table-bordered">');
         html.push('<thead>', '<tr>');
-        html.push('<th>', '名称', '</th>');
-        html.push('<th>', '计量模式', '</th>');
+        html.push('<th>', '标段名称', '</th>');
+        html.push('<th>', '创建人', '</th>');
+        html.push('<th>', '创建时间', '</th>');
         html.push('<th>', '计量期数', '</th>');
         html.push('<th>', '审批状态', '</th>');
-        html.push('<th>', '0号台帐', '</th>');
-        html.push('<th>', '本期完成', '</th>');
-        html.push('<th>', '截止本期合同', '</th>');
-        html.push('<th>', '截止本期变更', '</th>');
-        html.push('<th>', '截止本期完成', '</th>');
-        html.push('<th>', '截止上期完成', '</th>');
-        html.push('<th>', '本期应付', '</th>');
-        html.push('<th>', '截止本期应付', '</th>');
         html.push('</tr>', '</thead>');
         for (const t of tenderTree) {
             html.push(recursiveGetTenderNodeHtml(t, tenderTree));

+ 431 - 0
app/public/js/tender_list_info.js

@@ -0,0 +1,431 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Mai
+ * @date 2018/10/11
+ * @version
+ */
+const EmptyTenderHtml = [
+    '<div class="jumbotron">',
+    '<h3 class="display-6">还没有标段数据</h3>',
+    '</div>'
+];
+// levelTree - setting
+const levelTreeSetting = {
+    view: {
+        selectedMulti: false
+    },
+    data: {
+        simpleData: {
+            idKey: 'lid',
+            pIdKey: 'lpId',
+            rootPId: 0,
+            enable: true,
+        }
+    },
+    edit: {
+        enable: true,
+        showRemoveBtn: false,
+        showRenameBtn: false,
+        drag: {
+            autoExpandTrigger: true,
+            isCopy: false,
+            isMove:  true,
+            prev: false,
+            next: false,
+            inner: true,
+        }
+    },
+    callback: {
+        beforeDrop: beforeDropNode,
+        onDrop: onDropNode,
+    }
+};
+const levelNodes =[];
+const tenderTree = [];
+function createTree() {
+    const zTree = $.fn.zTree.getZTreeObj('treeLevel');
+    if (zTree) {
+        zTree.destroy();
+    }
+    $.fn.zTree.init($("#treeLevel"), levelTreeSetting, levelNodes);
+}
+function beforeDropNode(treeId, treeNodes, targetNode, moveType, isCopy) {
+    if (targetNode.lid !== 1) {
+        const parent = targetNode.getParentNode();
+        if (parent && parent.lid === 1) {
+            return false;
+        }
+    }
+}
+function onDropNode(event, treeId, treeNodes, targetNode, moveType) {
+    const zTree = $.fn.zTree.getZTreeObj(treeId);
+    function resetFixNode(id) {
+        const node = zTree.getNodeByParam('lid', id);
+        node.isParent = true;
+        zTree.updateNode(node, false);
+        zTree.expandNode(node, true);
+    }
+    function moveChildren(children, node) {
+        if (!children || children.length === 0) { return }
+        for (const c of children) {
+            moveChildren(c.children, node);
+            zTree.moveNode(node, c, 'inner');
+        }
+    }
+    resetFixNode(1);
+    resetFixNode(2);
+    if (targetNode.lid === 1 && treeNodes[0].children && treeNodes[0].children.length !== 0) {
+        moveChildren(treeNodes[0].children, zTree.getNodeByParam('lid', 1));
+    } else if (targetNode.lid !== 1) {
+        if (targetNode.children.length >= 2) {
+            for (const c of targetNode.children) {
+                if (c.lid !== treeNodes[0].lid) {
+                    zTree.moveNode(treeNodes[0], c, 'inner');
+                }
+            }
+        }
+    }
+}
+// 查询方法
+function findNode (key, value, arr) {
+    for (const a of arr) {
+        if (a[key] && a[key] === value) {
+            return a;
+        }
+    }
+}
+function getPId(level) {
+    if (level !== 1) {
+        const p = findNode('level', level - 1, levelNodes);
+        if (p) {
+            return p.lid
+        } else {
+            return 1;
+        }
+    } else {
+        return 2;
+    }
+}
+// 分类数据排序
+function sortCategory() {
+    category.sort(function (a, b) {
+        return a.level ? (b.level ? a.level - b.level : -1) : a.id - b.id;
+    });
+}
+// 初始化分类树结构数据
+function initCategoryLevelNode() {
+    levelNodes.splice(0, levelNodes.length);
+    levelNodes.push(
+        { lid:1, lpId:0, name:"可用类别", open:true, isParent: true},
+        { lid:2, lpId:0, name:"已用类别", open:true, isParent: true}
+    );
+    for (const c of category) {
+        const cate = JSON.parse(JSON.stringify(c));
+        cate.lid = levelNodes.length + 1;
+        cate.open = true;
+        if (!cate.level) {
+            cate.lpId = 1;
+            levelNodes.push(cate);
+        } else {
+            cate.lpId = getPId(cate.level);
+            levelNodes.push(cate);
+        }
+    }
+}
+// 新建标段 -- 分类属性选择
+function getCategoryHtml() {
+    function getSelectCategoryHtml (cate) {
+        const html = [];
+        html.push('<div class="form-group" cate-id="' + cate.id + '">');
+        html.push('<lable>', cate.name, '</lable>');
+        html.push('<select class="form-control">');
+        for (const v of cate.value) {
+            html.push('<option value="' + v.id + '">', v.value, '</option>');
+        }
+        html.push('</select>');
+        html.push('</div>');
+        return html.join('');
+    }
+    function getRadioCategoryHtml (cate) {
+        const html = [];
+        html.push('<div class="form-group" cate-id="' + cate.id + '">');
+        html.push('<lable>', cate.name, '</lable>');
+        html.push('<div>');
+        for (const iV in cate.value) {
+            const v = cate.value[iV];
+            html.push('<div class="form-check-inline">');
+            html.push('<input class="form-check-input" type="radio"', 'name="' + cate.name + '" ', 'value="' , v.id, (iV == 0 ? '" checked="' : ''),  '">');
+            html.push('<label class="form-check-label">', v.value, '</label>');
+            html.push('</div>');
+        }
+        html.push('</div>');
+        html.push('</div>');
+        return html.join('');
+    }
+    const html = [];
+    for (const c of category) {
+        if (c.type === categoryType.key.dropDown) {
+            html.push(getSelectCategoryHtml(c));
+        } else if (c.type === categoryType.key.radio) {
+            html.push(getRadioCategoryHtml(c));
+        }
+    }
+    return html.join('');
+}
+// 初始化TenderTree数据
+function initTenderTree () {
+    const levelCategory = category.filter(function (c) {
+        return c.level && c.level > 0;
+    });
+    function findCategoryNode(cid, value, array) {
+        for (const a of array) {
+            if (a.cid === cid && a.vid === value) {
+                return a;
+            }
+        }
+    }
+    function getCategoryNode(category, value, parent) {
+        const array = parent ?  parent.children : tenderTree;
+        let cate = findCategoryNode(category.id, value, array);
+        if (!cate) {
+            const cateValue = findNode('id', value, category.value);
+            cate = {
+                cid: category.id,
+                vid: value,
+                name: cateValue.value,
+                children: [],
+                level: category.level,
+            };
+            array.push(cate);
+        }
+        return cate;
+    }
+    function loadTenderCategory (tender) {
+        let tenderCategory = null;
+        for (const lc of levelCategory) {
+            const tenderCate = findNode('cid', lc.id, tender.category);
+            if (tenderCate) {
+                tenderCategory = getCategoryNode(lc, tenderCate.value, tenderCategory);
+            } else {
+                return tenderCategory;
+            }
+        }
+        return tenderCategory;
+    }
+    function calculateTender(tender) {
+        if (tender.lastStage) {
+            tender.gather_tp = ZhCalc.add(tender.lastStage.contract_tp, tender.lastStage.qc_tp);
+            tender.end_contract_tp = ZhCalc.add(tender.lastStage.pre_contract_tp, tender.lastStage.contract_tp);
+            tender.end_qc_tp = ZhCalc.add(tender.lastStage.pre_qc_tp, tender.lastStage.qc_tp);
+            tender.end_gather_tp = ZhCalc.add(tender.end_contract_tp, tender.end_qc_tp);
+            tender.pre_gather_tp = ZhCalc.add(tender.lastStage.pre_contract_tp, tender.lastStage.pre_qc_tp);
+            tender.yf_tp = ZhCalc.add(tender.lastStage.yf_tp);
+            tender.end_yf_tp = ZhCalc.add(tender.lastStage.pre_yf_tp, tender.yf_tp);
+        }
+    }
+    tenderTree.splice(0, tenderTree.length);
+    for (const t of tenders) {
+        calculateTender(t);
+        t.valid = true;
+        if (t.category && levelCategory.length > 0) {
+            const parent = loadTenderCategory(t);
+            if (parent) {
+                t.level = parent.level + 1;
+                parent.children.push(t);
+            } else {
+                tenderTree.push(t);
+            }
+        } else {
+            tenderTree.push(t);
+        }
+    }
+}
+function recursiveGetTenderNodeHtml (node, arr) {
+    const html = [];
+    html.push('<tr>');
+    // 名称
+    html.push('<td class="in-' + node.level + '">');
+    if (node.cid) {
+        html.push('<i class="fa fa-folder-o"></i> ', node.name);
+    } else {
+        html.push('<span class="text-muted mr-2">');
+        html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
+        html.push('</span>');
+        //html.push('<a href="/tender/' + node.id + '">', node[c.field], '</a>');
+        html.push('<a href="javascript: void(0)" id="' + node.id + '">', node.name, '</a>');
+    }
+    html.push('</td>');
+    // 计量模式
+    html.push('<td>');
+    if (node.measure_type) {
+        html.push(node.measure_type === measureType.tz.value ? '0号台账' : '工程量清单');
+    }
+    html.push('</td>');
+    // 计量期数
+    html.push('<td>');
+    if (!node.cid) {
+        html.push(node.lastStage ? '第' + node.lastStage.order + '期' : '台账');
+    }
+    html.push('</td>');
+    // 审批状态
+    html.push('<td>');
+    html.push(node.lastStage ? auditConst.stage.statusString[node.lastStage.status] : auditConst.ledger.statusString[node.ledger_status]);
+    html.push('</td>');
+    // 0号台账合同
+    html.push('<td class="text-right">');
+    html.push(node.total_price);
+    console.log(node);
+    html.push('</td>');
+    // 本期完成
+    html.push('<td class="text-right">');
+    html.push(node.gather_tp);
+    html.push('</td>');
+    // 截止本期合同
+    html.push('<td class="text-right">');
+    html.push(node.end_contract_tp);
+    html.push('</td>');
+    // 截止本期变更
+    html.push('<td class="text-right">');
+    html.push(node.end_qc_tp);
+    html.push('</td>');
+    // 截止本期完成
+    html.push('<td class="text-right">');
+    html.push(node.end_gather_tp);
+    html.push('</td>');
+    // 截止上期完成
+    html.push('<td class="text-right">');
+    html.push(node.pre_gather_tp);
+    html.push('</td>');
+    // 本期应付
+    html.push('<td class="text-right">');
+    html.push(node.yf_tp);
+    html.push('</td>');
+    // 截止本期应付
+    html.push('<td class="text-right">');
+    html.push(node.end_yf_tp);
+    html.push('</td>');
+    html.push('</tr>');
+    if (node.children) {
+        for (const c of node.children) {
+            html.push(recursiveGetTenderNodeHtml(c, node.children));
+        }
+    }
+    return html.join('');
+}
+// 根据TenderTree数据获取Html代码
+function getTenderTreeHtml () {
+    if (tenderTree.length > 0) {
+        const html = [];
+        html.push('<table class="table table-hover table-bordered">');
+        html.push('<thead>', '<tr>');
+        html.push('<th>', '名称', '</th>');
+        html.push('<th>', '计量模式', '</th>');
+        html.push('<th>', '计量期数', '</th>');
+        html.push('<th>', '审批状态', '</th>');
+        html.push('<th>', '0号台帐', '</th>');
+        html.push('<th>', '本期完成', '</th>');
+        html.push('<th>', '截止本期合同', '</th>');
+        html.push('<th>', '截止本期变更', '</th>');
+        html.push('<th>', '截止本期完成', '</th>');
+        html.push('<th>', '截止上期完成', '</th>');
+        html.push('<th>', '本期应付', '</th>');
+        html.push('<th>', '截止本期应付', '</th>');
+        html.push('</tr>', '</thead>');
+        for (const t of tenderTree) {
+            html.push(recursiveGetTenderNodeHtml(t, tenderTree));
+        }
+        html.push('</table>');
+        return html.join('');
+    } else {
+        return EmptyTenderHtml.join('');
+    }
+}
+function bindTenderUrl() {
+    $('a', '.c-body').bind('click', function () {
+        const tenderId = parseInt($(this).attr('id'));
+        const tender = _.find(tenders, function (t) {
+            return t.id === tenderId;
+        });
+        if (tender.measure_type) {
+            window.location.href = '/tender/' + tenderId;
+        } else {
+            for (const a of $('a', '#jlms')) {
+                a.href = '/tender/' + tenderId + '/type?type=' + $(a).attr('mst');
+            }
+            $('#jlms').modal('show');
+        }
+    });
+}
+
+$(document).ready(() => {
+    sortCategory();
+    // 初始化分类数据
+    initCategoryLevelNode();
+    $('.modal-body', '#add-bd').append(getCategoryHtml());
+    // 初始化标段树结构
+    initTenderTree();
+    $('.c-body').html(getTenderTreeHtml());
+    bindTenderUrl();
+    // 分类
+    $('#cate-set').on('show.bs.modal', function () {
+        createTree();
+    });
+    $('#set-cate-ok').click(function () {
+        const data = [];
+        const zTree = $.fn.zTree.getZTreeObj('treeLevel');
+        for (const c of category) {
+            const node = zTree.getNodeByParam('id', c.id);
+            const parent = node.getParentNode();
+            if (parent.lid === 1) {
+                data.push({id: c.id, level: 0});
+            } else {
+                data.push({id: c.id, level: node.getPath().length - 1});
+            }
+        }
+        postData('/setting/category/level', data, function (rst) {
+            for (const d of data) {
+                const c = findNode('id', d.id, category);
+                c.level = d.level;
+            }
+            sortCategory();
+            initCategoryLevelNode();
+            initTenderTree();
+            $('.c-body').html(getTenderTreeHtml());
+            $('#cate-set').modal('hide');
+        });
+    });
+    // 新增标段
+    $('#add-bd-ok').click(function () {
+        const data = {
+            name: $('[name=name]', '#add-bd').val(),
+            valuation: $('[name=valuation]:checked').val(),
+            category: [],
+        };
+        if (!data.name || data.name === '') {
+            // TODO 提示用户
+            return;
+        }
+        for (const c of category) {
+            const cate = {cid: c.id};
+            if (c.type === categoryType.key.dropDown) {
+                cate.value = parseInt($('select', '[cate-id=' + c.id + ']').val());
+            } else if (c.type === categoryType.key.radio) {
+                cate.value = parseInt($('input:checked', '[cate-id=' + c.id + ']').val());
+            }
+            data.category.push(cate);
+        }
+        $('#hide-all').show();
+        postData('/list/add', data, function (result) {
+            tenders.push(result);
+            initTenderTree();
+            $('.c-body').html(getTenderTreeHtml());
+            bindTenderUrl();
+            $('#add-bd').modal('hide');
+            $('[name=name]', '#add-bd').val('');
+            $('#hide-all').hide();
+        });
+    });
+});

+ 2 - 1
app/router.js

@@ -69,7 +69,8 @@ module.exports = app => {
      * 标段管理
      */
     // 金额概况
-    app.get('/list', sessionAuth, 'tenderController.listInfo');
+    app.get('/list', sessionAuth, 'tenderController.listDefault');
+    app.get('/list/info', sessionAuth, 'tenderController.listInfo');
     // 计量进度
     app.get('/list/progress', sessionAuth, 'tenderController.listProgress');
     // 管理标段

+ 14 - 0
app/view/tender/info.ejs

@@ -0,0 +1,14 @@
+<div class="panel-content">
+    <% include ./sub_menu.ejs %>
+    <div class="content-wrap">
+        <div class="c-body">
+        </div>
+    </div>
+</div>
+<script>
+    const tenders = JSON.parse('<%- JSON.stringify(tenderList) %>');
+    const categoryType = JSON.parse('<%- JSON.stringify(settingConst.cType) %>');
+    const category = JSON.parse('<%- JSON.stringify(categoryData) %>');
+    const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
+    const measureType = JSON.parse('<%- JSON.stringify(measureType) %>');
+</script>

+ 3 - 0
app/view/tender/sub_menu.ejs

@@ -7,6 +7,9 @@
             <div class="d-inline-block">
                 <div class="btn-group btn-group-toggle" data-toggle="buttons">
                     <label class="btn btn-sm btn-light <% if (ctx.url === '/list') { %>active<% } %>" onclick="window.location.href='/list'">
+                        <input type="radio" name="options" id="option1" autocomplete="off"> 标段列表
+                    </label>
+                    <label class="btn btn-sm btn-light <% if (ctx.url === '/list/info') { %>active<% } %>" onclick="window.location.href='/list/info'">
                         <input type="radio" name="options" id="option1" autocomplete="off"> 金额概况
                     </label>
                     <label class="btn btn-sm btn-light  <% if (ctx.url === '/list/progress') { %>active<% } %>" onclick="window.location.href='/list/progress'">

+ 14 - 1
config/web.js

@@ -58,6 +58,7 @@ const JsFiles = {
                     "/public/js/ztree/jquery.ztree.core.js",
                     "/public/js/ztree/jquery.ztree.exedit.js",
                     "/public/js/decimal.min.js",
+                    "/public/js/moment/moment.min.js",
                 ],
                 mergeFiles: [
                     "/public/js/zh_calc.js",
@@ -65,6 +66,18 @@ const JsFiles = {
                 ],
                 mergeFile: 'tender_list',
             },
+            info: {
+                files: [
+                    "/public/js/ztree/jquery.ztree.core.js",
+                    "/public/js/ztree/jquery.ztree.exedit.js",
+                    "/public/js/decimal.min.js",
+                ],
+                mergeFiles: [
+                    "/public/js/zh_calc.js",
+                    "/public/js/tender_list_info.js"
+                ],
+                mergeFile: 'tender_list_info',
+            },
             progress: {
                 files: [
                     "/public/js/ztree/jquery.ztree.core.js",
@@ -90,7 +103,7 @@ const JsFiles = {
                 ],
                 mergeFile: 'tender_list_manage',
             },
-            info: {
+            tenderInfo: {
                 files: [
                     "/public/js/echarts/echarts.min.js",
                     "/public/js/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js",