|
@@ -137,6 +137,46 @@ projectGljObject={
|
|
|
getUsedTenderInfo:function() {
|
|
|
return projectGljObject.usedTenderList.join("<br>");
|
|
|
},
|
|
|
+ filterLibGLJForMixRatio:function () {
|
|
|
+ let me = this;
|
|
|
+ if(me.selectedProjectGLJ){
|
|
|
+ let showTypes = [];
|
|
|
+ let materialArr = [202, 203, 204];//混凝土、砂浆、配合比,
|
|
|
+ if(me.selectedProjectGLJ.type == gljType.MAIN_MATERIAL){//对于主材,只显示没有组成物并且除了自已的主材
|
|
|
+ showTypes = [gljType.MAIN_MATERIAL];
|
|
|
+ }else if(_.includes(materialArr,me.selectedProjectGLJ.type)){//混凝土、砂浆、配合比
|
|
|
+ showTypes = [gljType.GENERAL_MATERIAL];
|
|
|
+ }else if(me.selectedProjectGLJ.type == gljType.GENERAL_MACHINE){//机械类型可添加机械组成物、机上人工
|
|
|
+ showTypes = [gljType.MACHINE_COMPOSITION,gljType.MACHINE_LABOUR];
|
|
|
+ }
|
|
|
+ gljOprObj.gljLibSheetData = _.filter(gljOprObj.gljLibSheetData, function (item) {
|
|
|
+ if(me.selectedProjectGLJ.type == gljType.MAIN_MATERIAL){
|
|
|
+ let p_index = gljOprObj.getIndex(me.selectedProjectGLJ,gljKeyArray);
|
|
|
+ let i_index = gljOprObj.getIndex(item,gljLibKeyArray);
|
|
|
+ return item.gljType == gljType.MAIN_MATERIAL &&item.component.length == 0 && p_index!=i_index
|
|
|
+ }else {
|
|
|
+ return _.includes(showTypes,item.gljType);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addMixRatio:function () {
|
|
|
+ let me = this, projectGLJ = projectObj.project.projectGLJ;
|
|
|
+ for(let mix of me.mixRatioData){
|
|
|
+ let m_key = gljOprObj.getIndex(mix, gljKeyArray);
|
|
|
+ let t_index = gljOprObj.GLJSelection.indexOf(m_key);
|
|
|
+ t_index != -1?gljOprObj.GLJSelection.splice(t_index,1):'';
|
|
|
+ }
|
|
|
+ projectGLJ.addMixRatio(gljOprObj.GLJSelection,function (mixRatios) {
|
|
|
+ me.showMixRatioData();//这里添加的组成物的消耗量默认都是0,所以对父工料机的价格不会有影响,不用触发计算
|
|
|
+ projectGLJ.loadData(function () {
|
|
|
+ me.showProjectGljData();
|
|
|
+ gljOprObj.showRationGLJSheetData();
|
|
|
+ me.onUnitFileChange(me.selectedProjectGLJ);
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
showMixRatioData:function () {
|
|
|
let me = this,gljId = null,gljType = null;
|
|
|
let sheet = me.projectGljSpread.getActiveSheet();
|
|
@@ -219,7 +259,7 @@ projectGljObject={
|
|
|
}
|
|
|
if(dataCode=='basePrice'||dataCode=='marketPrice'||dataCode=='supply'){//有组成物时,市场单价、定额价、供货方式不能修改
|
|
|
if (data.ratio_data && data.ratio_data.length > 0){
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
if(dataCode=='basePrice'&&data.is_add!=1){//如果不是新增,定额价不可修改。
|
|
|
return false;
|
|
@@ -227,7 +267,7 @@ projectGljObject={
|
|
|
}
|
|
|
if(dataCode == 'supply_quantity'){
|
|
|
if (data.supply != 1) {// 如果为部分甲供则甲供数量需要可编辑,其它的都不能编辑
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
if(dataCode == 'materialCoe'){//三材类别为空时,三材系数应只读,不允许输入。
|
|
@@ -270,7 +310,7 @@ projectGljObject={
|
|
|
changeInfo.push({row:c.row,col:c.col,value:value});
|
|
|
if(me.projectGljEditChecking(c.row,c.col)==false){//如果不能编辑
|
|
|
canChange = false;
|
|
|
- }
|
|
|
+ }
|
|
|
if (canChange==true&&!me.checkData(c.col,me.projectGljSetting,value)) {
|
|
|
alert('输入的数据类型不对,请重新输入!');
|
|
|
canChange = false;
|
|
@@ -279,7 +319,7 @@ projectGljObject={
|
|
|
if(canChange == false){//恢复原来的值
|
|
|
info.sheetName =="materialTreeSheet"?me.showMaterialTreeData():me.showProjectGljData();
|
|
|
}else if(info.sheetName =="projectGljSheet"){
|
|
|
- me.batchUpdatePrice(changeInfo);
|
|
|
+ me.batchUpdatePrice(changeInfo);
|
|
|
}
|
|
|
},
|
|
|
batchUpdatePrice(changeInfo){
|
|
@@ -564,11 +604,12 @@ projectGljObject={
|
|
|
let prow = parentSheet.getActiveRowIndex();//取父机械或组成物的下标
|
|
|
let prowData = parentSheet.name() == 'projectGljSheet'?me.projectGljSheetData[prow]:me.materialTree.items[prow].data;
|
|
|
composition.updateConsumption(updateData,recode,prowData.id,function (sid) {
|
|
|
- /* if(parentSheet.name() == 'projectGljSheet'){ 之前是单行刷新,父工料机与组成物对应的工料机分开刷,发现这样比整个刷新慢所以先整个刷新,当以后数据量大的时候再测试
|
|
|
- me.refreshProjectGljRowByID(sid);
|
|
|
- }*/
|
|
|
+ /* if(parentSheet.name() == 'projectGljSheet'){ 之前是单行刷新,父工料机与组成物对应的工料机分开刷,发现这样比整个刷新慢所以先整个刷新,当以后数据量大的时候再测试
|
|
|
+ me.refreshProjectGljRowByID(sid);
|
|
|
+ }*/
|
|
|
projectObj.project.projectGLJ.calcQuantity();
|
|
|
me.refreshParentData(prow,prowData.id,sid);
|
|
|
+ me.onUnitFileChange(recode);
|
|
|
});
|
|
|
},
|
|
|
refreshParentData:function (row,pid,sid) {
|
|
@@ -613,10 +654,15 @@ projectGljObject={
|
|
|
if(updateNodes.length>0){
|
|
|
projectObj.project.calcProgram.calcRationsAndSave(updateNodes,function () {
|
|
|
projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
|
|
|
+ installationFeeObj.calcInstallationFee();//计算安装增加费
|
|
|
});
|
|
|
}
|
|
|
gljOprObj.refreshView();
|
|
|
},
|
|
|
+ onUnitFileChange:function (data) {
|
|
|
+ socket.emit('unitFileChangeNotify', JSON.stringify(data));
|
|
|
+ projectObj.project.markUpdateProject({projectID:projectObj.project.ID(),'unitFileID':socketObject.getUnitFileRoomID()},"unitFile");
|
|
|
+ },
|
|
|
deleteMixRatio:function (row) {
|
|
|
let me = this, deleteRecode = me.mixRatioData[row];
|
|
|
let consumption = deleteRecode.consumption;
|
|
@@ -628,6 +674,7 @@ projectGljObject={
|
|
|
projectObj.project.composition.deleteComposition(updateData,deleteRecode,prowData.id,function () {
|
|
|
me.refreshParentData(prow,prowData.id);
|
|
|
me.mixRatioSheet.deleteRows(row,1);
|
|
|
+ me.onUnitFileChange(deleteRecode);
|
|
|
});
|
|
|
},
|
|
|
getCompositionSumPrice : function(scene, affectRow, newValue = 0) {
|
|
@@ -692,7 +739,6 @@ projectGljObject={
|
|
|
value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
|
|
|
let editField = dataCode === 'basePrice'?"base_price":"market_price";
|
|
|
projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',callback);
|
|
|
-
|
|
|
}else {
|
|
|
let extend = {};
|
|
|
// 如果是供货方式则需要处理数据
|
|
@@ -754,6 +800,22 @@ projectGljObject={
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
|
+ 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;
|
|
|
+ },
|
|
|
initRightClick : function() {
|
|
|
let activeSheet = this.mixRatioSheet;
|
|
|
let me = this;
|
|
@@ -780,11 +842,12 @@ projectGljObject={
|
|
|
name: '添加',
|
|
|
icon: 'fa-sign-in',
|
|
|
disabled: function () {
|
|
|
- return me.rightClickTarget.row === undefined;
|
|
|
+ let projectGLJ = projectGljObject.getProjectGLJSelected();
|
|
|
+ return !_.includes(compositionTypes,projectGLJ.type);
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
- let row = me.rightClickTarget.row;
|
|
|
- console.log(row);
|
|
|
+ me.selectedProjectGLJ = projectGljObject.getProjectGLJSelected();
|
|
|
+ getGLJData('addMix');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -808,12 +871,12 @@ projectGljObject={
|
|
|
},
|
|
|
calcPartASupplyFeeByProjectGLJs: function (projectGLJsArr) {
|
|
|
for (let pGLJ of projectGLJsArr){
|
|
|
- if (pGLJ.supply == supplyType.BFJG){
|
|
|
- let rations = calcTools.getRationsByProjectGLJ(pGLJ.id);
|
|
|
- projectObj.project.calcProgram.calcNodesAndSave(rations, function () {
|
|
|
- projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
|
|
|
- });
|
|
|
- }
|
|
|
+ if (pGLJ.supply == supplyType.BFJG){
|
|
|
+ let rations = calcTools.getRationsByProjectGLJ(pGLJ.id);
|
|
|
+ projectObj.project.calcProgram.calcNodesAndSave(rations, function () {
|
|
|
+ projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
checkUnitFileName:function (name,callback) {
|
|
@@ -875,23 +938,23 @@ $(function () {
|
|
|
me.refreshDataSheet();
|
|
|
loadProjectGljSize();
|
|
|
});
|
|
|
- /* $('#ration_link').on('shown.bs.tab', function (e) {
|
|
|
- let me = projectGljObject;
|
|
|
- me.showTag='ration';
|
|
|
- me.showProjectGljData();
|
|
|
- });
|
|
|
- $('#mix_ratio_link').on('shown.bs.tab', function (e) {
|
|
|
- let me = projectGljObject;
|
|
|
- me.showTag='mixRatio';
|
|
|
- me.showProjectGljData();
|
|
|
- me.initMixRatio();
|
|
|
- });
|
|
|
- $('#machine_ratio_link').on('shown.bs.tab', function (e) {
|
|
|
- let me = projectGljObject;
|
|
|
- me.showTag='machine';
|
|
|
- me.showProjectGljData();
|
|
|
- me.initMixRatio();
|
|
|
- });*/
|
|
|
+ /* $('#ration_link').on('shown.bs.tab', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showTag='ration';
|
|
|
+ me.showProjectGljData();
|
|
|
+ });
|
|
|
+ $('#mix_ratio_link').on('shown.bs.tab', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showTag='mixRatio';
|
|
|
+ me.showProjectGljData();
|
|
|
+ me.initMixRatio();
|
|
|
+ });
|
|
|
+ $('#machine_ratio_link').on('shown.bs.tab', function (e) {
|
|
|
+ let me = projectGljObject;
|
|
|
+ me.showTag='machine';
|
|
|
+ me.showProjectGljData();
|
|
|
+ me.initMixRatio();
|
|
|
+ });*/
|
|
|
$('#pop-used-list').popover({
|
|
|
placement: "bottom",
|
|
|
html: true,
|