|
@@ -40,18 +40,25 @@ var quantity_detail = {
|
|
|
this.refreshSheetData();
|
|
|
}
|
|
|
};
|
|
|
- quantity_detail.prototype.refreshAfterSave=function(data){
|
|
|
+ quantity_detail.prototype.refreshAfterSave=function(data,batchCallback){
|
|
|
var me = this;
|
|
|
+ let newData = null;
|
|
|
if(data.hasOwnProperty('resort')){
|
|
|
this.resortData(data.doc,1);
|
|
|
_.forEach(data.update_task,function (item) {
|
|
|
me.refreshEachItme(item.query,item.doc);
|
|
|
})
|
|
|
- this.datas.push(data.doc);
|
|
|
+ newData = data.doc;
|
|
|
}else {
|
|
|
- this.datas.push(data);
|
|
|
+ newData = data;
|
|
|
}
|
|
|
- this.refreshSheetData();
|
|
|
+ this.datas.push(newData);
|
|
|
+ if(batchCallback){
|
|
|
+ gljOprObj.detailData.push(newData);
|
|
|
+ }else {
|
|
|
+ this.refreshSheetData();
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
quantity_detail.prototype.resortData=function(data,req){
|
|
|
|
|
@@ -62,7 +69,7 @@ var quantity_detail = {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- quantity_detail.prototype.refreshAfterUpdate=function(data){
|
|
|
+ quantity_detail.prototype.refreshAfterUpdate=function(data,batchCallback){
|
|
|
var me = this;
|
|
|
var filter_object;
|
|
|
if(data.hasOwnProperty('refreshList')){
|
|
@@ -75,7 +82,11 @@ var quantity_detail = {
|
|
|
var showList = _.filter(this.datas,filter_object);
|
|
|
gljOprObj.detailData=showList;
|
|
|
gljOprObj.detailData=_.sortBy(gljOprObj.detailData,'seq');
|
|
|
- this.refreshSheetData();
|
|
|
+ console.log(batchCallback);
|
|
|
+ if(batchCallback == undefined){
|
|
|
+ this.refreshSheetData();
|
|
|
+ }
|
|
|
+
|
|
|
};
|
|
|
quantity_detail.prototype.refreshEachItme = function(query,doc){
|
|
|
var detail_list = this.datas;
|
|
@@ -107,7 +118,7 @@ var quantity_detail = {
|
|
|
quantity_detail.prototype.refreshSheetData=function () {
|
|
|
gljOprObj.showQuantityDetailData();
|
|
|
};
|
|
|
- quantity_detail.prototype.saveQuantityDetail=function (args,dataCode,selected) {
|
|
|
+ quantity_detail.prototype.saveQuantityDetail=function (args,dataCode,selected,batchCallback) {
|
|
|
var me = this;
|
|
|
var doc={};
|
|
|
var selected = selected?selected:projectObj.project.mainTree.selected;
|
|
@@ -127,9 +138,13 @@ var quantity_detail = {
|
|
|
}
|
|
|
doc.refreshQuantity=true;
|
|
|
if(!selected.data.hasOwnProperty('isFromDetail')||selected.data.isFromDetail==0){
|
|
|
- var c = confirm("确定要使用工程量明细替换原工程量吗?");
|
|
|
- if(!c){
|
|
|
- doc.refreshQuantity=false;
|
|
|
+ if(!args.replace){//为了批量粘贴时不重复提示,普通编辑时不受影响
|
|
|
+ var c = confirm("确定要使用工程量明细替换原工程量吗?");
|
|
|
+ if(c){
|
|
|
+ args.replace = true;
|
|
|
+ }else {
|
|
|
+ doc.refreshQuantity=false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -142,17 +157,19 @@ var quantity_detail = {
|
|
|
url = "/quantity_detail/save";
|
|
|
}
|
|
|
var callback = function (data) {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
if(doc.refreshQuantity==false){//清空数据
|
|
|
me.cleanQuantityDetail();
|
|
|
}else {
|
|
|
- data.newRecord?me.refreshAfterSave(data.newRecord):me.refreshAfterSave(data);
|
|
|
- if(data.node){
|
|
|
+ data.newRecord?me.refreshAfterSave(data.newRecord,batchCallback):me.refreshAfterSave(data,batchCallback);
|
|
|
+ if(batchCallback){
|
|
|
+ batchCallback(args)
|
|
|
+ }else if(data.node){
|
|
|
me.refreshRationOrBillNodes(data.node);
|
|
|
}
|
|
|
//gljOprObj.detailSheet.setActiveCell(0,0);
|
|
|
//gljOprObj.detailSheet.clearSelection();
|
|
|
}
|
|
|
- $.bootstrapLoading.end();
|
|
|
}
|
|
|
CommonAjax.post(url,doc,callback,function () {
|
|
|
$.bootstrapLoading.end();
|
|
@@ -166,7 +183,7 @@ var quantity_detail = {
|
|
|
console.log(newNode.data.quantity);
|
|
|
this.updateBillQuantity(newNode.data.quantity,newNode,newNode.data.quantityEXP);
|
|
|
}else {//更新定额所使用的值要用还没转换前的
|
|
|
- this.updateRationQuantity(node.data.r_quantity,newNode,newNode.data.quantityEXP);//to do 加上工程量表达式和含量更新
|
|
|
+ this.updateRationQuantity(node.data.r_quantity,newNode,newNode.data.quantityEXP);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -257,7 +274,7 @@ var quantity_detail = {
|
|
|
let regExp = new RegExp(FindText, "g");
|
|
|
return str.replace(regExp, RepText);
|
|
|
};
|
|
|
- quantity_detail.prototype.updateQuantityDetail=function (args,dataCode,recode,selected) {
|
|
|
+ quantity_detail.prototype.updateQuantityDetail=function (args,dataCode,recode,selected,batchCallback) {
|
|
|
var doc ={};
|
|
|
var query={
|
|
|
ID:recode.ID,
|
|
@@ -273,20 +290,23 @@ var quantity_detail = {
|
|
|
}
|
|
|
query.refreshQuantity=true;
|
|
|
if(!selected.data.hasOwnProperty('isFromDetail')||selected.data.isFromDetail==0){
|
|
|
- var c = confirm("确定要使用工程量明细替换原工程量吗?");
|
|
|
- if(!c){
|
|
|
- //query.refreshQuantity=false;
|
|
|
- this.cleanQuantityDetail(selected,true);
|
|
|
- return;
|
|
|
+ if(!args.replace){//为了批量粘贴时不重复提示,普通编辑时不受影响
|
|
|
+ var c = confirm("确定要使用工程量明细替换原工程量吗?");
|
|
|
+ if(c){
|
|
|
+ args.replace = true;
|
|
|
+ }else {
|
|
|
+ this.cleanQuantityDetail(selected,true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
query.index = args.row;
|
|
|
- this.updateQuantityRegex(query,doc,args)
|
|
|
+ this.updateQuantityRegex(query,doc,args,batchCallback)
|
|
|
}else {
|
|
|
- this.normalUpdate(query,doc);
|
|
|
+ this.normalUpdate(query,doc,args,batchCallback);
|
|
|
}
|
|
|
};
|
|
|
- quantity_detail.prototype.updateQuantityRegex=function(query,doc,args){
|
|
|
+ quantity_detail.prototype.updateQuantityRegex=function(query,doc,args,batchCallback){
|
|
|
var needupdate = false;
|
|
|
if(args.editingText==null){
|
|
|
needupdate =true;
|
|
@@ -297,7 +317,7 @@ var quantity_detail = {
|
|
|
}
|
|
|
}
|
|
|
if(needupdate){
|
|
|
- this.commonUpdate("/quantity_detail/updateRegex",{query:query,doc:doc});
|
|
|
+ this.commonUpdate("/quantity_detail/updateRegex",{query:query,doc:doc},args,batchCallback);
|
|
|
}else {
|
|
|
var sheet = subSpread.getActiveSheet();
|
|
|
sheet.getCell(args.row,args.col).value(gljOprObj.detailData[args.row].regex);
|
|
@@ -327,23 +347,25 @@ var quantity_detail = {
|
|
|
};
|
|
|
this.normalUpdate(query,doc);
|
|
|
};
|
|
|
- quantity_detail.prototype.commonUpdate = function (url,postData) {
|
|
|
+ quantity_detail.prototype.commonUpdate = function (url,postData,args,batchCallback) {
|
|
|
var me = this;
|
|
|
$.bootstrapLoading.start();
|
|
|
var callback = function (data) {
|
|
|
- me.refreshAfterUpdate(data);
|
|
|
- if(data.node){
|
|
|
- me.refreshRationOrBillNodes(data.node);
|
|
|
- }
|
|
|
$.bootstrapLoading.end();
|
|
|
+ me.refreshAfterUpdate(data,batchCallback);
|
|
|
+ if(batchCallback){
|
|
|
+ batchCallback(args)
|
|
|
+ }else if(data.node){
|
|
|
+ me.refreshRationOrBillNodes(data.node);
|
|
|
+ }
|
|
|
}
|
|
|
CommonAjax.post(url,postData,callback,function () {
|
|
|
$.bootstrapLoading.end();
|
|
|
});
|
|
|
};
|
|
|
- quantity_detail.prototype.normalUpdate=function(query,doc){
|
|
|
+ quantity_detail.prototype.normalUpdate=function(query,doc,args,batchCallback){
|
|
|
var url = "/quantity_detail/update";
|
|
|
- this.commonUpdate(url,{query:query,doc:doc});
|
|
|
+ this.commonUpdate(url,{query:query,doc:doc},args,batchCallback);
|
|
|
};
|
|
|
quantity_detail.prototype.regexChecking=function(text){
|
|
|
var regex=/^[0-9Cc\+\-\*\^/\(\)\.]*$/g;
|