|  | @@ -17,7 +17,8 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |              {headerName:"单位",headerWidth:60,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
 | 
	
		
			
				|  |  |              {headerName:"定额价",headerWidth:80, dataCode:"basePrice", dataType: "Number", formatter:"0.00",  precision: 2},
 | 
	
		
			
				|  |  |              {headerName:"定额消耗",headerWidth:80, dataCode:"consumeAmt", dataType: "Number", formatter: "0.000", precision: 3},
 | 
	
		
			
				|  |  | -            {headerName:"类型",headerWidth:70,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"}
 | 
	
		
			
				|  |  | +            {headerName:"类型",headerWidth:70,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"},
 | 
	
		
			
				|  |  | +            {headerName:"配合比",headerWidth:70,dataCode:"proportion", dataType: "Number", formatter:"0.00",  precision: 2}
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  |          view:{
 | 
	
		
			
				|  |  |              comboBox:[],
 | 
	
	
		
			
				|  | @@ -25,7 +26,6 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      getDistTypeTree: function (gljDistType) {
 | 
	
		
			
				|  |  | -        let me = this;
 | 
	
		
			
				|  |  |          let distType;
 | 
	
		
			
				|  |  |          let distTypeTree = {
 | 
	
		
			
				|  |  |              prefix : 'gljDistType',
 | 
	
	
		
			
				|  | @@ -61,66 +61,41 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          return distTypeTree;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    getGljDistType: function (callback) {
 | 
	
		
			
				|  |  | -        let me = this;
 | 
	
		
			
				|  |  | -        $.ajax({
 | 
	
		
			
				|  |  | -            type: 'post',
 | 
	
		
			
				|  |  | -            url: "api/getGljDistType",
 | 
	
		
			
				|  |  | -            dataType: 'json',
 | 
	
		
			
				|  |  | -            success: function (result) {
 | 
	
		
			
				|  |  | -                if(!result.error && callback){
 | 
	
		
			
				|  |  | -                    me.distTypeTree = me.getDistTypeTree(result.data);
 | 
	
		
			
				|  |  | -                    callback();
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | +    initGljDistType: function (gljDistTypeList) {
 | 
	
		
			
				|  |  | +        this.distTypeTree = this.getDistTypeTree(gljDistTypeList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      buildSheet: function(sheet) {
 | 
	
		
			
				|  |  | -        var me = this;
 | 
	
		
			
				|  |  | -        me.sheet = sheet;
 | 
	
		
			
				|  |  | -        me.getGljDistType(function () {
 | 
	
		
			
				|  |  | -            sheetCommonObj.initSheet(me.sheet, me.setting, 30);
 | 
	
		
			
				|  |  | -            me.onContextmenuOpr();
 | 
	
		
			
				|  |  | -            me.bindRationGljDelOpr();
 | 
	
		
			
				|  |  | -            me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
 | 
	
		
			
				|  |  | -            me.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
 | 
	
		
			
				|  |  | -            me.sheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStarting);
 | 
	
		
			
				|  |  | -            me.sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onCellEditEnd);
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +        this.sheet = sheet;
 | 
	
		
			
				|  |  | +        sheetCommonObj.initSheet(this.sheet, this.setting, 30);
 | 
	
		
			
				|  |  | +        this.onContextmenuOpr();
 | 
	
		
			
				|  |  | +        this.bindRationGljDelOpr();
 | 
	
		
			
				|  |  | +        this.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, this.onClipboardPasting);
 | 
	
		
			
				|  |  | +        this.sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, this.onClipboardPasted);
 | 
	
		
			
				|  |  | +        this.sheet.bind(GC.Spread.Sheets.Events.EditStarting, this.onEditStarting);
 | 
	
		
			
				|  |  | +        this.sheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onCellEditEnd);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      bindRationGljDelOpr: function () {
 | 
	
		
			
				|  |  | -        let me = rationGLJOprObj, spreadBook = me.sheet.getParent();
 | 
	
		
			
				|  |  | +        if (locked) {
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        const me = rationGLJOprObj;
 | 
	
		
			
				|  |  | +        const spreadBook = me.sheet.getParent();
 | 
	
		
			
				|  |  |          spreadBook.commandManager().register('rationGljDelete', function () {
 | 
	
		
			
				|  |  | -            let sels = me.sheet.getSelections(), lockCols = me.setting.view.lockColumns;
 | 
	
		
			
				|  |  | -            let cacheSection = me.cache["_GLJ_" + me.currentRationItem.ID], isUpdate = false;
 | 
	
		
			
				|  |  | -            if(sels.length > 0){
 | 
	
		
			
				|  |  | -                for(let sel = 0; sel < sels.length; sel++){
 | 
	
		
			
				|  |  | -                    if(sels[sel].colCount === me.setting.header.length){
 | 
	
		
			
				|  |  | -                        if(cacheSection && sels[sel].row < cacheSection.length){
 | 
	
		
			
				|  |  | -                            isUpdate = true;
 | 
	
		
			
				|  |  | -                            cacheSection.splice(sels[sel].row, sels[sel].rowCount);
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    else{
 | 
	
		
			
				|  |  | -                         if(sels[sel].col !== 0 && sels[sel].col !== 5 && !(sels[sel].col === 1 && sels.col + sels[sel].colCount -1 === 3)){
 | 
	
		
			
				|  |  | -                            if(cacheSection){
 | 
	
		
			
				|  |  | -                                for(let i = sels[sel].row === -1 ? 1 : 0; i < sels[sel].rowCount; i++){
 | 
	
		
			
				|  |  | -                                    if(sels[sel].row + i < cacheSection.length){
 | 
	
		
			
				|  |  | -                                        for(let col = sels[sel].col; col <= sels[sel].col + sels[sel].colCount - 1; col++){
 | 
	
		
			
				|  |  | -                                            if(lockCols.indexOf(col) === -1){
 | 
	
		
			
				|  |  | -                                                isUpdate = true;
 | 
	
		
			
				|  |  | -                                                cacheSection[sels[sel].row + i][me.setting.header[col].dataCode] = 0;
 | 
	
		
			
				|  |  | -                                                me.sheet.setValue(sels[sel].row + i, col, 0.00);
 | 
	
		
			
				|  |  | -                                            }
 | 
	
		
			
				|  |  | -                                        }
 | 
	
		
			
				|  |  | -                                    }
 | 
	
		
			
				|  |  | -                                }
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +            const cacheSection = me.cache["_GLJ_" + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | +            const sels = me.sheet.getSelections();
 | 
	
		
			
				|  |  | +            if (!cacheSection || !sels.length) {
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            let isUpdate = false;
 | 
	
		
			
				|  |  | +            for (const sel of sels) {
 | 
	
		
			
				|  |  | +                const deleteRow = sel.colCount === me.setting.header.length && sel.row < cacheSection.length;
 | 
	
		
			
				|  |  | +                if (deleteRow) {
 | 
	
		
			
				|  |  | +                    isUpdate = true;
 | 
	
		
			
				|  |  | +                    cacheSection.splice(sel.row, sel.rowCount);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if(isUpdate){
 | 
	
		
			
				|  |  | +            if (isUpdate) {
 | 
	
		
			
				|  |  |                  me.updateRationItem(function () {
 | 
	
		
			
				|  |  |                      me.sheet.getParent().focus(true);
 | 
	
		
			
				|  |  |                  });
 | 
	
	
		
			
				|  | @@ -132,155 +107,123 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |          spreadBook.commandManager().setShortcutKey('rationGljDelete', GC.Spread.Commands.Key.del, false, false, false, false);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onClipboardPasting: function(sender, args) {
 | 
	
		
			
				|  |  | -        var me = rationGLJOprObj;
 | 
	
		
			
				|  |  | -        let rationSection = rationOprObj.getCache();
 | 
	
		
			
				|  |  | -        let rationRow = rationOprObj.workBook.getSheet(0).getSelections()[0].row;
 | 
	
		
			
				|  |  | -        me.currentRationItem = rationRow < rationSection.length ? rationSection[rationRow] : null;
 | 
	
		
			
				|  |  | +        const me = rationGLJOprObj;
 | 
	
		
			
				|  |  | +        const rationCache = rationOprObj.getCache();
 | 
	
		
			
				|  |  | +        const rationRow = rationOprObj.workBook.getSheet(0).getSelections()[0].row;
 | 
	
		
			
				|  |  | +        me.currentRationItem = rationRow < rationCache.length ? rationCache[rationRow] : null;
 | 
	
		
			
				|  |  |          if(me.currentRationItem && typeof me.cache["_GLJ_" + me.currentRationItem.ID] === 'undefined'){
 | 
	
		
			
				|  |  |              me.cache["_GLJ_" + me.currentRationItem.ID] = [];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (!(args.cellRange.col === 0 || args.cellRange.col === 5) || !(me.currentRationItem)) {
 | 
	
		
			
				|  |  | +        const field = me.setting.header[args.cellRange.col].dataCode;
 | 
	
		
			
				|  |  | +        const canPasteFields = ['code', 'consumeAmt', 'proportion'];
 | 
	
		
			
				|  |  | +        if (!me.currentRationItem || !(canPasteFields.includes(field) && args.cellRange.colCount === 1)) {
 | 
	
		
			
				|  |  |              args.cancel = true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onClipboardPasted: function(e, info) {
 | 
	
		
			
				|  |  | -        var me = rationGLJOprObj, repId = pageOprObj.rationLibId;
 | 
	
		
			
				|  |  | +        const me = rationGLJOprObj;
 | 
	
		
			
				|  |  |          me.tempCacheArr = [];
 | 
	
		
			
				|  |  | -        if (repId) {
 | 
	
		
			
				|  |  | -            let gljLibId = pageOprObj.gljLibId;
 | 
	
		
			
				|  |  | -            if(gljLibId){
 | 
	
		
			
				|  |  | -                if (info.cellRange.col == 0) {
 | 
	
		
			
				|  |  | -                    let cacheArr = me.cache["_GLJ_" + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | -                    var tmpCodes = sheetCommonObj.analyzePasteData({header:[{dataCode: "code"}] }, info);
 | 
	
		
			
				|  |  | -                    var codes = [];
 | 
	
		
			
				|  |  | -                    for (var i = 0; i < tmpCodes.length; i++) {
 | 
	
		
			
				|  |  | -                        let rowIdx = info.cellRange.row + i;
 | 
	
		
			
				|  |  | -                        if(rowIdx < cacheArr.length){//更新
 | 
	
		
			
				|  |  | -                            me.tempCacheArr.push({org: cacheArr[rowIdx], newCode: tmpCodes[i].code});
 | 
	
		
			
				|  |  | -                            cacheArr.splice(rowIdx--, 1);
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        codes.push(tmpCodes[i].code);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    me.addGljItems(codes, gljLibId, info.cellRange);
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    //修改用量
 | 
	
		
			
				|  |  | -                    if(me.cache["_GLJ_" + me.currentRationItem.ID] && info.cellRange.row < me.cache["_GLJ_" + me.currentRationItem.ID].length){
 | 
	
		
			
				|  |  | -                        let tempConsumes = sheetCommonObj.analyzePasteData(me.setting, info);
 | 
	
		
			
				|  |  | -                        let maxCount = info.cellRange.row + info.cellRange.rowCount -1 > me.cache["_GLJ_" + me.currentRationItem.ID].length -1 ?
 | 
	
		
			
				|  |  | -                        me.cache["_GLJ_" + me.currentRationItem.ID].length - info.cellRange.row : info.cellRange.rowCount;
 | 
	
		
			
				|  |  | -                        for(let i = 0; i < maxCount; i++){
 | 
	
		
			
				|  |  | -                            let roundCons = scMathUtil.roundTo(tempConsumes[i].consumeAmt, -3);
 | 
	
		
			
				|  |  | -                            me.cache["_GLJ_" + me.currentRationItem.ID][info.cellRange.row + i].consumeAmt = roundCons;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        me.updateRationItem(function () {
 | 
	
		
			
				|  |  | -                            me.sheet.getParent().focus(true);
 | 
	
		
			
				|  |  | -                        });
 | 
	
		
			
				|  |  | -                        if(info.cellRange.row + info.cellRange.rowCount -1 >= me.cache["_GLJ_" + me.currentRationItem.ID].length -1){
 | 
	
		
			
				|  |  | -                            me.sheet.suspendPaint();
 | 
	
		
			
				|  |  | -                            for(let rowIdx = me.cache["_GLJ_" + me.currentRationItem.ID].length; rowIdx <= info.cellRange.row + info.cellRange.rowCount -1; rowIdx++){
 | 
	
		
			
				|  |  | -                                me.sheet.setValue(rowIdx, info.cellRange.col, '');
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                            me.sheet.resumePaint();
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    else if(info.cellRange.row >= me.cache["_GLJ_" + me.currentRationItem.ID].length){
 | 
	
		
			
				|  |  | -                        me.sheet.suspendPaint();
 | 
	
		
			
				|  |  | -                        for(let rowIdx = info.cellRange.row; rowIdx <= info.cellRange.row + info.cellRange.rowCount -1; rowIdx ++){
 | 
	
		
			
				|  |  | -                            me.sheet.setValue(rowIdx, info.cellRange.col, '');
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        me.sheet.resumePaint();
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +        const gljCache = me.cache["_GLJ_" + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | +        const field = me.setting.header[info.cellRange.col].dataCode;
 | 
	
		
			
				|  |  | +        if (field === 'code') {
 | 
	
		
			
				|  |  | +            const pasteList = sheetCommonObj.analyzePasteData({header:[{dataCode: "code"}] }, info);
 | 
	
		
			
				|  |  | +            const codes = [];
 | 
	
		
			
				|  |  | +            for (let i = 0; i < pasteList.length; i++) {
 | 
	
		
			
				|  |  | +                let rowIdx = info.cellRange.row + i;
 | 
	
		
			
				|  |  | +                if(rowIdx < gljCache.length){//更新
 | 
	
		
			
				|  |  | +                    me.tempCacheArr.push({org: gljCache[rowIdx], newCode: pasteList[i].code});
 | 
	
		
			
				|  |  | +                    gljCache.splice(rowIdx--, 1);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                codes.push(pasteList[i].code);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            me.addGljItems(codes, pageOprObj.gljLibId, info.cellRange);
 | 
	
		
			
				|  |  | +        } else if (gljCache && info.cellRange.row < gljCache.length) {
 | 
	
		
			
				|  |  | +            const pasteList = sheetCommonObj.analyzePasteData(me.setting, info);
 | 
	
		
			
				|  |  | +            const maxCount = info.cellRange.row + info.cellRange.rowCount -1 > gljCache.length -1 ?
 | 
	
		
			
				|  |  | +                gljCache.length - info.cellRange.row : info.cellRange.rowCount;
 | 
	
		
			
				|  |  | +            const precision = me.setting.header[info.cellRange.col].precision;
 | 
	
		
			
				|  |  | +            for (let i = 0; i < maxCount; i++) {
 | 
	
		
			
				|  |  | +                let roundCons = scMathUtil.roundTo(pasteList[i][field], -precision);
 | 
	
		
			
				|  |  | +                gljCache[info.cellRange.row + i][field] = roundCons;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            me.updateRationItem(function () {
 | 
	
		
			
				|  |  | +                me.sheet.getParent().focus(true);
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            if (info.cellRange.row + info.cellRange.rowCount -1 >= gljCache.length -1) {
 | 
	
		
			
				|  |  | +                me.sheet.suspendPaint();
 | 
	
		
			
				|  |  | +                for(let rowIdx = gljCache.length; rowIdx <= info.cellRange.row + info.cellRange.rowCount -1; rowIdx++){
 | 
	
		
			
				|  |  | +                    me.sheet.setValue(rowIdx, info.cellRange.col, '');
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                me.sheet.resumePaint();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else if (info.cellRange.row >= gljCache.length) {
 | 
	
		
			
				|  |  | +            me.sheet.suspendPaint();
 | 
	
		
			
				|  |  | +            for(let rowIdx = info.cellRange.row; rowIdx <= info.cellRange.row + info.cellRange.rowCount -1; rowIdx ++){
 | 
	
		
			
				|  |  | +                me.sheet.setValue(rowIdx, info.cellRange.col, '');
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            me.sheet.resumePaint();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onEditStarting: function (sender, args) {
 | 
	
		
			
				|  |  | -        let me = rationGLJOprObj;
 | 
	
		
			
				|  |  | -        let rationSection = rationOprObj.getCache();
 | 
	
		
			
				|  |  | -        let rationRow = rationOprObj.workBook.getSheet(0).getSelections()[0].row;
 | 
	
		
			
				|  |  | +        const me = rationGLJOprObj;
 | 
	
		
			
				|  |  | +        const rationSection = rationOprObj.getCache();
 | 
	
		
			
				|  |  | +        const rationRow = rationOprObj.workBook.getSheet(0).getSelections()[0].row;
 | 
	
		
			
				|  |  |          me.currentRationItem = rationRow < rationSection.length ? rationSection[rationRow] : null;
 | 
	
		
			
				|  |  |          if(me.currentRationItem && typeof me.cache["_GLJ_" + me.currentRationItem.ID] === 'undefined'){
 | 
	
		
			
				|  |  |              me.cache["_GLJ_" + me.currentRationItem.ID] = [];
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if(!me.currentRationItem){
 | 
	
		
			
				|  |  | -            args.cancel = true;
 | 
	
		
			
				|  |  | +        const isEmptyRation = !me.currentRationItem;
 | 
	
		
			
				|  |  | +        if (isEmptyRation) {
 | 
	
		
			
				|  |  | +            return args.cancel = true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        else {
 | 
	
		
			
				|  |  | -            if(args.col !== 0 && args.col !== 5 || args.col === 5 && args.row >= me.cache["_GLJ_" + me.currentRationItem.ID].length){
 | 
	
		
			
				|  |  | -                args.cancel = true;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +        const canEditFields = ['code', 'consumeAmt', 'proportion'];
 | 
	
		
			
				|  |  | +        const emptyGLJCanEditFields = ['code'];
 | 
	
		
			
				|  |  | +        const isEmptyGLJ = args.row >= me.cache["_GLJ_" + me.currentRationItem.ID].length;
 | 
	
		
			
				|  |  | +        const editingField = me.setting.header[args.col].dataCode;
 | 
	
		
			
				|  |  | +        const isValidField =  isEmptyGLJ && emptyGLJCanEditFields.includes(editingField) || !isEmptyGLJ && canEditFields.includes(editingField);
 | 
	
		
			
				|  |  | +        if (!isValidField) {
 | 
	
		
			
				|  |  | +            return args.cancel = true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    onCellEditEnd: function(sender, args){
 | 
	
		
			
				|  |  | -        var me = rationGLJOprObj;
 | 
	
		
			
				|  |  | -        if(me.currentRationItem) {
 | 
	
		
			
				|  |  | -            var cacheArr = me.cache["_GLJ_" + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | -            me.tempCacheArr = [];
 | 
	
		
			
				|  |  | -            if (args.col != 0) {
 | 
	
		
			
				|  |  | -                if (args.row < cacheArr.length) {
 | 
	
		
			
				|  |  | -                    var editGlj = cacheArr[args.row];
 | 
	
		
			
				|  |  | -                    if (editGlj["consumeAmt"] != args.editingText) {
 | 
	
		
			
				|  |  | -                        let parseNum = parseFloat(args.editingText);
 | 
	
		
			
				|  |  | -                        if (isNaN(parseFloat(args.editingText))) {
 | 
	
		
			
				|  |  | -                            $('#alertModalBtn').click();
 | 
	
		
			
				|  |  | -                            $('#alertText').text("定额消耗只能输入数值!");
 | 
	
		
			
				|  |  | -                            $('#alertModalCls').click(function () {
 | 
	
		
			
				|  |  | -                                args.sheet.setValue(args.row, args.col, editGlj['consumeAmt']);
 | 
	
		
			
				|  |  | -                            });
 | 
	
		
			
				|  |  | -                            $('#alertModalCof').click(function () {
 | 
	
		
			
				|  |  | -                                args.sheet.setValue(args.row, args.col, editGlj['consumeAmt']);
 | 
	
		
			
				|  |  | -                            })
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        else {
 | 
	
		
			
				|  |  | -                            args.sheet.setValue(args.row, args.col, parseNum);
 | 
	
		
			
				|  |  | -                            let roundNum = scMathUtil.roundTo(parseNum, -3);
 | 
	
		
			
				|  |  | -                            editGlj["consumeAmt"] = roundNum;
 | 
	
		
			
				|  |  | -                            me.updateRationItem(function () {
 | 
	
		
			
				|  |  | -                                me.sheet.getParent().focus(true);
 | 
	
		
			
				|  |  | -                            });
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +    onCellEditEnd: function(sender, args) {
 | 
	
		
			
				|  |  | +        const me = rationGLJOprObj;
 | 
	
		
			
				|  |  | +        me.tempCacheArr = [];
 | 
	
		
			
				|  |  | +        const cacheArr = me.cache["_GLJ_" + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | +        const editingField = me.setting.header[args.col].dataCode;
 | 
	
		
			
				|  |  | +        const trimText = args.editingText ? args.editingText.trim() : '';
 | 
	
		
			
				|  |  | +        const curGLJ = cacheArr[args.row];
 | 
	
		
			
				|  |  | +        const originText = curGLJ  && !commonUtil.isEmptyVal(curGLJ[editingField]) ? String(curGLJ[editingField]) : '';
 | 
	
		
			
				|  |  | +        if (!trimText || trimText === originText) {
 | 
	
		
			
				|  |  | +            args.sheet.setValue(args.row, args.col, originText);
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (editingField === 'code') {
 | 
	
		
			
				|  |  | +            const matchGLJ = cacheArr.find((item, index) => item.code === trimText && index !== args.row);
 | 
	
		
			
				|  |  | +            if (matchGLJ) {
 | 
	
		
			
				|  |  | +                alert("该人材机已存在!");
 | 
	
		
			
				|  |  | +                args.sheet.setValue(args.row, args.col, originText);
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (args.row < cacheArr.length) { // 替换人材机
 | 
	
		
			
				|  |  | +                me.tempCacheArr.push({org: cacheArr[args.row], newCode: args.editingText.toString().trim()});
 | 
	
		
			
				|  |  | +                cacheArr.splice(args.row, 1);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            me.addGljItems([trimText], pageOprObj.gljLibId)
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            const fieldName = me.setting.header[args.col].headerName;
 | 
	
		
			
				|  |  | +            if (isNaN(trimText)) {
 | 
	
		
			
				|  |  | +                $('#alertText').text(`${fieldName}只能输入数值。`);
 | 
	
		
			
				|  |  | +                $('#alertModal').modal('show');
 | 
	
		
			
				|  |  | +                args.sheet.setValue(args.row, args.col, originText);
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | -                if (args.editingText && args.editingText.toString().trim().length !== 0) {
 | 
	
		
			
				|  |  | -                    let isExist = false;
 | 
	
		
			
				|  |  | -                    for (let i = 0, len = cacheArr.length; i < len; i++) {
 | 
	
		
			
				|  |  | -                        if (cacheArr[i].code === args.editingText && i !== args.row) {
 | 
	
		
			
				|  |  | -                            isExist = true;
 | 
	
		
			
				|  |  | -                            break;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    if (isExist) {
 | 
	
		
			
				|  |  | -                        alert("该人材机已存在!");
 | 
	
		
			
				|  |  | -                        args.sheet.setValue(args.row, args.col, typeof cacheArr[args.row] !== 'undefined' ? cacheArr[args.row].code + '' : '');
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    else {
 | 
	
		
			
				|  |  | -                        if (args.row < cacheArr.length && args.editingText !== cacheArr[args.row].code) {//更新
 | 
	
		
			
				|  |  | -                            me.tempCacheArr.push({org: cacheArr[args.row], newCode: args.editingText.toString().trim()});
 | 
	
		
			
				|  |  | -                            cacheArr.splice(args.row, 1);
 | 
	
		
			
				|  |  | -                            let gljLibID = pageOprObj.gljLibId;
 | 
	
		
			
				|  |  | -                            let codes = [];
 | 
	
		
			
				|  |  | -                            codes.push(args.editingText.toString().trim());
 | 
	
		
			
				|  |  | -                            me.addGljItems(codes, gljLibID, args);
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        else if (args.row >= cacheArr.length) {//新增
 | 
	
		
			
				|  |  | -                            let gljLibID = pageOprObj.gljLibId;
 | 
	
		
			
				|  |  | -                            if (gljLibID) {
 | 
	
		
			
				|  |  | -                                var codes = [];
 | 
	
		
			
				|  |  | -                                codes.push(args.editingText.toString().trim());
 | 
	
		
			
				|  |  | -                                me.addGljItems(codes, gljLibID, args);
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                else {
 | 
	
		
			
				|  |  | -                    args.sheet.setValue(args.row, args.col, args.row < cacheArr.length ? cacheArr[args.row].code : '');
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +                const precision = me.setting.header[args.col].precision;
 | 
	
		
			
				|  |  | +                const roundText = scMathUtil.roundTo(trimText, -precision);
 | 
	
		
			
				|  |  | +                curGLJ[editingField] = roundText;
 | 
	
		
			
				|  |  | +                me.updateRationItem(function () {
 | 
	
		
			
				|  |  | +                    me.sheet.getParent().focus(true);
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        else {
 | 
	
		
			
				|  |  | -            args.sheet.setValue(args.row, args.col, '');
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onContextmenuOpr: function () {//右键菜单
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
	
		
			
				|  | @@ -291,57 +234,58 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |                  //控制允许右键菜单在哪个位置出现
 | 
	
		
			
				|  |  |                  let target = SheetDataHelper.safeRightClickSelection($triggerElement, e, me.sheet.getParent());
 | 
	
		
			
				|  |  |                  let sheet = me.sheet;
 | 
	
		
			
				|  |  | -                let addDis = false, delDis = false;
 | 
	
		
			
				|  |  | -                let rationGlj = [];
 | 
	
		
			
				|  |  |                  if(me.sheet.getParent().getActiveSheetIndex() === 0 && target.hitTestType === 3){//在表格内&& typeof target.row !== 'undefined' && typeof target.col !== 'undefined'
 | 
	
		
			
				|  |  |                      //rationGlj表
 | 
	
		
			
				|  |  |                      if(typeof target.row !== 'undefined'){
 | 
	
		
			
				|  |  |                          //控制按钮是否可用
 | 
	
		
			
				|  |  |                          sheet.setActiveCell(target.row, target.col);
 | 
	
		
			
				|  |  | -                        console.log(me.currentRationItem);
 | 
	
		
			
				|  |  | -                        if(me.currentRationItem){
 | 
	
		
			
				|  |  | -                            rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | -                            if(!rationGlj ||target.row >= rationGlj.length){//右键定位在有数据的行,删除键才显示可用
 | 
	
		
			
				|  |  | -                                delDis = true;
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                            else{//有数据
 | 
	
		
			
				|  |  | -                                if(typeof target.col === 'undefined'){//定位不在表格内
 | 
	
		
			
				|  |  | -                                    delDis = true;
 | 
	
		
			
				|  |  | -                                }
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        else{
 | 
	
		
			
				|  |  | -                            addDis = true;
 | 
	
		
			
				|  |  | -                            delDis = true;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    else{
 | 
	
		
			
				|  |  | -                        addDis = true;
 | 
	
		
			
				|  |  | -                        delDis = true;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      return {
 | 
	
		
			
				|  |  |                          callback: function(){},
 | 
	
		
			
				|  |  |                          items: {
 | 
	
		
			
				|  |  | -                            "add": {name: "添加人材机", disabled: addDis, icon: "fa-plus", callback: function (key, opt) {
 | 
	
		
			
				|  |  | -                                //默认radio所有工料机
 | 
	
		
			
				|  |  | -                                gljSelOprObj.initRadio();
 | 
	
		
			
				|  |  | -                                gljSelOprObj.gljCurTypeId = null;
 | 
	
		
			
				|  |  | -                                //默认点击树根节点
 | 
	
		
			
				|  |  | -                                if(gljSelOprObj.rootNode){
 | 
	
		
			
				|  |  | -                                    gljSelOprObj.treeObj.selectNode(gljSelOprObj.rootNode);
 | 
	
		
			
				|  |  | -                                    gljSelTreeOprObj.setting.callback.onClick(null, 'componentTree', gljSelOprObj.rootNode);
 | 
	
		
			
				|  |  | -                                }
 | 
	
		
			
				|  |  | -                                //弹出窗口
 | 
	
		
			
				|  |  | -                                $('#selGlj').modal('show');
 | 
	
		
			
				|  |  | -                            }},
 | 
	
		
			
				|  |  | -                            "delete": {name: "删除人材机", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
 | 
	
		
			
				|  |  | -                                rationGlj.splice(target.row, 1);
 | 
	
		
			
				|  |  | -                                me.updateRationItem(function(){
 | 
	
		
			
				|  |  | -                                    me.sheet.getParent().focus();
 | 
	
		
			
				|  |  | -                                });
 | 
	
		
			
				|  |  | -                                sheetCommonObj.cleanData(me.sheet, me.setting, -1);
 | 
	
		
			
				|  |  | -                                me.showGljItems(me.currentRationItem.ID);
 | 
	
		
			
				|  |  | -                            }},
 | 
	
		
			
				|  |  | +                            "add": {
 | 
	
		
			
				|  |  | +                                name: "添加人材机",
 | 
	
		
			
				|  |  | +                                disabled: function () {
 | 
	
		
			
				|  |  | +                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
 | 
	
		
			
				|  |  | +                                    if (locked || inValidCell || !me.currentRationItem) {
 | 
	
		
			
				|  |  | +                                        return true;
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                    return false;
 | 
	
		
			
				|  |  | +                                },
 | 
	
		
			
				|  |  | +                                icon: "fa-plus",
 | 
	
		
			
				|  |  | +                                callback: function (key, opt) {
 | 
	
		
			
				|  |  | +                                    //默认radio所有工料机
 | 
	
		
			
				|  |  | +                                    gljSelOprObj.initRadio();
 | 
	
		
			
				|  |  | +                                    gljSelOprObj.gljCurTypeId = null;
 | 
	
		
			
				|  |  | +                                    //默认点击树根节点
 | 
	
		
			
				|  |  | +                                    if(gljSelOprObj.rootNode){
 | 
	
		
			
				|  |  | +                                        gljSelOprObj.treeObj.selectNode(gljSelOprObj.rootNode);
 | 
	
		
			
				|  |  | +                                        gljSelTreeOprObj.setting.callback.onClick(null, 'componentTree', gljSelOprObj.rootNode);
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                    //弹出窗口
 | 
	
		
			
				|  |  | +                                    $('#selGlj').modal('show');
 | 
	
		
			
				|  |  | +                                }},
 | 
	
		
			
				|  |  | +                            "delete": {
 | 
	
		
			
				|  |  | +                                name: "删除人材机",
 | 
	
		
			
				|  |  | +                                disabled: function () {
 | 
	
		
			
				|  |  | +                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
 | 
	
		
			
				|  |  | +                                    const rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | +                                    const inValidData = !rationGlj || target.row >= rationGlj.length;
 | 
	
		
			
				|  |  | +                                    if (locked || inValidCell || !me.currentRationItem || inValidData) {
 | 
	
		
			
				|  |  | +                                        return true;
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                    return false;
 | 
	
		
			
				|  |  | +                                },
 | 
	
		
			
				|  |  | +                                icon: "fa-remove",
 | 
	
		
			
				|  |  | +                                callback: function (key, opt) {
 | 
	
		
			
				|  |  | +                                    const rationGlj =  me.cache['_GLJ_' + me.currentRationItem.ID];
 | 
	
		
			
				|  |  | +                                    rationGlj.splice(target.row, 1);
 | 
	
		
			
				|  |  | +                                    me.updateRationItem(function(){
 | 
	
		
			
				|  |  | +                                        me.sheet.getParent().focus();
 | 
	
		
			
				|  |  | +                                    });
 | 
	
		
			
				|  |  | +                                    sheetCommonObj.cleanData(me.sheet, me.setting, -1);
 | 
	
		
			
				|  |  | +                                    me.showGljItems(me.currentRationItem.ID);
 | 
	
		
			
				|  |  | +                                }},
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      };
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -349,55 +293,65 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |                  else if(me.sheet.getParent().getActiveSheetIndex() === 2 && target.hitTestType === 3 && typeof target.row !== 'undefined' && typeof target.col !== 'undefined'){
 | 
	
		
			
				|  |  |                      let currentCache = raCoe.curRation && raCoe.isDef(raCoe.cache["_Coe_" + raCoe.curRation.ID])  ? raCoe.cache["_Coe_" + raCoe.curRation.ID] : [];
 | 
	
		
			
				|  |  |                      sheet.setActiveCell(target.row, target.col);
 | 
	
		
			
				|  |  | -                    //控制按钮是否可用
 | 
	
		
			
				|  |  | -                    let upDis = false,
 | 
	
		
			
				|  |  | -                        downDis = false,
 | 
	
		
			
				|  |  | -                        refDis = false;
 | 
	
		
			
				|  |  | -                    if(target.row >= currentCache.length){
 | 
	
		
			
				|  |  | -                        upDis = true;
 | 
	
		
			
				|  |  | -                        downDis = true;
 | 
	
		
			
				|  |  | -                        refDis = true;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    else {
 | 
	
		
			
				|  |  | -                        if(!raCoe.isDef(currentCache[target.row - 1])){
 | 
	
		
			
				|  |  | -                            upDis = true;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        if(!raCoe.isDef(currentCache[target.row + 1])){
 | 
	
		
			
				|  |  | -                            downDis = true;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  |                      return {
 | 
	
		
			
				|  |  |                          callback: function(){},
 | 
	
		
			
				|  |  |                          items: {
 | 
	
		
			
				|  |  | -                            "upMove": {name: "上移", disabled: upDis, icon: "fa-arrow-up", callback: function (key, opt) {
 | 
	
		
			
				|  |  | -                                raCoe.upMove(currentCache[target.row], currentCache[target.row - 1], {row: target.row - 1, col: target.col});
 | 
	
		
			
				|  |  | -                            }},
 | 
	
		
			
				|  |  | -                            "downMove": {name: "下移", disabled: downDis, icon: "fa-arrow-down", callback: function (key, opt) {
 | 
	
		
			
				|  |  | -                                raCoe.downMove(currentCache[target.row], currentCache[target.row + 1], {row: target.row + 1, col: target.col});
 | 
	
		
			
				|  |  | -                            }},
 | 
	
		
			
				|  |  | -                            "ref": {name: "添加到本节其他定额", disabled: refDis, icon: "fa-arrow-left", callback: function (key, opt) {
 | 
	
		
			
				|  |  | -                                raCoe.updateSectionRation(rationOprObj.currentRations["_SEC_ID_" + rationOprObj.currentSectionId], currentCache[target.row], function (updateArr) {
 | 
	
		
			
				|  |  | -                                    for(let i = 0, len = updateArr.length; i < len; i++){
 | 
	
		
			
				|  |  | -                                        let ration = updateArr[i];
 | 
	
		
			
				|  |  | -                                        let rationCoeList = updateArr[i].rationCoeList;
 | 
	
		
			
				|  |  | -                                        let newNo = 1;
 | 
	
		
			
				|  |  | -                                        for(let j = 0, jLen = rationCoeList.length; j < jLen; j++){
 | 
	
		
			
				|  |  | -                                            if(rationCoeList[j].no >= newNo){
 | 
	
		
			
				|  |  | -                                                newNo = rationCoeList[j].no + 1;
 | 
	
		
			
				|  |  | +                            "upMove": {
 | 
	
		
			
				|  |  | +                                name: "上移",
 | 
	
		
			
				|  |  | +                                disabled: function () {
 | 
	
		
			
				|  |  | +                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
 | 
	
		
			
				|  |  | +                                    const inValidData = target.row >= currentCache.length || !raCoe.isDef(currentCache[target.row - 1]);
 | 
	
		
			
				|  |  | +                                    return locked || inValidCell || inValidData
 | 
	
		
			
				|  |  | +                                },
 | 
	
		
			
				|  |  | +                                icon: "fa-arrow-up",
 | 
	
		
			
				|  |  | +                                callback: function (key, opt) {
 | 
	
		
			
				|  |  | +                                    raCoe.upMove(currentCache[target.row], currentCache[target.row - 1], {row: target.row - 1, col: target.col});
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            },
 | 
	
		
			
				|  |  | +                            "downMove": {
 | 
	
		
			
				|  |  | +                                name: "下移",
 | 
	
		
			
				|  |  | +                                disabled: function () {
 | 
	
		
			
				|  |  | +                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
 | 
	
		
			
				|  |  | +                                    const inValidData = target.row >= currentCache.length || !raCoe.isDef(currentCache[target.row + 1]);
 | 
	
		
			
				|  |  | +                                    return locked || inValidCell || inValidData;
 | 
	
		
			
				|  |  | +                                },
 | 
	
		
			
				|  |  | +                                icon: "fa-arrow-down",
 | 
	
		
			
				|  |  | +                                callback: function (key, opt) {
 | 
	
		
			
				|  |  | +                                    raCoe.downMove(currentCache[target.row], currentCache[target.row + 1], {row: target.row + 1, col: target.col});
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            },
 | 
	
		
			
				|  |  | +                            "ref": {
 | 
	
		
			
				|  |  | +                                name: "添加到本节其他定额",
 | 
	
		
			
				|  |  | +                                disabled: function () {
 | 
	
		
			
				|  |  | +                                    const inValidCell = !commonUtil.isDef(target.row) || !commonUtil.isDef(target.col);
 | 
	
		
			
				|  |  | +                                    const inValidData = target.row >= currentCache.length;
 | 
	
		
			
				|  |  | +                                    return locked || inValidCell || inValidData;
 | 
	
		
			
				|  |  | +                                },
 | 
	
		
			
				|  |  | +                                icon: "fa-arrow-left",
 | 
	
		
			
				|  |  | +                                callback: function (key, opt) {
 | 
	
		
			
				|  |  | +                                    raCoe.updateSectionRation(rationOprObj.currentRations["_SEC_ID_" + rationOprObj.currentSectionId], currentCache[target.row], function (updateArr) {
 | 
	
		
			
				|  |  | +                                        for(let i = 0, len = updateArr.length; i < len; i++){
 | 
	
		
			
				|  |  | +                                            let ration = updateArr[i];
 | 
	
		
			
				|  |  | +                                            let rationCoeList = updateArr[i].rationCoeList;
 | 
	
		
			
				|  |  | +                                            let newNo = 1;
 | 
	
		
			
				|  |  | +                                            for(let j = 0, jLen = rationCoeList.length; j < jLen; j++){
 | 
	
		
			
				|  |  | +                                                if(rationCoeList[j].no >= newNo){
 | 
	
		
			
				|  |  | +                                                    newNo = rationCoeList[j].no + 1;
 | 
	
		
			
				|  |  | +                                                }
 | 
	
		
			
				|  |  |                                              }
 | 
	
		
			
				|  |  | -                                        }
 | 
	
		
			
				|  |  | -                                        let theCache = raCoe.cache["_Coe_" + ration.ID];
 | 
	
		
			
				|  |  | -                                        if(theCache !== undefined && theCache !== null){
 | 
	
		
			
				|  |  | -                                            let newCoe = {};
 | 
	
		
			
				|  |  | -                                            for(let attr in currentCache[target.row]){
 | 
	
		
			
				|  |  | -                                                newCoe[attr] = currentCache[target.row][attr];
 | 
	
		
			
				|  |  | +                                            let theCache = raCoe.cache["_Coe_" + ration.ID];
 | 
	
		
			
				|  |  | +                                            if(theCache !== undefined && theCache !== null){
 | 
	
		
			
				|  |  | +                                                let newCoe = {};
 | 
	
		
			
				|  |  | +                                                for(let attr in currentCache[target.row]){
 | 
	
		
			
				|  |  | +                                                    newCoe[attr] = currentCache[target.row][attr];
 | 
	
		
			
				|  |  | +                                                }
 | 
	
		
			
				|  |  | +                                                newCoe.no = newNo;
 | 
	
		
			
				|  |  | +                                                theCache.push(newCoe);
 | 
	
		
			
				|  |  |                                              }
 | 
	
		
			
				|  |  | -                                            newCoe.no = newNo;
 | 
	
		
			
				|  |  | -                                            theCache.push(newCoe);
 | 
	
		
			
				|  |  |                                          }
 | 
	
		
			
				|  |  | -                                    }
 | 
	
		
			
				|  |  | -                                });
 | 
	
		
			
				|  |  | -                            }}
 | 
	
		
			
				|  |  | +                                    });
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      };
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -423,7 +377,7 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return rst;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    addGljItems: function(codes, repId, args) {
 | 
	
		
			
				|  |  | +    addGljItems: function(codes, repId) {
 | 
	
		
			
				|  |  |          var me = this;
 | 
	
		
			
				|  |  |          $.ajax({
 | 
	
		
			
				|  |  |              type:"POST",
 | 
	
	
		
			
				|  | @@ -547,7 +501,11 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |          if (me.currentRationItem && me.cache["_GLJ_" + me.currentRationItem.ID]) {
 | 
	
		
			
				|  |  |              var cacheArr = me.cache["_GLJ_" + me.currentRationItem.ID];
 | 
	
		
			
				|  |  |              for (var i = 0; i < cacheArr.length; i++) {
 | 
	
		
			
				|  |  | -                rst.push({gljId: cacheArr[i].gljId, consumeAmt: cacheArr[i].consumeAmt, proportion: 0});
 | 
	
		
			
				|  |  | +                rst.push({
 | 
	
		
			
				|  |  | +                    gljId: cacheArr[i].gljId,
 | 
	
		
			
				|  |  | +                    consumeAmt: cacheArr[i].consumeAmt,
 | 
	
		
			
				|  |  | +                    proportion: cacheArr[i].proportion
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return rst;
 | 
	
	
		
			
				|  | @@ -557,6 +515,7 @@ var rationGLJOprObj = {
 | 
	
		
			
				|  |  |          var rst = {};
 | 
	
		
			
				|  |  |          rst.gljId = rItem.gljId;
 | 
	
		
			
				|  |  |          rst.consumeAmt = rItem.consumeAmt;
 | 
	
		
			
				|  |  | +        rst.proportion = rItem.proportion;
 | 
	
		
			
				|  |  |          rst.code = repGlj.code;
 | 
	
		
			
				|  |  |          rst.name = repGlj.name;
 | 
	
		
			
				|  |  |          rst.specs = repGlj.specs;
 |