|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * Created by Tony on 2017/4/28.
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  const digital = {
 | 
	
		
			
				|  |  |      gljPrc: -3,//计算定额基价时单个工料机价格取三位
 | 
	
		
			
				|  |  |      rationBasePrc: -2,
 | 
	
	
		
			
				|  | @@ -12,18 +13,17 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |      currentEditingRation: null,
 | 
	
		
			
				|  |  |      currentSectionId: -1,
 | 
	
		
			
				|  |  |      rationsCodes: [],
 | 
	
		
			
				|  |  | -    type: {std: 'std', complementary: 'complementary'},
 | 
	
		
			
				|  |  |      setting: {
 | 
	
		
			
				|  |  |          header:[
 | 
	
		
			
				|  |  | -            {headerName:"编码",headerWidth:120,dataCode:"code", dataType: "String", formatter: "@"},
 | 
	
		
			
				|  |  | -            {headerName:"名称",headerWidth:280,dataCode:"name", dataType: "String"},
 | 
	
		
			
				|  |  | -            {headerName:"计量单位",headerWidth:120,dataCode:"unit", dataType: "String", hAlign: "center"},
 | 
	
		
			
				|  |  | -            {headerName:"人工费",headerWidth:120,dataCode:"labourPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
 | 
	
		
			
				|  |  | -            {headerName:"材料费",headerWidth:120,dataCode:"materialPrice", dataType: "Number", formatter: "0.00",  hAlign: "right"},
 | 
	
		
			
				|  |  | -            {headerName:"机械费",headerWidth:120,dataCode:"machinePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
 | 
	
		
			
				|  |  | -            {headerName:"基价",headerWidth:120,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
 | 
	
		
			
				|  |  | -            {headerName:"显示名称(以%s表示参数)",headerWidth:280,dataCode:"caption", dataType: "String"},
 | 
	
		
			
				|  |  | -            {headerName:"取费专业",headerWidth:100,dataCode:"feeType", dataType: "Number", hAlign: "center"}
 | 
	
		
			
				|  |  | +            {headerName:"编码",headerWidth:70,dataCode:"code", dataType: "String", formatter: "@"},
 | 
	
		
			
				|  |  | +            {headerName:"名称",headerWidth:240,dataCode:"name", dataType: "String"},
 | 
	
		
			
				|  |  | +            {headerName:"计量单位",headerWidth:70,dataCode:"unit", dataType: "String", hAlign: "center"},
 | 
	
		
			
				|  |  | +            {headerName:"人工费",headerWidth:80,dataCode:"labourPrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
 | 
	
		
			
				|  |  | +            {headerName:"材料费",headerWidth:80,dataCode:"materialPrice", dataType: "Number", formatter: "0.00",  hAlign: "right"},
 | 
	
		
			
				|  |  | +            {headerName:"机械费",headerWidth:80,dataCode:"machinePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
 | 
	
		
			
				|  |  | +            {headerName:"基价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right"},
 | 
	
		
			
				|  |  | +            {headerName:"显示名称(以%s表示参数)",headerWidth:240,dataCode:"caption", dataType: "String"},
 | 
	
		
			
				|  |  | +            {headerName:"取费专业",headerWidth:70,dataCode:"feeType", dataType: "Number", hAlign: "center"}
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  |          view:{
 | 
	
		
			
				|  |  |              comboBox:[
 | 
	
	
		
			
				|  | @@ -41,7 +41,6 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |          let rationRepId = getQueryString("repository");
 | 
	
		
			
				|  |  |          let me = rationOprObj;
 | 
	
		
			
				|  |  |          me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
 | 
	
		
			
				|  |  | -        sheetCommonObj.spreadDefaultStyle(me.workBook);
 | 
	
		
			
				|  |  |          sheetCommonObj.bindEscKey(me.workBook, [{sheet: me.workBook.getSheet(0), editStarting: me.onCellEditStart, editEnded: me.onCellEditEnd}]);
 | 
	
		
			
				|  |  |          me.getRationsCodes(rationRepId);
 | 
	
		
			
				|  |  |          me.onContextmenuOpr();
 | 
	
	
		
			
				|  | @@ -74,37 +73,50 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |              me.rationSelInit(row);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    rationSelInit: function (row) {
 | 
	
		
			
				|  |  | +    //focusOnSection将工作簿焦点移到章节表上
 | 
	
		
			
				|  |  | +    rationSelInit: function (row, focusOnSection = null) {
 | 
	
		
			
				|  |  |          let me = rationOprObj,
 | 
	
		
			
				|  |  |              sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
 | 
	
		
			
				|  |  |              sheetCoe = rationCoeOprObj.sheet, settingCoe = rationCoeOprObj.setting,
 | 
	
		
			
				|  |  |              sheetAss = rationAssistOprObj.sheet, settingAss = rationAssistOprObj.setting,
 | 
	
		
			
				|  |  |              sheetInst = rationInstObj.sheet, settingInst = rationInstObj.setting;
 | 
	
		
			
				|  |  | -        sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
 | 
	
		
			
				|  |  | -        sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
 | 
	
		
			
				|  |  | -        sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
 | 
	
		
			
				|  |  | -        sheetCommonObj.cleanSheet(sheetInst, settingInst, -1);
 | 
	
		
			
				|  |  | +        sheetCommonObj.cleanData(sheetGLJ, settingGLJ, -1);
 | 
	
		
			
				|  |  | +        sheetCommonObj.cleanData(sheetCoe, settingCoe, -1);
 | 
	
		
			
				|  |  | +        sheetCommonObj.cleanData(sheetAss, settingAss, -1);
 | 
	
		
			
				|  |  | +        sheetCommonObj.cleanData(sheetInst, settingInst, -1);
 | 
	
		
			
				|  |  |          let cacheSection = me.getCache();
 | 
	
		
			
				|  |  |          if (cacheSection && row < cacheSection.length) {
 | 
	
		
			
				|  |  |              rationGLJOprObj.getGljItems(cacheSection[row], function () {
 | 
	
		
			
				|  |  | -                me.workBook.focus(true);
 | 
	
		
			
				|  |  | +                if (focusOnSection){
 | 
	
		
			
				|  |  | +                    sectionTreeObj.workBook.focus(true);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    me.workBook.focus(true);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |              rationCoeOprObj.getCoeItems(cacheSection[row], function () {
 | 
	
		
			
				|  |  | -                me.workBook.focus(true);
 | 
	
		
			
				|  |  | +                if (focusOnSection){
 | 
	
		
			
				|  |  | +                    sectionTreeObj.workBook.focus(true);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    me.workBook.focus(true);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |              rationAssistOprObj.getAssItems(cacheSection[row]);
 | 
	
		
			
				|  |  |              rationInstObj.getInstItems(cacheSection[row], function () {
 | 
	
		
			
				|  |  | -                me.workBook.focus(true);
 | 
	
		
			
				|  |  | +                if (focusOnSection){
 | 
	
		
			
				|  |  | +                    sectionTreeObj.workBook.focus(true);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    me.workBook.focus(true);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          else {
 | 
	
		
			
				|  |  |              rationGLJOprObj.currentRationItem = null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        me.workBook.focus(true);
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | -    isDef: function (v) {
 | 
	
		
			
				|  |  | -        return v !== undefined && v !== null;
 | 
	
		
			
				|  |  | +        if (!focusOnSection) {
 | 
	
		
			
				|  |  | +            me.workBook.focus(true);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      isInt: function (num) {
 | 
	
		
			
				|  |  |          return !isNaN(num) && num % 1 === 0;
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -137,6 +149,7 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                          cacheSection[j]["rationGljList"] = rstData.ops[i]["rationGljList"];
 | 
	
		
			
				|  |  |                          cacheSection[j]["rationCoeList"] = rstData.ops[i]["rationCoeList"];
 | 
	
		
			
				|  |  |                          cacheSection[j]["rationAssList"] = rstData.ops[i]["rationAssList"];
 | 
	
		
			
				|  |  | +                        cacheSection[j]["rationInstList"] = rstData.ops[i]["rationInstList"];
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -145,21 +158,25 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |              for (let j = 0; j < cacheSection.length; j++) {
 | 
	
		
			
				|  |  |                  if (updateArr[i]["ID"] && cacheSection[j]["ID"]) {
 | 
	
		
			
				|  |  |                      if (cacheSection[j]["ID"] == updateArr[i]["ID"]) {
 | 
	
		
			
				|  |  | -                        updateArr[i]['rationGljList'] = rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] ? rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] : [];
 | 
	
		
			
				|  |  | -                        updateArr[i]['rationCoeList'] = rationCoeOprObj.cache['_Coe_' + cacheSection[j]['ID']] ? rationCoeOprObj.cache['_Coe_' + cacheSection[j]['ID']] : [];
 | 
	
		
			
				|  |  | +                        updateArr[i]['rationGljList'] = rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] ?
 | 
	
		
			
				|  |  | +                            rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] :
 | 
	
		
			
				|  |  | +                            cacheSection[j]['rationGljList'] ?
 | 
	
		
			
				|  |  | +                                cacheSection[j]['rationGljList'] : [];
 | 
	
		
			
				|  |  | +                        updateArr[i]['rationCoeList'] = cacheSection[j]['rationCoeList'] ? cacheSection[j]['rationCoeList'] : [];
 | 
	
		
			
				|  |  |                          updateArr[i]['rationAssList'] = cacheSection[j]['rationAssList'];
 | 
	
		
			
				|  |  |                          updateArr[i]['rationInstList'] = cacheSection[j]['rationInstList'];
 | 
	
		
			
				|  |  |                          cacheSection[j] = updateArr[i];
 | 
	
		
			
				|  |  | -                        cacheSection[j].type = me.type.complementary;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      if (cacheSection[j][me.setting.header[0].dataCode] == updateArr[i][me.setting.header[0].dataCode]) {
 | 
	
		
			
				|  |  | -                        updateArr[i]['rationGljList'] = rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] ? rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] : [];
 | 
	
		
			
				|  |  | -                        updateArr[i]['rationCoeList'] = rationCoeOprObj.cache['_Coe_' + cacheSection[j]['ID']] ? rationCoeOprObj.cache['_Coe_' + cacheSection[j]['ID']] : [];
 | 
	
		
			
				|  |  | +                        updateArr[i]['rationGljList'] = rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] ?
 | 
	
		
			
				|  |  | +                            rationGLJOprObj.cache['_GLJ_' + cacheSection[j]['ID']] :
 | 
	
		
			
				|  |  | +                            cacheSection[j]['rationGljList'] ?
 | 
	
		
			
				|  |  | +                                cacheSection[j]['rationGljList'] : [];
 | 
	
		
			
				|  |  | +                        updateArr[i]['rationCoeList'] = cacheSection[j]['rationCoeList'] ? cacheSection[j]['rationCoeList'] : [];
 | 
	
		
			
				|  |  |                          updateArr[i]['rationAssList'] = cacheSection[j]['rationAssList'];
 | 
	
		
			
				|  |  |                          updateArr[i]['rationInstList'] = cacheSection[j]['rationInstList'];
 | 
	
		
			
				|  |  |                          cacheSection[j] = updateArr[i];
 | 
	
		
			
				|  |  | -                        cacheSection[j].type = me.type.complementary;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -188,9 +205,6 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                              if(typeof target.col === 'undefined'){//定位不在表格内
 | 
	
		
			
				|  |  |                                  delDis = true;
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  | -                            else {
 | 
	
		
			
				|  |  | -                                delDis = ration.type === 'std' ? true : false;
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      else{
 | 
	
	
		
			
				|  | @@ -200,9 +214,17 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                          callback: function(){},
 | 
	
		
			
				|  |  |                          items: {
 | 
	
		
			
				|  |  |                              "delete": {name: "删除", disabled: delDis, icon: "fa-remove", callback: function (key, opt) {
 | 
	
		
			
				|  |  | -                                me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
 | 
	
		
			
				|  |  | -                                me.mixDel = 1;
 | 
	
		
			
				|  |  | -                                me.mixUpdateRequest([], [], [ration.ID]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                let removeInfo = `确定要删除定额 “${ration.code}” 及其下的所有数据吗?`;
 | 
	
		
			
				|  |  | +                                $('#delRationAlert').find('.modal-body h5').text(removeInfo);
 | 
	
		
			
				|  |  | +                                $('#delRationAlert').modal('show');
 | 
	
		
			
				|  |  | +                                $('#delRationConfirm').bind('click', function () {
 | 
	
		
			
				|  |  | +                                    me.rationsCodes.splice(me.rationsCodes.indexOf(ration.code.toString()), 1);
 | 
	
		
			
				|  |  | +                                    me.mixDel = 1;
 | 
	
		
			
				|  |  | +                                    me.mixUpdateRequest([], [], [ration.ID]);
 | 
	
		
			
				|  |  | +                                    $('#delRationConfirm').unbind('click');
 | 
	
		
			
				|  |  | +                                    $('#delRationAlert').modal('hide');
 | 
	
		
			
				|  |  | +                                });
 | 
	
		
			
				|  |  |                              }}
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      };
 | 
	
	
		
			
				|  | @@ -218,21 +240,23 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |          me.workBook.commandManager().register('rationDelete', function () {
 | 
	
		
			
				|  |  |              let rationSheet = me.workBook.getActiveSheet();
 | 
	
		
			
				|  |  |              let sels = rationSheet.getSelections(), updateArr = [], removeArr = [], lockCols = me.setting.view.lockColumns;
 | 
	
		
			
				|  |  | +            let removeCodes = [];
 | 
	
		
			
				|  |  |              let cacheSection = me.getCache();
 | 
	
		
			
				|  |  |              if(sels.length > 0){
 | 
	
		
			
				|  |  |                  for(let sel = 0; sel < sels.length; sel++){
 | 
	
		
			
				|  |  |                      if(sels[sel].colCount === me.setting.header.length){
 | 
	
		
			
				|  |  |                          if(cacheSection){
 | 
	
		
			
				|  |  |                              for(let i = 0; i < sels[sel].rowCount; i++){
 | 
	
		
			
				|  |  | -                                if(sels[sel].row + i < cacheSection.length && cacheSection[sels[sel].row + i].type !== me.type.std){
 | 
	
		
			
				|  |  | +                                if(sels[sel].row + i < cacheSection.length){
 | 
	
		
			
				|  |  |                                      removeArr.push(cacheSection[sels[sel].row + i].ID);
 | 
	
		
			
				|  |  | +                                    removeCodes.push(cacheSection[sels[sel].row + i].code);
 | 
	
		
			
				|  |  |                                      me.rationsCodes.splice(me.rationsCodes.indexOf(cacheSection[sels[sel].row + i].code.toString()), 1);
 | 
	
		
			
				|  |  |                                  }
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      else{
 | 
	
		
			
				|  |  | -                        if(sels[sel].col === 0 && me.isDef(cacheSection[sels[sel].row]) && cacheSection[sels[sel].row].type !== me.type.std){
 | 
	
		
			
				|  |  | +                        if(sels[sel].col === 0){
 | 
	
		
			
				|  |  |                              $('#alertText').text("编号不能为空,修改失败!");
 | 
	
		
			
				|  |  |                              $('#alertModalBtn').click();
 | 
	
		
			
				|  |  |                              $('#alertModalCls').click(function () {
 | 
	
	
		
			
				|  | @@ -245,12 +269,12 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                                  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 && cacheSection[sels[sel].row + i].type !== me.type.std){
 | 
	
		
			
				|  |  | +                                            if(lockCols.indexOf(col) === -1){
 | 
	
		
			
				|  |  |                                                  cacheSection[sels[sel].row + i][me.setting.header[col].dataCode] = '';
 | 
	
		
			
				|  |  |                                              }
 | 
	
		
			
				|  |  |                                          }
 | 
	
		
			
				|  |  |                                      }
 | 
	
		
			
				|  |  | -                                    if(me.isDef(cacheSection[sels[sel].row + i]) && cacheSection[sels[sel].row + i].type !== me.type.std){
 | 
	
		
			
				|  |  | +                                    if(cacheSection[sels[sel].row + i] && typeof cacheSection[sels[sel].row + i] !== 'undefined'){
 | 
	
		
			
				|  |  |                                          updateArr.push(cacheSection[sels[sel].row + i]);
 | 
	
		
			
				|  |  |                                      }
 | 
	
		
			
				|  |  |                                  }
 | 
	
	
		
			
				|  | @@ -259,10 +283,25 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            if(updateArr.length > 0 || removeArr.length > 0){
 | 
	
		
			
				|  |  | +            /*  if(updateArr.length > 0 || removeArr.length > 0){
 | 
	
		
			
				|  |  | +             me.mixUpdate = 1;
 | 
	
		
			
				|  |  | +             me.mixDel = removeArr.length > 0 ? 1 : 0;
 | 
	
		
			
				|  |  | +             me.mixUpdateRequest(updateArr, [], removeArr);
 | 
	
		
			
				|  |  | +             }*/
 | 
	
		
			
				|  |  | +            if(updateArr.length > 0){
 | 
	
		
			
				|  |  |                  me.mixUpdate = 1;
 | 
	
		
			
				|  |  | -                me.mixDel = removeArr.length > 0 ? 1 : 0;
 | 
	
		
			
				|  |  | -                me.mixUpdateRequest(updateArr, [], removeArr);
 | 
	
		
			
				|  |  | +                me.mixUpdateRequest(updateArr, [], []);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(removeArr.length > 0){
 | 
	
		
			
				|  |  | +                let removeInfo = `确定要删除定额 “${removeCodes.join(',')}” 及其下的所有数据吗?`;
 | 
	
		
			
				|  |  | +                $('#delRationAlert').find('.modal-body h5').text(removeInfo);
 | 
	
		
			
				|  |  | +                $('#delRationAlert').modal('show');
 | 
	
		
			
				|  |  | +                $('#delRationConfirm').bind('click', function () {
 | 
	
		
			
				|  |  | +                    me.mixDel = 1;
 | 
	
		
			
				|  |  | +                    me.mixUpdateRequest([], [], removeArr);
 | 
	
		
			
				|  |  | +                    $('#delRationConfirm').unbind('click');
 | 
	
		
			
				|  |  | +                    $('#delRationAlert').modal('hide');
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          });
 | 
	
	
		
			
				|  | @@ -311,14 +350,13 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onCellEditStart: function(sender, args) {
 | 
	
		
			
				|  |  |          let me = rationOprObj;
 | 
	
		
			
				|  |  | -        let cacheSection = me.getCache();
 | 
	
		
			
				|  |  | -        if(!me.canRations || me.setting.view.lockColumns.indexOf(args.col) !== -1
 | 
	
		
			
				|  |  | -        || (me.isDef(cacheSection[args.row]) && cacheSection[args.row].type === me.type.std)){
 | 
	
		
			
				|  |  | +        if(!me.canRations || me.setting.view.lockColumns.indexOf(args.col) !== -1){
 | 
	
		
			
				|  |  |              args.cancel = true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          else{
 | 
	
		
			
				|  |  |              let rObj = sheetsOprObj.combineRationRowData(me.workBook.getSheet(0), me.setting, args.row);
 | 
	
		
			
				|  |  |              me.currentEditingRation = rObj;
 | 
	
		
			
				|  |  | +            let cacheSection = me.getCache();
 | 
	
		
			
				|  |  |              if (cacheSection) {
 | 
	
		
			
				|  |  |                  for (let j = 0; j < cacheSection.length; j++) {
 | 
	
		
			
				|  |  |                      if (cacheSection[j][me.setting.header[0].dataCode] == rObj[me.setting.header[0].dataCode]) {
 | 
	
	
		
			
				|  | @@ -387,6 +425,9 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                              rObj.annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          me.setInitPrc(rObj);
 | 
	
		
			
				|  |  | +                        if (rObj.code && rObj.code !== '') {
 | 
	
		
			
				|  |  | +                            rObj.code = rObj.code.toUpperCase();
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  |                          addArr.push(rObj);
 | 
	
		
			
				|  |  |                          me.rationsCodes.push(rObj.code.toString());
 | 
	
		
			
				|  |  |                          me.addRationItem = null;
 | 
	
	
		
			
				|  | @@ -416,33 +457,27 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onClipboardPasting: function(sender, args) {
 | 
	
		
			
				|  |  |          let me = rationOprObj;
 | 
	
		
			
				|  |  | -        let cacheSection = me.getCache();
 | 
	
		
			
				|  |  |          let maxCol = args.cellRange.col + args.cellRange.colCount -1;
 | 
	
		
			
				|  |  |          if(!me.canRations || !me.canPasted(args.cellRange.col, maxCol) || maxCol > me.setting.header.length - 1){
 | 
	
		
			
				|  |  |              args.cancel = true;
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        let hasStd = false;
 | 
	
		
			
				|  |  | -        for(let row = args.cellRange.row, len = args.cellRange.row + args.cellRange.rowCount - 1; row < len; row++){
 | 
	
		
			
				|  |  | -            if(me.isDef(cacheSection[row]) && me.isDef(cacheSection[row].type) && cacheSection[row].type === me.type.std){
 | 
	
		
			
				|  |  | -                hasStd = true;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if(hasStd){
 | 
	
		
			
				|  |  | -            args.cancel = true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    //todo: overwrite?
 | 
	
		
			
				|  |  |      onClipboardPasted: function(e, info) {
 | 
	
		
			
				|  |  | +        console.log('cp');
 | 
	
		
			
				|  |  |          let me = rationOprObj;
 | 
	
		
			
				|  |  |          let cacheSection = me.getCache();
 | 
	
		
			
				|  |  |          let updateArr = [], addArr = [];
 | 
	
		
			
				|  |  |          let items = sheetCommonObj.analyzePasteData(me.setting, info);
 | 
	
		
			
				|  |  |          for (let i = 0; i < items.length; i++) {
 | 
	
		
			
				|  |  | +            if (items[i].code && items[i].code !== '') {
 | 
	
		
			
				|  |  | +                items[i].code = items[i].code.toUpperCase();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              let rowIdx = info.cellRange.row + i;
 | 
	
		
			
				|  |  |              if (cacheSection) {
 | 
	
		
			
				|  |  | -               /* if(!me.isValidUnit(items[i], rationUnits)){//无效单位
 | 
	
		
			
				|  |  | -                    items[i].unit = rowIdx < cacheSection.length  && typeof cacheSection[rowIdx].unit !== 'undefined' ? cacheSection[rowIdx].unit : '';
 | 
	
		
			
				|  |  | -                }*/
 | 
	
		
			
				|  |  | +                /*  if(!me.isValidUnit(items[i], rationUnits)){//无效单位
 | 
	
		
			
				|  |  | +                 items[i].unit = rowIdx < cacheSection.length  && typeof cacheSection[rowIdx].unit !== 'undefined' ? cacheSection[rowIdx].unit : '';
 | 
	
		
			
				|  |  | +                 }*/
 | 
	
		
			
				|  |  |                  if(!cacheSection[rowIdx] && info.cellRange.col === 0 ){
 | 
	
		
			
				|  |  |                      if(me.rationsCodes.indexOf(items[i].code.toString()) === -1){
 | 
	
		
			
				|  |  |                          //jobConten
 | 
	
	
		
			
				|  | @@ -486,33 +521,34 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | -                /*if(!me.isValidUnit(items[i], rationUnits)){//无效单位
 | 
	
		
			
				|  |  | -                    items[i].unit = '';
 | 
	
		
			
				|  |  | -                }*/
 | 
	
		
			
				|  |  | +                /* if(!me.isValidUnit(items[i], rationUnits)){//无效单位
 | 
	
		
			
				|  |  | +                 items[i].unit = '';
 | 
	
		
			
				|  |  | +                 }*/
 | 
	
		
			
				|  |  |                  //add
 | 
	
		
			
				|  |  |                  if(info.cellRange.col === 0){
 | 
	
		
			
				|  |  |                      //是否含有已存在的编号
 | 
	
		
			
				|  |  | -                        if(me.rationsCodes.indexOf(items[i].code.toString()) === -1){
 | 
	
		
			
				|  |  | -                            //jobConten
 | 
	
		
			
				|  |  | -                            if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
 | 
	
		
			
				|  |  | -                                items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                            if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
 | 
	
		
			
				|  |  | -                                items[i].annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                            me.setInitPrc(items[i]);
 | 
	
		
			
				|  |  | -                            addArr.push(items[i]);
 | 
	
		
			
				|  |  | +                    if(me.rationsCodes.indexOf(items[i].code.toString()) === -1){
 | 
	
		
			
				|  |  | +                        //jobConten
 | 
	
		
			
				|  |  | +                        if(jobContentOprObj && jobContentOprObj.currentSituation === jobContentOprObj.situations.ALL){
 | 
	
		
			
				|  |  | +                            items[i].jobContent = jobContentOprObj.currentJobContent ? jobContentOprObj.currentJobContent : '';
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | +                        if(annotationOprObj && annotationOprObj.currentSituation === annotationOprObj.situations.ALL){
 | 
	
		
			
				|  |  | +                            items[i].annotation = annotationOprObj.currentAnnotation ? annotationOprObj.currentAnnotation : '';
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        me.setInitPrc(items[i]);
 | 
	
		
			
				|  |  | +                        addArr.push(items[i]);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  | -         if (updateArr.length > 0 || addArr.length > 0) {
 | 
	
		
			
				|  |  | -             me.mixUpdate = 1;
 | 
	
		
			
				|  |  | +        if (updateArr.length > 0 || addArr.length > 0) {
 | 
	
		
			
				|  |  | +            console.log(updateArr);
 | 
	
		
			
				|  |  | +            me.mixUpdate = 1;
 | 
	
		
			
				|  |  |              me.mixUpdateRequest(updateArr, addArr, []);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          else{
 | 
	
		
			
				|  |  | -             me.getRationItems(me.currentSectionId);
 | 
	
		
			
				|  |  | -         }
 | 
	
		
			
				|  |  | +            me.getRationItems(me.currentSectionId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      setInitPrc: function (obj) {
 | 
	
		
			
				|  |  |          obj.labourPrice = 0;
 | 
	
	
		
			
				|  | @@ -529,60 +565,64 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      getRationsCodes: function (repId) {
 | 
	
		
			
				|  |  |          let me = rationOprObj;
 | 
	
		
			
				|  |  | -        CommonAjax.post('api/getRationsCodes', {rationRepId: repId}, function (rstData) {
 | 
	
		
			
				|  |  | -            me.rationsCodes = rstData;
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +        $.ajax({
 | 
	
		
			
				|  |  | +            type: 'post',
 | 
	
		
			
				|  |  | +            url: 'api/getRationsCodes',
 | 
	
		
			
				|  |  | +            data: {data: JSON.stringify({repId: repId})},
 | 
	
		
			
				|  |  | +            dataType: 'json',
 | 
	
		
			
				|  |  | +            success: function (result) {
 | 
	
		
			
				|  |  | +                if(!result.error){
 | 
	
		
			
				|  |  | +                    me.rationsCodes = result.data;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      mixUpdateRequest: function(updateArr, addArr, removeIds, callback) {
 | 
	
		
			
				|  |  |          let me = rationOprObj;
 | 
	
		
			
				|  |  |          me.saveInString(updateArr);
 | 
	
		
			
				|  |  | -        CommonAjax.post('api/mixUpdateRationItems',
 | 
	
		
			
				|  |  | -            {rationRepId: getQueryString("repository"),  sectionId: me.currentSectionId, updateItems: updateArr, addItems: addArr, removeIds: removeIds},
 | 
	
		
			
				|  |  | -            function (rstData) {
 | 
	
		
			
				|  |  | -                //mark complementary
 | 
	
		
			
				|  |  | -                for(let i = 0, len = addArr.length; i < len; i++){
 | 
	
		
			
				|  |  | -                    addArr[i].type = me.type.complementary;
 | 
	
		
			
				|  |  | +        CommonAjax.post('api/mixUpdateRationItems', {sectionId: me.currentSectionId, updateItems: updateArr, addItems: addArr, removeIds: removeIds}, function (rstData) {
 | 
	
		
			
				|  |  | +            let cacheSection = me.updateCache(addArr, updateArr, removeIds, rstData);
 | 
	
		
			
				|  |  | +            me.sortByCode(cacheSection);
 | 
	
		
			
				|  |  | +            /*cacheSection.sort(function(a, b){
 | 
	
		
			
				|  |  | +                let rst = 0;
 | 
	
		
			
				|  |  | +                if (a.code > b.code) rst = 1
 | 
	
		
			
				|  |  | +                else if (a.code < b.code) rst = -1;
 | 
	
		
			
				|  |  | +                return rst;
 | 
	
		
			
				|  |  | +            });*/
 | 
	
		
			
				|  |  | +            //add
 | 
	
		
			
				|  |  | +            let curRow = me.workBook.getActiveSheet().getActiveRowIndex();
 | 
	
		
			
				|  |  | +            me.rationSelInit(curRow);
 | 
	
		
			
				|  |  | +            //add
 | 
	
		
			
				|  |  | +            //jobContent
 | 
	
		
			
				|  |  | +            if(jobContentOprObj ){
 | 
	
		
			
				|  |  | +                jobContentOprObj.currentRationItems = cacheSection;
 | 
	
		
			
				|  |  | +                jobContentOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, jobContentOprObj.radios);
 | 
	
		
			
				|  |  | +                if(cacheSection.length === 0){
 | 
	
		
			
				|  |  | +                    jobContentOprObj.updateSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                let cacheSection = me.updateCache(addArr, updateArr, removeIds, rstData);
 | 
	
		
			
				|  |  | -                cacheSection.sort(function(a, b){
 | 
	
		
			
				|  |  | -                    let rst = 0;
 | 
	
		
			
				|  |  | -                    if (a.code > b.code) rst = 1
 | 
	
		
			
				|  |  | -                    else if (a.code < b.code) rst = -1;
 | 
	
		
			
				|  |  | -                    return rst;
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | -                let curRow = me.workBook.getActiveSheet().getActiveRowIndex();
 | 
	
		
			
				|  |  | -                me.rationSelInit(curRow);
 | 
	
		
			
				|  |  | -                //jobContent
 | 
	
		
			
				|  |  | -                if(jobContentOprObj ){
 | 
	
		
			
				|  |  | -                    jobContentOprObj.currentRationItems = cacheSection;
 | 
	
		
			
				|  |  | -                    jobContentOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, jobContentOprObj.radios);
 | 
	
		
			
				|  |  | -                  /*  if(cacheSection.length === 0){
 | 
	
		
			
				|  |  | -                        jobContentOprObj.updateSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
 | 
	
		
			
				|  |  | -                    }*/
 | 
	
		
			
				|  |  | -                    jobContentOprObj.setRadiosChecked(jobContentOprObj.currentSituation, jobContentOprObj.radios);
 | 
	
		
			
				|  |  | -                    if(jobContentOprObj.currentSituation === jobContentOprObj.situations.PARTIAL){
 | 
	
		
			
				|  |  | -                        jobContentOprObj.buildTablePartial(jobContentOprObj.tablePartial, jobContentOprObj.getGroup(cacheSection));
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +                jobContentOprObj.setRadiosChecked(jobContentOprObj.currentSituation, jobContentOprObj.radios);
 | 
	
		
			
				|  |  | +                if(jobContentOprObj.currentSituation === jobContentOprObj.situations.PARTIAL){
 | 
	
		
			
				|  |  | +                    jobContentOprObj.buildTablePartial(jobContentOprObj.tablePartial, jobContentOprObj.getGroup(cacheSection));
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if(annotationOprObj ){
 | 
	
		
			
				|  |  | -                    annotationOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, annotationOprObj.radios);
 | 
	
		
			
				|  |  | -                    if(cacheSection.length === 0){
 | 
	
		
			
				|  |  | -                        annotationOprObj.updateAnnoSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    annotationOprObj.setRadiosChecked(annotationOprObj.currentSituation, annotationOprObj.radios);
 | 
	
		
			
				|  |  | -                    if(annotationOprObj.currentSituation === annotationOprObj.situations.PARTIAL){
 | 
	
		
			
				|  |  | -                        annotationOprObj.buildTablePartial(annotationOprObj.fzTablePartial, annotationOprObj.getGroup(cacheSection));
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if(annotationOprObj ){
 | 
	
		
			
				|  |  | +                annotationOprObj.setRadiosDisabled(cacheSection.length > 0 ? false : true, annotationOprObj.radios);
 | 
	
		
			
				|  |  | +                if(cacheSection.length === 0){
 | 
	
		
			
				|  |  | +                    annotationOprObj.updateAnnoSituation(pageOprObj.rationLibId, me.currentSectionId, 'NONE');
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                me.showRationItems(me.currentSectionId);
 | 
	
		
			
				|  |  | -                me.mixUpdate = 0;
 | 
	
		
			
				|  |  | -                me.mixDel = 0;
 | 
	
		
			
				|  |  | -                if(callback) callback();
 | 
	
		
			
				|  |  | -                sectionTreeObj.workBook.focus(false);
 | 
	
		
			
				|  |  | -                rationOprObj.workBook.focus(true);
 | 
	
		
			
				|  |  | -            }, function () {
 | 
	
		
			
				|  |  | -                me.getRationItems(me.currentSectionId);
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | +                annotationOprObj.setRadiosChecked(annotationOprObj.currentSituation, annotationOprObj.radios);
 | 
	
		
			
				|  |  | +                if(annotationOprObj.currentSituation === annotationOprObj.situations.PARTIAL){
 | 
	
		
			
				|  |  | +                    annotationOprObj.buildTablePartial(annotationOprObj.fzTablePartial, annotationOprObj.getGroup(cacheSection));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            me.showRationItems(me.currentSectionId);
 | 
	
		
			
				|  |  | +            me.mixUpdate = 0;
 | 
	
		
			
				|  |  | +            me.mixDel = 0;
 | 
	
		
			
				|  |  | +            me.workBook.focus(true);
 | 
	
		
			
				|  |  | +            if(callback) callback();
 | 
	
		
			
				|  |  | +        }, function () {
 | 
	
		
			
				|  |  | +            me.getRationItems(me.currentSectionId);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      getRationItems: function(sectionID, callback = null){
 | 
	
		
			
				|  |  |          if (sectionID != -1) {
 | 
	
	
		
			
				|  | @@ -596,40 +636,30 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                  //annotation
 | 
	
		
			
				|  |  |                  annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
 | 
	
		
			
				|  |  |                  me.showRationItems(sectionID);
 | 
	
		
			
				|  |  | -                if(callback) {
 | 
	
		
			
				|  |  | +                sectionTreeObj.removeBtn.removeClass('disabled');
 | 
	
		
			
				|  |  | +                if(callback){
 | 
	
		
			
				|  |  |                      callback();
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | -                CommonAjax.post('/complementaryRation/api/getRationItems', {rationRepId: pageOprObj.rationLibId, sectionId: sectionID}, function (rstData) {
 | 
	
		
			
				|  |  | +                CommonAjax.post('api/getRationItems', {sectionId: sectionID}, function (rstData) {
 | 
	
		
			
				|  |  |                      me.currentRations["_SEC_ID_" + sectionID] = rstData;
 | 
	
		
			
				|  |  | -                    me.currentRations["_SEC_ID_" + sectionID] = me.sortByCode(me.currentRations["_SEC_ID_" + sectionID]);
 | 
	
		
			
				|  |  | +                    me.sortByCode(me.currentRations["_SEC_ID_" + sectionID]);
 | 
	
		
			
				|  |  |                      //job--
 | 
	
		
			
				|  |  |                      jobContentOprObj.currentRationItems = me.currentRations["_SEC_ID_" + sectionID];
 | 
	
		
			
				|  |  |                      jobContentOprObj.rationJobContentOpr(me.currentRations["_SEC_ID_" + sectionID]);
 | 
	
		
			
				|  |  |                      //annotation
 | 
	
		
			
				|  |  |                      annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
 | 
	
		
			
				|  |  |                      me.showRationItems(sectionID);
 | 
	
		
			
				|  |  | +                    sectionTreeObj.removeBtn.removeClass('disabled');
 | 
	
		
			
				|  |  |                      if(callback) {
 | 
	
		
			
				|  |  |                          callback();
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                }, function () {
 | 
	
		
			
				|  |  | +                    sectionTreeObj.removeBtn.removeClass('disabled');
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    setColor: function (cache) {
 | 
	
		
			
				|  |  | -        let me = this;
 | 
	
		
			
				|  |  | -        let sheet = me.workBook.getSheet(0);
 | 
	
		
			
				|  |  | -        sheet.suspendPaint();
 | 
	
		
			
				|  |  | -        for(let i = 0, len = cache.length; i < len; i++){
 | 
	
		
			
				|  |  | -            if(cache[i].type === me.type.complementary){
 | 
	
		
			
				|  |  | -                sheet.getRange(i, -1, 1, -1).foreColor('gray');
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            else {
 | 
	
		
			
				|  |  | -                sheet.getRange(i, -1, 1, -1).foreColor('');
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        sheet.resumePaint();
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  |      showRationItems: function(sectionID){
 | 
	
		
			
				|  |  |          let me = rationOprObj,
 | 
	
		
			
				|  |  |              sheetGLJ = rationGLJOprObj.sheet, settingGLJ = rationGLJOprObj.setting,
 | 
	
	
		
			
				|  | @@ -641,7 +671,6 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                  let cacheSection = me.currentRations["_SEC_ID_" + sectionID];
 | 
	
		
			
				|  |  |                  sheetCommonObj.cleanData(me.workBook.getSheet(0), me.setting, -1);
 | 
	
		
			
				|  |  |                  sheetsOprObj.showData(me.workBook.getSheet(0), me.setting, cacheSection);
 | 
	
		
			
				|  |  | -                me.setColor(cacheSection);
 | 
	
		
			
				|  |  |                  //combo
 | 
	
		
			
				|  |  |                  //sheetCommonObj.setStaticCombo(me.workBook.getActiveSheet(), 0, 2, cacheSection.length, rationUnits, 10, false);
 | 
	
		
			
				|  |  |                  //--sheetCommonObj.setDynamicCombo(me.workBook.getActiveSheet(), 0, 2, me.workBook.getActiveSheet().getRowCount(), rationUnits, 10, false);
 | 
	
	
		
			
				|  | @@ -678,38 +707,35 @@ let rationOprObj = {
 | 
	
		
			
				|  |  |                  sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
 | 
	
		
			
				|  |  |                  sheetCommonObj.cleanSheet(sheetInst, settingInst, -1);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -           //--- me.workBook.focus(true);
 | 
	
		
			
				|  |  | +            //--- me.workBook.focus(true);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          sectionTreeObj.workBook.focus(true);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      sortByCode: function(arr){
 | 
	
		
			
				|  |  | -        let me = rationOprObj;
 | 
	
		
			
				|  |  | -        //std complementary
 | 
	
		
			
				|  |  | -        let stdArr = [], compleArr = [];
 | 
	
		
			
				|  |  | -        for(let i = 0, len = arr.length; i < len; i++){
 | 
	
		
			
				|  |  | -            if(arr[i].type === me.type.std){
 | 
	
		
			
				|  |  | -                stdArr.push(arr[i]);
 | 
	
		
			
				|  |  | +        arr.sort(function (a, b) {
 | 
	
		
			
				|  |  | +            let rst = 0;
 | 
	
		
			
				|  |  | +            let splitA = a.code.split('-'),
 | 
	
		
			
				|  |  | +                splitB = b.code.split('-');
 | 
	
		
			
				|  |  | +            if(splitA[0] > splitB[0]){
 | 
	
		
			
				|  |  | +                rst = 1;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            else if(arr[i].type === me.type.complementary){
 | 
	
		
			
				|  |  | -                compleArr.push(arr[i]);
 | 
	
		
			
				|  |  | +            else if(splitA[0] < splitB[0]){
 | 
	
		
			
				|  |  | +                rst = -1;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        stdArr.sort(compare());
 | 
	
		
			
				|  |  | -        compleArr.sort(compare());
 | 
	
		
			
				|  |  | -        return stdArr.concat(compleArr);
 | 
	
		
			
				|  |  | -        function compare(){
 | 
	
		
			
				|  |  | -            return function (a, b) {
 | 
	
		
			
				|  |  | -                let rst = 0;
 | 
	
		
			
				|  |  | -                if (a.code > b.code) {
 | 
	
		
			
				|  |  | -                    rst = 1;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                else if (a.code < b.code) {
 | 
	
		
			
				|  |  | -                    rst = -1;
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                if(splitA[1] && splitB[1]){
 | 
	
		
			
				|  |  | +                    let floatA = parseFloat(splitA[1]),
 | 
	
		
			
				|  |  | +                        floatB = parseFloat(splitB[1]);
 | 
	
		
			
				|  |  | +                    if(floatA > floatB){
 | 
	
		
			
				|  |  | +                        rst = 1;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    else if(floatA < floatB){
 | 
	
		
			
				|  |  | +                        rst = -1;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                return rst;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -       // arr.sort(compare());
 | 
	
		
			
				|  |  | +            return rst;
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      saveInString(datas){
 | 
	
		
			
				|  |  |          for(let i = 0, len = datas.length; i < len; i++){
 |