|
@@ -450,9 +450,7 @@ var Ration = {
|
|
|
updateBillsOprRation();
|
|
|
})
|
|
|
};
|
|
|
- ration.prototype.addMultiRation = function (items, callback) {
|
|
|
- debugger;
|
|
|
- console.log('addMultiRation');
|
|
|
+ ration.prototype.addMultiRation = async function (items) {
|
|
|
let me = this;
|
|
|
let project = projectObj.project, sheetController = projectObj.mainController;
|
|
|
let engineering = projectObj.project.projectInfo.property.engineering;
|
|
@@ -502,63 +500,43 @@ var Ration = {
|
|
|
}
|
|
|
newDatas.push({itemQuery: items[i].itemQuery, newData: newData, defaultLibID: rationLibObj.getDefaultStdRationLibID(), calQuantity: calQuantity, brUpdate: brUpdate, needInstall: needInstall})
|
|
|
}
|
|
|
- let showLoding = true;
|
|
|
- $.bootstrapLoading.start();
|
|
|
- //保证由于异步的关系loading界面被隐藏,比如清单指引插入清单定额时,endUpdate中提前隐藏了loading
|
|
|
- let interval =setInterval(function () {
|
|
|
- if(!$.bootstrapLoading.isLoading()&& showLoding){
|
|
|
- $.bootstrapLoading.start();
|
|
|
- clearInterval(interval);
|
|
|
- }
|
|
|
- else{
|
|
|
- clearInterval(interval);
|
|
|
- }
|
|
|
- }, 100);
|
|
|
- CommonAjax.post("/ration/addMultiRation",{projectID:me.project.ID(),newDatas: newDatas},function (rstData) {
|
|
|
- let newNodes = [];
|
|
|
- //更新缓存
|
|
|
- for(let data of rstData){
|
|
|
- me.datas.push(data.ration);
|
|
|
- me.addSubListOfRation(data,false);
|
|
|
- //插入树节点
|
|
|
- newSource = data.ration;
|
|
|
- newNode = project.mainTree.insert(billItemID, nextID, newSource.ID);
|
|
|
- newNodes.push(newNode);
|
|
|
- newNode.source = newSource;
|
|
|
- newNode.sourceType = project.Ration.getSourceType();
|
|
|
- newNode.data = newSource;
|
|
|
- ProjectController.syncDisplayNewNode(sheetController, newNode);
|
|
|
- nextID = project.mainTree.selected.getNextSiblingID();
|
|
|
- }
|
|
|
- project.projectGLJ.calcQuantity();
|
|
|
- for(let data of rstData){
|
|
|
- project.ration_glj.addToMainTree(data.ration_gljs);
|
|
|
- }
|
|
|
- projectObj.mainController.refreshTreeNode(newNodes, false);
|
|
|
- if(project.Bills.isFBFX(newNodes[0])) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
|
|
|
- project.installation_fee.calcInstallationFee(function (isChange,rations) {
|
|
|
- if(isChange){
|
|
|
- rations = rations.concat(newNodes);
|
|
|
- project.calcProgram.calcNodesAndSave(rations);
|
|
|
- itemIncreaseFeeObj.calcItemIncreaseFeeByNodes(rations);
|
|
|
- }else {
|
|
|
- project.calcProgram.calcNodesAndSave(newNodes);
|
|
|
- itemIncreaseFeeObj.calcItemIncreaseFeeByNodes(newNodes);
|
|
|
- }
|
|
|
- });
|
|
|
- }else {
|
|
|
- project.calcProgram.calcNodesAndSave(newNodes);
|
|
|
- itemIncreaseFeeObj.calcItemIncreaseFeeByNodes(newNodes);
|
|
|
- }
|
|
|
- updateBillsOprRation();
|
|
|
-
|
|
|
- if(callback){
|
|
|
- callback();
|
|
|
+ const rstData = await ajaxPost('/ration/addMultiRation', { projectID:me.project.ID(), newDatas });
|
|
|
+ let newNodes = [];
|
|
|
+ //更新缓存
|
|
|
+ for(let data of rstData){
|
|
|
+ me.datas.push(data.ration);
|
|
|
+ me.addSubListOfRation(data,false);
|
|
|
+ //插入树节点
|
|
|
+ newSource = data.ration;
|
|
|
+ newNode = project.mainTree.insert(billItemID, nextID, newSource.ID);
|
|
|
+ newNodes.push(newNode);
|
|
|
+ newNode.source = newSource;
|
|
|
+ newNode.sourceType = project.Ration.getSourceType();
|
|
|
+ newNode.data = newSource;
|
|
|
+ ProjectController.syncDisplayNewNode(sheetController, newNode);
|
|
|
+ nextID = project.mainTree.selected.getNextSiblingID();
|
|
|
+ }
|
|
|
+ project.projectGLJ.calcQuantity();
|
|
|
+ for(let data of rstData){
|
|
|
+ project.ration_glj.addToMainTree(data.ration_gljs);
|
|
|
+ }
|
|
|
+ projectObj.mainController.refreshTreeNode(newNodes, false);
|
|
|
+ if(project.Bills.isFBFX(newNodes[0])) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
|
|
|
+ project.installation_fee.calcInstallationFee(function (isChange,rations) {
|
|
|
+ if(isChange){
|
|
|
+ rations = rations.concat(newNodes);
|
|
|
+ project.calcProgram.calcNodesAndSave(rations);
|
|
|
+ itemIncreaseFeeObj.calcItemIncreaseFeeByNodes(rations);
|
|
|
+ }else {
|
|
|
+ project.calcProgram.calcNodesAndSave(newNodes);
|
|
|
+ itemIncreaseFeeObj.calcItemIncreaseFeeByNodes(newNodes);
|
|
|
}
|
|
|
- showLoding = false;
|
|
|
- $.bootstrapLoading.end();
|
|
|
-
|
|
|
- })
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ project.calcProgram.calcNodesAndSave(newNodes);
|
|
|
+ itemIncreaseFeeObj.calcItemIncreaseFeeByNodes(newNodes);
|
|
|
+ }
|
|
|
+ updateBillsOprRation();
|
|
|
}
|
|
|
};
|
|
|
ration.prototype.insertVolumePrice = function(type){
|