|
@@ -108,16 +108,17 @@ let zmhs_obj = {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
initCusSpread:function () {
|
|
initCusSpread:function () {
|
|
|
- if(zmhs_obj.cusSpread == null){
|
|
|
|
|
- this.cusSpread = SheetDataHelper.createNewSpread($("#cusSpread")[0]);
|
|
|
|
|
- sheetCommonObj.spreadDefaultStyle(this.cusSpread);
|
|
|
|
|
- this.cusSheet = this.cusSpread.getSheet(0);
|
|
|
|
|
- sheetCommonObj.initSheet(this.cusSheet, this.cusSetting, 30);
|
|
|
|
|
- this.cusSheet.name('ration_cus');
|
|
|
|
|
- this.cusSheet.bind(GC.Spread.Sheets.Events.ValueChanged,this.onCusValueChange);
|
|
|
|
|
- this.cusSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onCusRangeChanged);
|
|
|
|
|
- SheetDataHelper.protectdSheet(this.cusSheet);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
|
|
+ if(zmhs_obj[pre+'cusSpread'] == null){
|
|
|
|
|
+ this[pre+'cusSpread'] = SheetDataHelper.createNewSpread($("#"+pre+"cusSpread")[0]);
|
|
|
|
|
+ sheetCommonObj.spreadDefaultStyle(this[pre+'cusSpread']);
|
|
|
|
|
+ this[pre+"cusSheet"] = this[pre+'cusSpread'].getSheet(0);
|
|
|
|
|
+ sheetCommonObj.initSheet(this[pre+"cusSheet"], this.cusSetting, 30);
|
|
|
|
|
+ this[pre+"cusSheet"].name(pre+'ration_cus');
|
|
|
|
|
+ this[pre+"cusSheet"].bind(GC.Spread.Sheets.Events.ValueChanged,this.onCusValueChange);
|
|
|
|
|
+ this[pre+"cusSheet"].bind(GC.Spread.Sheets.Events.RangeChanged, this.onCusRangeChanged);
|
|
|
|
|
+ SheetDataHelper.protectdSheet(this[pre+"cusSheet"]);
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
initAssSpread:function () {
|
|
initAssSpread:function () {
|
|
|
if(zmhs_obj.assSheet == null){
|
|
if(zmhs_obj.assSheet == null){
|
|
@@ -132,94 +133,110 @@ let zmhs_obj = {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
initStableSpread:function () {
|
|
initStableSpread:function () {
|
|
|
- if(zmhs_obj.stableSpread == null){
|
|
|
|
|
- this.stableSpread = SheetDataHelper.createNewSpread($("#stableSpread")[0]);
|
|
|
|
|
- sheetCommonObj.spreadDefaultStyle(this.stableSpread);
|
|
|
|
|
- this.stableSheet = this.stableSpread.getSheet(0);
|
|
|
|
|
- sheetCommonObj.initSheet(this.stableSheet, this.stableSetting, 30);
|
|
|
|
|
- this.stableSheet.name('ration_stable');
|
|
|
|
|
- this.stableSheet.bind(GC.Spread.Sheets.Events.ValueChanged,this.onStableValueChange);
|
|
|
|
|
- this.stableSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onStableRangeChanged);
|
|
|
|
|
- SheetDataHelper.protectdSheet(this.stableSheet);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
|
|
+ if(zmhs_obj[pre+'stableSpread'] == null){
|
|
|
|
|
+ this[pre+'stableSpread'] = SheetDataHelper.createNewSpread($("#"+pre+"stableSpread")[0]);
|
|
|
|
|
+ sheetCommonObj.spreadDefaultStyle(this[pre+'stableSpread'] );
|
|
|
|
|
+ this[pre+"stableSheet"] = this[pre+'stableSpread'].getSheet(0);
|
|
|
|
|
+ sheetCommonObj.initSheet(this[pre+"stableSheet"], this.stableSetting, 30);
|
|
|
|
|
+ this[pre+"stableSheet"].name(pre+'ration_stable');
|
|
|
|
|
+ this[pre+"stableSheet"].bind(GC.Spread.Sheets.Events.ValueChanged,this.onStableValueChange);
|
|
|
|
|
+ this[pre+"stableSheet"].bind(GC.Spread.Sheets.Events.RangeChanged, this.onStableRangeChanged);
|
|
|
|
|
+ SheetDataHelper.protectdSheet(this);
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
showCoeData:function (node) {
|
|
showCoeData:function (node) {
|
|
|
- let preSelections = this.coeSheet.getSelections();
|
|
|
|
|
- let selected = node?node:projectObj.project.mainTree.selected;
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
|
|
+ let preSelections = this[pre+'coeSheet'].getSelections();
|
|
|
let ration_coe = projectObj.project.ration_coe;
|
|
let ration_coe = projectObj.project.ration_coe;
|
|
|
let coeList = [];
|
|
let coeList = [];
|
|
|
|
|
+ let coeSheet = this[pre+'coeSheet'];
|
|
|
this.coeSheet.suspendPaint();
|
|
this.coeSheet.suspendPaint();
|
|
|
this.coeSheet.suspendEvent();
|
|
this.coeSheet.suspendEvent();
|
|
|
- if(selected&&selected.sourceType == "ration"){
|
|
|
|
|
- let ration = selected.data;
|
|
|
|
|
- let assList = this.getAssList(node); //2019-01-23 新需求,将辅助定额合并到一个表显示 -- 20191206
|
|
|
|
|
- // this.assFirstIndex = coeList.length;//没改前这里要记录辅助定额的起始下标,现在调整顺序后,默认就是0
|
|
|
|
|
- coeList = ration_coe.getCoeByRationID(ration.ID);
|
|
|
|
|
- _.remove(coeList,{"coeID":-1})//2018-12-24 新需求,把自定义乘系数分离出来,这里排除自定义乘系数行
|
|
|
|
|
- coeList = assList.concat(coeList)
|
|
|
|
|
- }
|
|
|
|
|
- this.coeSheet.setRowCount(0);
|
|
|
|
|
- sheetCommonObj.showData(this.coeSheet, this.coeSetting,coeList);
|
|
|
|
|
|
|
+ if(pre == "divide_"){//来自分摊
|
|
|
|
|
+ coeList = divideObj.getCoeList();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ let selected = node?node:projectObj.project.mainTree.selected;
|
|
|
|
|
+ if(selected&&selected.sourceType == "ration"){
|
|
|
|
|
+ let ration = selected.data;
|
|
|
|
|
+ let assList = this.getAssList(node); //2019-01-23 新需求,将辅助定额合并到一个表显示 -- 20191206
|
|
|
|
|
+ // this.assFirstIndex = coeList.length;//没改前这里要记录辅助定额的起始下标,现在调整顺序后,默认就是0
|
|
|
|
|
+ coeList = ration_coe.getCoeByRationID(ration.ID);
|
|
|
|
|
+ _.remove(coeList,{"coeID":-1})//2018-12-24 新需求,把自定义乘系数分离出来,这里排除自定义乘系数行
|
|
|
|
|
+ coeList = assList.concat(coeList)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ coeSheet.setRowCount(0);
|
|
|
|
|
+ sheetCommonObj.showData(coeSheet, this.coeSetting,coeList);
|
|
|
if (coeList.length > 0) {
|
|
if (coeList.length > 0) {
|
|
|
for(let i =0;i<coeList.length;i++ ){
|
|
for(let i =0;i<coeList.length;i++ ){
|
|
|
if(gljUtil.isDef(coeList[i].option_codes)&&coeList[i].option_codes!=""){
|
|
if(gljUtil.isDef(coeList[i].option_codes)&&coeList[i].option_codes!=""){
|
|
|
this.getComboBoxForCodes(coeList[i],i);//设置可选类型的下拉框
|
|
this.getComboBoxForCodes(coeList[i],i);//设置可选类型的下拉框
|
|
|
// sheet.setValue(row, col, val, ch);
|
|
// sheet.setValue(row, col, val, ch);
|
|
|
} else if(coeList[i].assistCode && coeList[i].assistCode !=''){//是辅助定额列
|
|
} else if(coeList[i].assistCode && coeList[i].assistCode !=''){//是辅助定额列
|
|
|
- this.coeSheet.getCell(i, 2, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
|
|
|
|
+ coeSheet.getCell(i, 2, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
} else if(coeList[i].coeID == -1){ //自定义系数列
|
|
} else if(coeList[i].coeID == -1){ //自定义系数列
|
|
|
- this.coeSheet.getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
|
|
- this.coeSheet.setCellType(i, 1, sheetCommonObj.getCustomerCoeCellType(this.generateHtmlString,this.bindCusEditorValue,this.updateCusCoeAfterEditor), GC.Spread.Sheets.SheetArea.viewport);
|
|
|
|
|
|
|
+ coeSheet.getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
|
|
+ coeSheet.setCellType(i, 1, sheetCommonObj.getCustomerCoeCellType(this.generateHtmlString,this.bindCusEditorValue,this.updateCusCoeAfterEditor), GC.Spread.Sheets.SheetArea.viewport);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.coeSheetData = coeList;
|
|
|
|
|
|
|
+ this[pre+'coeSheetData'] = coeList;
|
|
|
if(projectReadOnly){
|
|
if(projectReadOnly){
|
|
|
disableSpread(zmhs_obj.coeSpread);
|
|
disableSpread(zmhs_obj.coeSpread);
|
|
|
}
|
|
}
|
|
|
if(preSelections){//定位光标到之前的位置
|
|
if(preSelections){//定位光标到之前的位置
|
|
|
- this.coeSheet.setSelection(preSelections[0].row,preSelections[0].col,preSelections[0].rowCount,preSelections[0].colCount);
|
|
|
|
|
|
|
+ coeSheet.setSelection(preSelections[0].row,preSelections[0].col,preSelections[0].rowCount,preSelections[0].colCount);
|
|
|
}
|
|
}
|
|
|
- this.coeSheet.resumeEvent();
|
|
|
|
|
- this.coeSheet.resumePaint();
|
|
|
|
|
|
|
+ coeSheet.resumeEvent();
|
|
|
|
|
+ coeSheet.resumePaint();
|
|
|
},
|
|
},
|
|
|
showCusData:function (node) {
|
|
showCusData:function (node) {
|
|
|
- let selected = node?node:projectObj.project.mainTree.selected;
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
let ration_coe = projectObj.project.ration_coe;
|
|
let ration_coe = projectObj.project.ration_coe;
|
|
|
let cusList = [];
|
|
let cusList = [];
|
|
|
- if(selected&&selected.sourceType == "ration"){
|
|
|
|
|
- let ration = selected.data;
|
|
|
|
|
- let coeList = ration_coe.getCoeByRationID(ration.ID);
|
|
|
|
|
- this.cusSheetData = _.find(coeList,{"coeID":-1});
|
|
|
|
|
- if(this.cusSheetData) cusList = this.cusSheetData.coes;
|
|
|
|
|
- }
|
|
|
|
|
- sheetCommonObj.showData(this.cusSheet, this.cusSetting,cusList);
|
|
|
|
|
- this.cusSheet.getRange(cusList.length,-1,this.cusSheet.getRowCount()-cusList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
|
|
|
|
+ if(pre == "divide_"){
|
|
|
|
|
+ cusList = divideObj.getCusList();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ let selected = node?node:projectObj.project.mainTree.selected;
|
|
|
|
|
+ if(selected&&selected.sourceType == "ration"){
|
|
|
|
|
+ let ration = selected.data;
|
|
|
|
|
+ let coeList = ration_coe.getCoeByRationID(ration.ID);
|
|
|
|
|
+ this.cusSheetData = _.find(coeList,{"coeID":-1});
|
|
|
|
|
+ if(this.cusSheetData) cusList = this.cusSheetData.coes;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ sheetCommonObj.showData(this[pre+'cusSheet'], this.cusSetting,cusList);
|
|
|
|
|
+ this[pre+'cusSheet'].getRange(cusList.length,-1,this[pre+'cusSheet'].getRowCount()-cusList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
if(projectReadOnly){
|
|
if(projectReadOnly){
|
|
|
- disableSpread(zmhs_obj.cusSpread);
|
|
|
|
|
|
|
+ disableSpread(zmhs_obj[pre+'cusSpread']);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
showStableData: function (node) {
|
|
showStableData: function (node) {
|
|
|
// 过滤出定额配合比不为0的数据
|
|
// 过滤出定额配合比不为0的数据
|
|
|
- const stableList = gljOprObj.sheetData.filter(glj => !glj.isMixRatio && glj.rationProportion);
|
|
|
|
|
- this.stableSheetData = stableList;
|
|
|
|
|
- sheetCommonObj.showData(this.stableSheet, this.stableSetting, stableList);
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
|
|
+ const stableList = pre == 'divide_' ?divideObj.getStableList():gljOprObj.sheetData.filter(glj => !glj.isMixRatio && glj.rationProportion);
|
|
|
|
|
+ this[pre+'stableSheetData'] = stableList;
|
|
|
|
|
+ sheetCommonObj.showData(this[pre+"stableSheet"], this.stableSetting, stableList);
|
|
|
const proportionCol = this.stableSetting.header.findIndex(item => item.dataCode === 'adjustProportion');
|
|
const proportionCol = this.stableSetting.header.findIndex(item => item.dataCode === 'adjustProportion');
|
|
|
- this.stableSheet.getRange(0, proportionCol, stableList.length, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
|
|
- this.stableSheet.getRange(stableList.length, -1, this.stableSheet.getRowCount() - stableList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
|
|
|
|
+ this[pre+"stableSheet"].getRange(0, proportionCol, stableList.length, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
|
|
+ this[pre+"stableSheet"].getRange(stableList.length, -1, this[pre+"stableSheet"].getRowCount() - stableList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
|
|
|
if(projectReadOnly){
|
|
if(projectReadOnly){
|
|
|
- disableSpread(zmhs_obj.cusSpread);
|
|
|
|
|
|
|
+ disableSpread(zmhs_obj[pre+'stableSpread']);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
getComboBoxForCodes:function (coe,i) {
|
|
getComboBoxForCodes:function (coe,i) {
|
|
|
- this.coeSheet.getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
|
|
+ this[pre+'coeSheet'].getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
|
|
|
let options = coe.option_list; //coe.option_codes.split("|");
|
|
let options = coe.option_list; //coe.option_codes.split("|");
|
|
|
let combo = new GC.Spread.Sheets.CellTypes.ComboBox();//sheetCommonObj.getDynamicCombo(true); 2019-4-1 这里用普通的下拉框,一直显示
|
|
let combo = new GC.Spread.Sheets.CellTypes.ComboBox();//sheetCommonObj.getDynamicCombo(true); 2019-4-1 这里用普通的下拉框,一直显示
|
|
|
- let buttonRow = this.coeSheet.getViewportBottomRow(1);
|
|
|
|
|
|
|
+ let buttonRow = this[pre+'coeSheet'].getViewportBottomRow(1);
|
|
|
combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
|
|
combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
|
|
|
combo.items(options).maxDropDownItems(buttonRow - i -1 < 3 ?3:buttonRow - i -1 );//itemHeight(options.length).
|
|
combo.items(options).maxDropDownItems(buttonRow - i -1 < 3 ?3:buttonRow - i -1 );//itemHeight(options.length).
|
|
|
- this.coeSheet.setCellType(i, 1, combo, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
|
|
- this.coeSheet.setValue(i, 1, coe.select_code);
|
|
|
|
|
|
|
+ this[pre+'coeSheet'].setCellType(i, 1, combo, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
|
|
+ this[pre+'coeSheet'].setValue(i, 1, coe.select_code);
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
showAssData:function (node) {
|
|
showAssData:function (node) {
|
|
@@ -304,10 +321,10 @@ let zmhs_obj = {
|
|
|
},
|
|
},
|
|
|
showDatas:function () {
|
|
showDatas:function () {
|
|
|
if($('#itemCharacterText').is(':visible'))MaterialController.showItemCharacterText()
|
|
if($('#itemCharacterText').is(':visible'))MaterialController.showItemCharacterText()
|
|
|
- if($('#coeSpread').is(':visible')) this.showCoeData();
|
|
|
|
|
- if($('#cusSpread').is(':visible')) this.showCusData();
|
|
|
|
|
|
|
+ if($('#coeSpread').is(':visible')||$('#divide_coeSpread').is(':visible')) this.showCoeData();
|
|
|
|
|
+ if($('#cusSpread').is(':visible')||$('#divide_cusSpread').is(':visible')) this.showCusData();
|
|
|
if($('#assSpread').is(':visible')) this.showAssData();
|
|
if($('#assSpread').is(':visible')) this.showAssData();
|
|
|
- if($('#stableSpread').is(':visible')) this.showStableData();
|
|
|
|
|
|
|
+ if($('#stableSpread').is(':visible')||$('#divide_stableSpread').is(':visible')) this.showStableData();
|
|
|
},
|
|
},
|
|
|
refreshStableDataIfNeeded: function () {
|
|
refreshStableDataIfNeeded: function () {
|
|
|
if ($('#stableSpread').is(':visible')) {
|
|
if ($('#stableSpread').is(':visible')) {
|
|
@@ -337,8 +354,9 @@ let zmhs_obj = {
|
|
|
},
|
|
},
|
|
|
bindCusEditorValue:function(context){
|
|
bindCusEditorValue:function(context){
|
|
|
let me = zmhs_obj;
|
|
let me = zmhs_obj;
|
|
|
- if(me.coeSheetData[context.row]){
|
|
|
|
|
- let data = me.coeSheetData[context.row];
|
|
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
|
|
+ if(me[pre+'coeSheetData'][context.row]){
|
|
|
|
|
+ let data = me[pre+'coeSheetData'][context.row];
|
|
|
for(let c of data.coes){
|
|
for(let c of data.coes){
|
|
|
$("#"+ c.coeType).val(c.amount);
|
|
$("#"+ c.coeType).val(c.amount);
|
|
|
}
|
|
}
|
|
@@ -353,8 +371,10 @@ let zmhs_obj = {
|
|
|
updateCusCoeAfterEditor:function(){
|
|
updateCusCoeAfterEditor:function(){
|
|
|
let me = zmhs_obj;
|
|
let me = zmhs_obj;
|
|
|
let result = me.checkIfNeedUpdate();
|
|
let result = me.checkIfNeedUpdate();
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
if (result.isNeed) {
|
|
if (result.isNeed) {
|
|
|
- projectObj.project.ration_coe.updateCustomerCoe(result);
|
|
|
|
|
|
|
+ if(pre == "") projectObj.project.ration_coe.updateCustomerCoe(result);
|
|
|
|
|
+ if(pre == "divide_") divideObj.updateCustomerCoe(result);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onInputChange(id, name){
|
|
onInputChange(id, name){
|
|
@@ -436,10 +456,11 @@ let zmhs_obj = {
|
|
|
},
|
|
},
|
|
|
generateHtmlString: function (context,cellRect,$editor) {//这里要改成动态的了,根据自定义系数内容生成对应的输入框
|
|
generateHtmlString: function (context,cellRect,$editor) {//这里要改成动态的了,根据自定义系数内容生成对应的输入框
|
|
|
let me = zmhs_obj;
|
|
let me = zmhs_obj;
|
|
|
|
|
+ let pre = $('#divide_subSpread').is(':visible')?"divide_":"";
|
|
|
let height = cellRect.height;
|
|
let height = cellRect.height;
|
|
|
let offect = 0;
|
|
let offect = 0;
|
|
|
let newString = "<form style='margin-top:1px' ><table width='100%' cellpadding='0' border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;'>";
|
|
let newString = "<form style='margin-top:1px' ><table width='100%' cellpadding='0' border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;'>";
|
|
|
- let cus_coe = me.coeSheetData[context.row];
|
|
|
|
|
|
|
+ let cus_coe = me[pre+'coeSheetData'][context.row];
|
|
|
if(cus_coe){
|
|
if(cus_coe){
|
|
|
for(let i =0;i< cus_coe.coes.length;i++){
|
|
for(let i =0;i< cus_coe.coes.length;i++){
|
|
|
newString += me.getOneRow(cus_coe.coes[i].coeType, i, cus_coe.coes[i].coeType,height);
|
|
newString += me.getOneRow(cus_coe.coes[i].coeType, i, cus_coe.coes[i].coeType,height);
|