|
@@ -13,6 +13,19 @@ let projectGljObject={
|
|
|
materialTreeSheet:null,
|
|
|
projectGljSheetData:[],
|
|
|
mixRatioSetting:{},
|
|
|
+ relatedRationSetting:{
|
|
|
+ header:[
|
|
|
+ {headerName: "编码", headerWidth: 100, dataCode: "code", dataType: "String"},
|
|
|
+ {headerName: "名称", headerWidth: 180, dataCode: "name", dataType: "String"},
|
|
|
+ {headerName: "单位", headerWidth: 50, dataCode: "unit", dataType: "String",hAlign: "center"},
|
|
|
+ {headerName: "工程量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right",decimalField: "ration.quantity"},
|
|
|
+ {headerName: "单价", headerWidth: 65, dataCode: "feesIndex.common.unitFee", dataType: "Number", hAlign: "right",decimalField: "ration.unitPrice"}
|
|
|
+ ],
|
|
|
+ view: {
|
|
|
+ lockColumns: [0,1,2,3,4]//,
|
|
|
+ //colHeaderHeight:30
|
|
|
+ }
|
|
|
+ },
|
|
|
materialTreeSetting:{
|
|
|
"emptyRows":0,
|
|
|
"headRows":1,
|
|
@@ -94,12 +107,14 @@ let projectGljObject={
|
|
|
}
|
|
|
},
|
|
|
initMixRatioSpread:function () {
|
|
|
- this.mixRatioSpread = SheetDataHelper.createNewSpread($("#mix_ratio_sheet")[0]);
|
|
|
+ this.mixRatioSpread = SheetDataHelper.createNewSpread($("#mix_ratio_sheet")[0],2);
|
|
|
sheetCommonObj.spreadDefaultStyle(this.mixRatioSpread);
|
|
|
this.mixRatioSheet = this.mixRatioSpread .getSheet(0);
|
|
|
this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
|
|
|
this.mixRatioSheet.name('mixRatioSheet');
|
|
|
this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
|
|
|
+ this.initRelatedRationSheet();
|
|
|
+
|
|
|
if(projectReadOnly){
|
|
|
if(this.mixRatioSetting.view.lockColumns){
|
|
|
this.mixRatioSetting.view.lockColumns = null;
|
|
@@ -107,6 +122,13 @@ let projectGljObject={
|
|
|
disableSpread(this.mixRatioSpread);
|
|
|
}
|
|
|
},
|
|
|
+ initRelatedRationSheet:function(){
|
|
|
+ this.relatedRationSheet = this.mixRatioSpread.getSheet(1);
|
|
|
+ sheetCommonObj.initSheet(this.relatedRationSheet, this.relatedRationSetting, 30);
|
|
|
+ this.relatedRationSheet.name('relatedRation');
|
|
|
+ this.relatedRationSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick, this.onRelatedRationDoubleClick);
|
|
|
+ //this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
|
|
|
+ },
|
|
|
initMaterialTreeSheet:function () {
|
|
|
this.materialTreeSheet = this.projectGljSpread.getSheet(1);
|
|
|
this.materialTreeSetting = this.createMaterialTreeSheetSetting();
|
|
@@ -268,6 +290,8 @@ let projectGljObject={
|
|
|
},
|
|
|
showMixRatioData:function () {
|
|
|
let me = this,gljId = null,gljType = null;
|
|
|
+ if(!$('#mixRatio-nav').hasClass('active')) return;
|
|
|
+ me.mixRatioSpread.setActiveSheetIndex(0);
|
|
|
if(!me.projectGljSpread) return;
|
|
|
let sheet = me.projectGljSpread.getActiveSheet();
|
|
|
let oldSel = me.mixRatioSheet.getSelections()[0];
|
|
@@ -303,6 +327,28 @@ let projectGljObject={
|
|
|
me.mixRatioSheet.setSelection(oldSel.row==-1?0:oldSel.row,oldSel.col,oldSel.rowCount,oldSel.colCount);
|
|
|
})
|
|
|
},
|
|
|
+ showRelatedRationDatas:function(){
|
|
|
+ let me = this;
|
|
|
+ if(!$('#ration-nav').hasClass('active')) return;
|
|
|
+ me.mixRatioSpread.setActiveSheetIndex(1);
|
|
|
+ let projectGLJData = me.getProjectGLJSelected();
|
|
|
+ let rationIDMap = {};
|
|
|
+ let rations = [];
|
|
|
+ if(projectGLJData){
|
|
|
+ for(let rg of projectObj.project.ration_glj.datas){
|
|
|
+ if(rg.projectGLJID == projectGLJData.id) rationIDMap[rg.rationID] = true;
|
|
|
+ }
|
|
|
+ for(let r of projectObj.project.Ration.datas){
|
|
|
+ if(rationIDMap[r.ID] || (r.type == rationType.gljRation && r.projectGLJID== projectGLJData.id)){
|
|
|
+ rations.push(r);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.relatedRationSheetData = rations;
|
|
|
+ sheetCommonObj.showData(me.relatedRationSheet, me.relatedRationSetting,rations);
|
|
|
+ me.relatedRationSheet.setRowCount(rations.length);
|
|
|
+ },
|
|
|
+
|
|
|
getMixRatioSheetData:function (glj) {
|
|
|
let data ={
|
|
|
id:glj.id,
|
|
@@ -374,6 +420,12 @@ let projectGljObject={
|
|
|
me.showMixRatioData();
|
|
|
me.materialTreeSheet.repaint();
|
|
|
},
|
|
|
+ onRelatedRationDoubleClick:function (sender,args) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ let record = me.relatedRationSheetData[args.row];
|
|
|
+ $("#tab_zaojiashu").click();
|
|
|
+ locateObject.locateNode(record.ID);
|
|
|
+ },
|
|
|
onProjectGljSelectionChange:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
let newSel = args.newSelections[0];
|
|
@@ -405,6 +457,7 @@ let projectGljObject={
|
|
|
sel.rowCount = 1;
|
|
|
sel.colCount = 1;
|
|
|
me.showMixRatioData();
|
|
|
+ me.showRelatedRationDatas();
|
|
|
},
|
|
|
rightClickCallback:function (row) {
|
|
|
let me = projectGljObject;
|
|
@@ -678,6 +731,7 @@ let projectGljObject={
|
|
|
}else {
|
|
|
me.showProjectGljData();
|
|
|
me.showMixRatioData();
|
|
|
+ me.showRelatedRationDatas();
|
|
|
}
|
|
|
},
|
|
|
createMaterialTree:function (gljList) {
|
|
@@ -871,6 +925,7 @@ let projectGljObject={
|
|
|
me.projectGljSheetData.splice(row,1);
|
|
|
me.projectGljSheet.deleteRows(row,1);
|
|
|
me.showMixRatioData();
|
|
|
+ me.showRelatedRationDatas();
|
|
|
}
|
|
|
//me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
|
|
|
},
|
|
@@ -1105,20 +1160,20 @@ let projectGljObject={
|
|
|
return sheetCommonObj.checkData(col,setting, value);
|
|
|
},
|
|
|
getProjectGLJSelected:function () {
|
|
|
- let me = projectGljObject;
|
|
|
- let sheet = me.projectGljSpread.getActiveSheet();
|
|
|
- let selectedProjectGLJ = null;
|
|
|
- if(sheet.name() == 'projectGljSheet'){//projectGljSheet/materialSheet 工料机汇总和三材汇总表
|
|
|
- let sel = me.projectGljSheet.getSelections()[0];
|
|
|
- if(sel.row != -1 && me.projectGljSheetData.length>sel.row){
|
|
|
- selectedProjectGLJ = me.projectGljSheetData[sel.row]
|
|
|
- }
|
|
|
- }else if(sheet.name() == 'materialTreeSheet' ){
|
|
|
- if(me.materialTree.selected){
|
|
|
- selectedProjectGLJ = me.materialTree.selected.data;
|
|
|
- }
|
|
|
- }
|
|
|
- return selectedProjectGLJ;
|
|
|
+ let me = this,data = null;
|
|
|
+ let sheet = me.projectGljSpread.getActiveSheet();
|
|
|
+ if(sheet.name() == 'projectGljSheet'){//projectGljSheet/materialSheet 工料机汇总和三材汇总表
|
|
|
+ let sel = me.projectGljSheet.getSelections()[0];
|
|
|
+ let srow = sel.row == -1||sel.row == ""?0:sel.row;
|
|
|
+ if(me.projectGljSheetData.length>srow){
|
|
|
+ data = me.projectGljSheetData[srow];
|
|
|
+ }
|
|
|
+ }else if(sheet.name() == 'materialTreeSheet'){
|
|
|
+ if(this.materialTree.selected){
|
|
|
+ data = this.materialTree.selected.data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
},
|
|
|
initRightClick : function() {
|
|
|
let activeSheet = this.mixRatioSheet;
|
|
@@ -1544,6 +1599,16 @@ $(function () {
|
|
|
me.refreshViewsData();
|
|
|
loadProjectGljSize();
|
|
|
});
|
|
|
+
|
|
|
+ $("#mixRatio-nav").on('shown.bs.tab', function () {
|
|
|
+ projectGljObject.mixRatioSpread.refresh();
|
|
|
+ projectGljObject.showMixRatioData();
|
|
|
+ });
|
|
|
+
|
|
|
+ $("#ration-nav").on('shown.bs.tab', function () {
|
|
|
+ projectGljObject.mixRatioSpread.refresh();
|
|
|
+ projectGljObject.showRelatedRationDatas();
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
|