|
@@ -154,10 +154,80 @@ ProjectGLJ.prototype.updatePriceFromRG=function(recode,updateField,newval){
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ProjectGLJ.prototype.updatePropertyFromMainSpread = function (node,updateField,newval) {
|
|
|
+ if(updateField=="contain"){
|
|
|
+
|
|
|
+ }else {
|
|
|
+ this.updateGLJProperty(node,updateField,newval);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+ProjectGLJ.prototype.updateGLJProperty=function (node,updateField,newval) {
|
|
|
+ let rationTypeGLJ = node.data;
|
|
|
+ let postData = {};
|
|
|
+ if(rationTypeGLJ[updateField]==newval){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let data ={
|
|
|
+ glj_id: rationTypeGLJ.GLJID,
|
|
|
+ project_id: rationTypeGLJ.projectID,
|
|
|
+ code: rationTypeGLJ.code,
|
|
|
+ original_code:rationTypeGLJ.original_code,
|
|
|
+ name: rationTypeGLJ.name,
|
|
|
+ shortName:rationTypeGLJ.shortName,
|
|
|
+ specs: rationTypeGLJ.specs,
|
|
|
+ unit: rationTypeGLJ.unit,
|
|
|
+ type:rationTypeGLJ.subType,
|
|
|
+ type_of_work:rationTypeGLJ.subType,
|
|
|
+ base_price: rationTypeGLJ.basePrice,
|
|
|
+ market_price: rationTypeGLJ.basePrice,
|
|
|
+ repositoryId:rationTypeGLJ.repositoryId,
|
|
|
+ adjCoe:rationTypeGLJ.adjCoe,
|
|
|
+ from:rationTypeGLJ.from?rationTypeGLJ.from:'std'//std:标准工料机库, cpt:补充工料机库
|
|
|
+ };
|
|
|
+ if(updateField=='subType'){
|
|
|
+ data.type = newval;
|
|
|
+ data.type_of_work = newval;
|
|
|
+ data.shortName = this.getShortNameByID(newval);
|
|
|
+ }else {
|
|
|
+ data[updateField]=newval;
|
|
|
+ }
|
|
|
+ postData.ration = {
|
|
|
+ ID:rationTypeGLJ.ID,
|
|
|
+ projectID:rationTypeGLJ.projectID
|
|
|
+ };
|
|
|
+ postData.updateData = data;
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.post("/glj/modifyKeyValue",postData,function (result) {
|
|
|
+ console.log(result); //更新节点信息
|
|
|
+ rationTypeGLJ[updateField]=newval;
|
|
|
+ rationTypeGLJ.projectGLJID = result.id;
|
|
|
+ rationTypeGLJ.code = result.code;
|
|
|
+ rationTypeGLJ.basePrice = result.unit_price.base_price;
|
|
|
+ rationTypeGLJ.marketUnitFee = result.unit_price.market_price;
|
|
|
+ rationTypeGLJ.isAdd = result.unit_price.is_add;
|
|
|
+ rationTypeGLJ.isEstimate=result.is_evaluate;
|
|
|
+ rationTypeGLJ.shortName = result.unit_price.short_name;
|
|
|
+ //触发计算并更新节点信息
|
|
|
+ node.changed=true;
|
|
|
+ projectObj.project.projectGLJ.loadData(function () {
|
|
|
+ projectObj.project.calcProgram.calculate(node);
|
|
|
+ projectObj.project.calcProgram.saveNode(node);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ });//重新加载项目工料机数据
|
|
|
+ //上面两步都是异步操作,这句应该是要等上面两步做完了再执行的
|
|
|
+ },function (err) {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
ProjectGLJ.prototype.updateBasePriceFromRG=function(recode,updateField,newval){
|
|
|
let me = this;
|
|
|
let projectGljs = this.datas.gljList;
|
|
|
let glj = _.find(projectGljs,{'id':recode.projectGLJID});
|
|
|
+ console.log(glj);
|
|
|
if(glj){
|
|
|
let data = {id:glj.unit_price.id,field:updateField,newval:newval};
|
|
|
let callback =function (data) {
|