|  | @@ -3,6 +3,7 @@
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  projectGljObject={
 | 
	
		
			
				|  |  |      showTag:'ration',//mixRatio/machine
 | 
	
		
			
				|  |  | +    showMixRatioMark:'',
 | 
	
		
			
				|  |  |      displayType:filterType.ALL,
 | 
	
		
			
				|  |  |      mixRatioType: [gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO,gljType.MAIN_MATERIAL],
 | 
	
		
			
				|  |  |      machineType: [gljType.GENERAL_MACHINE],
 | 
	
	
		
			
				|  | @@ -22,7 +23,7 @@ projectGljObject={
 | 
	
		
			
				|  |  |              {headerName: "供货方式", headerWidth: 80, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
 | 
	
		
			
				|  |  |              {headerName: "甲供数量", headerWidth: 100, dataCode: "supply_quantity", hAlign: "right", dataType: "Number",validator:"number"},
 | 
	
		
			
				|  |  |              {headerName: "三材类别", headerWidth: 80, dataCode: "materialType", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:materialComboMap},
 | 
	
		
			
				|  |  | -            {headerName: "三材系数", headerWidth: 100, dataCode: "materialCoe", hAlign: "right", dataType: "Number",decimalField:'material'},
 | 
	
		
			
				|  |  | +            {headerName: "三材系数", headerWidth: 100, dataCode: "materialCoe", hAlign: "right", dataType: "Number",decimalField:'material',validator:"number"},
 | 
	
		
			
				|  |  |              {headerName: "交货方式", headerWidth: 90, dataCode: "delivery", hAlign: "left", dataType: "String"},
 | 
	
		
			
				|  |  |              {headerName: "送达地点", headerWidth: 100, dataCode: "delivery_address", hAlign: "left", dataType: "String"},
 | 
	
		
			
				|  |  |              {headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", dataType: "String",cellType: "checkBox"}
 | 
	
	
		
			
				|  | @@ -33,6 +34,7 @@ projectGljObject={
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      projectGljSpread:null,
 | 
	
		
			
				|  |  |      projectGljSheet:null,
 | 
	
		
			
				|  |  | +    materialTreeSheet:null,
 | 
	
		
			
				|  |  |      projectGljSheetData:[],
 | 
	
		
			
				|  |  |      mixRatioSetting:{
 | 
	
		
			
				|  |  |          header:[
 | 
	
	
		
			
				|  | @@ -55,34 +57,24 @@ projectGljObject={
 | 
	
		
			
				|  |  |          "headRowHeight":[21],
 | 
	
		
			
				|  |  |          "defaultRowHeight": 21,
 | 
	
		
			
				|  |  |          "treeCol": 0,
 | 
	
		
			
				|  |  | -        "cols":[//left:0,center:1,right:2
 | 
	
		
			
				|  |  | -           /* {
 | 
	
		
			
				|  |  | -                "width":100,
 | 
	
		
			
				|  |  | -                "readOnly": true,
 | 
	
		
			
				|  |  | -                "head":{
 | 
	
		
			
				|  |  | -                    "titleNames":["具体位置"],
 | 
	
		
			
				|  |  | -                    "spanCols":[1],
 | 
	
		
			
				|  |  | -                    "spanRows":[1],
 | 
	
		
			
				|  |  | -                    "vAlign":[1],
 | 
	
		
			
				|  |  | -                    "hAlign":[1],
 | 
	
		
			
				|  |  | -                    "font":["Arial"]
 | 
	
		
			
				|  |  | -                },
 | 
	
		
			
				|  |  | -                "data":{
 | 
	
		
			
				|  |  | -                    "field":"selected",
 | 
	
		
			
				|  |  | -                    "vAlign":1,
 | 
	
		
			
				|  |  | -                    "hAlign":1,
 | 
	
		
			
				|  |  | -                    "font":"Arial",
 | 
	
		
			
				|  |  | -                    "cellType":function (node) {
 | 
	
		
			
				|  |  | -                        if(node.data.canSelect == true){
 | 
	
		
			
				|  |  | -                            return new GC.Spread.Sheets.CellTypes.CheckBox();
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }*/
 | 
	
		
			
				|  |  | -        ]
 | 
	
		
			
				|  |  | +        "cols":[]
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      materialSetting:{
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        header:[
 | 
	
		
			
				|  |  | +            {headerName: "编码", headerWidth: 200, dataCode: "code", dataType: "String"},
 | 
	
		
			
				|  |  | +            {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
 | 
	
		
			
				|  |  | +            {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String"},
 | 
	
		
			
				|  |  | +            {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
 | 
	
		
			
				|  |  | +            {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
 | 
	
		
			
				|  |  | +            {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
 | 
	
		
			
				|  |  | +            {headerName: "总消耗量", headerWidth: 100, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
 | 
	
		
			
				|  |  | +            {headerName: "三材系数", headerWidth: 100, dataCode: "materialCoe", hAlign: "right", dataType: "Number",decimalField:'material',validator:"number"},
 | 
	
		
			
				|  |  | +            {headerName: "三材量", headerWidth: 100, dataCode: "materialQuantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
 | 
	
		
			
				|  |  | +            {headerName: "三材类别", headerWidth: 80, dataCode: "materialType", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:materialComboMap}
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        view: {
 | 
	
		
			
				|  |  | +            lockColumns: [0,1,2,3,6,8]
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      mixRatioSpread:null,
 | 
	
		
			
				|  |  |      mixRatioSheet:null,
 | 
	
	
		
			
				|  | @@ -90,7 +82,13 @@ projectGljObject={
 | 
	
		
			
				|  |  |      usedTenderList:[],
 | 
	
		
			
				|  |  |      usedUnitPriceInfo:null,
 | 
	
		
			
				|  |  |      initProjectGljSpread:function () {
 | 
	
		
			
				|  |  | -        this.projectGljSpread = SheetDataHelper.createNewSpread($("#project_glj_sheet")[0]);
 | 
	
		
			
				|  |  | +        if(!this.projectGljSpread){
 | 
	
		
			
				|  |  | +            this.projectGljSpread = SheetDataHelper.createNewSpread($("#project_glj_sheet")[0],2);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        this.initProjectGljSheet();
 | 
	
		
			
				|  |  | +        this.initMaterialTreeSheet();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    initProjectGljSheet:function () {
 | 
	
		
			
				|  |  |          this.projectGljSheet = this.projectGljSpread .getSheet(0);
 | 
	
		
			
				|  |  |          this.initSheet(this.projectGljSheet,this.projectGljSetting);
 | 
	
		
			
				|  |  |          this.projectGljSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onProjectGljSelectionChange);
 | 
	
	
		
			
				|  | @@ -112,9 +110,69 @@ projectGljObject={
 | 
	
		
			
				|  |  |          this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
 | 
	
		
			
				|  |  |          this.mixRatioSheet.name('mixRatioSheet');
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    initMaterialTreeSheet:function () {
 | 
	
		
			
				|  |  | +        this.materialTreeSheet = this.projectGljSpread.getSheet(1);
 | 
	
		
			
				|  |  | +        this.materialTreeSetting = this.createMaterialTreeSheetSetting();
 | 
	
		
			
				|  |  | +        this.materialTree = cacheTree.createNew(this);
 | 
	
		
			
				|  |  | +        this.materialTreeController = TREE_SHEET_CONTROLLER.createNew(this.materialTree, this.materialTreeSheet, this.materialTreeSetting);
 | 
	
		
			
				|  |  | +        this.materialTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.onSelectionChange);
 | 
	
		
			
				|  |  | +        this.materialTreeSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMaterialTreeEditStarting);
 | 
	
		
			
				|  |  | +        this.materialTreeSheet.name('materialTreeSheet');
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    createMaterialTreeSheetSetting:function () {
 | 
	
		
			
				|  |  | +        for(let h of this.materialSetting.header){
 | 
	
		
			
				|  |  | +            this.materialTreeSetting.cols.push(getSettingCol(h))
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        for(let l of this.materialSetting.view.lockColumns){
 | 
	
		
			
				|  |  | +            this.materialTreeSetting.cols[l].readOnly = true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return this.materialTreeSetting;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        function getSettingCol(header) {
 | 
	
		
			
				|  |  | +            let aMap ={left:0,center:1,right:2};
 | 
	
		
			
				|  |  | +            let hAlign = header.hAlign?aMap[header.hAlign]:0;
 | 
	
		
			
				|  |  | +            let col = {
 | 
	
		
			
				|  |  | +                "width":header.headerWidth?header.headerWidth:100,
 | 
	
		
			
				|  |  | +                "head":{
 | 
	
		
			
				|  |  | +                    "titleNames":[header.headerName],
 | 
	
		
			
				|  |  | +                    "spanCols":[1],
 | 
	
		
			
				|  |  | +                    "spanRows":[1],
 | 
	
		
			
				|  |  | +                    "vAlign":[1],
 | 
	
		
			
				|  |  | +                    "hAlign":[1],
 | 
	
		
			
				|  |  | +                    "font":["Arial"]
 | 
	
		
			
				|  |  | +                },
 | 
	
		
			
				|  |  | +                "data": {
 | 
	
		
			
				|  |  | +                    "field": header.dataCode,
 | 
	
		
			
				|  |  | +                    "vAlign": 1,
 | 
	
		
			
				|  |  | +                    "hAlign": hAlign,
 | 
	
		
			
				|  |  | +                    "font": "Arial"
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            if(header.cellType){
 | 
	
		
			
				|  |  | +                col.data.cellType = getCellType(header);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return col;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        function getCellType(header) {
 | 
	
		
			
				|  |  | +            return function () {
 | 
	
		
			
				|  |  | +                if(header.cellType === "checkBox"){
 | 
	
		
			
				|  |  | +                    return new GC.Spread.Sheets.CellTypes.CheckBox();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if(header.cellType === "comboBox"){
 | 
	
		
			
				|  |  | +                    let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
 | 
	
		
			
				|  |  | +                    if(header.options){
 | 
	
		
			
				|  |  | +                        dynamicCombo.itemHeight(header.options.length).items(header.options);
 | 
	
		
			
				|  |  | +                        if(header.editorValueType==true){
 | 
	
		
			
				|  |  | +                            dynamicCombo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    return dynamicCombo
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      unitPriceFileInit:function() {
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
		
			
				|  |  |          let projectGLJ = projectObj.project.projectGLJ;
 | 
	
	
		
			
				|  | @@ -129,25 +187,29 @@ projectGljObject={
 | 
	
		
			
				|  |  |      getUsedTenderInfo:function() {
 | 
	
		
			
				|  |  |          return projectGljObject.usedTenderList.join("<br>");
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    showMixRatioData:function (from = 'projectGljSheet') { //projectGljSheet/materialSheet 工料机汇总和三材汇总表
 | 
	
		
			
				|  |  | +    showMixRatioData:function () {
 | 
	
		
			
				|  |  |          let me = this,gljId = null,gljType = null;
 | 
	
		
			
				|  |  | -        /*let consumptionCol =  _.findIndex(me.mixRatioSetting.header, { 'dataCode': 'consumption'});
 | 
	
		
			
				|  |  | -        if(me.showTag == 'ration'){
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }*/
 | 
	
		
			
				|  |  | -        if(from == 'projectGljSheet'){
 | 
	
		
			
				|  |  | +        let sheet = me.projectGljSpread.getActiveSheet();
 | 
	
		
			
				|  |  | +        if(sheet.name() == 'projectGljSheet'){//projectGljSheet/materialSheet 工料机汇总和三材汇总表
 | 
	
		
			
				|  |  |              let sel = me.projectGljSheet.getSelections()[0];
 | 
	
		
			
				|  |  |              let srow = sel.row == -1?0:sel.row;
 | 
	
		
			
				|  |  |              if(me.projectGljSheetData.length>srow){
 | 
	
		
			
				|  |  |                  gljId = me.projectGljSheetData[srow].id;
 | 
	
		
			
				|  |  |                  gljType = me.projectGljSheetData[srow].type;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +        }else if(sheet.name() == 'materialTreeSheet' ){
 | 
	
		
			
				|  |  | +            if(this.materialTree.selected){
 | 
	
		
			
				|  |  | +                gljId = this.materialTree.selected.data.id;
 | 
	
		
			
				|  |  | +                gljType = this.materialTree.selected.data.type;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if(compositionTypes.indexOf(gljType)==-1){//如果不是有组成物的类型,工料机id设置为空,组成物表设置为空
 | 
	
		
			
				|  |  |              gljId = null
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          projectObj.project.projectGLJ.getRatioData(gljId,function (data) {
 | 
	
		
			
				|  |  | +            if(gljId !== projectObj.project.projectGLJ.getRatioId){//两个id不一致说明不是最新的请求,不用往下执行。
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              let rationList =[];
 | 
	
		
			
				|  |  |              for(let glj of data){
 | 
	
		
			
				|  |  |                  rationList.push(me.getMixRatioSheetData(glj)) ;
 | 
	
	
		
			
				|  | @@ -192,7 +254,7 @@ projectGljObject={
 | 
	
		
			
				|  |  |              return false;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='glj.is_main_material'){
 | 
	
		
			
				|  |  | +        if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='is_main_material'){
 | 
	
		
			
				|  |  |              return false;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
 | 
	
	
		
			
				|  | @@ -210,9 +272,26 @@ projectGljObject={
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    onProjectGljSelectionChange:function (sender, args) {
 | 
	
		
			
				|  |  | +    onSelectionChange:function (){
 | 
	
		
			
				|  |  |          let me = projectGljObject;
 | 
	
		
			
				|  |  |          me.showMixRatioData();
 | 
	
		
			
				|  |  | +        me.materialTreeSheet.repaint();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onMaterialTreeEditStarting:function (sender, args) {
 | 
	
		
			
				|  |  | +        let me = projectGljObject;
 | 
	
		
			
				|  |  | +        let selected = me.materialTree.selected;
 | 
	
		
			
				|  |  | +        if(selected && (selected.data.ParentID == -1 || selected.data.id == 'GJ')){//三材类别项不能编辑
 | 
	
		
			
				|  |  | +            args.cancel = true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onProjectGljSelectionChange:function (sender, args) {
 | 
	
		
			
				|  |  | +        let me = projectGljObject;
 | 
	
		
			
				|  |  | +        let newSel = args.newSelections[0];
 | 
	
		
			
				|  |  | +        let oldSel = args.oldSelections?args.oldSelections[0]:{};
 | 
	
		
			
				|  |  | +        if(newSel.row != oldSel.row){
 | 
	
		
			
				|  |  | +            me.showMixRatioData();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          me.projectGljSheet.repaint();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onProjectGljRangeChange:function (sender,info) {
 | 
	
	
		
			
				|  | @@ -254,6 +333,7 @@ projectGljObject={
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      showProjectGljData:function () {
 | 
	
		
			
				|  |  | +        this.projectGljSpread.setActiveSheetIndex(0);
 | 
	
		
			
				|  |  |          let sel = this.projectGljSheet.getSelections()[0];
 | 
	
		
			
				|  |  |          let projectGljSheetData = [];
 | 
	
		
			
				|  |  |          let gljList = projectObj.project.projectGLJ.datas.gljList;
 | 
	
	
		
			
				|  | @@ -268,6 +348,106 @@ projectGljObject={
 | 
	
		
			
				|  |  |          this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
 | 
	
		
			
				|  |  |          this.projectGljSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    showMaterialTreeData:function () {
 | 
	
		
			
				|  |  | +        this.projectGljSpread.setActiveSheetIndex(1);
 | 
	
		
			
				|  |  | +        let sel = this.materialTreeSheet.getSelections()[0];
 | 
	
		
			
				|  |  | +        let selNode = this.materialTree.selected;
 | 
	
		
			
				|  |  | +        let gljList = projectObj.project.projectGLJ.datas.gljList;
 | 
	
		
			
				|  |  | +        gljList = _.sortByAll(gljList, [ 'code']);
 | 
	
		
			
				|  |  | +        this.createMaterialTree(gljList);
 | 
	
		
			
				|  |  | +        this.materialTreeController.showTreeData();
 | 
	
		
			
				|  |  | +        this.materialTreeSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
 | 
	
		
			
				|  |  | +        this.materialTreeController.setTreeSelected(selNode);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    createMaterialTree:function (gljList) {
 | 
	
		
			
				|  |  | +        let me = projectGljObject;
 | 
	
		
			
				|  |  | +        let q_decimal = getDecimal("glj.quantity");
 | 
	
		
			
				|  |  | +        let GC = {id:'GC',name:materialType[materialTypeMap.GC],code:'GC',unit:'t',ParentID:-1,NextSiblingID:'MC'};//000001
 | 
	
		
			
				|  |  | +        let GJ = {id:'GJ',name:materialType[materialTypeMap.GJ],code:'GJ',unit:'t',ParentID:'GC',NextSiblingID:-1};
 | 
	
		
			
				|  |  | +        let MC = {id:'MC',name:materialType[materialTypeMap.MC],code:'MC',unit:'t',ParentID:-1,NextSiblingID:'SN'};
 | 
	
		
			
				|  |  | +        let SN = {id:'SN',name:materialType[materialTypeMap.SN],code:'SN',unit:'m3',ParentID:-1,NextSiblingID:'SZ'};
 | 
	
		
			
				|  |  | +        let SZ = {id:'SZ',name:materialType[materialTypeMap.SZ],code:'BZZ',unit:'千块',ParentID:-1,NextSiblingID:-1};
 | 
	
		
			
				|  |  | +        let rootDatas= [GC,GJ,MC,SN,SZ];
 | 
	
		
			
				|  |  | +        let parentMap = {};
 | 
	
		
			
				|  |  | +        let sumMap = {};
 | 
	
		
			
				|  |  | +        this.materialTree.nodes={},this.materialTree.selected = null,this.materialTree.roots = [],this.materialTree.items=[];
 | 
	
		
			
				|  |  | +        for(let r of rootDatas){
 | 
	
		
			
				|  |  | +            let baseNode = null;
 | 
	
		
			
				|  |  | +            if(r.id == 'GJ'){
 | 
	
		
			
				|  |  | +                baseNode = createMaterialNode(r,parentMap['GC'],null);//钢筋的父节点为钢材
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                baseNode = createMaterialNode(r,null,null);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            parentMap[r.id] = baseNode;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        for(let g of gljList){
 | 
	
		
			
				|  |  | +            if(g.quantity !== 0 && g.quantity !== '0'){
 | 
	
		
			
				|  |  | +                if(g.materialType){
 | 
	
		
			
				|  |  | +                    let tem = me.getMaterialSheetDataByGLJ(g);
 | 
	
		
			
				|  |  | +                    if(tem.materialQuantity){
 | 
	
		
			
				|  |  | +                        sumMap[g.materialType] = sumMap[g.materialType]?sumMap[g.materialType] + tem.materialQuantity:tem.materialQuantity;
 | 
	
		
			
				|  |  | +                        tem.materialQuantity = scMathUtil.roundToString(tem.materialQuantity,q_decimal);//转成string
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if(g.materialType == materialTypeMap.GC){ //钢材的下一节点是钢筋
 | 
	
		
			
				|  |  | +                        createMaterialNode(tem,parentMap['GC'],parentMap['GJ']);
 | 
	
		
			
				|  |  | +                    }else {
 | 
	
		
			
				|  |  | +                        createMaterialNode(tem,parentMap[materialTypeMap[g.materialType]]);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for(let mkey in sumMap){
 | 
	
		
			
				|  |  | +            if(mkey == materialTypeMap.GC && sumMap[materialTypeMap.GJ]){//钢材汇总要加上钢筋的总量
 | 
	
		
			
				|  |  | +                parentMap['GC'].data.materialQuantity = scMathUtil.roundToString(sumMap[mkey]+sumMap[materialTypeMap.GJ],q_decimal);
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                parentMap[materialTypeMap[mkey]].data.materialQuantity = scMathUtil.roundToString(sumMap[mkey],q_decimal);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        this.materialTree.sortTreeItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        function createMaterialNode(data,parent,next) {
 | 
	
		
			
				|  |  | +            let newNode = me.materialTree.addNode(parent, next, data.id);
 | 
	
		
			
				|  |  | +            newNode.data = data;
 | 
	
		
			
				|  |  | +            return newNode;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    getMaterialSheetDataByGLJ:function (glj) {
 | 
	
		
			
				|  |  | +        let q_decimal = getDecimal("glj.quantity");
 | 
	
		
			
				|  |  | +        let m_decimal = getDecimal("material");
 | 
	
		
			
				|  |  | +        let p_decimal = getDecimal("glj.unitPrice");
 | 
	
		
			
				|  |  | +        let projectGLJ = projectObj.project.projectGLJ;
 | 
	
		
			
				|  |  | +        let data ={
 | 
	
		
			
				|  |  | +            id:glj.id,
 | 
	
		
			
				|  |  | +            code:glj.code,
 | 
	
		
			
				|  |  | +            name:glj.name,
 | 
	
		
			
				|  |  | +            specs:glj.specs,
 | 
	
		
			
				|  |  | +            unit:glj.unit,
 | 
	
		
			
				|  |  | +            type:glj.type,
 | 
	
		
			
				|  |  | +            short_name:projectGLJ.getShortNameByID(glj.type),
 | 
	
		
			
				|  |  | +            quantity:scMathUtil.roundToString(glj.quantity,q_decimal),
 | 
	
		
			
				|  |  | +            supply:glj.supply,
 | 
	
		
			
				|  |  | +            supply_quantity:glj.supply_quantity,
 | 
	
		
			
				|  |  | +            materialType:glj.materialType,
 | 
	
		
			
				|  |  | +            delivery:glj.delivery,
 | 
	
		
			
				|  |  | +            delivery_address:glj.delivery_address,
 | 
	
		
			
				|  |  | +            is_adjust_price:glj.is_adjust_price,
 | 
	
		
			
				|  |  | +            ratio_data:glj.ratio_data,
 | 
	
		
			
				|  |  | +            is_add:glj.unit_price.is_add,
 | 
	
		
			
				|  |  | +            bgColour:'white'
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +        if(glj.materialCoe){
 | 
	
		
			
				|  |  | +            data.materialCoe = scMathUtil.roundToString(glj.materialCoe,m_decimal);
 | 
	
		
			
				|  |  | +            data.materialQuantity = scMathUtil.roundForObj(glj.materialCoe * glj.quantity,q_decimal);//还要做汇总,汇总完再转成string
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        gljOprObj.setGLJPrice(data,glj);
 | 
	
		
			
				|  |  | +        data.basePrice = scMathUtil.roundToString(data.basePrice,p_decimal);
 | 
	
		
			
				|  |  | +        data.marketPrice = scMathUtil.roundToString(data.marketPrice,p_decimal);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return data;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      filterProjectGLJ:function (gljList) {
 | 
	
		
			
				|  |  |          let me = projectGljObject;
 | 
	
		
			
				|  |  |          if(gljList.length>0){
 | 
	
	
		
			
				|  | @@ -296,9 +476,6 @@ projectGljObject={
 | 
	
		
			
				|  |  |              }else if(me.displayType == filterType.ZYCL){//筛选“主要材料”=“是”的工料机行。
 | 
	
		
			
				|  |  |                  return item.is_main_material == 1;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            console.log(item);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return false;
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -364,7 +541,8 @@ projectGljObject={
 | 
	
		
			
				|  |  |              sheetCommonObj.showRowData(this.projectGljSheet, this.projectGljSetting,row,this.projectGljSheetData);
 | 
	
		
			
				|  |  |          }else {
 | 
	
		
			
				|  |  |              me.projectGljSheetData.splice(row,1);
 | 
	
		
			
				|  |  | -            this.projectGljSheet.deleteRows(row,1);
 | 
	
		
			
				|  |  | +            me.projectGljSheet.deleteRows(row,1);
 | 
	
		
			
				|  |  | +            me.showMixRatioData();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -379,7 +557,7 @@ projectGljObject={
 | 
	
		
			
				|  |  |          let me = projectGljObject;
 | 
	
		
			
				|  |  |          if(info.sheetName=='projectGljSheet'){
 | 
	
		
			
				|  |  |              me.onProjectGLJValueChange(e,info);
 | 
	
		
			
				|  |  | -        }if(info.sheetName == 'mixRatioSheet'){
 | 
	
		
			
				|  |  | +        }else if(info.sheetName == 'mixRatioSheet'){
 | 
	
		
			
				|  |  |              me.onMixRatioValueChange(e,info);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -476,8 +654,13 @@ projectGljObject={
 | 
	
		
			
				|  |  |          let dataCode = me.projectGljSetting.header[col].dataCode;
 | 
	
		
			
				|  |  |          let recode = me.projectGljSheetData[row];
 | 
	
		
			
				|  |  |          let value = info.newValue;
 | 
	
		
			
				|  |  | +        if(info.newValue == undefined ){
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          if (!me.checkData(col,me.projectGljSetting,value)) {
 | 
	
		
			
				|  |  | -            alert('输入的数据类型不对,请重新输入!');
 | 
	
		
			
				|  |  | +            setTimeout(function () {//为了不与click事件冲突
 | 
	
		
			
				|  |  | +                alert('输入的数据类型不对,请重新输入!');
 | 
	
		
			
				|  |  | +            },200);
 | 
	
		
			
				|  |  |              me.refreshProjectGljRow(row);
 | 
	
		
			
				|  |  |              return ;
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -511,7 +694,7 @@ projectGljObject={
 | 
	
		
			
				|  |  |              if(dataCode === 'supply_quantity'){//修改数量需做4舍5入
 | 
	
		
			
				|  |  |                  value= value.toDecimal(getDecimal('glj.quantity'));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'){
 | 
	
		
			
				|  |  | +            if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'||dataCode === 'is_main_material'){
 | 
	
		
			
				|  |  |                  if(value == true){
 | 
	
		
			
				|  |  |                      value = 1;
 | 
	
		
			
				|  |  |                  }else if(value == false){
 | 
	
	
		
			
				|  | @@ -629,14 +812,18 @@ $(function () {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          me.unitPriceFileInit();
 | 
	
		
			
				|  |  |          //projectObj.project.projectGLJ.calcQuantity(); 在工程量有更新的地方调用
 | 
	
		
			
				|  |  | -        me.showProjectGljData();
 | 
	
		
			
				|  |  | +        if(me.displayType == filterType.SCHZ){//三材汇总树节点
 | 
	
		
			
				|  |  | +            me.showMaterialTreeData();
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            me.showProjectGljData();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          me.initMixRatio();
 | 
	
		
			
				|  |  |          loadSize(pojGljResizeEles, 'height', function () {
 | 
	
		
			
				|  |  |              me.projectGljSpread.refresh();
 | 
	
		
			
				|  |  |              me.mixRatioSpread?me.mixRatioSpread.refresh():'';
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    $('#ration_link').on('shown.bs.tab', function (e) {
 | 
	
		
			
				|  |  | +  /*  $('#ration_link').on('shown.bs.tab', function (e) {
 | 
	
		
			
				|  |  |          let me = projectGljObject;
 | 
	
		
			
				|  |  |          me.showTag='ration';
 | 
	
		
			
				|  |  |          me.showProjectGljData();
 | 
	
	
		
			
				|  | @@ -652,7 +839,7 @@ $(function () {
 | 
	
		
			
				|  |  |          me.showTag='machine';
 | 
	
		
			
				|  |  |          me.showProjectGljData();
 | 
	
		
			
				|  |  |          me.initMixRatio();
 | 
	
		
			
				|  |  | -    });
 | 
	
		
			
				|  |  | +    });*/
 | 
	
		
			
				|  |  |      $('#pop-used-list').popover({
 | 
	
		
			
				|  |  |              placement: "bottom",
 | 
	
		
			
				|  |  |              html: true,
 | 
	
	
		
			
				|  | @@ -772,9 +959,12 @@ $(function () {
 | 
	
		
			
				|  |  |      $("#filterType").on("click","ul li a",function(){
 | 
	
		
			
				|  |  |          let me = projectGljObject;
 | 
	
		
			
				|  |  |          me.displayType = filterType[this.id];
 | 
	
		
			
				|  |  | -        me.showProjectGljData();
 | 
	
		
			
				|  |  | -        me.showMixRatioData();
 | 
	
		
			
				|  |  | -        console.log(this.id);
 | 
	
		
			
				|  |  | +        if(me.displayType == filterType.SCHZ){//三材汇总树节点
 | 
	
		
			
				|  |  | +            me.showMaterialTreeData();
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            me.showProjectGljData();
 | 
	
		
			
				|  |  | +            me.showMixRatioData();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  });
 |