|
@@ -3,6 +3,8 @@
|
|
|
*/
|
|
|
projectGljObject={
|
|
|
showTag:'ration',//mixRatio/machine
|
|
|
+ showMixRatioMark:'',
|
|
|
+ displayType:filterType.ALL,
|
|
|
mixRatioType: [gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO,gljType.MAIN_MATERIAL],
|
|
|
machineType: [gljType.GENERAL_MACHINE],
|
|
|
projectGljSetting:{
|
|
@@ -17,10 +19,11 @@ 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},
|
|
|
- {headerName: "三材系数", headerWidth: 100, dataCode: "materialCoe", hAlign: "right", dataType: "Number",decimalField:'material'},
|
|
|
+ {headerName: "三材系数", headerWidth: 100, dataCode: "materialCoe", hAlign: "right", dataType: "Number",decimalField:'material',validator:"number"},
|
|
|
{headerName: "交货方式", headerWidth: 90, dataCode: "delivery", hAlign: "left", dataType: "String"},
|
|
|
{headerName: "送达地点", headerWidth: 100, dataCode: "delivery_address", hAlign: "left", dataType: "String"},
|
|
|
{headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", dataType: "String",cellType: "checkBox"}
|
|
@@ -31,6 +34,7 @@ projectGljObject={
|
|
|
},
|
|
|
projectGljSpread:null,
|
|
|
projectGljSheet:null,
|
|
|
+ materialTreeSheet:null,
|
|
|
projectGljSheetData:[],
|
|
|
mixRatioSetting:{
|
|
|
header:[
|
|
@@ -41,19 +45,50 @@ 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":[]
|
|
|
+ },
|
|
|
+ materialSetting:{
|
|
|
+ header:[
|
|
|
+ {headerName: "编码", headerWidth: 200, dataCode: "code", dataType: "String"},
|
|
|
+ {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String"},
|
|
|
+ {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String"},
|
|
|
+ {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
|
|
|
+ {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",decimalField:'glj.unitPrice',validator:"number"},
|
|
|
+ {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",decimalField:"glj.unitPrice",validator:"number"},
|
|
|
+ {headerName: "总消耗量", headerWidth: 100, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
|
|
|
+ {headerName: "三材系数", headerWidth: 100, dataCode: "materialCoe", hAlign: "right", dataType: "Number",decimalField:'material',validator:"number"},
|
|
|
+ {headerName: "三材量", headerWidth: 100, dataCode: "materialQuantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
|
|
|
+ {headerName: "三材类别", headerWidth: 80, dataCode: "materialType", hAlign: "center", dataType: "String",cellType:'comboBox',editorValueType:true,options:materialComboMap}
|
|
|
+ ],
|
|
|
+ view: {
|
|
|
+ lockColumns: [0,1,2,3,6,8]
|
|
|
+ }
|
|
|
+ },
|
|
|
mixRatioSpread:null,
|
|
|
mixRatioSheet:null,
|
|
|
mixRatioData:[],
|
|
|
usedTenderList:[],
|
|
|
usedUnitPriceInfo:null,
|
|
|
initProjectGljSpread:function () {
|
|
|
- this.projectGljSpread = SheetDataHelper.createNewSpread($("#project_glj_sheet")[0]);
|
|
|
+ if(!this.projectGljSpread){
|
|
|
+ this.projectGljSpread = SheetDataHelper.createNewSpread($("#project_glj_sheet")[0],2);
|
|
|
+ }
|
|
|
+ this.initProjectGljSheet();
|
|
|
+ this.initMaterialTreeSheet();
|
|
|
+ },
|
|
|
+ initProjectGljSheet:function () {
|
|
|
this.projectGljSheet = this.projectGljSpread .getSheet(0);
|
|
|
this.initSheet(this.projectGljSheet,this.projectGljSetting);
|
|
|
this.projectGljSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onProjectGljSelectionChange);
|
|
@@ -75,6 +110,69 @@ projectGljObject={
|
|
|
this.initSheet(this.mixRatioSheet,this.mixRatioSetting);
|
|
|
this.mixRatioSheet.name('mixRatioSheet');
|
|
|
},
|
|
|
+ initMaterialTreeSheet:function () {
|
|
|
+ this.materialTreeSheet = this.projectGljSpread.getSheet(1);
|
|
|
+ this.materialTreeSetting = this.createMaterialTreeSheetSetting();
|
|
|
+ this.materialTree = cacheTree.createNew(this);
|
|
|
+ this.materialTreeController = TREE_SHEET_CONTROLLER.createNew(this.materialTree, this.materialTreeSheet, this.materialTreeSetting);
|
|
|
+ this.materialTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, this.onSelectionChange);
|
|
|
+ this.materialTreeSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onMaterialTreeEditStarting);
|
|
|
+ this.materialTreeSheet.name('materialTreeSheet');
|
|
|
+ },
|
|
|
+ createMaterialTreeSheetSetting:function () {
|
|
|
+ for(let h of this.materialSetting.header){
|
|
|
+ this.materialTreeSetting.cols.push(getSettingCol(h))
|
|
|
+ }
|
|
|
+ for(let l of this.materialSetting.view.lockColumns){
|
|
|
+ this.materialTreeSetting.cols[l].readOnly = true;
|
|
|
+ }
|
|
|
+ return this.materialTreeSetting;
|
|
|
+
|
|
|
+ function getSettingCol(header) {
|
|
|
+ let aMap ={left:0,center:1,right:2};
|
|
|
+ let hAlign = header.hAlign?aMap[header.hAlign]:0;
|
|
|
+ let col = {
|
|
|
+ "width":header.headerWidth?header.headerWidth:100,
|
|
|
+ "head":{
|
|
|
+ "titleNames":[header.headerName],
|
|
|
+ "spanCols":[1],
|
|
|
+ "spanRows":[1],
|
|
|
+ "vAlign":[1],
|
|
|
+ "hAlign":[1],
|
|
|
+ "font":["Arial"]
|
|
|
+ },
|
|
|
+ "data": {
|
|
|
+ "field": header.dataCode,
|
|
|
+ "vAlign": 1,
|
|
|
+ "hAlign": hAlign,
|
|
|
+ "font": "Arial"
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if(header.cellType){
|
|
|
+ col.data.cellType = getCellType(header);
|
|
|
+ }
|
|
|
+ return col;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function getCellType(header) {
|
|
|
+ return function () {
|
|
|
+ if(header.cellType === "checkBox"){
|
|
|
+ return new GC.Spread.Sheets.CellTypes.CheckBox();
|
|
|
+ }
|
|
|
+ if(header.cellType === "comboBox"){
|
|
|
+ let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
|
|
|
+ if(header.options){
|
|
|
+ dynamicCombo.itemHeight(header.options.length).items(header.options);
|
|
|
+ if(header.editorValueType==true){
|
|
|
+ dynamicCombo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return dynamicCombo
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
unitPriceFileInit:function() {
|
|
|
let me = this;
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
@@ -90,23 +188,29 @@ projectGljObject={
|
|
|
return projectGljObject.usedTenderList.join("<br>");
|
|
|
},
|
|
|
showMixRatioData:function () {
|
|
|
- let me = this,gljId = 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);
|
|
|
+ let me = this,gljId = null,gljType = null;
|
|
|
+ let sheet = me.projectGljSpread.getActiveSheet();
|
|
|
+ if(sheet.name() == 'projectGljSheet'){//projectGljSheet/materialSheet 工料机汇总和三材汇总表
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }else if(sheet.name() == 'materialTreeSheet' ){
|
|
|
+ if(this.materialTree.selected){
|
|
|
+ gljId = this.materialTree.selected.data.id;
|
|
|
+ gljType = this.materialTree.selected.data.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) {
|
|
|
+ if(gljId !== projectObj.project.projectGLJ.getRatioId){//两个id不一致说明不是最新的请求,不用往下执行。
|
|
|
+ return;
|
|
|
+ }
|
|
|
let rationList =[];
|
|
|
- console.log(data);
|
|
|
for(let glj of data){
|
|
|
rationList.push(me.getMixRatioSheetData(glj)) ;
|
|
|
}
|
|
@@ -132,7 +236,6 @@ projectGljObject={
|
|
|
gljOprObj.setGLJPrice(data,glj);
|
|
|
return data;
|
|
|
},
|
|
|
-
|
|
|
onProjectGljEditStarting:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
let row = args.row;
|
|
@@ -151,7 +254,7 @@ projectGljObject={
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'){
|
|
|
+ if(dataCode=='is_adjust_price'||dataCode=='is_evaluate'||dataCode=='is_main_material'){
|
|
|
return false;
|
|
|
}
|
|
|
if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
|
|
@@ -169,10 +272,26 @@ projectGljObject={
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
+ onSelectionChange:function (){
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showMixRatioData();
|
|
|
+ me.materialTreeSheet.repaint();
|
|
|
+ },
|
|
|
+ onMaterialTreeEditStarting:function (sender, args) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ let selected = me.materialTree.selected;
|
|
|
+ if(selected && (selected.data.ParentID == -1 || selected.data.id == 'GJ')){//三材类别项不能编辑
|
|
|
+ args.cancel = true;
|
|
|
+ }
|
|
|
|
|
|
+ },
|
|
|
onProjectGljSelectionChange:function (sender, args) {
|
|
|
let me = projectGljObject;
|
|
|
- me.showMixRatioData();
|
|
|
+ let newSel = args.newSelections[0];
|
|
|
+ let oldSel = args.oldSelections?args.oldSelections[0]:{};
|
|
|
+ if(newSel.row != oldSel.row){
|
|
|
+ me.showMixRatioData();
|
|
|
+ }
|
|
|
me.projectGljSheet.repaint();
|
|
|
},
|
|
|
onProjectGljRangeChange:function (sender,info) {
|
|
@@ -213,9 +332,8 @@ projectGljObject={
|
|
|
me.projectGljSheet.setSelection(selected.row,selected.col,selected.rowCount,selected.colCount);
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
showProjectGljData:function () {
|
|
|
+ this.projectGljSpread.setActiveSheetIndex(0);
|
|
|
let sel = this.projectGljSheet.getSelections()[0];
|
|
|
let projectGljSheetData = [];
|
|
|
let gljList = projectObj.project.projectGLJ.datas.gljList;
|
|
@@ -228,27 +346,139 @@ 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);
|
|
|
+ },
|
|
|
+ showMaterialTreeData:function () {
|
|
|
+ this.projectGljSpread.setActiveSheetIndex(1);
|
|
|
+ let sel = this.materialTreeSheet.getSelections()[0];
|
|
|
+ let selNode = this.materialTree.selected;
|
|
|
+ let gljList = projectObj.project.projectGLJ.datas.gljList;
|
|
|
+ gljList = _.sortByAll(gljList, [ 'code']);
|
|
|
+ this.createMaterialTree(gljList);
|
|
|
+ this.materialTreeController.showTreeData();
|
|
|
+ this.materialTreeSheet.setSelection(sel.row==-1?0:sel.row,sel.col,sel.rowCount,sel.colCount);
|
|
|
+ this.materialTreeController.setTreeSelected(selNode);
|
|
|
+ },
|
|
|
+ createMaterialTree:function (gljList) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ let q_decimal = getDecimal("glj.quantity");
|
|
|
+ let GC = {id:'GC',name:materialType[materialTypeMap.GC],code:'GC',unit:'t',ParentID:-1,NextSiblingID:'MC'};//000001
|
|
|
+ let GJ = {id:'GJ',name:materialType[materialTypeMap.GJ],code:'GJ',unit:'t',ParentID:'GC',NextSiblingID:-1};
|
|
|
+ let MC = {id:'MC',name:materialType[materialTypeMap.MC],code:'MC',unit:'t',ParentID:-1,NextSiblingID:'SN'};
|
|
|
+ let SN = {id:'SN',name:materialType[materialTypeMap.SN],code:'SN',unit:'m3',ParentID:-1,NextSiblingID:'SZ'};
|
|
|
+ let SZ = {id:'SZ',name:materialType[materialTypeMap.SZ],code:'BZZ',unit:'千块',ParentID:-1,NextSiblingID:-1};
|
|
|
+ let rootDatas= [GC,GJ,MC,SN,SZ];
|
|
|
+ let parentMap = {};
|
|
|
+ let sumMap = {};
|
|
|
+ this.materialTree.nodes={},this.materialTree.selected = null,this.materialTree.roots = [],this.materialTree.items=[];
|
|
|
+ for(let r of rootDatas){
|
|
|
+ let baseNode = null;
|
|
|
+ if(r.id == 'GJ'){
|
|
|
+ baseNode = createMaterialNode(r,parentMap['GC'],null);//钢筋的父节点为钢材
|
|
|
+ }else {
|
|
|
+ baseNode = createMaterialNode(r,null,null);
|
|
|
+ }
|
|
|
+ parentMap[r.id] = baseNode;
|
|
|
+ }
|
|
|
+ for(let g of gljList){
|
|
|
+ if(g.quantity !== 0 && g.quantity !== '0'){
|
|
|
+ if(g.materialType){
|
|
|
+ let tem = me.getMaterialSheetDataByGLJ(g);
|
|
|
+ if(tem.materialQuantity){
|
|
|
+ sumMap[g.materialType] = sumMap[g.materialType]?sumMap[g.materialType] + tem.materialQuantity:tem.materialQuantity;
|
|
|
+ tem.materialQuantity = scMathUtil.roundToString(tem.materialQuantity,q_decimal);//转成string
|
|
|
+ }
|
|
|
+ if(g.materialType == materialTypeMap.GC){ //钢材的下一节点是钢筋
|
|
|
+ createMaterialNode(tem,parentMap['GC'],parentMap['GJ']);
|
|
|
+ }else {
|
|
|
+ createMaterialNode(tem,parentMap[materialTypeMap[g.materialType]]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for(let mkey in sumMap){
|
|
|
+ if(mkey == materialTypeMap.GC && sumMap[materialTypeMap.GJ]){//钢材汇总要加上钢筋的总量
|
|
|
+ parentMap['GC'].data.materialQuantity = scMathUtil.roundToString(sumMap[mkey]+sumMap[materialTypeMap.GJ],q_decimal);
|
|
|
+ }else {
|
|
|
+ parentMap[materialTypeMap[mkey]].data.materialQuantity = scMathUtil.roundToString(sumMap[mkey],q_decimal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.materialTree.sortTreeItems();
|
|
|
+
|
|
|
+ function createMaterialNode(data,parent,next) {
|
|
|
+ let newNode = me.materialTree.addNode(parent, next, data.id);
|
|
|
+ newNode.data = data;
|
|
|
+ return newNode;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getMaterialSheetDataByGLJ:function (glj) {
|
|
|
+ let q_decimal = getDecimal("glj.quantity");
|
|
|
+ let m_decimal = getDecimal("material");
|
|
|
+ let p_decimal = getDecimal("glj.unitPrice");
|
|
|
+ let projectGLJ = projectObj.project.projectGLJ;
|
|
|
+ let data ={
|
|
|
+ id:glj.id,
|
|
|
+ code:glj.code,
|
|
|
+ name:glj.name,
|
|
|
+ specs:glj.specs,
|
|
|
+ unit:glj.unit,
|
|
|
+ type:glj.type,
|
|
|
+ short_name:projectGLJ.getShortNameByID(glj.type),
|
|
|
+ quantity:scMathUtil.roundToString(glj.quantity,q_decimal),
|
|
|
+ supply:glj.supply,
|
|
|
+ supply_quantity:glj.supply_quantity,
|
|
|
+ materialType:glj.materialType,
|
|
|
+ delivery:glj.delivery,
|
|
|
+ delivery_address:glj.delivery_address,
|
|
|
+ is_adjust_price:glj.is_adjust_price,
|
|
|
+ ratio_data:glj.ratio_data,
|
|
|
+ is_add:glj.unit_price.is_add,
|
|
|
+ bgColour:'white'
|
|
|
+ };
|
|
|
+ if(glj.materialCoe){
|
|
|
+ data.materialCoe = scMathUtil.roundToString(glj.materialCoe,m_decimal);
|
|
|
+ data.materialQuantity = scMathUtil.roundForObj(glj.materialCoe * glj.quantity,q_decimal);//还要做汇总,汇总完再转成string
|
|
|
+ }
|
|
|
+ gljOprObj.setGLJPrice(data,glj);
|
|
|
+ data.basePrice = scMathUtil.roundToString(data.basePrice,p_decimal);
|
|
|
+ data.marketPrice = scMathUtil.roundToString(data.marketPrice,p_decimal);
|
|
|
+
|
|
|
+ return data;
|
|
|
},
|
|
|
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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
getSheetDataByGLJ:function (glj) {
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
|
let materialIdList = projectGLJ.datas.constData.materialIdList;
|
|
@@ -274,6 +504,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 +532,21 @@ 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);
|
|
|
+ }
|
|
|
+ if(me.displayTypeFilter(newRow) == true){
|
|
|
+ me.projectGljSheetData[row] = newRow;
|
|
|
+ sheetCommonObj.showRowData(this.projectGljSheet, this.projectGljSetting,row,this.projectGljSheetData);
|
|
|
+ }else {
|
|
|
+ me.projectGljSheetData.splice(row,1);
|
|
|
+ me.projectGljSheet.deleteRows(row,1);
|
|
|
+ me.showMixRatioData();
|
|
|
}
|
|
|
- sheetCommonObj.showRowData(this.projectGljSheet, this.projectGljSetting,row,this.projectGljSheetData);
|
|
|
+ //me.projectGljSheetData[row] = me.getSheetDataByGLJ(glj);
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
initSheet: function (sheet,setting) {
|
|
|
var me = this;
|
|
@@ -312,7 +557,7 @@ projectGljObject={
|
|
|
let me = projectGljObject;
|
|
|
if(info.sheetName=='projectGljSheet'){
|
|
|
me.onProjectGLJValueChange(e,info);
|
|
|
- }if(info.sheetName == 'mixRatioSheet'){
|
|
|
+ }else if(info.sheetName == 'mixRatioSheet'){
|
|
|
me.onMixRatioValueChange(e,info);
|
|
|
}
|
|
|
},
|
|
@@ -333,7 +578,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 +616,6 @@ projectGljObject={
|
|
|
}
|
|
|
gljOprObj.refreshView();
|
|
|
},
|
|
|
-
|
|
|
deleteMixRatio:function (row) {
|
|
|
let me = this, deleteRecode = me.mixRatioData[row];
|
|
|
let consumption = deleteRecode.consumption;
|
|
@@ -409,8 +654,13 @@ projectGljObject={
|
|
|
let dataCode = me.projectGljSetting.header[col].dataCode;
|
|
|
let recode = me.projectGljSheetData[row];
|
|
|
let value = info.newValue;
|
|
|
+ if(info.newValue == undefined ){
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!me.checkData(col,me.projectGljSetting,value)) {
|
|
|
- alert('输入的数据类型不对,请重新输入!');
|
|
|
+ setTimeout(function () {//为了不与click事件冲突
|
|
|
+ alert('输入的数据类型不对,请重新输入!');
|
|
|
+ },200);
|
|
|
me.refreshProjectGljRow(row);
|
|
|
return ;
|
|
|
}
|
|
@@ -419,10 +669,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();
|
|
@@ -447,7 +694,7 @@ projectGljObject={
|
|
|
if(dataCode === 'supply_quantity'){//修改数量需做4舍5入
|
|
|
value= value.toDecimal(getDecimal('glj.quantity'));
|
|
|
}
|
|
|
- if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'){
|
|
|
+ if(dataCode === 'is_evaluate'||dataCode === 'is_adjust_price'||dataCode === 'is_main_material'){
|
|
|
if(value == true){
|
|
|
value = 1;
|
|
|
}else if(value == false){
|
|
@@ -459,6 +706,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;
|
|
@@ -551,6 +805,7 @@ $(function () {
|
|
|
projectGljObject.mixRatioSpread?projectGljObject.mixRatioSpread.refresh():'';
|
|
|
});
|
|
|
$('#tab_project_glj').on('shown.bs.tab', function (e) {
|
|
|
+ sessionStorage.setItem('mainTab', '#tab_project_glj');
|
|
|
let me = projectGljObject;
|
|
|
$(e.relatedTarget.hash).removeClass('active');
|
|
|
if(me.projectGljSpread==null){
|
|
@@ -558,13 +813,18 @@ $(function () {
|
|
|
}
|
|
|
me.unitPriceFileInit();
|
|
|
//projectObj.project.projectGLJ.calcQuantity(); 在工程量有更新的地方调用
|
|
|
- me.showProjectGljData();
|
|
|
+ if(me.displayType == filterType.SCHZ){//三材汇总树节点
|
|
|
+ me.showMaterialTreeData();
|
|
|
+ }else {
|
|
|
+ me.showProjectGljData();
|
|
|
+ }
|
|
|
+ me.initMixRatio();
|
|
|
loadSize(pojGljResizeEles, 'height', function () {
|
|
|
me.projectGljSpread.refresh();
|
|
|
me.mixRatioSpread?me.mixRatioSpread.refresh():'';
|
|
|
});
|
|
|
});
|
|
|
- $('#ration_link').on('shown.bs.tab', function (e) {
|
|
|
+ /* $('#ration_link').on('shown.bs.tab', function (e) {
|
|
|
let me = projectGljObject;
|
|
|
me.showTag='ration';
|
|
|
me.showProjectGljData();
|
|
@@ -580,7 +840,7 @@ $(function () {
|
|
|
me.showTag='machine';
|
|
|
me.showProjectGljData();
|
|
|
me.initMixRatio();
|
|
|
- });
|
|
|
+ });*/
|
|
|
$('#pop-used-list').popover({
|
|
|
placement: "bottom",
|
|
|
html: true,
|
|
@@ -696,6 +956,18 @@ $(function () {
|
|
|
$("#unitFile-save-as").modal("hide");
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ $("#filterType").on("click","ul li a",function(){
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.displayType = filterType[this.id];
|
|
|
+ if(me.displayType == filterType.SCHZ){//三材汇总树节点
|
|
|
+ me.showMaterialTreeData();
|
|
|
+ }else {
|
|
|
+ me.showProjectGljData();
|
|
|
+ me.showMixRatioData();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
|
|
|
|