Przeglądaj źródła

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

TonyKang 3 lat temu
rodzic
commit
14d1cb1035

+ 3 - 3
app/const/map.js

@@ -12,10 +12,10 @@ const level = 15;
 
 const map = [
     { province: '默认', lng: 116.404, lat: 39.915, office: 15, level: 15 },
-    { province: '甘肃', lng: 103.612, lat: 34.687, office: 3, level: 15 },
-    { province: '内蒙', lng: 110.088, lat: 41.457, office: 9, level: 15 },
+    { province: '甘肃', lng: 103.605, lat: 34.68, office: 3, level: 15 },
+    { province: '内蒙', lng: 110.331, lat: 41.427, office: 9, level: 15 },
     { province: '四川', lng: 102.6445, lat: 29.386, office: 7, level: 15 },
-    { province: '重庆', lng: 106.863, lat: 29.066, office: 8, level: 15 },
+    { province: '重庆', lng: 106.780, lat: 28.666, office: 8, level: 15 },
     { province: '广西', lng: 109.980, lat: 24.484, office: 5, level: 15 },
     { province: '广东', lng: 113.795, lat: 23.218, office: 4, level: 15 },
     { province: '江西', lng: 118.366, lat: 27.071, office: 6, level: 15 },

+ 6 - 1
app/const/tender_info.js

@@ -8,7 +8,7 @@
  * @version
  */
 
-const parseInfo = ['deal_info', 'construction_unit', 'tech_param', 'decimal', 'precision', 'deal_param', 'display', 'pay_account', 'shenpi', 'bid_info', 'ledger_check'];
+const parseInfo = ['deal_info', 'construction_unit', 'tech_param', 'decimal', 'precision', 'deal_param', 'display', 'pay_account', 'shenpi', 'bid_info', 'ledger_check', 'fun_rela'];
 const arrayInfo = ['chapter'];
 const defaultInfo = {
     // 合同信息
@@ -160,6 +160,11 @@ const defaultInfo = {
         same_code: true,
         sibling: true,
         over: true,
+    },
+    fun_rela: {
+        sum_load: {
+            ignoreParent: 1,
+        }
     }
 };
 

+ 9 - 8
app/controller/material_controller.js

@@ -368,7 +368,7 @@ module.exports = app => {
                     searchsql.mid = midList;
                 }
                 searchsql.t_type = materialConst.t_type[0].value;
-                renderData.materialBillsData = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql });
+                renderData.materialBillsData = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql, orders: [['order', 'asc']] });
                 // 取对应期的截取上期的调差金额和应耗数量
                 if (ctx.material.highOrder !== ctx.material.order) {
                     for (const [mindex, mb] of renderData.materialBillsData.entries()) {
@@ -618,13 +618,14 @@ module.exports = app => {
                     case 'paste':
                         responseData.data.m_tp = await ctx.service.materialBills.saveDatas(data.updateData);
                         // 根据期判断需要获取的工料信息值
-                        const searchsql = { tid: ctx.tender.id };
-                        if (ctx.material.highOrder !== ctx.material.order) {
-                            const midList = await ctx.service.material.getPreMidList(ctx.tender.id, ctx.material.order);
-                            searchsql.mid = midList;
-                        }
-                        // 取所有工料表
-                        responseData.data.info = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql });
+                        // const searchsql = { tid: ctx.tender.id };
+                        // if (ctx.material.highOrder !== ctx.material.order) {
+                        //     const midList = await ctx.service.material.getPreMidList(ctx.tender.id, ctx.material.order);
+                        //     searchsql.mid = midList;
+                        // }
+                        // // 取所有工料表
+                        // responseData.data.info = await ctx.service.materialBills.getAllDataByCondition({ where: searchsql, orders: [['order', 'asc']] });
+                        responseData.data.info = await this._getMaterialBillsData(ctx);
                         break;
                     default: throw '参数有误';
                 }

+ 1 - 0
app/controller/tender_controller.js

