浏览代码

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

chenshilong 7 年之前
父节点
当前提交
cade94dd9f

+ 4 - 1
public/web/tree_sheet/tree_sheet_helper.js

@@ -110,7 +110,10 @@ var TREE_SHEET_HELPER = {
             //test
             setting.cols.forEach(function (colSetting, iCol) {
                 var cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
-
+                let boldFontStyle = projectObj.getBoldFontStyle(node, colSetting);
+                if(boldFontStyle){
+                    sheet.setStyle(iRow, iCol, boldFontStyle);
+                }
                 // var getFieldText = function () {
                 //     var fields = colSetting.data.field.split('.');
                 //     var validField = fields.reduce(function (field1, field2) {

+ 15 - 11
web/building_saas/glj/js/project_glj.js

@@ -27,9 +27,7 @@ let otherFileData = {};
 let currentTag = '';
 let isChanging = false;
 let initPage = false;
-let projectGLJView={
-    currentTag:''
-}
+
 
 $(document).ready(function () {
     $('#tab_gongliaoji').on('show.bs.tab', function (e) {
@@ -264,6 +262,9 @@ function init() {
  * @return {void}
  */
 function spreadInit() {
+    if(projectGLJSheet&&projectGLJSpread){
+        projectGLJSheet.spread.destroy();
+    }
     projectGLJSpread = new ProjectGLJSpread();
     projectGLJSpread.successCallback = successTrigger;
     projectGLJSheet = projectGLJSpread.init();
@@ -364,7 +365,7 @@ function successTrigger(field, info,id) {
 
 //更新是否暂估
 function changeIsEvaluate (id){
-    let projectGLJ = projectObj.project.projectGLJ
+    let projectGLJ = projectObj.project.projectGLJ;
     let datas = projectGLJ.datas;
     let gljList = datas.gljList;
     let glj = _.find(gljList, {'id': id});
@@ -380,6 +381,13 @@ function changeIsEvaluate (id){
         let gljs = projectGLJ.getProjectGLJs(conditions,false);
         gljs.push(glj);
         let nodes = projectGLJ.getImpactRationNodes(gljs);//取到因为改变工料机价格而受影响的定额
+        //更新对应的工料机类型的定额
+        let ration =_.find(projectObj.project.Ration.datas,{'type':rationType.gljRation,'projectGLJID':glj.id});
+        if(ration){
+            ration.isEstimate =glj.is_evaluate?1:0;
+            let ration_node = projectObj.project.mainTree.getNodeByID(ration.ID);
+            ration_node?projectObj.mainController.refreshTreeNode([ration_node]):"";
+        }
         projectObj.project.calcProgram.calcRationsAndSave(nodes);//触发计算程序
     }
 }
@@ -413,13 +421,9 @@ function socketInit() {
 function filterProjectGLJ(jsonData) {
     if (jsonData.length > 0) {
         // 不显示消耗量为0的数据
-        let tmpData = [];
-        for (let data of jsonData) {
-            if (data.quantity !== 0 && data.quantity !== '0') {
-                tmpData.push(data);
-            }
-        }
-        jsonData = tmpData;
+        jsonData= _.filter(jsonData,function (item) {
+            return item.quantity !== 0 && item.quantity !== '0'
+        })
     }
     return jsonData;
 }

+ 1 - 1
web/building_saas/main/js/models/bills.js

@@ -575,7 +575,7 @@ var Bills = {
                     parentNodes.push(me.getEngineeringCostNode(controller));
                     includeRootNode=true
                 }else {
-                    parentNodes.push(m_node.parent);
+                    m_node.parent?parentNodes.push(m_node.parent):"";
                 }
                 updateNodes.push(m_node);
                 controller.tree.getAllSubNode(m_node,updateNodes);

+ 4 - 1
web/building_saas/main/js/models/cache_tree.js

@@ -440,7 +440,10 @@ var cacheTree = {
               this.getAllSubNode(c,nodeArray);
           }
         };
-        
+        Tree.prototype.getNodeByID = function (ID) {
+          let node = this.nodes[this.prefix+ID];
+          return node;
+        };
         return new Tree(owner);
     }
 };

+ 1 - 6
web/building_saas/main/js/models/calc_base.js

@@ -23,12 +23,7 @@ let cbTools = {
         return r;
     },
     findBill: function (fixedFlag) {
-        let bills = projectObj.project.Bills.datas;
-        for(let i = 0, len = bills.length; i < len; i++){
-            if(bills[i].flagsIndex && bills[i].flagsIndex.fixed && bills[i].flagsIndex.fixed.flag && bills[i].flagsIndex.fixed.flag === fixedFlag){
-                return bills[i];
-            }
-        }
+        return this.isDef(calcBase.fixedBills[fixedFlag]) ? calcBase.fixedBills[fixedFlag]['bill'] : null;
     },
     //通过行获取根节点清单
     getBillByRow: function (items, row) {

+ 6 - 2
web/building_saas/main/js/models/project_glj.js

@@ -140,11 +140,15 @@ ProjectGLJ.prototype.loadCacheData = function (resort) {
         return;
     }
     jsonData = data.gljList !== undefined && data.gljList.length > 0 ? data.gljList : [];
+    console.log("filter start");
     jsonData = filterProjectGLJ(jsonData);
+    console.log("filter end");
     jsonData = sortProjectGLJ(jsonData);
+    console.log("sort end");
     if(projectGLJSheet&&projectGLJSpread){
-        projectGLJSheet.setData(jsonData);
-        projectGLJSpread.specialColumn(jsonData);
+        setTimeout(spreadInit, 1);
+         /*projectGLJSheet.setData(jsonData);
+         projectGLJSpread.specialColumn(jsonData);*/
     }
 };
 

+ 8 - 8
web/building_saas/main/js/models/quantity_detail.js

@@ -511,7 +511,7 @@ var quantity_detail = {
         quantity_detail.prototype.autoTransformQuantity = function(value,node){//根据单位转换定额工程量
             let data = node.data;
             let option = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS,'rationQuanACToRationUnit');
-            if(option==true&&node.sourceType === project.Ration.getSourceType()&&data.unit) {//还需加入判读是否转换
+            if(node.data.quantityEXP=='GCLMXHJ'||(option==true&&node.sourceType === project.Ration.getSourceType()&&data.unit)) {//还需加入判读是否转换,如果是来自工程量明细的话,默认都进行转换
                 let times = parseInt(data.unit);
                 if (isNaN(times)) {
                     times = 1
@@ -531,7 +531,7 @@ var quantity_detail = {
             }
             return value
         };
-        quantity_detail.prototype.editMainTreeNodeQuantity=function (value,node,fieldName) {
+        quantity_detail.prototype.editMainTreeNodeQuantity=function (value,node,fieldName,editingText) {
             var me = this;
             if(isNaN(value)){
                 alert("当前输入的数据类型不正确,请重新输入。");
@@ -543,9 +543,9 @@ var quantity_detail = {
                         node.data.isFromDetail=0;
                         project.quantity_detail.cleanQuantityDetail(node,true);
                         if(node.sourceType === project.Bills.getSourceType()){
-                            me.updateBillQuantity(value,node);
+                            me.updateBillQuantity(value,node,null,editingText);
                         }else {
-                            me.updateRationQuantity(value,node);
+                            me.updateRationQuantity(value,node,null,editingText);
                         }
                     }else {
                         projectObj.mainController.refreshTreeNode([node]);
@@ -553,8 +553,8 @@ var quantity_detail = {
                 },100);
             }
         };
-        quantity_detail.prototype.updateBillQuantity=function (value,node,quantityEXP) {
-            node.data.quantityEXP = quantityEXP?quantityEXP:value;
+        quantity_detail.prototype.updateBillQuantity=function (value,node,quantityEXP,editingText) {
+            node.data.quantityEXP = quantityEXP?quantityEXP:editingText;
             value = scMathUtil.roundForObj(value,getDecimal("quantity",node));
             node.data.quantity = value+"";
             console.log(value);
@@ -596,8 +596,8 @@ var quantity_detail = {
                 projectObj.mainController.refreshTreeNode(gljNodes);
             }
         };
-        quantity_detail.prototype.updateRationQuantity=function(value,node,quantityEXP){
-            node.data.quantityEXP = quantityEXP?quantityEXP:value;
+        quantity_detail.prototype.updateRationQuantity=function(value,node,quantityEXP,editingText){
+            node.data.quantityEXP = quantityEXP?quantityEXP:editingText;
             value = scMathUtil.roundForObj(value,getDecimal("ration.quantity"));
             if(node.parent.data.quantity&&node.parent.data.quantity!=0&&node.parent.data.quantity!=""){
                 var billQuantity = scMathUtil.roundForObj(node.parent.data.quantity,getDecimal("quantity",node.parent));

+ 1 - 1
web/building_saas/main/js/models/ration_coe.js

@@ -86,7 +86,7 @@ var ration_coe = {
                     newCoe.isAdjust=0;
                     newCoe.coes = this.getCustomerCoeData();
                 }else {
-                    newCoe.coeID= data.rationCoeList[i];
+                    newCoe.coeID= data.rationCoeList[i].ID;
                 }
                 criteria.ration_coe_list.push(newCoe);
             }

+ 5 - 2
web/building_saas/main/js/views/glj_view.js

@@ -741,6 +741,7 @@ var gljOprObj = {
         this.sheetData = gljList;
         this.sheet.setRowCount(0);
         this.sheetData = sortRationGLJ(this.sheetData);
+        this.sheet.getRange(-1, 0, -1, 1).cellType(this.getTreeNodeCellType([]));
         sheetCommonObj.showData(this.sheet, this.setting, this.sheetData);
 
         this.sheet.getRange(-1, 0, -1, this.setting.header.length).locked(true);//锁住定额工料机的所有列
@@ -788,13 +789,14 @@ var gljOprObj = {
         this.sheet.getRange(-1, 0, -1, 1).cellType(this.getTreeNodeCellType(this.sheetData));
         for (var i = 0; i < this.sheetData.length; i++) {
             if (this.sheetData[i].hasOwnProperty('subList')) {
-                var collapsed = false;
+               /* var collapsed = false;
                 if (init) {
                     this.sheetData[i].collapsed = true;
                     collapsed = true;
                 } else {
                     collapsed = this.sheetData[i].collapsed == undefined ? true : this.sheetData[i].collapsed;
-                }
+                }*/
+                var collapsed = this.sheetData[i].collapsed == undefined ? true : this.sheetData[i].collapsed;
                 if (collapsed == true) {
                     this.sheet.getRange(i + 1, -1, this.sheetData[i].subList.length, -1).visible(false);
                 }
@@ -1290,6 +1292,7 @@ var gljOprObj = {
         $("#glj_tree_div").modal('hide');
         project.ration_glj.insertGLJAsRation(me.GLJSelection, selected, function (node) {
             project.projectGLJ.loadData(function () {
+                projectObj.mainController.refreshTreeNode([node]);
                 if(me.hasComposition(node.data,true)){
                     me.showMixRatio(node);
                 }else {

+ 40 - 28
web/building_saas/main/js/views/project_view.js

@@ -42,7 +42,7 @@ var projectObj = {
         };
         let selected = tree.selected, that = projectObj;
         let canUpLevel = function (node) {
-            if (selected && selected.depth() > 0 && selected.canUpLevel()) {
+            if (selected && selected.depth() > 1 && selected.canUpLevel()) {
                 if (selected.sourceType === that.project.Bills.getSourceType()) {
                     return (!selected.nextSibling) || (selected.children.length === 0) || (selected.source.children.length > 0);
                 } else {
@@ -251,7 +251,7 @@ var projectObj = {
             };*/
         }
     },
-    updateCellValue: function (node, value, colSetting) {
+    updateCellValue: function (node, value, colSetting,editingText) {
         let project = projectObj.project, fieldName = colSetting.data.field;
         if(node.sourceType==project.ration_glj.getSourceType()){
             project.ration_glj.updateFromMainSpread(value,node,fieldName);
@@ -269,7 +269,7 @@ var projectObj = {
             else if (fieldName === 'quantity' || fieldName === 'marketUnitFee' || fieldName === 'programID' ||
                 fieldName === 'subType' || fieldName === 'calcBase' || fieldName === 'feesIndex.common.unitFee'){
                 if (fieldName === 'quantity') {
-                    project.quantity_detail.editMainTreeNodeQuantity(value,node,fieldName);
+                    project.quantity_detail.editMainTreeNodeQuantity(value,node,fieldName,editingText);
                     return;
                 }
                 else if (fieldName === 'marketUnitFee' || fieldName === 'feesIndex.common.unitFee') {
@@ -352,7 +352,7 @@ var projectObj = {
         let fieldName = projectObj.mainController.setting.cols[info.col].data.field;
         // 检查输入类型等
         let value = projectObj.checkSpreadEditingText(info.editingText, colSetting);
-        projectObj.updateCellValue(node, value, colSetting);
+        projectObj.updateCellValue(node, value, colSetting,info.editingText);
 
         // 自动行高
         const autoHeight = project.property.displaySetting.autoHeight;
@@ -469,7 +469,6 @@ var projectObj = {
                 that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);
                 that.loadMainSpreadContextMenu();
                 that.loadFocusLocation();
-                that.setRootsStyle();
                 let endTime = +new Date();
                 console.log("加载完成-----"+endTime);
             }
@@ -803,29 +802,15 @@ var projectObj = {
             }, 200);
         };
  },
-    setRootsStyle: function  () {
-        let me = this;
-        let style = new GC.Spread.Sheets.Style();
-        // style.backColor = "#d5e8ee";
-        style.font = 'bold 15px Arial';
-        let count = me.project.mainTree.items.length;
-        for (var i = 0; i < count; i++) {
-            if (!me.project.mainTree.items[i].parent)
-                me.mainSpread.getActiveSheet().setStyle(i, -1, style, GC.Spread.Sheets.SheetArea.viewport);
-        }
-},
+
  //根据节点获取行style(颜色、字体加粗)
     getNodeColorStyle: function (node) {
-        let type, backColor = null, font = null;
+        let type, backColor = null, foreColor = null;
         if(!isDef(node)){
             return null;
         }
         //清单大类
         if(node.sourceType === this.project.Bills.getSourceType()){
-            //大项费用
-            if(node.data.type === billType.DXFY){
-                type = 0;
-            }
             //分部
             if(node.data.type === billType.FB){
                 type = 1;
@@ -855,18 +840,18 @@ var projectObj = {
             type = 4;
         }
         switch (type){
-            case 0: font = 'bold 15px "Arial"'; break;
+            //case 0: font = 'bold 13px "Arial"'; break;
             case 1: backColor = '#c1d3e3'; break;
             case 2: backColor = '#dae5ee'; break;
             case 3: backColor = '#e5f3f2';  break;
-            case 4: backColor = '#4DBCFB';   break;
+            case 4: foreColor = '#4D7BFF';   break;
         }
-        if(!font && !backColor){
+        if(!backColor && !foreColor){
             return null;
         }
         let style = new GC.Spread.Sheets.Style();
-        if(font){
-            style.font = 'bold 15px "Arial"';
+        if(foreColor){
+            style.foreColor = foreColor;
         }
         if(backColor){
             style.backColor = backColor;
@@ -875,8 +860,35 @@ var projectObj = {
             style.borderRight = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
             style.borderBottom = new GC.Spread.Sheets.LineBorder("#D4D4D4", GC.Spread.Sheets.LineStyle.thin);
         }
-        return style;    
-}
+        return style;
+    },
+    //大项费用则字体加粗,String 15px, Number 13px
+    getBoldFontStyle: function (node, colSetting) {
+        if(node.sourceType !== this.project.Bills.getSourceType() || node.data.type !== billType.DXFY){
+            return null;
+        }
+        let style = new GC.Spread.Sheets.Style();
+        //备注暂无字段
+        let stringFields = [
+            'code',
+            'subType',
+            'name',
+            'unit',
+            'itemCharacterText',
+            'jobContentText',
+            'adjustState',
+            'calcBase',
+            'programID',
+            'ruleText'
+        ];
+        if(stringFields.indexOf(colSetting.data.field) > 0){
+            style.font = 'bold 15px Arial';
+        }
+        else {
+            style.font = 'bold 13px Arial';
+        }
+        return style;
+    }
 };
 // 点击合计框中的复制
 $("body").on("click", "#total-tips a", function() {