Quellcode durchsuchen

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

Tony Kang vor 1 Jahr
Ursprung
Commit
58d041f3bf

+ 2 - 1
app/const/payment.js

@@ -77,7 +77,8 @@ const signature_msg = {
 };
 
 const defaultSafeBills = [
-    { b_code: '', name: '安全生产费用清单', tree_id: 1, tree_pid: -1, tree_level: 1, tree_order: 1, tree_full_path: '1', tree_is_leaf: 1 }
+    { b_code: '', name: '安全生产费用清单', tree_id: 1, tree_pid: -1, tree_level: 1, tree_order: 1, tree_full_path: '1', tree_is_leaf: 0 },
+    { b_code: '', name: '请输入费用名称', tree_id: 2, tree_pid: 1, tree_level: 2, tree_order: 1, tree_full_path: '1-2', tree_is_leaf: 1 },
 ];
 
 module.exports = {

+ 1 - 1
app/controller/dashboard_controller.js

@@ -33,7 +33,7 @@ module.exports = app => {
             const auditChangeProject = ctx.session.sessionProject.page_show.openChangeProject ? await ctx.service.changeProjectAudit.getAuditChangeProject(ctx.session.sessionUser.accountId) : [];
             const auditChangeApply = ctx.session.sessionProject.page_show.openChangeApply ? await ctx.service.changeApplyAudit.getAuditChangeApply(ctx.session.sessionUser.accountId) : [];
             const auditChangePlan = ctx.session.sessionProject.page_show.openChangePlan ? await ctx.service.changePlanAudit.getAuditChangePlan(ctx.session.sessionUser.accountId) : [];
-            const auditPayments = await ctx.service.paymentDetailAudit.getAuditPayment(ctx.session.sessionUser.accountId);
+            const auditPayments = ctx.session.sessionProject.page_show.openPayment ? await ctx.service.paymentDetailAudit.getAuditPayment(ctx.session.sessionUser.accountId) : [];
             const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
             const noticeList = await ctx.service.noticePush.getNotice(ctx.session.sessionProject.id, pa.id);
             const projectData = await ctx.service.project.getDataById(ctx.session.sessionProject.id);

+ 8 - 1
app/lib/ledger.js

@@ -512,11 +512,15 @@ class gatherTree extends baseTree {
                 order: siblings.length + 1,
                 children: [],
                 code: node.code, b_code: node.b_code, name: node.name,
-                unit: node.unit, unit_price: node.unit_price,
+                unit: node.unit, unit_price: node.unit_price, drawing_code: node.drawing_code,
             };
             siblings.push(cur);
             this.datas.push(cur);
         }
+        if (!cur.memo && !!node.memo) cur.memo = node.memo;
+        if (!cur.ex_memo1 && !!node.ex_memo1) cur.ex_memo1 = node.ex_memo1;
+        if (!cur.ex_memo2 && !!node.ex_memo2) cur.ex_memo2 = node.ex_memo2;
+        if (!cur.ex_memo3 && !!node.ex_memo3) cur.ex_memo3 = node.ex_memo3;
         loadFun(cur, node);
         if (node.children && node.children.length > 0) {
             for (const c of node.children) {
@@ -666,6 +670,9 @@ class gatherPos extends pos {
                 this.datas.push(gp);
                 posRange.push(gp);
             }
+            if (!gp.ex_memo1 && !!spr.ex_memo1) gp.ex_memo1 = spr.ex_memo1;
+            if (!gp.ex_memo2 && !!spr.ex_memo2) gp.ex_memo2 = spr.ex_memo2;
+            if (!gp.ex_memo3 && !!spr.ex_memo3) gp.ex_memo3 = spr.ex_memo3;
             loadFun(gp, spr);
         }
     }

+ 65 - 11
app/lib/rpt_data_analysis.js

@@ -135,7 +135,6 @@ class PosIndex {
         }
     }
 }
-
 // 通用方法
 const rdaUtils = {
     orderCalc(ctx, data, fields) {
@@ -165,7 +164,6 @@ const rdaUtils = {
         }
     },
 };
