|  | @@ -30,6 +30,19 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |          autoFit:true,
 | 
	
		
			
				|  |  |          fitRow:['name']
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    cusSpread:null,
 | 
	
		
			
				|  |  | +    cusSheet:null,
 | 
	
		
			
				|  |  | +    cusSheetData:null,
 | 
	
		
			
				|  |  | +    cusSetting:{
 | 
	
		
			
				|  |  | +        header: [
 | 
	
		
			
				|  |  | +            {headerName: "类型", headerWidth: 250, dataCode: "coeType", dataType: "String",hAlign: "left"},
 | 
	
		
			
				|  |  | +            {headerName: "系数", headerWidth: 160, dataCode: "amount", dataType: "String", hAlign: "right",validator:"number"}
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        view: {
 | 
	
		
			
				|  |  | +            lockColumns:["coeType"],
 | 
	
		
			
				|  |  | +            rowHeaderWidth:25
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      assSpread:null,
 | 
	
		
			
				|  |  |      assSheet:null,
 | 
	
		
			
				|  |  |      assSheetData: [],
 | 
	
	
		
			
				|  | @@ -64,6 +77,18 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |              SheetDataHelper.protectdSheet(this.coeSheet);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    initCusSpread:function () {
 | 
	
		
			
				|  |  | +        if(zmhs_obj.cusSpread == null){
 | 
	
		
			
				|  |  | +            this.cusSpread = SheetDataHelper.createNewSpread($("#cusSpread")[0]);
 | 
	
		
			
				|  |  | +            sheetCommonObj.spreadDefaultStyle(this.cusSpread);
 | 
	
		
			
				|  |  | +            this.cusSheet = this.cusSpread.getSheet(0);
 | 
	
		
			
				|  |  | +            sheetCommonObj.initSheet(this.cusSheet, this.cusSetting, 30);
 | 
	
		
			
				|  |  | +            this.cusSheet.name('ration_cus');
 | 
	
		
			
				|  |  | +            this.cusSheet.bind(GC.Spread.Sheets.Events.ValueChanged,this.onCusValueChange);
 | 
	
		
			
				|  |  | +            this.cusSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onCusRangeChanged);
 | 
	
		
			
				|  |  | +            SheetDataHelper.protectdSheet(this.cusSheet);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      initAssSpread:function () {
 | 
	
		
			
				|  |  |          if(zmhs_obj.assSheet == null){
 | 
	
		
			
				|  |  |              this.assSpread = SheetDataHelper.createNewSpread($("#assSpread")[0]);
 | 
	
	
		
			
				|  | @@ -83,7 +108,9 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |          if(selected&&selected.sourceType == "ration"){
 | 
	
		
			
				|  |  |              let ration = selected.data;
 | 
	
		
			
				|  |  |              coeList = ration_coe.getCoeByRationID(ration.ID);
 | 
	
		
			
				|  |  | +            _.remove(coeList,{"coeID":-1})//2018-12-24 新需求,把自定义乘系数分离出来,这里排除自定义乘系数行
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        this.coeSheet.setRowCount(0);
 | 
	
		
			
				|  |  |          sheetCommonObj.showData(this.coeSheet, this.coeSetting,coeList);
 | 
	
		
			
				|  |  |          if (coeList.length > 0) {
 | 
	
		
			
				|  |  |              this.coeSheet.suspendPaint();
 | 
	
	
		
			
				|  | @@ -105,6 +132,23 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |              disableSpread(zmhs_obj.coeSpread);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    showCusData:function (node) {
 | 
	
		
			
				|  |  | +        let selected = node?node:projectObj.project.mainTree.selected;
 | 
	
		
			
				|  |  | +        let ration_coe = projectObj.project.ration_coe;
 | 
	
		
			
				|  |  | +        let cusList = [];
 | 
	
		
			
				|  |  | +        if(selected&&selected.sourceType == "ration"){
 | 
	
		
			
				|  |  | +            let ration = selected.data;
 | 
	
		
			
				|  |  | +            let coeList = ration_coe.getCoeByRationID(ration.ID);
 | 
	
		
			
				|  |  | +            this.cusSheetData = _.find(coeList,{"coeID":-1});
 | 
	
		
			
				|  |  | +            if(this.cusSheetData) cusList = this.cusSheetData.coes;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        sheetCommonObj.showData(this.cusSheet, this.cusSetting,cusList);
 | 
	
		
			
				|  |  | +        this.cusSheet.getRange(cusList.length,-1,this.cusSheet.getRowCount()-cusList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
 | 
	
		
			
				|  |  | +        if(projectReadOnly){
 | 
	
		
			
				|  |  | +            disableSpread(zmhs_obj.cusSpread);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      getComboBoxForCodes:function (coe,i) {
 | 
	
		
			
				|  |  |          this.coeSheet.getCell(i, 2, GC.Spread.Sheets.SheetArea.viewport).locked(false);
 | 
	
		
			
				|  |  |          let options = coe.option_codes.split("|");
 | 
	
	
		
			
				|  | @@ -114,7 +158,6 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |          this.coeSheet.setValue(i, 2, coe.select_code);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      showAssData:function (node) {
 | 
	
		
			
				|  |  |          this.assSheet.suspendPaint();
 | 
	
		
			
				|  |  |          this.assSheet.suspendEvent();
 | 
	
	
		
			
				|  | @@ -186,8 +229,14 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      refresh:function () {
 | 
	
		
			
				|  |  | -        this.coeSpread?this.coeSpread.refresh():'';
 | 
	
		
			
				|  |  | -        this.assSpread?this.assSpread.refresh():'';
 | 
	
		
			
				|  |  | +        $('#coeSpread').is(':visible')&&this.coeSpread?this.coeSpread.refresh():'';
 | 
	
		
			
				|  |  | +        $('#cusSpread').is(':visible')&&this.cusSpread?this.cusSpread.refresh():'';
 | 
	
		
			
				|  |  | +        $('#assSpread').is(':visible')&&this.assSpread?this.assSpread.refresh():'';
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    showDatas:function () {
 | 
	
		
			
				|  |  | +        if($('#coeSpread').is(':visible')) this.showCoeData();
 | 
	
		
			
				|  |  | +        if($('#cusSpread').is(':visible')) this.showCusData();
 | 
	
		
			
				|  |  | +        if($('#assSpread').is(':visible')) this.showAssData();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      showZMHSData:function (node) {
 | 
	
		
			
				|  |  |          if(this.coeSpread&& this.assSpread && $('#linkZMHS').hasClass('active')){
 | 
	
	
		
			
				|  | @@ -347,7 +396,47 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |              projectObj.project.ration_coe.adjustCoeClick(recode, 1,{'select_code':args.newValue});
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    onCusValueChange:function (e,args) {
 | 
	
		
			
				|  |  | +      zmhs_obj.changeCusValue([{row:args.row,col:args.col,value:args.newValue}]);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    changeCusValue:function (datas) {//[{row:,col,value}]
 | 
	
		
			
				|  |  | +        if(this.cusSheetData){
 | 
	
		
			
				|  |  | +            let tem_coes = _.cloneDeep(this.cusSheetData.coes);
 | 
	
		
			
				|  |  | +            for(let d of datas){
 | 
	
		
			
				|  |  | +                if(d.value&&!sheetCommonObj.checkData(d.col,this.cusSetting,d.value)){
 | 
	
		
			
				|  |  | +                    this.showDatas();
 | 
	
		
			
				|  |  | +                    alert('输入的数据类型不对,请重新输入!');
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if(gljUtil.isDef(d.value)&&d.value !=""){
 | 
	
		
			
				|  |  | +                    if(tem_coes[d.row].coeType=="定额"){
 | 
	
		
			
				|  |  | +                        for(let t of tem_coes){
 | 
	
		
			
				|  |  | +                            t.amount = d.value;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }else {
 | 
	
		
			
				|  |  | +                        tem_coes[d.row].amount = d.value;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            let doc = {'coes':tem_coes,'content':this.generationContent(tem_coes)};
 | 
	
		
			
				|  |  | +            projectObj.project.ration_coe.adjustCoeClick(this.cusSheetData, 1,doc);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    generationContent:function (coes) {
 | 
	
		
			
				|  |  | +        let rationAmount = coes[0].amount;
 | 
	
		
			
				|  |  | +        let string ='';
 | 
	
		
			
				|  |  | +        if(_.every(coes,'amount',rationAmount)){
 | 
	
		
			
				|  |  | +            string = coes[0].coeType + 'x'+rationAmount;
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            let context_arr =[];
 | 
	
		
			
				|  |  | +            for(let i =1;i<coes.length;i++){
 | 
	
		
			
				|  |  | +                context_arr.push( coes[i].coeType + 'x'+coes[i].amount);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            string = context_arr.join(',');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return string;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      onAssEditEnded:function (e,args) {
 | 
	
		
			
				|  |  |          var me = zmhs_obj;
 | 
	
		
			
				|  |  |          if (args.row >= me.assSheetData.length) {
 | 
	
	
		
			
				|  | @@ -358,6 +447,14 @@ let zmhs_obj = {
 | 
	
		
			
				|  |  |              me.updateRationAss(args);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    onCusRangeChanged:function (e,args) {
 | 
	
		
			
				|  |  | +        let datas = [];
 | 
	
		
			
				|  |  | +        for(let c of args.changedCells){
 | 
	
		
			
				|  |  | +            let value=  args.sheet.getCell(c.row, c.col).text();
 | 
	
		
			
				|  |  | +            datas.push({row:c.row,col:c.col,value:value})
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        zmhs_obj.changeCusValue(datas);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      onAssRangeChanged:function (e,args) {
 | 
	
		
			
				|  |  |          let me = zmhs_obj;
 | 
	
		
			
				|  |  |          if (args.action == GC.Spread.Sheets.RangeChangedAction.clear) {
 |