|
@@ -3,6 +3,7 @@
|
|
|
*/
|
|
|
projectGljObject={
|
|
|
showTag:'ration',//mixRatio/machine
|
|
|
+ displayType:filterType.ALL,
|
|
|
mixRatioType: [gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO,gljType.MAIN_MATERIAL],
|
|
|
machineType: [gljType.GENERAL_MACHINE],
|
|
|
projectGljSetting:{
|
|
@@ -17,6 +18,7 @@ projectGljObject={
|
|
|
{headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
|
|
|
{headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
|
|
|
{headerName: "是否暂估", headerWidth: 60, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
|
|
|
+ {headerName: "主要材料", headerWidth: 60, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
|
|
|
{headerName: "供货方式", headerWidth: 80, dataCode: "supply", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:supplyComboMap},
|
|
|
{headerName: "甲供数量", headerWidth: 100, dataCode: "supply_quantity", hAlign: "right", dataType: "Number",validator:"number"},
|
|
|
{headerName: "三材类别", headerWidth: 80, dataCode: "materialType", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:materialComboMap},
|
|
@@ -41,12 +43,47 @@ projectGljObject={
|
|
|
{headerName: "定额价", headerWidth: 120, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
|
|
|
{headerName: "调整价", headerWidth: 120, dataCode: "adjustPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice"},
|
|
|
{headerName: "市场价", headerWidth: 120, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
|
|
|
- {headerName: "用量", headerWidth: 120, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
|
|
|
+ {headerName: "消耗量", headerWidth: 120, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
|
|
|
],
|
|
|
view: {
|
|
|
lockColumns: [0,1,2,3,4,5,6]
|
|
|
}
|
|
|
},
|
|
|
+ materialTreeSetting:{
|
|
|
+ "emptyRows":0,
|
|
|
+ "headRows":1,
|
|
|
+ "headRowHeight":[21],
|
|
|
+ "defaultRowHeight": 21,
|
|
|
+ "treeCol": 0,
|
|
|
+ "cols":[//left:0,center:1,right:2
|
|
|
+ /* {
|
|
|
+ "width":100,
|
|
|
+ "readOnly": true,
|
|
|
+ "head":{
|
|
|
+ "titleNames":["具体位置"],
|
|
|
+ "spanCols":[1],
|
|
|
+ "spanRows":[1],
|
|
|
+ "vAlign":[1],
|
|
|
+ "hAlign":[1],
|
|
|
+ "font":["Arial"]
|
|
|
+ },
|
|
|
+ "data":{
|
|
|
+ "field":"selected",
|
|
|
+ "vAlign":1,
|
|
|
+ "hAlign":1,
|
|
|
+ "font":"Arial",
|
|
|
+ "cellType":function (node) {
|
|
|
+ if(node.data.canSelect == true){
|
|
|
+ return new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ materialSetting:{
|
|
|
+
|
|
|
+ },
|
|
|
mixRatioSpread:null,
|
|
|
mixRatioSheet:null,
|
|
|
mixRatioData:[],
|
|
@@ -75,6 +112,9 @@ projectGljObject={
|
|
|
this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
|
|
|
this.mixRatioSheet.name('mixRatioSheet');
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
unitPriceFileInit:function() {
|
|
|
let me = this;
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
@@ -89,24 +129,26 @@ projectGljObject={
|
|
|
getUsedTenderInfo:function() {
|
|
|
return projectGljObject.usedTenderList.join("<br>");
|
|
|
},
|
|
|
- showMixRatioData:function () {
|
|
|
- let me = this,gljId = null;
|
|
|
- let consumptionCol = _.findIndex(me.mixRatioSetting.header, { 'dataCode': 'consumption'});
|
|
|
+ showMixRatioData:function (from = 'projectGljSheet') { //projectGljSheet/materialSheet 工料机汇总和三材汇总表
|
|
|
+ let me = this,gljId = null,gljType = null;
|
|
|
+ /*let consumptionCol = _.findIndex(me.mixRatioSetting.header, { 'dataCode': 'consumption'});
|
|
|
if(me.showTag == 'ration'){
|
|
|
return;
|
|
|
- }else if(me.showTag == 'mixRatio'){
|
|
|
- me.mixRatioSheet.setValue(0, consumptionCol, '用量', GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
- }else if(me.showTag == 'machine'){
|
|
|
- me.mixRatioSheet.setValue(0, consumptionCol, '消耗量', GC.Spread.Sheets.SheetArea.colHeader);
|
|
|
+ }*/
|
|
|
+ if(from == 'projectGljSheet'){
|
|
|
+ let sel = me.projectGljSheet.getSelections()[0];
|
|
|
+ let srow = sel.row == -1?0:sel.row;
|
|
|
+ if(me.projectGljSheetData.length>srow){
|
|
|
+ gljId = me.projectGljSheetData[srow].id;
|
|
|
+ gljType = me.projectGljSheetData[srow].type;
|
|
|
+ }
|
|
|
}
|
|
|
- let sel = me.projectGljSheet.getSelections()[0];
|
|
|
- let srow = sel.row == -1?0:sel.row;
|
|
|
- if(me.projectGljSheetData.length>srow){
|
|
|
- gljId = me.projectGljSheetData[srow].id;
|
|
|
+ if(compositionTypes.indexOf(gljType)==-1){//如果不是有组成物的类型,工料机id设置为空,组成物表设置为空
|
|
|
+ gljId = null
|
|
|
}
|
|
|
+
|
|
|
projectObj.project.projectGLJ.getRatioData(gljId,function (data) {
|
|
|
let rationList =[];
|
|
|
- console.log(data);
|
|
|
for(let glj of data){
|
|
|
rationList.push(me.getMixRatioSheetData(glj)) ;
|
|
|
}
|
|
@@ -132,7 +174,6 @@ projectGljObject={
|
|
|
gljOprObj.setGLJPrice(data,glj);
|
|
|
return data;
|
|
|
},
|
|
|
-
|
|
|
onProjectGljEditStarting:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
let row = args.row;
|
|
@@ -151,7 +192,7 @@ projectGljObject={
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'){
|
|
|
+ if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='glj.is_main_material'){
|
|
|
return false;
|
|
|
}
|
|
|
if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
|
|
@@ -169,7 +210,6 @@ projectGljObject={
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
-
|
|
|
onProjectGljSelectionChange:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
me.showMixRatioData();
|
|
@@ -213,8 +253,6 @@ projectGljObject={
|
|
|
me.projectGljSheet.setSelection(selected.row,selected.col,selected.rowCount,selected.colCount);
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
showProjectGljData:function () {
|
|
|
let sel = this.projectGljSheet.getSelections()[0];
|
|
|
let projectGljSheetData = [];
|
|
@@ -228,27 +266,42 @@ projectGljObject={
|
|
|
this.projectGljSheet.setRowCount(0);
|
|
|
sheetCommonObj.showData(this.projectGljSheet, this.projectGljSetting,this.projectGljSheetData);
|
|
|
this.projectGljSheet.setRowCount(this.projectGljSheetData.length);
|
|
|
- this.projectGljSheet.setSelection(sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
+ this.projectGljSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
},
|
|
|
filterProjectGLJ:function (gljList) {
|
|
|
let me = projectGljObject;
|
|
|
if(gljList.length>0){
|
|
|
gljList = _.filter(gljList,function (item) {
|
|
|
- if(item.quantity !== 0 && item.quantity !== '0'){//过滤掉消耗量为0的工料机
|
|
|
- //showTag:'ration',//mixRatio/machine
|
|
|
- if(me.showTag == 'ration'){
|
|
|
- return true;
|
|
|
- }else if(me.showTag == 'mixRatio'){
|
|
|
- return _.includes(me.mixRatioType,item.type)
|
|
|
- }else if(me.showTag == 'machine'){
|
|
|
- return _.includes(me.machineType,item.type)
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
+ return me.displayTypeFilter(item);
|
|
|
});
|
|
|
}
|
|
|
return gljList;
|
|
|
},
|
|
|
+ displayTypeFilter:function (item) {
|
|
|
+ let me = this;
|
|
|
+ if(item.quantity !== 0 && item.quantity !== '0'){//过滤掉消耗量为0的工料机
|
|
|
+ if(me.displayType == filterType.ALL){//所有工料机
|
|
|
+ return true;
|
|
|
+ }else if(filterTypeArray.indexOf(me.displayType) != -1){//人工、材料、机械、主材、设备
|
|
|
+ let typeString = item.type+"";
|
|
|
+ return typeString.startsWith(me.displayType);
|
|
|
+ }else if(me.displayType == filterType.FBFX){//“分部分项总消耗量”≠0的工料机行
|
|
|
+ return item.subdivisionQuantity !== 0 && item.subdivisionQuantity !== '0';
|
|
|
+ }else if(me.displayType == filterType.TECH){//筛选“措施项目总消耗量”≠0的工料机行
|
|
|
+ return item.techQuantity !== 0 && item.techQuantity !== '0';
|
|
|
+ }else if(me.displayType == filterType.JGCL){//筛选“供货方式”=“完全甲供”或“部分甲供”的工料机行
|
|
|
+ return item.supply == supplyType.WQJG || item.supply == supplyType.BFJG;
|
|
|
+ }else if(me.displayType == filterType.ZGCL){//筛选“是否暂估”=“是”的工料机行。
|
|
|
+ return item.is_evaluate == 1;
|
|
|
+ }else if(me.displayType == filterType.ZYCL){//筛选“主要材料”=“是”的工料机行。
|
|
|
+ return item.is_main_material == 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(item);
|
|
|
+
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
getSheetDataByGLJ:function (glj) {
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
|
let materialIdList = projectGLJ.datas.constData.materialIdList;
|
|
@@ -274,6 +327,10 @@ projectGljObject={
|
|
|
};
|
|
|
gljOprObj.setGLJPrice(data,glj);
|
|
|
|
|
|
+
|
|
|
+ data.is_main_material = glj.is_main_material == 1?1:0;
|
|
|
+
|
|
|
+
|
|
|
//供货方式为完全甲供时设置甲供数量为总消耗量
|
|
|
if (data.supply == 2) {
|
|
|
data.supply_quantity = glj.quantity;
|
|
@@ -298,10 +355,20 @@ projectGljObject={
|
|
|
let me = projectGljObject;
|
|
|
let rowData = me.projectGljSheetData[row];
|
|
|
let glj = projectObj.project.projectGLJ.getByID(rowData.id);
|
|
|
+ let newRow = null;
|
|
|
if(glj){
|
|
|
- me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
|
|
|
+ newRow = me.getSheetDataByGLJ(glj);
|
|
|
}
|
|
|
- sheetCommonObj.showRowData(this.projectGljSheet, this.projectGljSetting,row,this.projectGljSheetData);
|
|
|
+ if(me.displayTypeFilter(newRow) == true){
|
|
|
+ me.projectGljSheetData[row] = newRow;
|
|
|
+ sheetCommonObj.showRowData(this.projectGljSheet, this.projectGljSetting,row,this.projectGljSheetData);
|
|
|
+ }else {
|
|
|
+ me.projectGljSheetData.splice(row,1);
|
|
|
+ this.projectGljSheet.deleteRows(row,1);
|
|
|
+ }
|
|
|
+ //me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
initSheet: function (sheet,setting) {
|
|
|
var me = this;
|
|
@@ -333,7 +400,8 @@ projectGljObject={
|
|
|
let prow= projectGljObject.projectGljSheet.getActiveRowIndex();//取父机械或组成物的下标
|
|
|
let prowData = projectGljObject.projectGljSheetData[prow];
|
|
|
composition.updateConsumption(updateData,recode,prowData.id,function (sid) {
|
|
|
- me.refreshParentData(prow,prowData.id,sid);
|
|
|
+ me.refreshProjectGljRowByID(sid);
|
|
|
+ me.refreshParentData(prow,prowData.id,sid);
|
|
|
});
|
|
|
},
|
|
|
refreshParentData:function (row,pid,sid) {
|
|
@@ -370,7 +438,6 @@ projectGljObject={
|
|
|
}
|
|
|
gljOprObj.refreshView();
|
|
|
},
|
|
|
-
|
|
|
deleteMixRatio:function (row) {
|
|
|
let me = this, deleteRecode = me.mixRatioData[row];
|
|
|
let consumption = deleteRecode.consumption;
|
|
@@ -419,10 +486,7 @@ projectGljObject={
|
|
|
info.sheet.suspendEvent();
|
|
|
me.refreshProjectGljRow(row);
|
|
|
for(let g of impactList){
|
|
|
- let index = _.findIndex(me.projectGljSheetData, { 'id': g.id });
|
|
|
- if(index>=0&&index != row){
|
|
|
- me.refreshProjectGljRow(index);
|
|
|
- }
|
|
|
+ me.refreshProjectGljRowByID(g.id,row);
|
|
|
}
|
|
|
info.sheet.resumeEvent();
|
|
|
info.sheet.resumePaint();
|
|
@@ -459,6 +523,13 @@ projectGljObject={
|
|
|
projectGLJ.pGljUpdate(updateData,callback);
|
|
|
};
|
|
|
},
|
|
|
+ refreshProjectGljRowByID:function (ID,row) {//row 可以不传,如果row 和 index 相等就不刷新
|
|
|
+ let me = this;
|
|
|
+ let index = _.findIndex(me.projectGljSheetData, { 'id': ID});
|
|
|
+ if(index>=0&&index != row){
|
|
|
+ me.refreshProjectGljRow(index);
|
|
|
+ }
|
|
|
+ },
|
|
|
getSupplyQuantity : function(supplyType, quantity) {
|
|
|
// 自行采购和甲定乙供则把甲供数量设置为0,其余情况则设置为当前总消耗量
|
|
|
let supplyQuantity = supplyType == 0 || supplyType == 3 ? 0 : quantity;
|
|
@@ -561,6 +632,7 @@ $(function () {
|
|
|
//projectObj.project.projectGLJ.calcQuantity(); 在工程量有更新的地方调用
|
|
|
|
|
|
me.showProjectGljData();
|
|
|
+ me.initMixRatio();
|
|
|
loadSize(pojGljResizeEles, 'height', function () {
|
|
|
me.projectGljSpread.refresh();
|
|
|
me.mixRatioSpread?me.mixRatioSpread.refresh():'';
|
|
@@ -698,6 +770,15 @@ $(function () {
|
|
|
$("#unitFile-save-as").modal("hide");
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ $("#filterType").on("click","ul li a",function(){
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.displayType = filterType[this.id];
|
|
|
+ me.showProjectGljData();
|
|
|
+ me.showMixRatioData();
|
|
|
+ console.log(this.id);
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
|
|
|
|