@@ -641,6 +641,7 @@ module.exports = app => {
 
                 const updateData = {};
                 if (data.ledger_check) updateData.ledger_check = data.ledger_check;
+                if (data.sum_load) updateData.sum_load = data.sum_load;
                 await ctx.service.tenderInfo.saveTenderInfo(ctx.tender.id, data);
 
                 ctx.body = { err: 0, msg: '', data: JSON.parse(ctx.request.body.data) };

+ 52 - 11
app/lib/sum_load.js

@@ -21,8 +21,10 @@ class loadGclBaseTree {
         // 常量
         this.splitChar = '-';
         // 索引
-        // 以code为索引
+        // 仅通过addNode或addNodeWithoutParent添加节点
         this.items = [];
+        // this.parent下原来的节点
+        this.baseNodes = [];
 
         // 缓存
         this.keyNodeId = setting.maxId ? setting.maxId + 1 : 1;
@@ -70,6 +72,7 @@ class loadGclBaseTree {
                 b_code: source.b_code,
                 name: source.name,
                 unit: source.unit,
+                deal_qty: 0,
                 sgfh_qty: 0,
                 qtcl_qty: 0,
                 sjcl_qyt: 0,
@@ -84,6 +87,47 @@ class loadGclBaseTree {
         return node;
     }
 
+    findLeaf(node, check) {
+        for (const bn of this.baseNodes) {
+            if (bn.b_code === node.b_code && bn.name === node.name && bn.unit === node.unit
+                && bn.is_leaf && !bn.hasPos && (!check || check(bn, node))) return bn;
+        }
+        for (const i of this.items) {
+            if (i.b_code === node.b_code && i.name === node.name && i.unit === node.unit
+                && i.is_leaf && !i.hasPos && (!check || check(i, node))) return i;
+        }
+        return null;
+    }
+
+    addNodeWithoutParent(source, check) {
+        let node = this.findLeaf(source, check);
+        if (!node) {
+            node = {
+                id: this.ctx.app.uuid.v4(),
+                tender_id: this.ctx.tender.id,
+                ledger_id: this.keyNodeId,
+                ledger_pid: this.parent.ledger_id,
+                level: this.parent.level + 1,
+                full_path: this.parent.full_path + '-' + this.keyNodeId,
+                order: this.parent.children.length + 1,
+                b_code: source.b_code,
+                name: source.name,
+                unit: source.unit,
+                deal_qty: 0,
+                sgfh_qty: 0,
+                qtcl_qty: 0,
+                sjcl_qty: 0,
+                quantity: 0,
+                is_leaf: source.is_leaf,
+                hasPos: false,
+            }
+            this.keyNodeId += 1;
+            this.parent.children.push(node);
+            this.items.push(node);
+        }
+        return node;
+    }
+
     gather(source, parent) {}
     getUpdateData() {}
 
@@ -149,7 +193,6 @@ class loadLedgerGclTree extends loadGclBaseTree {
 class updateReviseGclTree extends loadGclBaseTree {
     constructor (ctx, setting) {
         super(ctx, setting);
-        this.baseNodes = [];
         this.errors = [];
     }
     loadBase(datas, pos) {
@@ -237,10 +280,6 @@ class updateReviseGclTree extends loadGclBaseTree {
 }
 
 class gatherStageGclTree extends loadGclBaseTree {
-    constructor (ctx, setting) {
-        super(ctx, setting);
-        this.baseNodes = [];
-    }
     loadBase(datas, pos) {
         datas.sort((x, y) => { return x.level === y.level ? x.order - y.order : x.level - y.level; });
         const Index = {};
@@ -338,9 +377,10 @@ class sumLoad {
         this.ctx = ctx;
     }
 
-    recusiveLoadGatherGcl(node, parent) {
-        const cur = node.b_code ? this.loadTree.gather(node, parent) : parent;
-        if (!node.children || node.children.length === 0) return;
+    recusiveLoadGatherGcl(node, parent, ignoreParent) {
+        const isLeaf = !node.children || node.children.length === 0;
+        const cur = (!ignoreParent || isLeaf) &&  node.b_code ? this.loadTree.gather(node, parent) : parent;
+        if (isLeaf) return;
         for (const child of node.children) {
             this.recusiveLoadGatherGcl(child, cur);
         }
@@ -429,8 +469,9 @@ class sumLoad {
     }
 
     async stageGatherGcl(select, maxId, tenders, defaultData) {
+        const ignoreParent = this.ctx.tender.info.fun_rela.ignoreParent;
         this.loadTree = new gatherStageGclTree(this.ctx, {
-            parent: select, maxId, type: 'ledger', defaultData,
+            parent: select, maxId, type: 'ledger', defaultData, ignoreParent,
         });
         const posterity = await this.ctx.service.ledger.getPosterityByParentId(this.ctx.tender.id, select.ledger_id);
         const pos = await this.ctx.service.revisePos.getData(this.ctx.tender.id);
@@ -456,7 +497,7 @@ class sumLoad {
             billsTree.loadDatas(billsData);
             for (const top of billsTree.children) {
                 if ([1].indexOf(top.node_type) < 0) continue;
-                this.recusiveLoadGatherGcl(top, null);
+                this.recusiveLoadGatherGcl(top, null, ignoreParent);
             }
         }
         return this.loadTree;

+ 7 - 2
app/public/js/material.js

@@ -589,7 +589,8 @@ $(document).ready(() => {
             // 更新至服务器
             postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
                 materialBillsData = result.info;
-                SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
+                // SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
+                SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
                 // for (const row in rowData) {
                 //     materialBillsData.splice(index, 1, result.info[row]);
                 //     SpreadJsObj.reLoadRowData(info.sheet, row);
@@ -599,12 +600,16 @@ $(document).ready(() => {
                         m.code = materialBillsData[i].code;
                         m.name = materialBillsData[i].name;
                         m.unit = materialBillsData[i].unit;
+                        m.origin = materialBillsData[i].origin;
                     }
-                    SpreadJsObj.reLoadSheetData(materialMonthSpread.getActiveSheet());
+                    SpreadJsObj.loadSheetData(materialMonthSpread.getActiveSheet(), SpreadJsObj.DataType.Data, monthsList);
+                    // SpreadJsObj.reLoadSheetData(materialMonthSpread.getActiveSheet());
                 }
                 m_tp = result.m_tp;
                 resetTpTable();
+                // materialSpreadObj.refreshActn();
             }, function () {
+                // materialSpreadObj.refreshActn();
                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
                 return;
             });

+ 6 - 6
app/service/stage_rela.js

@@ -449,12 +449,12 @@ module.exports = app => {
                     cache_tp: JSON.stringify(calcModel.cache_tp), cache_org_tp: JSON.stringify(calcModel.cache_org_tp),
                 };
                 const addRela = await conn.insert(this.tableName, data);
-                if (calcModel.stageBills.length > 0) await conn.insert(this.ctx.service.stageRelaBills.tableName, calcModel.stageBills);
-                if (calcModel.stageBillsFinal.length > 0) await conn.insert(this.ctx.service.stageRelaBillsFinal.tableName, calcModel.stageBillsFinal);
-                if (calcModel.stagePos.length > 0) await conn.insert(this.ctx.service.stageRelaPos.tableName, calcModel.stagePos);
-                if (calcModel.stagePosFinal.length > 0) await conn.insert(this.ctx.service.stageRelaPosFinal.tableName, calcModel.stagePosFinal);
-                if (calcModel.stageIm.length > 0) await conn.insert(this.ctx.service.stageRelaIm.tableName, calcModel.stageIm);
-                if (calcModel.stageImBills.length > 0) await conn.insert(this.ctx.service.stageRelaImBills.tableName, calcModel.stageImBills);
+                if (calcModel.stageBills && calcModel.stageBills.length > 0) await conn.insert(this.ctx.service.stageRelaBills.tableName, calcModel.stageBills);
+                if (calcModel.stageBillsFinal && calcModel.stageBillsFinal.length > 0) await conn.insert(this.ctx.service.stageRelaBillsFinal.tableName, calcModel.stageBillsFinal);
+                if (calcModel.stagePos && calcModel.stagePos.length > 0) await conn.insert(this.ctx.service.stageRelaPos.tableName, calcModel.stagePos);
+                if (calcModel.stagePosFinal && calcModel.stagePosFinal.length > 0) await conn.insert(this.ctx.service.stageRelaPosFinal.tableName, calcModel.stagePosFinal);
+                if (calcModel.stageIm && calcModel.stageIm.length > 0) await conn.insert(this.ctx.service.stageRelaIm.tableName, calcModel.stageIm);
+                if (calcModel.stageImBills && calcModel.stageImBills.length > 0) await conn.insert(this.ctx.service.stageRelaImBills.tableName, calcModel.stageImBills);
                 await conn.update(this.ctx.service.stage.tableName, { id: this.ctx.stage.id, check_calc: 1 });
                 await conn.commit();
                 return addRela.insertId;

+ 1 - 0
app/view/tender/detail.ejs

@@ -48,6 +48,7 @@
                             <a href="/tender/<%- tender.id %>/shenpi" class="dropdown-item">审批流程</a>
                             <a href="#bd-set-9" data-toggle="modal" data-target="#bd-set-9" class="dropdown-item">游客账号 <span id="tourist-num" <% if (tourists.length !== 0) { %>class="badge badge-secondary"<% } %>><% if (tourists.length !== 0) { %><%- tourists.length %><% } %></span></a>
                             <a href="#bd-set-10" data-toggle="modal" data-target="#bd-set-10" class="dropdown-item">上报限制</a>
+                            <a href="#bd-set-12" data-toggle="modal" data-target="#bd-set-12" class="dropdown-item">功能设置</a>
                             <a href="#bd-set-11" data-toggle="modal" data-target="#bd-set-11" class="dropdown-item">概况设置</a>
                         </div>
                     </div>

+ 39 - 0
app/view/tender/detail_modal.ejs

@@ -1775,6 +1775,27 @@
         </div>
     </div>
 </div>
+<div class="modal fade" id="bd-set-12" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">功能设置</h5>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <div class="custom-control custom-checkbox mb-2">
+                        <input type="checkbox" class="custom-control-input" id="sl_ignoreParent" checked="">
+                        <label class="custom-control-label" for="lc_same_code">计量台账-导入其他标段数据-忽略父项</label>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
+                <button type="button" class="btn btn-sm btn-primary" onclick="post12()">确认修改</button>
+            </div>
+        </div>
+    </div>
+</div>
 <script>
     const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
     const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
@@ -1802,6 +1823,24 @@
             $('#bd-set-10').modal('hide');
         });
     }
+    const loadLedgerCheckProperty = function () {
+        $('#lc_same_code')[0].checked = property.sum_load.ignoreParent;
+    }
+    $('#bd-set-12').on('show.bs.modal', function () {
+        loadFunRelaProperty();
+    });
+    function post12 () {
+        const prop = {
+            sum_load: {
+                ignoreParent: $('#sl_ignoreParent')[0].checked,
+            },
+        };
+        const tenderId = window.location.pathname.split('/')[2];
+        postData('/tender/' + tenderId + '/save2', prop, function (data) {
+            property.sum_load = data.sum_load;
+            $('#bd-set-12').modal('hide');
+        });
+    }
     $(function () {
         // 投资进度
         let timer2 = null;

+ 3 - 0
sql/update.sql

@@ -114,3 +114,6 @@ CREATE TABLE `zh_s2b_z_tender` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='浙江项目标段表';
 
 ALTER TABLE `zh_project` ADD `customType` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '定制项目通知类型参数' AFTER `secret`;
+
+ALTER TABLE `calculation`.`zh_tender_info` 
+ADD COLUMN `fun_rela` varchar(255) CHARACTER SET utf8 NULL COMMENT '功能设置' AFTER `ledger_check`;