|
@@ -304,7 +304,7 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
|
|
|
$.bootstrapLoading.start();
|
|
|
CommonAjax.post("/glj/batchUpdateGLJProperty", updateMap,function (result) {
|
|
|
$.bootstrapLoading.end();
|
|
|
- let supplyChangeIDs = [],evaluateIDs = [],rationNodes = [];
|
|
|
+ let supplyChangeIDs = [],evaluate_gljs = [],rationNodes = [];
|
|
|
console.log(updateMap);
|
|
|
for(let idKey in updateMap){
|
|
|
let gljID = parseInt(idKey);
|
|
@@ -317,20 +317,20 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
|
|
|
supplyChangeIDs.push(gljID);
|
|
|
}
|
|
|
if(doc.hasOwnProperty("is_evaluate")){
|
|
|
- evaluateIDs.push(gljID);
|
|
|
+ evaluate_gljs.push(glj);
|
|
|
}
|
|
|
}
|
|
|
if(supplyChangeIDs.length>0){
|
|
|
let temRationNodes = calcTools.getRationsByProjectGLJ(supplyChangeIDs);
|
|
|
if (temRationNodes.length > 0) rationNodes = rationNodes.concat(temRationNodes);
|
|
|
}
|
|
|
- for(let e of evaluateIDs){
|
|
|
- //me.changeIsEvaluate(s);
|
|
|
+ if(evaluate_gljs.length > 0){
|
|
|
+ let [impactRationNodes,impactGLJs] = me.batchChangeIsEvaluate(evaluate_gljs);
|
|
|
+ rationNodes = rationNodes.concat(impactRationNodes);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if(rationNodes.length > 0){
|
|
|
+ rationNodes = _.uniq(rationNodes,'data');
|
|
|
projectObj.project.calcProgram.calcNodesAndSave(rationNodes, function () {
|
|
|
projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
|
|
|
});
|
|
@@ -584,8 +584,8 @@ ProjectGLJ.prototype.changeIsEvaluate=function (id){
|
|
|
let datas = projectGLJ.datas;
|
|
|
let gljList = datas.gljList;
|
|
|
let glj = _.find(gljList, {'id': id});
|
|
|
- if(glj){
|
|
|
- let con_key = gljOprObj.getIndex(glj,gljKeyArray);
|
|
|
+ if(glj){//与批量更新调用相同的方法
|
|
|
+ /* let con_key = gljOprObj.getIndex(glj,gljKeyArray);
|
|
|
let pratioM =datas.mixRatioConnectData[con_key];//找到父key
|
|
|
let conditions = [];
|
|
|
if(pratioM&&pratioM.length>0){
|
|
@@ -611,7 +611,8 @@ ProjectGLJ.prototype.changeIsEvaluate=function (id){
|
|
|
rg.data.isEstimate =glj.is_evaluate?1:0;
|
|
|
ration_nodes.push(rg);
|
|
|
}
|
|
|
- ration_nodes.length>0?projectObj.mainController.refreshTreeNode(ration_nodes):"";
|
|
|
+ ration_nodes.length>0?projectObj.mainController.refreshTreeNode(ration_nodes):"";*/
|
|
|
+ let [nodes,gljs] = projectGLJ.batchChangeIsEvaluate([glj]);
|
|
|
projectObj.project.calcProgram.calcNodesAndSave(nodes);//触发计算程序
|
|
|
return gljs;
|
|
|
}
|
|
@@ -623,62 +624,41 @@ ProjectGLJ.prototype.changeIsEvaluate=function (id){
|
|
|
*/
|
|
|
|
|
|
ProjectGLJ.prototype.batchChangeIsEvaluate=function (gljs){
|
|
|
- let impactGLJs = [], changeArray =_.map(gljs,'id');
|
|
|
+ let impactGLJs = [], changeArray =_.map(gljs,'id'),changeMap = _.indexBy(gljs,'id');;
|
|
|
for(let glj of gljs){
|
|
|
let con_key = gljOprObj.getIndex(glj,gljKeyArray);
|
|
|
- let pratioM =datas.mixRatioConnectData[con_key];//找到父key
|
|
|
+ let pratioM =this.datas.mixRatioConnectData[con_key];//找到父key
|
|
|
let conditions = [];
|
|
|
if(pratioM&&pratioM.length>0){
|
|
|
for(let p_key of pratioM ){
|
|
|
conditions.push(gljOprObj.getConditionByKey(p_key));
|
|
|
}
|
|
|
}
|
|
|
- let tem_gljs = projectGLJ.getProjectGLJs(conditions,false);
|
|
|
+ let tem_gljs = this.getProjectGLJs(conditions,false);
|
|
|
if(tem_gljs.length > 0) impactGLJs = impactGLJs.concat(tem_gljs);
|
|
|
}
|
|
|
impactGLJs = impactGLJs.concat(gljs);
|
|
|
- let impactRationNodes = projectGLJ.getImpactRationNodes(impactGLJs);
|
|
|
- let neeRefreshNode = [];
|
|
|
- let rations =_.filter(projectObj.project.Ration.datas,function (item) {
|
|
|
- //{'type':rationType.gljRation,'projectGLJID':glj.id}
|
|
|
- if(item.type == rationType.gljRation ){//&&
|
|
|
+ impactGLJs = _.uniq(impactGLJs,'id');//去重复
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- if(glj){
|
|
|
- let con_key = gljOprObj.getIndex(glj,gljKeyArray);
|
|
|
- let pratioM =datas.mixRatioConnectData[con_key];//找到父key
|
|
|
- let conditions = [];
|
|
|
- if(pratioM&&pratioM.length>0){
|
|
|
- for(let p_key of pratioM ){
|
|
|
- conditions.push(gljOprObj.getConditionByKey(p_key));
|
|
|
- }
|
|
|
- }
|
|
|
- let gljs = projectGLJ.getProjectGLJs(conditions,false);
|
|
|
- gljs.push(glj);
|
|
|
- let nodes = projectGLJ.getImpactRationNodes(gljs);//取到因为改变工料机价格而受影响的定额
|
|
|
- //更新对应的工料机类型的定额
|
|
|
- let rations =_.filter(projectObj.project.Ration.datas,{'type':rationType.gljRation,'projectGLJID':glj.id});
|
|
|
- let ration_nodes = [];
|
|
|
- for(r of rations){
|
|
|
- if(r){
|
|
|
- r.isEstimate =glj.is_evaluate?1:0;
|
|
|
- let ration_node = projectObj.project.mainTree.getNodeByID(r.ID);
|
|
|
- ration_node?ration_nodes.push(ration_node):'';
|
|
|
- }
|
|
|
- }
|
|
|
- let ration_glj_nodes = projectGLJ.getMainAndEquGLJNodeByID(glj.id);//取显示在造价书界面上的主材和设备节点
|
|
|
- for(rg of ration_glj_nodes){
|
|
|
- rg.data.isEstimate =glj.is_evaluate?1:0;
|
|
|
- ration_nodes.push(rg);
|
|
|
- }
|
|
|
- ration_nodes.length>0?projectObj.mainController.refreshTreeNode(ration_nodes):"";
|
|
|
- projectObj.project.calcProgram.calcNodesAndSave(nodes);//触发计算程序
|
|
|
- return gljs;
|
|
|
- }
|
|
|
+ let impactRationNodes = this.getImpactRationNodes(impactGLJs);
|
|
|
+ let neeRefreshNode = [];
|
|
|
+ //更新对应的工料机类型的定额
|
|
|
+ for(let item of projectObj.project.Ration.datas){
|
|
|
+ if(item.type == rationType.gljRation && changeArray.indexOf(item.projectGLJID) != -1){
|
|
|
+ let tem_g = changeMap[item.projectGLJID];
|
|
|
+ item.isEstimate =tem_g.is_evaluate?1:0;
|
|
|
+ let ration_node = projectObj.project.mainTree.getNodeByID(item.ID);
|
|
|
+ neeRefreshNode?neeRefreshNode.push(ration_node):'';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let ration_glj_nodes = this.getMainAndEquGLJNodeByID(changeArray);//取显示在造价书界面上的主材和设备节点
|
|
|
+ for(let rg of ration_glj_nodes){
|
|
|
+ let tem_g = changeMap[rg.data.projectGLJID];
|
|
|
+ rg.data.isEstimate =tem_g.is_evaluate?1:0;
|
|
|
+ neeRefreshNode.push(rg);
|
|
|
+ }
|
|
|
+ neeRefreshNode.length>0?projectObj.mainController.refreshTreeNode(neeRefreshNode):"";
|
|
|
+ return [impactRationNodes,impactGLJs];
|
|
|
};
|
|
|
|
|
|
ProjectGLJ.prototype.getByID = function (ID) {
|
|
@@ -707,9 +687,15 @@ ProjectGLJ.prototype.refreshTreeNodePriceIfNeed = function (data) {
|
|
|
|
|
|
ProjectGLJ.prototype.getMainAndEquGLJNodeByID = function (id) {//通过ID取显示到主树上的主材和设备节点
|
|
|
let nodes = [];
|
|
|
+ let ids = [];
|
|
|
+ if(Array.isArray(id)){
|
|
|
+ ids = id;
|
|
|
+ }else {
|
|
|
+ ids = [id];
|
|
|
+ }
|
|
|
if(projectInfoObj.projectInfo.property.displaySetting.disPlayMainMaterial == true){
|
|
|
nodes = _.filter(projectObj.project.mainTree.items, function (tem) {
|
|
|
- return tem.sourceType == ModuleNames.ration_glj && tem.data.projectGLJID == id
|
|
|
+ return tem.sourceType == ModuleNames.ration_glj && ids.indexOf(tem.data.projectGLJID) !== -1
|
|
|
})
|
|
|
}
|
|
|
return nodes;
|