|
|
@@ -13,6 +13,19 @@ 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,
|
|
|
@@ -90,13 +103,15 @@ 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.mixRatioSheet = this.mixRatioSpread.getSheet(0);
|
|
|
this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
|
|
|
this.mixRatioSheet.name('mixRatioSheet');
|
|
|
this.mixRatioSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMixRatioEditStarting);
|
|
|
this.mixRatioSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onMixRatioRangeChange);
|
|
|
+
|
|
|
+ this.initRelatedRationSheet();
|
|
|
if(projectReadOnly){
|
|
|
if(this.mixRatioSetting.view.lockColumns){
|
|
|
this.mixRatioSetting.view.lockColumns = null;
|
|
|
@@ -104,6 +119,14 @@ 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();
|
|
|
@@ -265,6 +288,8 @@ projectGljObject={
|
|
|
|
|
|
showMixRatioData:function () {
|
|
|
let me = this,gljId = null,gljType = null;
|
|
|
+ if(!$('#mixRatio-nav').hasClass('active')) return;
|
|
|
+ me.mixRatioSpread.setActiveSheetIndex(0);
|
|
|
let oldSel = me.mixRatioSheet.getSelections()[0];
|
|
|
let projectGLJData = me.getSelectedProjectGLJ();
|
|
|
if(projectGLJData){
|
|
|
@@ -290,6 +315,28 @@ projectGljObject={
|
|
|
me.mixRatioSheet.setSelection(oldSel.row==-1?0:oldSel.row,oldSel.col,oldSel.rowCount,oldSel.colCount);
|
|
|
})
|
|
|
},
|
|
|
+ showRelatedRationDatas:function(){
|
|
|
+ let me = this,gljId = null,gljType = null;
|
|
|
+ if(!$('#ration-nav').hasClass('active')) return;
|
|
|
+ me.mixRatioSpread.setActiveSheetIndex(1);
|
|
|
+ let projectGLJData = me.getSelectedProjectGLJ();
|
|
|
+ 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.subType == 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,
|
|
|
@@ -377,6 +424,12 @@ projectGljObject={
|
|
|
let dataCode = me.projectGljSetting.header[args.col].dataCode;
|
|
|
if(dataCode=='name'&& recode && gljUtil.isMaterialType(recode.type)) projectObj.project.projectGLJ.updateCalcMaterial(recode,'calcMaterial',1);
|
|
|
},
|
|
|
+ onRelatedRationDoubleClick:function (sender,args) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ let record = me.relatedRationSheetData[args.row];
|
|
|
+ $("#tab_zaojiashu").click();
|
|
|
+ locateObject.locateNode(record.ID);
|
|
|
+ },
|
|
|
setSelectionWhenMaterialChange:function(material){
|
|
|
if(material){
|
|
|
let i = _.findIndex(this.projectGljSheetData,{id:material.id})
|
|
|
@@ -421,6 +474,7 @@ projectGljObject={
|
|
|
sel.rowCount = 1;
|
|
|
sel.colCount = 1;
|
|
|
me.showMixRatioData();
|
|
|
+ me.showRelatedRationDatas();
|
|
|
if(fromMaterial != true) materialCalcObj.showDatas();
|
|
|
},
|
|
|
rightClickCallback:function (row) {
|
|
|
@@ -675,6 +729,7 @@ projectGljObject={
|
|
|
}else {
|
|
|
me.showProjectGljData();
|
|
|
me.showMixRatioData();
|
|
|
+ me.showRelatedRationDatas();
|
|
|
}
|
|
|
},
|
|
|
createMaterialTree:function (gljList) {
|
|
|
@@ -866,6 +921,7 @@ projectGljObject={
|
|
|
me.projectGljSheetData.splice(row,1);
|
|
|
me.projectGljSheet.deleteRows(row,1);
|
|
|
me.showMixRatioData();
|
|
|
+ me.showRelatedRationDatas();
|
|
|
}
|
|
|
//me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
|
|
|
},
|
|
|
@@ -1520,7 +1576,13 @@ $(function () {
|
|
|
|
|
|
$("#mixRatio-nav").on('shown.bs.tab', function () {
|
|
|
projectGljObject.mixRatioSpread.refresh();
|
|
|
+ projectGljObject.showMixRatioData();
|
|
|
});
|
|
|
+ $("#ration-nav").on('shown.bs.tab', function () {
|
|
|
+ projectGljObject.mixRatioSpread.refresh();
|
|
|
+ projectGljObject.showRelatedRationDatas();
|
|
|
+ console.log('hehe');
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
|