|  | @@ -18,10 +18,6 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |      selectedGLJClass:null,
 | 
	
		
			
				|  |  |      parentNodeIds:{},
 | 
	
		
			
				|  |  |      activeTab:'#linkGLJ',
 | 
	
		
			
				|  |  | -    decimalSetting:{
 | 
	
		
			
				|  |  | -        marketPrice:2,
 | 
	
		
			
				|  |  | -        customQuantity:3
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  |      setting: {
 | 
	
		
			
				|  |  |          header: [
 | 
	
		
			
				|  |  |              {headerName: "编码", headerWidth: 100, dataCode: "code", dataType: "String", formatter: "@"},
 | 
	
	
		
			
				|  | @@ -32,6 +28,7 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |              {headerName: "定额消耗量", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},    // dataType: "Number", formatter: "0.00"
 | 
	
		
			
				|  |  |              {headerName: "自定义消耗量", headerWidth: 80, dataCode: "customQuantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},
 | 
	
		
			
				|  |  |              {headerName: "消耗量", headerWidth: 80, dataCode: "quantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},
 | 
	
		
			
				|  |  | +            {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right",decimalField:"glj.quantity"},
 | 
	
		
			
				|  |  |              {headerName: "基价单价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right",decimalField:"glj.unitPrice"},
 | 
	
		
			
				|  |  |              {headerName: "调整基价", headerWidth: 80, dataCode: "adjustPrice", dataType: "Number", hAlign: "right",decimalField:"glj.unitPrice"},
 | 
	
		
			
				|  |  |              {headerName: "市场单价", headerWidth: 80, dataCode: "marketPrice", dataType: "Number", hAlign: "right",decimalField:"glj.unitPrice"},
 | 
	
	
		
			
				|  | @@ -68,7 +65,7 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |          header:[
 | 
	
		
			
				|  |  |              {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
 | 
	
		
			
				|  |  |              {headerName: "计算式", headerWidth: 120, dataCode: "regex", dataType: "String"},
 | 
	
		
			
				|  |  | -            {headerName: "结果(C)", headerWidth: 120, dataCode: "result", dataType: "Number",formatter:"0.0000",tofix:4},
 | 
	
		
			
				|  |  | +            {headerName: "结果(C)", headerWidth: 120, dataCode: "result", dataType: "Number",decimalField:"quantity_detail"},
 | 
	
		
			
				|  |  |              {headerName: "累加", headerWidth: 120, dataCode: "isSummation", dataType: "String",cellType:"checkBox"}
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  |          view:{
 | 
	
	
		
			
				|  | @@ -541,6 +538,8 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |       //   $('#dropdown').hide();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      showRationGLJData:function (node) {
 | 
	
		
			
				|  |  | +        console.log("showRationGLJData");
 | 
	
		
			
				|  |  | +        console.log(+new Date());
 | 
	
		
			
				|  |  |          var gljList = [];
 | 
	
		
			
				|  |  |          var ration_glj = projectObj.project.ration_glj;
 | 
	
		
			
				|  |  |          node=node?node:projectObj.project.mainTree.selected;
 | 
	
	
		
			
				|  | @@ -551,12 +550,24 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      showRationGLJSheetData:function (init) {
 | 
	
		
			
				|  |  | -        this.sheet.getRange(0,-1,this.sheet.getRowCount(),-1).visible(true);
 | 
	
		
			
				|  |  | +        this.sheet.setRowCount(0);
 | 
	
		
			
				|  |  | +        console.log("showRationGLJSheetData---init")
 | 
	
		
			
				|  |  | +        console.log(+new Date())
 | 
	
		
			
				|  |  | +        //this.sheet.getRange(0,-1,this.sheet.getRowCount(),-1).visible(true); //这个方法导致加载缓慢
 | 
	
		
			
				|  |  |          this.sheetData=_.sortBy(this.sheetData,'type');
 | 
	
		
			
				|  |  | -        this.addMixRatioToShow();
 | 
	
		
			
				|  |  | +        console.log("addMixRatioToShow");
 | 
	
		
			
				|  |  | +        console.log(+new Date())
 | 
	
		
			
				|  |  | +        this.sumQuantity();//计算总消耗量
 | 
	
		
			
				|  |  | +        this.addMixRatioToShow();//显示组成物信息
 | 
	
		
			
				|  |  | +        console.log("start initRationTree");
 | 
	
		
			
				|  |  | +        console.log(+new Date());
 | 
	
		
			
				|  |  |          this.initRationTree(init);
 | 
	
		
			
				|  |  | -        sheetCommonObj.showData(this.sheet,this.setting,this.sheetData);
 | 
	
		
			
				|  |  | +        console.log("end initRationTree");
 | 
	
		
			
				|  |  | +        console.log(+new Date());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        sheetCommonObj.showData(this.sheet,this.setting,this.sheetData);
 | 
	
		
			
				|  |  | +        console.log("end show");
 | 
	
		
			
				|  |  | +        console.log(+new Date())
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      initRationTree:function (init) {
 | 
	
		
			
				|  |  |          this.sheet.getRange(-1, 0, -1, 1).cellType(this.getTreeNodeCellType(this.sheetData));
 | 
	
	
		
			
				|  | @@ -569,7 +580,11 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |                  }else {
 | 
	
		
			
				|  |  |                      collapsed = this.sheetData[i].collapsed==undefined?true:this.sheetData[i].collapsed;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                this.sheet.getRange(i+1, -1, this.sheetData[i].subList.length, -1).visible(!collapsed);// this.sheet.getRange(i+1, -1, this.sheetData[i].subList.length, -1).locked(true);
 | 
	
		
			
				|  |  | +                if(collapsed==true){
 | 
	
		
			
				|  |  | +                    this.sheet.getRange(i+1, -1, this.sheetData[i].subList.length, -1).visible(false);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                //this.sheet.getRange(i+1, -1, this.sheetData[i].subList.length, -1).visible(!collapsed);// this.sheet.getRange(i+1, -1, this.sheetData[i].subList.length, -1).locked(true);
 | 
	
		
			
				|  |  | +                //这个方法导致加载缓慢 试着在加载数据时隐藏行,看可不可行
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -584,6 +599,25 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |          this.sheetData=this.combineWithProjectGlj(gljList);
 | 
	
		
			
				|  |  |          this.showRationGLJSheetData(true);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    sumQuantity:function (node) {
 | 
	
		
			
				|  |  | +      if(this.sheetData.length>0){
 | 
	
		
			
				|  |  | +          node=node?node:projectObj.project.mainTree.selected;
 | 
	
		
			
				|  |  | +          let ration = node.data;
 | 
	
		
			
				|  |  | +          let quantity = ration.quantity;
 | 
	
		
			
				|  |  | +          quantity = (quantity==0||quantity==undefined||quantity==null||quantity=="")?1:quantity;
 | 
	
		
			
				|  |  | +          for(let glj of this.sheetData){
 | 
	
		
			
				|  |  | +              if(glj.isMixRatio==true){//如果是用于显示的组成物,则不用计算,跳过
 | 
	
		
			
				|  |  | +                  continue;
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +              glj.totalQuantity = scMathUtil.roundToString(quantity*glj.quantity,getDecimal("glj.quantity"));
 | 
	
		
			
				|  |  | +              if(glj.hasOwnProperty('subList')){//需要计算glj下挂的组成物的总消耗量
 | 
	
		
			
				|  |  | +                  for(let subG of glj.subList){
 | 
	
		
			
				|  |  | +                      subG.totalQuantity = scMathUtil.roundToString(subG.rationItemQuantity*glj.totalQuantity,getDecimal("glj.quantity"));
 | 
	
		
			
				|  |  | +                  }
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      addMixRatioToShow:function () {
 | 
	
		
			
				|  |  |          var newList=[];
 | 
	
		
			
				|  |  |          _.remove(this.sheetData,{'isMixRatio':true});
 | 
	
	
		
			
				|  | @@ -722,7 +756,8 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |              if(args.editingText==null){
 | 
	
		
			
				|  |  |                  newval="";
 | 
	
		
			
				|  |  |              }else {
 | 
	
		
			
				|  |  | -                newval = number_util.checkNumberValue(args.editingText,this.decimalSetting[updateField]);
 | 
	
		
			
				|  |  | +                var decimal = updateField=='customQuantity'?getDecimal("glj.quantity"):getDecimal("glj.unitPrice");
 | 
	
		
			
				|  |  | +                newval = number_util.checkNumberValue(args.editingText,decimal);
 | 
	
		
			
				|  |  |                  if(newval==null){
 | 
	
		
			
				|  |  |                      me.sheet.getCell(args.row, args.col).value(recode[updateField]);
 | 
	
		
			
				|  |  |                      return;
 | 
	
	
		
			
				|  | @@ -1246,7 +1281,7 @@ $(function(){
 | 
	
		
			
				|  |  |  function getDecimal(fieldID,node) {
 | 
	
		
			
				|  |  |      if(node){
 | 
	
		
			
				|  |  |          return decimalObj.decimal(fieldID,node);
 | 
	
		
			
				|  |  | -    }else if(fieldID.indexOf(".")){
 | 
	
		
			
				|  |  | +    }else if(fieldID.indexOf(".")!=-1){
 | 
	
		
			
				|  |  |          var keyArray = fieldID.split(".");
 | 
	
		
			
				|  |  |          return decimalObj[keyArray[0]][keyArray[1]];
 | 
	
		
			
				|  |  |      }else {
 |