浏览代码

Merge branch 'master' of http://192.168.1.12:3000/SmartCost/ConstructionCost

TonyKang 7 年之前
父节点
当前提交
71983286bb

+ 5 - 6
public/web/gljUtil.js

@@ -14,7 +14,6 @@ let gljUtil = {
         let quantityMap={};
         let rationGljGroup = _.groupBy(rationGLJDatas,'projectGLJID');
         let IDarray =  this.getSubdivisionAndTechBillsLeavesID(billsDatas);//分别取分部分项和技术措施项目的所有叶子清单ID
-        console.log(IDarray);
         let billIDs = IDarray[0],tech_billIDS = IDarray[1];
         for(let pglj of project_gljs ){
             let pg_index = this.getIndex(pglj,this.gljKeyArray);
@@ -87,9 +86,9 @@ let gljUtil = {
         return result;
     },
     getSubdivisionAndTechBillsLeavesID:function (billsDatas) {//分别取分部分项和技术措施项目的所有叶子清单ID
-        // if(projectObj){//存在,说明在前端调用
-        //     return [projectObj.project.Bills.getSubdivisionProjectLeavesID(),projectObj.project.Bills.getTechLeavesID()];
-        // }
+         if(typeof (projectObj) !== 'undefined'){//存在,说明在前端调用
+             return [projectObj.project.Bills.getSubdivisionProjectLeavesID(),projectObj.project.Bills.getTechLeavesID()];
+         }
         let parentMap ={};
         let subdivisionBillID  = null,techBillID = null,sIDs = [],tIDS = [];
         for(let b of billsDatas){
@@ -98,7 +97,7 @@ let gljUtil = {
             }else {
                 parentMap[b.ParentID]= [b];
             }
-            let flag = this.getFalg(b);
+            let flag = this.getFlag(b);
             if(this.isDef(flag)&&flag.flag == this.fixedFlag.SUB_ENGINERRING){
                 subdivisionBillID = b.ID;
             }
@@ -124,7 +123,7 @@ let gljUtil = {
             }
         }
     },
-    getFalg:function (b) {
+    getFlag:function (b) {
         return _.find(b.flags,{"fieldName":"fixed"});
 
     },

+ 3 - 0
public/web/scMathUtil.js

@@ -205,6 +205,9 @@ let scMathUtil = {
             value = null;
         }
         return value;
+    },
+    isDef:function (v) {
+        return v !== undefined && v !== null;
     }
 };
 

+ 28 - 0
web/building_saas/main/html/main.html

@@ -92,6 +92,9 @@
                   <div class="side-tabs">
                       <ul class="nav nav-tabs" role="tablist">
                           <li class="nav-item">
+                              <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单指引</a>
+                          </li>
+                          <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsTab' relaPanel="#qd">清单规则</a>
                           </li>
                           <li class="nav-item">
@@ -248,6 +251,31 @@
                       <div class="main-side" style="display: inline-block">
                           <div class="resize" id="sideResize" style="width: 1%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
                           <div class="tab-content" style="width: 99%; height: 100%; float: left">
+                              <!--清单指引-->
+                              <div class="tab-pane" id="zy">
+                                  <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
+                                      <div class="p-1 d-flex justify-content-center">
+                                          <select class="form-control form-control-sm" id="stdBillsGuidanceLibSelect">
+                                          </select>
+                                          <div class="input-group" id="stdBillsGuidanceSearch">
+                                              <input type="text" class="form-control form-control-sm" placeholder="搜索清单">
+                                              <span class="input-group-btn">
+                                                  <button class="btn btn-secondary btn-sm" type="button"><i class="fa fa-search" aria-hidden="true"></i></button>
+                                              </span>
+                                          </div>
+                                          <button class="btn btn-primary btn-sm mx-3" type="button">插入定额</button>
+                                          <button class="btn btn-primary btn-sm mx-3" type="button">插入清单</button>
+                                      </div>
+                                  </div>
+                                  <div class="main-data-side-z">
+                                      <table class="table table-bordered">
+                                          <tr>
+                                              <th></th><th>项目指引</th><th>选择</th>
+                                          </tr>
+                                          </tr>
+                                      </table>
+                                  </div>
+                              </div>
                               <!--清单规则-->
                               <div class="tab-pane" id="qd">
                                   <div class="tools-bar-height-q container-fluid">

+ 6 - 6
web/building_saas/main/html/tender_price.html

@@ -1,11 +1,11 @@
 <div class="toolsbar px-1">
     <div class="btn-toolbar py-1">
-
-        <select class="form-control mr-2" style="width: auto; font-size: .875rem" id="calcPriceOption">
-            <option value="coeBase">根据调整系数计算报价</option>
-            <option value="priceBase" >根据报价计算调整系数</option>
-        </select>
-
+        <div class="input-group input-group-sm mr-2">
+            <select class="form-control form-control-sm" style="width: auto; font-size: .875rem" id="calcPriceOption">
+                <option value="coeBase">根据调整系数计算报价</option>
+                <option value="priceBase" >根据报价计算调整系数</option>
+            </select>
+        </div>
         <div class="input-group input-group-sm mr-2" style="width:240px">
             <div class="input-group-prepend">
                 <span class="input-group-text" id="inputGroup-sizing-sm">工料机单价调整系数</span>

+ 2 - 0
web/building_saas/main/js/main.js

@@ -184,6 +184,8 @@ function loadSize(eles, type, callback) {
 
 function getResizeWidthPercent(nearSize, farSize){
     const resizeWidth = 6;
+    nearSize = parseFloat(nearSize);
+    farSize = parseFloat(farSize);
     let nearPercent = (nearSize / (resizeWidth + nearSize + farSize) * 100) + '%';
     let farPercent = (farSize / (resizeWidth + nearSize + farSize) * 100) + '%';
     return {nearPercent, farPercent};

+ 5 - 4
web/building_saas/main/js/views/project_view.js

@@ -1100,11 +1100,12 @@ var projectObj = {
     },
 
     //根据节点获取行style(颜色、字体加粗)
-    getNodeColorStyle: function (sheet, node, colSetting = null) {
+    getNodeColorStyle: function (sheet, node, tree) {
         let colorSetting = optionsOprObj.getOption(optionsOprObj.optionsTypes.COLOROPTS);
         let mapping = {DEFAULT: 'DEFAULT', SELECTED: 'SELECTED', DXFY: 'DXFY', FB: 'FB', UNLEAFBILL: 'UNLEAFBILL',
             FX: 'FX', BX: 'BX', UNCBBILL: 'UNCBBILL', CBBILL: 'CBBILL', ZCSB: 'ZCSB'};
         let styleMap = null;
+        tree?'':tree =  this.project.mainTree;
         //中文字段名,由于同一节点中,中文字体大小和数字字体大小不同
         if(colorSetting == null){
             return null;
@@ -1187,7 +1188,7 @@ var projectObj = {
             }*/
         }
         //选中行-替换底色
-        if(node === this.project.mainTree.selected){
+        if(node === tree.selected){
              style.backColor = colorSetting[mapping.SELECTED]['backColor'];
         }
         style.borderLeft = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
@@ -1225,12 +1226,12 @@ var projectObj = {
         return style;
     },
    //设置节点style
-    setNodesStyle: function (sheet, nodes) {
+    setNodesStyle: function (sheet, nodes,tree) {
         let me = this;
         TREE_SHEET_HELPER.massOperationSheet(sheet, function () {
             for(let node of nodes){
                 if(node && node.serialNo()!= -1){
-                    sheet.getRange(node.serialNo(), -1, 1, -1).backColor(me.getNodeColorStyle(sheet, node).backColor);
+                    sheet.getRange(node.serialNo(), -1, 1, -1).backColor(me.getNodeColorStyle(sheet, node,tree).backColor);
                 }
             }
         });

+ 9 - 0
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -0,0 +1,9 @@
+'use strict';
+
+/**
+ *
+ *
+ * @author Zhong
+ * @date 2018/6/11
+ * @version
+ */

+ 73 - 6
web/building_saas/main/js/views/tender_price_view.js

@@ -51,7 +51,7 @@ let tender_obj={
         this.tenderController = TREE_SHEET_CONTROLLER.createNew(this.tenderTree, this.tenderSheet, this.tenderTreeSetting);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onSheetValueChange);
         this.tenderSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onEditStarting);
-
+        this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.treeSelectedChanged);
        // this.tenderController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.onSelectionChange);
     },
     createTenderTreeSetting:function () {
@@ -104,6 +104,9 @@ let tender_obj={
             }else if(value == false){
                 value = 0;
             }
+            if(value == 1){
+                updateData = me.cleanTenderCoe(updateData,node);//打勾不调价后清空消耗量调整系数
+            }
             me.updateChildrenValue(node,dataCode,value,datas,nodes);
         }
         if(updateData&&dataCode.indexOf("Coe") != -1 ){//如果是调整系统项,级联更新子项
@@ -134,15 +137,53 @@ let tender_obj={
     updateChildrenValue:function (node,dataCode,value,datas,nodes) {
          if(node.children.length > 0){
             for(let c of node.children){
+                this.updateChildrenValue(c,dataCode,value,datas,nodes);
                 let updateData = {type:c.sourceType,data:{'ID' : c.data.ID}};
                 updateData.data[dataCode] = value;
+                if(dataCode == 'is_adjust_price' && value == 1){
+                    updateData = this.cleanTenderCoe(updateData,c);
+                }else if(dataCode.indexOf("Coe")!= -1 && c.data.is_adjust_price == 1){//更新调整系数时忽略不调价的行
+                    continue;
+                }
                 datas.push(updateData);
                 nodes.push(c);
-                this.updateChildrenValue(c,dataCode,value,datas,nodes);
             }
          }
 
     },
+    cleanTenderCoe:function (updateData,node) {//清空调整系数
+        scMathUtil.isDef(node.data.rationQuantityCoe)?updateData.data["rationQuantityCoe"] = null:'';
+        if(scMathUtil.isDef(node.data.quantityCoe)){
+            scMathUtil.isDef(node.data.quantityCoe.labour)?updateData.data["quantityCoe.labour"] = null:'';
+            scMathUtil.isDef(node.data.quantityCoe.material)?updateData.data["quantityCoe.material"] = null:'';
+            scMathUtil.isDef(node.data.quantityCoe.machine)?updateData.data["quantityCoe.machine"] = null:'';
+            scMathUtil.isDef(node.data.quantityCoe.main)?updateData.data["quantityCoe.main"] = null:'';
+            scMathUtil.isDef(node.data.quantityCoe.equipment)?updateData.data["quantityCoe.equipment"] = null:'';
+        }
+        return updateData;
+    },
+    cleanTargetPrice:function (updateData,node) {//清空目标报价
+        scMathUtil.isDef(node.data.targetUnitFee)?updateData.data["targetUnitFee"] = null:'';
+        scMathUtil.isDef(node.data.targetTotalFee)?updateData.data["targetTotalFee"] = null:'';
+        return updateData;
+    },
+    calcOptionsChecking:function (option) {//调整选项检查,返回需要更新的数组
+        let datas = [];
+        let me = tender_obj;
+        for(let node of me.tenderTree.items){
+            let tem_updateData = {type:node.sourceType,data:{}};
+            if(option == 'coeBase') { //当值为“根据调整系数计算报价”时,清空目标报价。
+                me.cleanTargetPrice(tem_updateData,node);
+            }else if(option == 'priceBase'){//当值为“根据报价计算调整系数”时,清空调整系数。
+                me.cleanTenderCoe(tem_updateData,node);
+            }
+            if(!_.isEmpty(tem_updateData.data)){//如果需要更新
+                tem_updateData.data.ID = node.data.ID;
+                datas.push(tem_updateData);
+            }
+        }
+        return datas;
+    },
 
     updateTenderData:function (datas,callback) {
         let me = tender_obj;
@@ -173,8 +214,20 @@ let tender_obj={
             $.bootstrapLoading.end();
         })
     },
-
-
+    treeSelectedChanged:function (node) {
+        let me = tender_obj;
+        //设置选中行底色和恢复前选中行底色
+        let refreshNodes = [node];
+        if(!me.tenderTree.preSelected){
+            refreshNodes.push(me.tenderTree.items[0]);
+        }
+        else {
+            refreshNodes.push(me.tenderTree.preSelected);
+        }
+        me.tenderTree.preSelected = node;
+        projectObj.setNodesStyle(me.tenderSheet, refreshNodes,me.tenderTree);
+        //console.log(node);
+    },
     onEditStarting:function (sender,args) {
         let me = tender_obj, row = args.row, col = args.col;
         if(me.editChecking(row,col) == false){
@@ -245,14 +298,28 @@ $(function () {
     });
 
     $('#tenderGLJQuantity').bind('click',function () {
-        console.log($('#gljPriceTenderCoe').val()) ;
+        //console.log($('#gljPriceTenderCoe').val()) ;
+    });
+
+    $('#cleanTender').bind('click',function () {
+       console.log("clean tender")
     });
 
     $('#calcPriceOption').change(function(){
         let me = tender_obj;
         let newVal = $(this).val();
+        let datas = me.calcOptionsChecking(newVal);
         let updateData = {type:ModuleNames.project,data:{'ID' : projectObj.project.ID(),'property.tenderSetting.calcPriceOption':newVal}};
-        me.updateTenderData([updateData],function () {
+        datas.push(updateData);
+        me.updateTenderData(datas,function () {
+            let nodes = [];
+            for(let d of datas){
+                if(d.type == ModuleNames.bills || d.type == ModuleNames.ration){
+                    let node = me.tenderTree.getNodeByID(d.data.ID);
+                    node?nodes.push(node):'';
+                }
+            }
+            me.tenderController.refreshTreeNode(nodes);
             me.initPageContent();
         });
     });