|
@@ -299,10 +299,42 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb
|
|
};
|
|
};
|
|
|
|
|
|
ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
|
|
ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
|
|
|
|
+ let me = this;
|
|
//更新是否暂估和供货方式时,要做特殊处理
|
|
//更新是否暂估和供货方式时,要做特殊处理
|
|
$.bootstrapLoading.start();
|
|
$.bootstrapLoading.start();
|
|
CommonAjax.post("/glj/batchUpdateGLJProperty", updateMap,function (result) {
|
|
CommonAjax.post("/glj/batchUpdateGLJProperty", updateMap,function (result) {
|
|
$.bootstrapLoading.end();
|
|
$.bootstrapLoading.end();
|
|
|
|
+ let supplyChangeIDs = [],evaluateIDs = [],rationNodes = [];
|
|
|
|
+ console.log(updateMap);
|
|
|
|
+ for(let idKey in updateMap){
|
|
|
|
+ let gljID = parseInt(idKey);
|
|
|
|
+ let glj = me.getByID(gljID);
|
|
|
|
+ let doc = updateMap[idKey];
|
|
|
|
+ for(let property in doc){
|
|
|
|
+ glj[property] = doc[property];
|
|
|
|
+ }
|
|
|
|
+ if(doc.hasOwnProperty("supply")||doc.hasOwnProperty("supply_quantity")){
|
|
|
|
+ supplyChangeIDs.push(gljID);
|
|
|
|
+ }
|
|
|
|
+ if(doc.hasOwnProperty("is_evaluate")){
|
|
|
|
+ evaluateIDs.push(gljID);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ 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(rationNodes.length > 0){
|
|
|
|
+ projectObj.project.calcProgram.calcNodesAndSave(rationNodes, function () {
|
|
|
|
+ projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
if(callback){
|
|
if(callback){
|
|
callback();
|
|
callback();
|
|
@@ -583,7 +615,71 @@ ProjectGLJ.prototype.changeIsEvaluate=function (id){
|
|
projectObj.project.calcProgram.calcNodesAndSave(nodes);//触发计算程序
|
|
projectObj.project.calcProgram.calcNodesAndSave(nodes);//触发计算程序
|
|
return gljs;
|
|
return gljs;
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 批量更新是否暂估
|
|
|
|
+ *传入项目工料机数组
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ProjectGLJ.prototype.batchChangeIsEvaluate=function (gljs){
|
|
|
|
+ let impactGLJs = [], changeArray =_.map(gljs,'id');
|
|
|
|
+ for(let glj of gljs){
|
|
|
|
+ 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 tem_gljs = projectGLJ.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 && ){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
|
|
ProjectGLJ.prototype.getByID = function (ID) {
|
|
ProjectGLJ.prototype.getByID = function (ID) {
|
|
return _.find(this.datas.gljList,{'id':ID});
|
|
return _.find(this.datas.gljList,{'id':ID});
|