فهرست منبع

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

TonyKang 5 سال پیش
والد
کامیت
0e0b4e8b23

+ 12 - 1
app/base/base_bills_service.js

@@ -21,7 +21,14 @@ class BaseBillsSerivce extends TreeService {
 
     // 继承方法
     clearParentingData(data) {
+        console.log(1);
         data.unit_price = null;
+        data.sgfh_qty = null;
+        data.sgfh_tp = null;
+        data.sjcl_qty = null;
+        data.sjcl_tp = null;
+        data.qtcl_qty = null;
+        data.qtcl_tp = null;
         data.quantity = null;
         data.total_price = null;
         data.deal_qty = null;
@@ -89,7 +96,11 @@ class BaseBillsSerivce extends TreeService {
             const result = await this.transaction.insert(this.tableName, data);
             if (children.length === 0) {
                 await this.transaction.update(this.tableName,
-                    {is_leaf: false, quantity: null, unit_price: null, total_price: null, deal_qty: null, deal_tp: null},
+                    {
+                        is_leaf: false,
+                        sgfh_qty: null, sgfh_tp: null, qtcl_qty: null, qtcl_tp: null, sjcl_qty: null, sjcl_tp: null,
+                        quantity: null, unit_price: null, total_price: null, deal_qty: null, deal_tp: null
+                    },
                     { where: {tender_id: tenderId, ledger_id: selectData.ledger_id} });
             }
             await this.transaction.commit();

+ 1 - 1
app/base/base_tree_service.js

@@ -635,7 +635,7 @@ class TreeService extends Service {
      * 节点成为父项时,可能需要修改父项数据,供子类继承
      * @param data
      */
-    clearParentingData(data) {
+    clearParentingData (data) {
     }
 
     /**

+ 2 - 2
app/controller/profile_controller.js

@@ -105,11 +105,11 @@ module.exports = app => {
                     throw '修改密码失败';
                 }
                 this.setMessage('修改密码成功', this.messageType.SUCCESS);
+                ctx.redirect('/logout');
             } catch (error) {
                 this.setMessage(error.toString(), this.messageType.ERROR);
+                ctx.redirect(ctx.request.header.referer);
             }
-
-            ctx.redirect(ctx.request.header.referer);
         }
 
         /**

+ 35 - 29
app/lib/stage_im.js

@@ -263,12 +263,12 @@ class StageIm {
             const memo = [];
             for (const [i, b] of im.gclBills.entries()) {
                 if (b.pos && b.pos.length > 0) {
-                    memo.push('清单' + (i+1) + b.b_code + ' ' + b.name);
+                    memo.push('清单' + (i+1) + ':' + b.b_code + ' ' + b.name);
                     for (const p of b.pos) {
                         memo.push(p.name + ':' + p.jl + ' ' + b.unit);
                     }
                 } else {
-                    memo.push('清单' + (i+1) + b.b_code + ' ' + b.name + ':' + b.jl + ' ' + b.unit);
+                    memo.push('清单' + (i+1) + ':' + b.b_code + ' ' + b.name + ':' + b.jl + ' ' + b.unit);
                 }
             }
             im.calc_memo = memo.join('\n');
@@ -303,37 +303,43 @@ class StageIm {
             lp.qc_jl = this.ctx.helper.add(lp.qc_jl, p.qc_qty);
         }
     }
+    _recursiveGenerateTzGclBills(node, im) {
+        for (const p of node.children) {
+            if (p.children && p.children.length > 0) {
+                this._recursiveGenerateTzGclBills(p, im);
+            } else {
+                if ((!p.b_code || p.b_code === '') || (p.children && p.children.length > 0)) {
+                    continue;
+                }
+                if ((!p.contract_tp || p.contract_tp === 0) && (!p.qc_tp || p.qc_tp === 0)) {
+                    continue;
+                }
+                let b = this._.find(im.gclBills, {bid: p.id});
+                if (!b) {
+                    b = {imid: im.id, bid: p.id, b_code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price};
+                    im.gclBills.push(b);
+                    this.ImBillsData.push(b);
+                }
+                b.jl = this.ctx.helper.add(b.jl, p.gather_qty);
+                b.contract_jl = this.ctx.helper.add(b.contract_jl, p.contract_qty);
+                b.qc_jl = this.ctx.helper.add(b.qc_jl, p.qc_qty);
+
+                b.pre_jl = this.ctx.helper.add(b.pre_jl, p.pre_gather_qty);
+                b.pre_contract_jl = this.ctx.helper.add(b.pre_contract_jl, p.pre_contract_qty);
+                b.pre_qc_jl = this.ctx.helper.add(b.pre_qc_jl, p.pre_qc_qty);
+
+                b.end_jl = this.ctx.helper.add(b.end_jl, p.end_gather_qty);
+                b.end_contract_jl = this.ctx.helper.add(b.end_contract_jl, p.end_contract_qty);
+                b.end_qc_jl = this.ctx.helper.add(b.end_qc_jl, p.end_qc_qty);
+                this._generateTzPosData(p, b);
+            }
+        }
+    }
     _generateTzGclBillsData(node, im) {
         if (!im.gclBills) {
             im.gclBills = [];
         }
-        const posterity = this.billsTree.getPosterity(node);
-        for (const p of posterity) {
-            if ((!p.b_code || p.b_code === '') || (p.children && p.children.length > 0)) {
-                continue;
-            }
-            if ((!p.contract_tp || p.contract_tp === 0) && (!p.qc_tp || p.qc_tp === 0)) {
-                continue;
-            }
-            let b = this._.find(im.gclBills, {bid: p.id});
-            if (!b) {
-                b = {imid: im.id, bid: p.id, b_code: p.b_code, name: p.name, unit: p.unit, unit_price: p.unit_price};
-                im.gclBills.push(b);
-                this.ImBillsData.push(b);
-            }
-            b.jl = this.ctx.helper.add(b.jl, p.gather_qty);
-            b.contract_jl = this.ctx.helper.add(b.contract_jl, p.contract_qty);
-            b.qc_jl = this.ctx.helper.add(b.qc_jl, p.qc_qty);
-
-            b.pre_jl = this.ctx.helper.add(b.pre_jl, p.pre_gather_qty);
-            b.pre_contract_jl = this.ctx.helper.add(b.pre_contract_jl, p.pre_contract_qty);
-            b.pre_qc_jl = this.ctx.helper.add(b.pre_qc_jl, p.pre_qc_qty);
-
-            b.end_jl = this.ctx.helper.add(b.end_jl, p.end_gather_qty);
-            b.end_contract_jl = this.ctx.helper.add(b.end_contract_jl, p.end_contract_qty);
-            b.end_qc_jl = this.ctx.helper.add(b.end_qc_jl, p.end_qc_qty);
-            this._generateTzPosData(p, b);
-        }
+        this._recursiveGenerateTzGclBills(node, im);
     }
     _generateTzChangeData(node, im) {
         if (!im.changes) {

BIN
app/public/files/template/ledger/导入分项清单EXCEL格式.xls


+ 1 - 1
app/public/js/ledger.js

@@ -98,7 +98,7 @@ $(document).ready(function() {
                 const data = SpreadJsObj.getSelectObject(sheet);
                 if (data) {
                     $('#bills-expr').val(data[col.field]).attr('field', col.field).attr('org', data[col.field])
-                        .attr('readOnly', readOnly || cell.locked());
+                        .attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0));
                 } else {
                     $('#bills-expr').val('').attr('readOnly', true);
                 }

+ 3 - 3
app/public/js/revise_history.js

@@ -15,9 +15,9 @@ $(document).ready(() => {
     const billsSpread = SpreadJsObj.createNewSpread($('#bills-spread')[0]);
     const billsSheet = billsSpread.getActiveSheet();
     SpreadJsObj.initSheet(billsSheet, billsSpreadSetting);
-    const posSpread = isTz ? SpreadJsObj.createNewSpread($('#pos-spread')[0]) : null;
-    const posSheet = isTz ? posSpread.getActiveSheet() : null;
-    if (isTz) SpreadJsObj.initSheet(posSheet, posSpreadSetting);
+    const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
+    const posSheet = posSpread.getActiveSheet();
+    SpreadJsObj.initSheet(posSheet, posSpreadSetting);
 
     const posSearch = isTz ? $.posSearch({selector: '#pos-search', searchSpread: posSpread}) : null;
 

+ 26 - 20
app/public/js/stage_im.js

@@ -272,12 +272,12 @@ const stageIm = (function () {
             const memo = [];
             for (const [i, b] of im.gclBills.entries()) {
                 if (b.pos && b.pos.length > 0) {
-                    memo.push('清单' + (i+1) + b.b_code + ' ' + b.name);
+                    memo.push('清单' + (i+1) + ':' + b.b_code + ' ' + b.name);
                     for (const p of b.pos) {
                         memo.push(p.name + ':' + p.jl + ' ' + b.unit);
                     }
                 } else {
-                    memo.push('清单' + (i+1) + b.b_code + ' ' + b.name + ':' + b.jl + ' ' + b.unit);
+                    memo.push('清单' + (i+1) + ':' + b.b_code + ' ' + b.name + ':' + b.jl + ' ' + b.unit);
                 }
             }
             im.calc_memo = memo.join('\n');
@@ -337,28 +337,34 @@ const stageIm = (function () {
             lp.qc_jl = ZhCalc.add(lp.qc_jl, p.qc_qty);
         }
     }
+    function recursiveGenerateTzGclBills(node, im) {
+        for (const p of node.children) {
+            if (p.children && p.children.length > 0) {
+                recursiveGenerateTzGclBills(p, im)
+            } else {
+                if ((!p.b_code || p.b_code === '') || (p.children && p.children.length > 0)) {
+                    continue;
+                }
+                if ((!p.contract_tp || p.contract_tp === 0) && (!p.qc_tp || p.qc_tp === 0)) {
+                    continue;
+                }
+                let b = _.find(im.gclBills, {bid: p.id});
+                if (!b) {
+                    b = {bid: p.id, b_code: p.b_code, name: p.name, unit: p.unit};
+                    im.gclBills.push(b);
+                }
+                b.jl = ZhCalc.add(b.jl, p.gather_qty);
+                b.contract_jl = ZhCalc.add(b.contract_jl, p.contract_qty);
+                b.qc_jl = ZhCalc.add(b.qc_jl, p.qc_qty);
+                generateTzPosData(p, b);
+            }
+        }
+    }
     function generateTzGclBillsData(node, im) {
         if (!im.gclBills) {
             im.gclBills = [];
         }
-        const posterity = gsTree.getPosterity(node);
-        for (const p of posterity) {
-            if (p.children && p.children.length > 0) {
-                continue;
-            }
-            if ((!p.contract_tp || p.contract_tp === 0) && (!p.qc_tp || p.qc_tp === 0)) {
-                continue;
-            }
-            let b = _.find(im.gclBills, {bid: p.id});
-            if (!b) {
-                b = {bid: p.id, b_code: p.b_code, name: p.name, unit: p.unit};
-                im.gclBills.push(b);
-            }
-            b.jl = ZhCalc.add(b.jl, p.gather_qty);
-            b.contract_jl = ZhCalc.add(b.contract_jl, p.contract_qty);
-            b.qc_jl = ZhCalc.add(b.qc_jl, p.qc_qty);
-            generateTzPosData(p, b);
-        }
+        recursiveGenerateTzGclBills(node, im);
     }
     function generateTzChangeData(node, im) {
         if (!im.changes) {

+ 6 - 1
app/service/project_account.js

@@ -363,7 +363,12 @@ module.exports = app => {
             }
             data.id = parseInt(id);
             const operate = await this.db.update(this.tableName, data);
-            return operate.affectedRows > 0;
+            const result = operate.affectedRows > 0;
+            if (result) {
+                // 存入session
+                this.ctx.session.sessionUser.name = data.name;
+            }
+            return result;
         }
 
 

+ 2 - 2
app/service/report_memory.js

@@ -190,11 +190,11 @@ module.exports = app => {
             await this._checkStage(sid);
             const cache = await this._getReportMemoryCache('mem_stage_im_tz', tid, sid, this.ctx.stage.cacheTime);
             if (cache) {
-                console.log('cache');
+                // console.log('cache');
                 return cache;
             }
 
-            console.log('build');
+            // console.log('build');
             if (!this.stageImData) {
                 this.stageImData = {};
                 try {

+ 0 - 2
app/service/tender_info.js

@@ -83,13 +83,11 @@ module.exports = app => {
          * @returns {Promise<void>}
          */
         async saveTenderInfo(tenderId, data) {
-            console.log(data);
             for (const di in data) {
                 if (parseInfo.indexOf(di) >= 0 || arrayInfo.indexOf(di) >= 0) {
                     data[di] = JSON.stringify(data[di]);
                 }
             }
-            console.log(data);
             await this.db.update(this.tableName, data, {where: {tid: tenderId}});
         }
 

+ 1 - 1
app/view/layout/menu.ejs

@@ -19,7 +19,7 @@
         <ul class="nav nav-pills nav-stacked bg-nav">
             <li <% if (ctx.controllerName === 'setting') { %>class="active"<% } %>><a href="/setting/info" data-toggle="tooltip" data-placement="right" title="" data-original-title="项目信息"><i class="fa fa-cogs"></i><span>项目信息</span></a></li>
         </ul>
-        <div class="dropright mb-1 ml-1">
+        <div class="dropup mb-1 ml-1">
             <a href="" class="btn btn-sm btn-light" data-toggle="dropdown" aria-haspopup="false" aria-expanded="false">
                 <%- ctx.session.sessionUser.name.substr(ctx.session.sessionUser.name.length > 2 ? ctx.session.sessionUser.name.length - 2 : 0) %>
             </a>

+ 1 - 1
app/view/ledger/explode.ejs

@@ -65,7 +65,7 @@
         <div class="row w-100 sub-content">
             <!--左栏-->
             <div class="c-body" id="left-view" style="width: 100%">
-                <div id="ledger-spread" class="<% if (tender.measure_type === measureType.tz.value) { %>sjs-height-1<% } else { %>sjs-height-0<% } %>"></div>
+                <div id="ledger-spread" class="sjs-height-1"></div>
                 <% if (tender.measure_type === measureType.tz.value) { %>
                 <div class="bcontent-wrap" id="main-bottom">
                     <div id="main-resize" class="resize-y" id="top-spr" r-Type="height" div1=".sjs-height-1" div2=".bcontent-wrap" title="调整大小"><!--调整上下高度条--></div>

+ 2 - 1
app/view/login/login.ejs

@@ -72,9 +72,10 @@
 $(document).ready(function() {
     const lSPName = getLocalCache('project_name');
     const lSPCode = getLocalCache('project_code');
-    if (lSPName !== undefined) {
+    if (lSPName !== null) {
         $('#project_name').text(lSPName);
         $('#project').val(lSPCode);
+        $('#account').focus();
     }
     $("#login-tab a[data-toggle='tab']").on('shown.bs.tab', function () {
         let type = $(this).data('type');

+ 0 - 2
app/view/revise/history.ejs

@@ -103,10 +103,8 @@
     </div>
 </div>
 <script>
-    <% if (ctx.tender.data.measure_type === measureType.tz.value) { %>
     const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');
     const posData = JSON.parse('<%- JSON.stringify(revisePos) %>');
-    <% } %>
     const readOnly = <%- readOnly %>;
     const isTz = <%- ctx.tender.data.measure_type === measureType.tz.value %>;
     const billsSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');

+ 1 - 2
app/view/revise/info.ejs

@@ -186,9 +186,8 @@
 <script>
     const readOnly = <%- readOnly %>;
     const isTz = <%- ctx.tender.data.measure_type === measureType.tz.value %>;
-    //const info = JSON.parse(<%- JSON.stringify(ctx.tender.info) %>);
+    const posData = JSON.parse('<%- JSON.stringify(revisePos) %>');
     const billsSpreadSetting = JSON.parse('<%- JSON.stringify(ledgerSpread) %>');
     const posSpreadSetting = JSON.parse('<%- JSON.stringify(posSpread) %>');
     const billsData = JSON.parse('<%- JSON.stringify(reviseBills) %>');
-    const posData = JSON.parse('<%- JSON.stringify(revisePos) %>');
 </script>

+ 2 - 2
app/view/setting/user.ejs

@@ -43,9 +43,9 @@
                                     <td class="text-center"><a href="#edit-user" data-account="<%= JSON.stringify(account) %>" data-toggle="modal" data-target="#edit-user" class="btn btn-sm btn-outline-primary">编辑</a>
                                         <% if (account.is_admin !== 1) { %>
                                             <% if (account.enable !== 1) { %>
-                                                <a href="" class="btn btn-sm btn-outline-success account-switch-btn" data-account="<%= account.id %>">启用</a>
+                                                <!--<a href="" class="btn btn-sm btn-outline-success account-switch-btn" data-account="<%= account.id %>">启用</a>-->
                                             <% } else { %>
-                                                <a href="" class="btn btn-sm btn-outline-danger account-switch-btn" data-account="<%= account.id %>">停用</a>
+                                                <!--<a href="" class="btn btn-sm btn-outline-danger account-switch-btn" data-account="<%= account.id %>">停用</a>-->
                                             <% } %>
                                         <% } %>
                                     </td>

+ 6 - 4
app/view/tender/detail.ejs

@@ -154,14 +154,14 @@
             text: '标段期进度'
         },
         tooltip : {
-            trigger: 'axis'
+            trigger: 'axis',
         },
         calculable : true,
         legend: {
             data:['本期合同计量','本期数量变更计量','截至上期累计完成','本期完成计量','完成度']
         },
         dataZoom: [
-            {show: true,start: 0, end: 100}
+            {show: true, start: 0, end: 100}
         ],
         xAxis : [
             {
@@ -182,7 +182,8 @@
                 axisLabel : {
                     formatter: '{value} 元'
                 },
-                splitArea : {show : true}
+                splitArea : {show : true},
+                splitLine : {show : true},
             },
             {
                 type : 'value',
@@ -191,7 +192,8 @@
                     formatter: '{value} %'
                 },
                 position: 'right',
-                splitArea : {show : true}
+                splitArea : {show : false},
+                splitLine : {show : false},
             }
         ],
         series : [

+ 4 - 4
app/view/tender/detail_modal.ejs

@@ -603,7 +603,7 @@
         $('#supervision2-date').val(property.construction_unit.supervision2.date);
 
         // 技术参数
-        $('#loadLevel').val(property.tech_param.loadLevel);
+        $('#load-level').find("option:contains('" + property.tech_param.loadLevel + "')").attr("selected",true);;
         $('#length').val(property.tech_param.loadLength);
         $('#start-peg').val(property.tech_param.startPeg);
         $('#end-peg').val(property.tech_param.endPeg);
@@ -650,7 +650,7 @@
                 },
             },
             tech_param: {
-                loadLevel: _.toNumber($('#loadLevel').val()),
+                loadLevel: $('#load-level').find("option:selected").text(),
                 loadLength: _.toNumber($('#length').val()),
                 startPeg: $('#start-peg').val(),
                 endPeg: $('#end-peg').val(),
@@ -951,7 +951,7 @@
                 toastr.warning('请输入不超过万亿的数字');
                 info.sheet.setText(info.row, info.col, '0');
             }
-            if (info.row === 1 || info.row === 2) {
+            if (info.row === 0 || info.row === 1) {
                 calcHtjMinusZlj();
             }
         });
@@ -1026,7 +1026,7 @@
         const tenderId = window.location.pathname.split('/')[2];
         postData('/tender/' + tenderId + '/save', prop, function (data) {
             property.deal_param = data.deal_param;
-            $('bd-set-4').modal('hide');
+            $('#bd-set-4').modal('hide');
         });
     }
 

+ 5 - 5
app/view/tender/tender_sub_menu.ejs

@@ -33,11 +33,11 @@
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/change') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/change"><i class="fa fa-retweet"></i> <span>工程变更</span></a></li>
             </ul>
         </div>
-        <div class="nav-box">
-            <ul class="nav-list list-unstyled">
-                <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/material') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/measure/material"><i class="fa fa-line-chart"></i> <span>材料调差</span></a></li>
-            </ul>
-        </div>
+        <!--<div class="nav-box">-->
+            <!--<ul class="nav-list list-unstyled">-->
+                <!--<li <% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/material') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/measure/material"><i class="fa fa-line-chart"></i> <span>材料调差</span></a></li>-->
+            <!--</ul>-->
+        <!--</div>-->
         <div class="nav-box">
             <ul class="nav-list list-unstyled">
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/report') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/report"><i class="fa fa-file-text-o"></i> <span>报表</span></a></li>

+ 5 - 5
app/view/tender/tender_sub_mini_menu.ejs

@@ -33,11 +33,11 @@
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/change') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/change"><i class="fa fa-retweet"></i> <span>工程变更</span></a></li>
             </ul>
         </div>
-        <div class="nav-box">
-            <ul class="nav-list list-unstyled">
-                <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/material') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/measure/material"><i class="fa fa-line-chart"></i> <span>材料调差</span></a></li>
-            </ul>
-        </div>
+        <!--<div class="nav-box">-->
+            <!--<ul class="nav-list list-unstyled">-->
+                <!--<li <% if (ctx.url === '/tender/' + ctx.tender.id + '/measure/material') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/measure/material"><i class="fa fa-line-chart"></i> <span>材料调差</span></a></li>-->
+            <!--</ul>-->
+        <!--</div>-->
         <div class="nav-box">
             <ul class="nav-list list-unstyled">
                 <li <% if (ctx.url === '/tender/' + ctx.tender.id + '/report') { %>class="active"<% } %>><a href="/tender/<%- ctx.tender.id %>/report"><i class="fa fa-file-text-o"></i> <span>报表</span></a></li>

+ 8 - 8
config/menu.js

@@ -25,14 +25,14 @@ const menu = {
         children: null,
         caption: '项目',
     },
-    sum: {
-        name: '总分包',
-        icon: 'fa-sitemap',
-        display: true,
-        url: '/sum',
-        children: null,
-        caption: '总分包',
-    },
+    // sum: {
+    //     name: '总分包',
+    //     icon: 'fa-sitemap',
+    //     display: true,
+    //     url: '/sum',
+    //     children: null,
+    //     caption: '总分包',
+    // },
 };
 
 const tenderMenu = {