-
 // 可提供的数据处理方法
 const changeSort = {
     name: '变更令排序',
@@ -1214,6 +1212,7 @@ const gatherSelectConverse = {
         for (const t of options.table) {
             switch (t) {
                 case 'mem_gather_stage_bills':
+                case 'mem_gather_stage_bills_filter':
                 case 'mem_gather_stage_pos':
                 case 'mem_gather_stage_pay':
                 case 'mem_gather_deal_bills':
@@ -1435,6 +1434,7 @@ const stageSelectConverse = {
             for (const t of options.table) {
                 switch (t) {
                     case 'mem_stage_sum_bills':
+                    case 'mem_stage_sum_bills_filter':
                     case 'mem_stage_sum_pos':
                     case 'mem_stage_sum_pay':
                     case 'mem_union_data':
@@ -1459,17 +1459,35 @@ const materialSumSelectConverse = {
         for (const s of materials) {
             const curReg = new RegExp('^m_' + s + '_');
             for (const [i, d] of data.entries()) {
-                const nd = { cross_index: i + 1, s_order: s };
-                for (const prop in d) {
-                    if (reg.test(prop)) {
-                        if (curReg.test(prop)) {
-                            nd[prop.replace(curReg, 'm_')] = d[prop];
+                const stageId = `m_${s}_stageId`;
+                if (d[stageId]) {
+                    for (const sid of d[stageId]) {
+                        const curStageReg = new RegExp(`^m_${s}_s${sid}_`);
+                        const nd = { cross_index: i + 1, s_order: `${s}_${sid}` };
+                        for (const prop in d) {
+                            if (reg.test(prop)) {
+                                if (curStageReg.test(prop)) {
+                                    nd[prop.replace(curStageReg, 'm_')] = d[prop];
+                                }
+                            } else {
+                                nd[prop] = d[prop];
+                            }
+                        }
+                        result.push(nd);
+                    }
+                } else {
+                    const nd = { cross_index: i + 1, s_order: s };
+                    for (const prop in d) {
+                        if (reg.test(prop)) {
+                            if (curReg.test(prop)) {
+                                nd[prop.replace(curReg, 'm_')] = d[prop];
+                            }
+                        } else {
+                            nd[prop] = d[prop];
                         }
-                    } else {
-                        nd[prop] = d[prop];
                     }
+                    result.push(nd);
                 }
-                result.push(nd);
             }
         }
         return result;
@@ -1973,6 +1991,41 @@ const masterCross = {
         data[options.target] = this._converse(ctx, options, mainTable, subTable);
     },
 };
+const orderBy = {
+    name: "简单排序",
+    hint: "仅提供简单的排序",
+    defaultSetting: {
+        table: 'mem_material_sum_gl',
+        orders: [['m_order', 'asc']],
+    },
+    fun(ctx, data, fieldsKey, options, csRela) {
+        if (!options || !options.table || !options.orders) return;
+
+        const ascSort = function (x, y, field) {
+            if (!x[field]) return 1;
+            if (!y[field]) return -1;
+            return x[field] === y[field] ? 0 : (x[field] > y[field] ? 1 : -1);
+        };
+        const descSort = function (x, y, field) {
+            if (!x[field]) return -1;
+            if (!y[field]) return 1;
+            return x[field] === y[field] ? 0 : (x[field] > y[field] ? -1 : 1);
+        };
+        const orderFun = [];
+        for (const order of options.orders) {
+            if (order.length !== 2) return;
+            if (['asc', 'desc'].indexOf(order[1]) === -1) return;
+            orderFun.push({ field: order[0], fun: order[1] === 'asc' ? ascSort : descSort });
+        }
+
+        data[options.table].sort((x, y) => {
+            for (const order of orderFun) {
+                const sortResult = order.fun(x, y, order.field);
+                if (sortResult !== 0) return sortResult;
+            }
+        });
+    }
+};
 
 const analysisObj = {
     changeSort,
@@ -1998,7 +2051,8 @@ const analysisObj = {
     treeFilter,
     gatherGcl2,
     gatherMaterialGl,
-    masterCross
+    masterCross,
+    orderBy,
 };
 const analysisDefine = (function(obj) {
     const result = [];

+ 35 - 2
app/public/js/change_revise.js

@@ -608,6 +608,17 @@ $(document).ready(() => {
                         data[exprInfo.expr] = '';
                     }
                 }
+                if (col.field === 'b_code' && newValue) {
+                    const ledgerData = _.filter(billsTree.nodes, function (item) {
+                        return item.b_code !== null && item.b_code !== '' && item.ccid === '';
+                    });
+                    const ledgerOneData = _.find(ledgerData, { b_code: newValue });
+                    if (ledgerOneData) {
+                        data.name = ledgerOneData.name;
+                        data.unit = ledgerOneData.unit;
+                        data.unit_price = ledgerOneData.unit_price;
+                    }
+                }
                 // 更新至服务器
                 postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
                     const refreshNode = billsTree.loadPostData(result);
@@ -722,6 +733,17 @@ $(document).ready(() => {
                         }
                         data[colSetting.field] = value;
                     }
+                    if (colSetting.field === 'b_code' && value) {
+                        const ledgerData = _.filter(billsTree.nodes, function (item) {
+                            return item.b_code !== null && item.b_code !== '' && item.ccid === '';
+                        });
+                        const ledgerOneData = _.find(ledgerData, { b_code: value });
+                        if (ledgerOneData) {
+                            data.name = ledgerOneData.name;
+                            data.unit = ledgerOneData.unit;
+                            data.unit_price = ledgerOneData.unit_price;
+                        }
+                    }
                     bPaste = true;
                 }
                 if (bPaste) {
@@ -782,7 +804,7 @@ $(document).ready(() => {
                                 continue;
                             }
                         }
-                        if (node.used && col.field === 'unit_price') {
+                        if (node.used && colSetting.field === 'unit_price') {
                             toastMessageUniq (hint.usedUp);
                             continue;
                         }
@@ -799,13 +821,24 @@ $(document).ready(() => {
                                 }
                             }
                         } else {
-                            if (node.used && (col.field === 'code' || col.field ==='b_code')
+                            if (node.used && (colSetting.field === 'code' || colSetting.field === 'b_code')
                                 && data[colSetting.field] !== '' && value === '') {
                                 toastMessageUniq(hint.usedCode);
                                 continue;
                             }
                             data[colSetting.field] = value;
                         }
+                        if (colSetting.field === 'b_code' && value) {
+                            const ledgerData = _.filter(billsTree.nodes, function (item) {
+                                return item.b_code !== null && item.b_code !== '' && item.ccid === '';
+                            });
+                            const ledgerOneData = _.find(ledgerData, { b_code: value });
+                            if (ledgerOneData) {
+                                data.name = ledgerOneData.name;
+                                data.unit = ledgerOneData.unit;
+                                data.unit_price = ledgerOneData.unit_price;
+                            }
+                        }
                         bPaste = true;
                     }
                     if (bPaste) {

+ 4 - 3
app/public/js/payment_safe.js

@@ -27,7 +27,7 @@ $(document).ready(function() {
             this.spreadSetting = {
                 cols: [
                     {title: '编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 230, formatter: '@', cellType: 'tree'},
-                    {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@'},
+                    {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@', cellType: 'autoTip'},
                     {title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 150, formatter: '@'},
                     {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
                     {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 80, type: 'Number'},
@@ -202,7 +202,7 @@ $(document).ready(function() {
             let count = 1;
             if (sel.rowCount > 1) {
                 for (let r = 1; r < sel.rowCount; r++) {
-                    const rNode = sheet.zh_tree.nodes[sel.row + r];
+                    const rNode = this.sheet.zh_tree.nodes[sel.row + r];
                     if (rNode.tree_level > node.tree_level) continue;
                     if ((rNode.tree_level < node.tree_level) || (rNode.tree_level === node.tree_level && rNode.tree_pid !== node.tree_pid)) {
                         toastr.warning('请选择同一节点下的节点,进行该操作');
@@ -767,6 +767,7 @@ $(document).ready(function() {
 
             const safeBills = billsObj.tree.nodes.find(x => { return x.safe_id === file.safe_id; });
             SpreadJsObj.locateTreeNode(billsObj.sheet, safeBills.tree_id, true);
+            this.refreshCurTable();
         }
         setTab(tab) {
             this.activeTab = tab;
@@ -912,7 +913,7 @@ $(document).ready(function() {
                         mainSheet.setSelection(billsObj.tree.nodes.indexOf(node), sel.col, 1, sel.colCount);
                         SpreadJsObj.reloadRowsBackColor(mainSheet, [sel.row, billsObj.tree.nodes.indexOf(node)]);
                     }
-                    billsObj.refreshOperationValid;
+                    billsObj.refreshOperationValid();
                     billsObj.spread.focus();
                 });
             } else {

+ 1 - 0
app/service/budget_final_list.js

@@ -13,6 +13,7 @@ const status = {
     wait: 1,
     ext: 2,
     done: 3,
+    error: 4,
 };
 
 module.exports = app => {

+ 2 - 1
app/service/payment_safe_bills.js

@@ -412,6 +412,7 @@ module.exports = app => {
             };
             let parent = await this.getDataByKid(detail.id, targetId);
             if (targetId && !parent) throw '新增节点数据错误,请刷新页面重试';
+            const orgParentId = parent.id;
             let children = await this.getChildrenByParentId(detail.id, targetId);
             const updateParent = children.length === 0;
 
@@ -455,7 +456,7 @@ module.exports = app => {
             const createData = await this.getDataByFullPath(detail.id, insertData[0][this.setting.fullPath] + '%');
             const updateData = await this.getNextsData(detail.id, targetId, insertData[0][this.setting.order]);
             if (updateParent) {
-                updateData.push(await this.getDataById(parent.id));
+                updateData.push(await this.getDataByKid(detail.id, targetId));
             }
             return { create: createData, update: updateData };
         }

+ 6 - 6
app/service/rpt_gather_memory.js

@@ -37,8 +37,8 @@ const gatherUtils = {
 
         gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
         gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
-        gatherNode[prefix + "deal_qty"] = helper.add(gatherNode[prefix + "deal_qty"], sourceNode.quantity);
-        gatherNode[prefix + "deal_tp"] = helper.add(gatherNode[prefix + "deal_tp"], sourceNode.total_price);
+        gatherNode[prefix + "deal_qty"] = helper.add(gatherNode[prefix + "deal_qty"], sourceNode.deal_qty);
+        gatherNode[prefix + "deal_tp"] = helper.add(gatherNode[prefix + "deal_tp"], sourceNode.deal_tp);
 
         gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
         gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);
@@ -112,8 +112,8 @@ const gatherUtils = {
 
         gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
         gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
-        gatherNode[prefix + "deal_qty"] = helper.add(gatherNode[prefix + "deal_qty"], sourceNode.quantity);
-        gatherNode[prefix + "deal_tp"] = helper.add(gatherNode[prefix + "deal_tp"], sourceNode.total_price);
+        gatherNode[prefix + "deal_qty"] = helper.add(gatherNode[prefix + "deal_qty"], sourceNode.deal_qty);
+        gatherNode[prefix + "deal_tp"] = helper.add(gatherNode[prefix + "deal_tp"], sourceNode.deal_tp);
 
         gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
         gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);
@@ -151,8 +151,8 @@ const gatherUtils = {
 
         gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
         gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
-        gatherNode[prefix + "deal_qty"] = helper.add(gatherNode[prefix + "deal_qty"], sourceNode.quantity);
-        gatherNode[prefix + "deal_tp"] = helper.add(gatherNode[prefix + "deal_tp"], sourceNode.total_price);
+        gatherNode[prefix + "deal_qty"] = helper.add(gatherNode[prefix + "deal_qty"], sourceNode.deal_qty);
+        gatherNode[prefix + "deal_tp"] = helper.add(gatherNode[prefix + "deal_tp"], sourceNode.deal_tp);
 
         gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
         gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);

+ 54 - 13
app/service/rpt_stage_sum_memory.js

@@ -177,19 +177,60 @@ module.exports = app => {
                 const material = await this.db.get(this.ctx.service.material.tableName, { tid: this.ctx.tender.id, order: m });
                 if (!material) continue;
 
-                const prefix = 'm_' + material.order + '_';
-                calcPrefix.push(prefix);
-                const defaultData = {};
-                defaultData[prefix + 'order'] = material.order;
-
-                const curMaterial = material.status === auditConst.material.status.checked
-                    ? await this.ctx.service.materialBillsHistory.getAllDataByCondition({ where: { mid: material.id } })
-                    : await this.ctx.service.materialBills.getAllDataByCondition({ where: { tid }});
-                const relaId = material.status === auditConst.material.status.checked ? 'mb_id' : 'id';
-
-                this.ctx.helper.assignRelaData(materialData, [
-                    {data: curMaterial, fields, prefix: prefix, relaId, defaultData: defaultData}
-                ]);
+                if (material.is_stage_self) {
+                    let curMaterial = [];
+                    if (material.status !== auditConst.material.status.checked) {
+                        const sql = 'SELECT msb.id, msb.tid, msb.mid, msb.ms_id, ms.sid, ms.`order` as s_order, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type, mb.in_time, msb.mb_id, ' +
+                            '    msb.quantity, mb.expr,' +
+                            '    mb.basic_price, mb.basic_times, ' +
+                            '    msb.msg_tp, msb.msg_times, msb.msg_spread, mb.m_up_risk, mb.m_down_risk, msb.m_spread, msb.m_tp, mb.pre_tp, msb.m_tax_tp, mb.tax_pre_tp, mb.origin, ' +
+                            '    msb.remark, msb.is_summary, mb.m_tax, mb.in_time, mb.origin' +
+                            `  FROM ${this.ctx.service.materialStageBills.tableName} msb` +
+                            `  LEFT JOIN ${this.ctx.service.materialBills.tableName} mb ON msb.mb_id = mb.id` +
+                            '  LEFT JOIN ' + this.ctx.service.materialStage.tableName + ' ms ON msb.ms_id = ms.id ' +
+                            `  WHERE msb.mid = ?` +
+                            '  ORDER By msb.ms_id, mb.order';
+                        curMaterial = await this.ctx.app.mysql.query(sql, [material.id]);
+                    } else {
+                        const sql = 'SELECT msb.id, msb.tid, msb.mid, msb.ms_id, ms.sid, ms.`order` as s_order, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type, mb.in_time, msb.mb_id,' +
+                            '    msb.quantity, mbh.expr,' +
+                            '    mb.basic_price, mb.basic_times, ' +
+                            '    msb.msg_tp, msb.msg_times, msb.msg_spread, mbh.m_up_risk, mbh.m_down_risk, msb.m_spread, msb.m_tp, mbh.pre_tp, msb.m_tax_tp, mbh.tax_pre_tp, mbh.origin, ' +
+                            '    msb.remark, msb.is_summary, mbh.m_tax, mb.in_time, mbh.origin' +
+                            `  FROM ${this.ctx.service.materialStageBills.tableName} msb` +
+                            '  LEFT JOIN ' + this.ctx.service.materialBillsHistory.tableName + ' mbh ON msb.mb_id = mbh.mb_id AND msb.mid = mbh.mid' +
+                            '  LEFT JOIN ' + this.ctx.service.materialBills.tableName + ' mb ON msb.mb_id = mb.id ' +
+                            '  LEFT JOIN ' + this.ctx.service.materialStage.tableName + ' ms ON msb.ms_id = ms.id ' +
+                            '  WHERE msb.mid = ?'+
+                            '  ORDER By msb.ms_id, mb.order';
+                        curMaterial = await this.ctx.app.mysql.query(sql, [material.id]);
+                    }
+                    const stageId = material.stage_id.split(',');
+                    materialData.forEach(x => { return x['m_' + material.order + '_' + 'stageId'] = stageId });
+                    for (const sid of stageId) {
+                        const prefix = 'm_' + material.order + '_' + `s${sid}_`;
+                        calcPrefix.push(prefix);
+                        const defaultData = {};
+                        defaultData[prefix + 'order'] = material.order;
+                        const sidInt = parseInt(sid);
+                        const curStageMaterial = curMaterial.filter(x => { return x.sid === sidInt; });
+                        this.ctx.helper.assignRelaData(materialData, [
+                            {data: curStageMaterial, fields, prefix: prefix, relaId: 'mb_id', defaultData: defaultData}
+                        ]);
+                    }
+                } else {
+                    const prefix = 'm_' + material.order + '_';
+                    calcPrefix.push(prefix);
+                    const defaultData = {};
+                    defaultData[prefix + 'order'] = material.order;
+                    const curMaterial = material.status === auditConst.material.status.checked
+                        ? await this.ctx.service.materialBillsHistory.getAllDataByCondition({ where: { mid: material.id } })
+                        : await this.ctx.service.materialBills.getAllDataByCondition({ where: { tid }});
+                    const relaId = material.status === auditConst.material.status.checked ? 'mb_id' : 'id';
+                    this.ctx.helper.assignRelaData(materialData, [
+                        {data: curMaterial, fields, prefix: prefix, relaId, defaultData: defaultData}
+                    ]);
+                }
             }
 
             return materialData;

+ 1 - 1
app/view/budget/sub_menu_list.ejs

@@ -5,7 +5,7 @@
 <nav-menu title="设计概算" url="/budget/<%= ctx.budget.id %>/gai%>" ml="3" active="<%= ctx.url.indexOf('/gai') %>"></nav-menu>
 <nav-menu title="施工图预算" url="/budget/<%= ctx.budget.id %>/yu" ml="3" active="<%= ctx.url.indexOf('/yu') %>"></nav-menu>
 <nav-menu title="招标预算" url="/budget/<%= ctx.budget.id %>/zb" ml="3" active="<%= ctx.url.indexOf('/zb') %>"></nav-menu>
-<nav-menu title="输出报表" url="/budget/<%= ctx.budget.id %>/report" ml="3" active="<%= ctx.url.indexOf('/report') %>"></nav-menu>
+<!--<nav-menu title="输出报表" url="/budget/<%= ctx.budget.id %>/report" ml="3" active="<%= ctx.url.indexOf('/report') %>"></nav-menu>-->
 <% if (!ctx.budget.readOnly && ctx.url.indexOf('/compare') === -1 && ctx.url !== '/budget/' + ctx.budget.id) { %>
 <div class="contarl-box"><button class="btn btn-primary btn-sm btn-block" data-toggle="modal" data-target="#budget-set">设置</button></div>
 <% } %>

+ 1 - 1
app/view/dashboard/index.ejs

@@ -66,7 +66,7 @@
                                     <% if (auditMaterial.length !== 0) { %>
                                     <option value="1">材料调差(<%- auditMaterial.length %>)</option>
                                     <% } %>
-                                    <% if (auditPayments.length !== 0) { %>
+                                    <% if (ctx.session.sessionProject.page_show.openPayment && auditPayments.length !== 0) { %>
                                         <option value="10">支付审批(<%- auditPayments.length %>)</option>
                                     <% } %>
                                 </select>

+ 1 - 1
app/view/measure/stage.ejs

@@ -99,7 +99,7 @@
                             <a href="<%- '/tender/' + ctx.tender.id + '/measure/stage/' + s.order %>" target="_blank" class="btn <%- auditConst.statusButtonClass[s.status] %> btn-sm"><%- auditConst.statusButton[s.status] %></a>
                             <% } else if (s.status === auditConst.status.checking && s.curAuditors && s.curAuditors.findIndex(x => { return x.aid === ctx.session.sessionUser.accountId; }) >= 0) { %>
                             <a href="<%- '/tender/' + ctx.tender.id + '/measure/stage/' + s.order %>" target="_blank" class="btn <%- auditConst.statusButtonClass[s.status] %> btn-sm"><%- auditConst.statusButton[s.status] %></a>
-                            <% } else if (s.status === auditConst.status.checkNoPre && s.curAuditors && s.curAuditor2.findIndex(x => { return x.aid === ctx.session.sessionUser.accountId; }) >= 0) { %>
+                            <% } else if (s.status === auditConst.status.checkNoPre && s.curAuditor2 && s.curAuditor2.findIndex(x => { return x.aid === ctx.session.sessionUser.accountId; }) >= 0) { %>
                             <a href="<%- '/tender/' + ctx.tender.id + '/measure/stage/' + s.order %>" target="_blank" class="btn <%- auditConst.statusButtonClass[s.status] %> btn-sm"><%- auditConst.statusButton[s.status] %></a>
                             <% } else { %>
                             <span class="<%- auditConst.auditStringClass[s.status] %>"><%- auditConst.auditString[s.status] %></span>

+ 0 - 98
sql/update.sql

@@ -1,98 +0,0 @@
-ALTER TABLE `zh_budget_std`
-ADD COLUMN `zb_chapter_id`  varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '招标-项目节-id列表(\',\'分隔)' AFTER `in_time`,
-ADD COLUMN `zb_template_id`  varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '招标-新建模板-id列表(\',\'分隔)' AFTER `zb_chapter_id`,
-ADD COLUMN `zb_bills_id`  varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '招标-工程量清单-id列表(\',\'分隔)' AFTER `zb_template_id`;
-
-CREATE TABLE `zh_budget_zb` (
-  `id` varchar(36) NOT NULL COMMENT 'uuid',
-  `bid` int(10) NOT NULL COMMENT '概算投资项目id',
-  `tree_id` int(10) NOT NULL COMMENT '节点id',
-  `tree_pid` int(10) NOT NULL COMMENT '父节点id',
-  `level` tinyint(4) NOT NULL COMMENT '层级',
-  `order` mediumint(4) NOT NULL DEFAULT '0' COMMENT '同级排序',
-  `full_path` varchar(255) DEFAULT '' COMMENT '层级定位辅助字段parent.full_path-tree_id',
-  `is_leaf` tinyint(1) NOT NULL COMMENT '是否叶子节点,界面显示辅助字段',
-  `code` varchar(50) DEFAULT '' COMMENT '节点编号',
-  `b_code` varchar(50) DEFAULT NULL,
-  `name` varchar(255) DEFAULT NULL COMMENT '名称',
-  `unit` varchar(15) DEFAULT '' COMMENT '单位',
-  `unit_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '单价',
-  `quantity` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '数量',
-  `total_price` decimal(24,8) DEFAULT '0.00000000' COMMENT '金额',
-  `dgn_qty1` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量1',
-  `dgn_qty2` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量2',
-  `drawing_code` varchar(255) DEFAULT NULL COMMENT '图册号',
-  `memo` varchar(1000) DEFAULT '' COMMENT '备注',
-  `node_type` int(4) unsigned DEFAULT '0' COMMENT '节点类别',
-  `source` varchar(30) DEFAULT '' COMMENT '添加源',
-  `remark` varchar(60) DEFAULT '' COMMENT '备注',
-  PRIMARY KEY (`id`),
-  KEY `idx_bid` (`bid`),
-  KEY `idx_tree_pid` (`tree_pid`),
-  KEY `idx_level` (`level`),
-  KEY `idx_full_path` (`bid`,`full_path`) USING BTREE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='招标预算数据';
-
-ALTER TABLE `zh_budget_final`
-ADD COLUMN `zb_dgn_qty1`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-设计数量1' AFTER `yu_tp`,
-ADD COLUMN `zb_dgn_qty2`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-设计数量1' AFTER `zb_dgn_qty1`,
-ADD COLUMN `zb_dgn_qty`  varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '预算-设计数量1/设计数量2' AFTER `zb_dgn_qty2`,
-ADD COLUMN `zb_dgn_price`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-经济指标' AFTER `zb_dgn_qty`,
-ADD COLUMN `zb_tp`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-金额' AFTER `zb_dgn_price`;
-
-CREATE TABLE `zh_control_price` (
-  `id` varchar(36) NOT NULL COMMENT 'uuid',
-  `tid` int(10) NOT NULL COMMENT '标段id',
-  `tree_id` int(10) NOT NULL COMMENT '节点id',
-  `tree_pid` int(10) NOT NULL COMMENT '父节点id',
-  `level` tinyint(4) NOT NULL COMMENT '层级',
-  `order` mediumint(4) NOT NULL DEFAULT '0' COMMENT '同级排序',
-  `full_path` varchar(255) DEFAULT '' COMMENT '层级定位辅助字段parent.full_path-tree_id',
-  `is_leaf` tinyint(1) NOT NULL COMMENT '是否叶子节点,界面显示辅助字段',
-  `code` varchar(50) DEFAULT '' COMMENT '节点编号',
-  `b_code` varchar(50) DEFAULT NULL,
-  `name` varchar(255) DEFAULT NULL COMMENT '名称',
-  `unit` varchar(15) DEFAULT '' COMMENT '单位',
-  `unit_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '单价',
-  `quantity` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '数量',
-  `total_price` decimal(24,8) DEFAULT '0.00000000' COMMENT '金额',
-  `dgn_qty1` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量1',
-  `dgn_qty2` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量2',
-  `drawing_code` varchar(255) DEFAULT NULL COMMENT '图册号',
-  `memo` varchar(1000) DEFAULT '' COMMENT '备注',
-  `node_type` int(4) unsigned DEFAULT '0' COMMENT '节点类别',
-  `source` varchar(30) DEFAULT '' COMMENT '添加源',
-  `remark` varchar(60) DEFAULT '' COMMENT '备注',
-  PRIMARY KEY (`id`),
-  KEY `idx_tid` (`tid`),
-  KEY `idx_tree_pid` (`tree_pid`),
-  KEY `idx_level` (`level`),
-  KEY `idx_full_path` (`tid`,`full_path`) USING BTREE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='招标控制价';
-
-ALTER TABLE `zh_material_list_notjoin`
-ADD COLUMN `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1为本期不参与调差,2为数量变更不参与调差' AFTER `mx_id`;
-
-ALTER TABLE `zh_stage_bills_pc`
-MODIFY COLUMN `lid` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '项目节id' AFTER `sorder`;
-
-CREATE TABLE `zh_project_stopmsg`  (
-  `id` int NOT NULL AUTO_INCREMENT,
-  `pid` int NOT NULL COMMENT '项目id',
-  `msg` varchar(255) NULL COMMENT '停用信息',
-  `is_checked` tinyint(1) NULL DEFAULT 0 COMMENT '是否选中',
-  `in_time` datetime NULL COMMENT '创建时间',
-  PRIMARY KEY (`id`)
-) ENGINE = InnoDB CHARACTER SET = utf8 COMMENT = '用户账号停用提示表';
-
-ALTER TABLE `zh_material_list`
-ADD COLUMN `contract_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期合同数量' AFTER `mx_id`,
-ADD COLUMN `qc_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期数量变更数量' AFTER `contract_qty`,
-ADD COLUMN `qc_minus_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期不计价数量' AFTER `qc_qty`,
-MODIFY COLUMN `gather_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期完成数量' AFTER `qc_minus_qty`;
-
-ALTER TABLE `zh_material`
-ADD COLUMN `qty_source` tinyint(4) NOT NULL DEFAULT 1 COMMENT '计量本期计量数量来源,默认是完成计量1' AFTER `status`;
-
-ALTER TABLE `zh_material`
-ADD COLUMN `is_new_qty` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是新建的调差期,用于qty值更新' AFTER `is_new`;

+ 98 - 0
sql/update20231128.sql

@@ -0,0 +1,98 @@
+ALTER TABLE `zh_budget_std`
+ADD COLUMN `zb_chapter_id`  varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '招标-项目节-id列表(\',\'分隔)' AFTER `in_time`,
+ADD COLUMN `zb_template_id`  varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '招标-新建模板-id列表(\',\'分隔)' AFTER `zb_chapter_id`,
+ADD COLUMN `zb_bills_id`  varchar(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT '招标-工程量清单-id列表(\',\'分隔)' AFTER `zb_template_id`;
+
+CREATE TABLE `zh_budget_zb` (
+  `id` varchar(36) NOT NULL COMMENT 'uuid',
+  `bid` int(10) NOT NULL COMMENT '概算投资项目id',
+  `tree_id` int(10) NOT NULL COMMENT '节点id',
+  `tree_pid` int(10) NOT NULL COMMENT '父节点id',
+  `level` tinyint(4) NOT NULL COMMENT '层级',
+  `order` mediumint(4) NOT NULL DEFAULT '0' COMMENT '同级排序',
+  `full_path` varchar(255) DEFAULT '' COMMENT '层级定位辅助字段parent.full_path-tree_id',
+  `is_leaf` tinyint(1) NOT NULL COMMENT '是否叶子节点,界面显示辅助字段',
+  `code` varchar(50) DEFAULT '' COMMENT '节点编号',
+  `b_code` varchar(50) DEFAULT NULL,
+  `name` varchar(255) DEFAULT NULL COMMENT '名称',
+  `unit` varchar(15) DEFAULT '' COMMENT '单位',
+  `unit_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '单价',
+  `quantity` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '数量',
+  `total_price` decimal(24,8) DEFAULT '0.00000000' COMMENT '金额',
+  `dgn_qty1` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量1',
+  `dgn_qty2` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量2',
+  `drawing_code` varchar(255) DEFAULT NULL COMMENT '图册号',
+  `memo` varchar(1000) DEFAULT '' COMMENT '备注',
+  `node_type` int(4) unsigned DEFAULT '0' COMMENT '节点类别',
+  `source` varchar(30) DEFAULT '' COMMENT '添加源',
+  `remark` varchar(60) DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`),
+  KEY `idx_bid` (`bid`),
+  KEY `idx_tree_pid` (`tree_pid`),
+  KEY `idx_level` (`level`),
+  KEY `idx_full_path` (`bid`,`full_path`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='招标预算数据';
+
+ALTER TABLE `zh_budget_final`
+ADD COLUMN `zb_dgn_qty1`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-设计数量1' AFTER `yu_tp`,
+ADD COLUMN `zb_dgn_qty2`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-设计数量1' AFTER `zb_dgn_qty1`,
+ADD COLUMN `zb_dgn_qty`  varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '预算-设计数量1/设计数量2' AFTER `zb_dgn_qty2`,
+ADD COLUMN `zb_dgn_price`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-经济指标' AFTER `zb_dgn_qty`,
+ADD COLUMN `zb_tp`  decimal(24,8) NOT NULL DEFAULT 0.00000000 COMMENT '预算-金额' AFTER `zb_dgn_price`;
+
+CREATE TABLE `zh_control_price` (
+  `id` varchar(36) NOT NULL COMMENT 'uuid',
+  `tid` int(10) NOT NULL COMMENT '标段id',
+  `tree_id` int(10) NOT NULL COMMENT '节点id',
+  `tree_pid` int(10) NOT NULL COMMENT '父节点id',
+  `level` tinyint(4) NOT NULL COMMENT '层级',
+  `order` mediumint(4) NOT NULL DEFAULT '0' COMMENT '同级排序',
+  `full_path` varchar(255) DEFAULT '' COMMENT '层级定位辅助字段parent.full_path-tree_id',
+  `is_leaf` tinyint(1) NOT NULL COMMENT '是否叶子节点,界面显示辅助字段',
+  `code` varchar(50) DEFAULT '' COMMENT '节点编号',
+  `b_code` varchar(50) DEFAULT NULL,
+  `name` varchar(255) DEFAULT NULL COMMENT '名称',
+  `unit` varchar(15) DEFAULT '' COMMENT '单位',
+  `unit_price` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '单价',
+  `quantity` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '数量',
+  `total_price` decimal(24,8) DEFAULT '0.00000000' COMMENT '金额',
+  `dgn_qty1` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量1',
+  `dgn_qty2` decimal(24,8) NOT NULL DEFAULT '0.00000000' COMMENT '设计数量2',
+  `drawing_code` varchar(255) DEFAULT NULL COMMENT '图册号',
+  `memo` varchar(1000) DEFAULT '' COMMENT '备注',
+  `node_type` int(4) unsigned DEFAULT '0' COMMENT '节点类别',
+  `source` varchar(30) DEFAULT '' COMMENT '添加源',
+  `remark` varchar(60) DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`),
+  KEY `idx_tid` (`tid`),
+  KEY `idx_tree_pid` (`tree_pid`),
+  KEY `idx_level` (`level`),
+  KEY `idx_full_path` (`tid`,`full_path`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='招标控制价';
+
+ALTER TABLE `zh_material_list_notjoin`
+ADD COLUMN `type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1为本期不参与调差,2为数量变更不参与调差' AFTER `mx_id`;
+
+ALTER TABLE `zh_stage_bills_pc`
+MODIFY COLUMN `lid` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '项目节id' AFTER `sorder`;
+
+CREATE TABLE `zh_project_stopmsg`  (
+  `id` int NOT NULL AUTO_INCREMENT,
+  `pid` int NOT NULL COMMENT '项目id',
+  `msg` varchar(255) NULL COMMENT '停用信息',
+  `is_checked` tinyint(1) NULL DEFAULT 0 COMMENT '是否选中',
+  `in_time` datetime NULL COMMENT '创建时间',
+  PRIMARY KEY (`id`)
+) ENGINE = InnoDB CHARACTER SET = utf8 COMMENT = '用户账号停用提示表';
+
+ALTER TABLE `zh_material_list`
+ADD COLUMN `contract_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期合同数量' AFTER `mx_id`,
+ADD COLUMN `qc_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期数量变更数量' AFTER `contract_qty`,
+ADD COLUMN `qc_minus_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期不计价数量' AFTER `qc_qty`,
+MODIFY COLUMN `gather_qty` decimal(30, 8) NULL DEFAULT NULL COMMENT '本期完成数量' AFTER `qc_minus_qty`;
+
+ALTER TABLE `zh_material`
+ADD COLUMN `qty_source` tinyint(4) NOT NULL DEFAULT 1 COMMENT '计量本期计量数量来源,默认是完成计量1' AFTER `status`;
+
+ALTER TABLE `zh_material`
+ADD COLUMN `is_new_qty` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是新建的调差期,用于qty值更新' AFTER `is_new`;