|  | @@ -139,24 +139,29 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |                  doc.refreshQuantity=true;
 | 
	
		
			
				|  |  |                  if(!selected.data.hasOwnProperty('isFromDetail')||selected.data.isFromDetail==0){
 | 
	
		
			
				|  |  |                      if(!args.replace){//为了批量粘贴时不重复提示,普通编辑时不受影响
 | 
	
		
			
				|  |  | -                        var c = confirm("确定要使用工程量明细替换原工程量吗?");
 | 
	
		
			
				|  |  | -                        if(c){
 | 
	
		
			
				|  |  | +                        hintBox.infoBox('操作确认', '确定要使用工程量明细替换原工程量吗?', 2, function () {
 | 
	
		
			
				|  |  |                              args.replace = true;
 | 
	
		
			
				|  |  | -                        }else {
 | 
	
		
			
				|  |  | +                            me.doSaveAction(doc,args,batchCallback);
 | 
	
		
			
				|  |  | +                        }, function () {
 | 
	
		
			
				|  |  |                              doc.refreshQuantity=false;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | +                            me.doSaveAction(doc,args,batchCallback);
 | 
	
		
			
				|  |  | +                        },['确定','取消']);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            var url="";
 | 
	
		
			
				|  |  | +            me.doSaveAction(doc,args,batchCallback);
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        quantity_detail.prototype.doSaveAction = function(doc,args,batchCallback){
 | 
	
		
			
				|  |  | +            let url="",me = this;
 | 
	
		
			
				|  |  |              $.bootstrapLoading.start();
 | 
	
		
			
				|  |  |              if(args.hasOwnProperty("insertRecode")){//右键插入或者是通过直接编辑保存
 | 
	
		
			
				|  |  |                  url = "/quantity_detail/insertRecode";
 | 
	
		
			
				|  |  |              }else{
 | 
	
		
			
				|  |  |                  url = "/quantity_detail/save";
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            var callback = function (data) {
 | 
	
		
			
				|  |  | +            CommonAjax.post(url,doc,function (data) {
 | 
	
		
			
				|  |  |                  $.bootstrapLoading.end();
 | 
	
		
			
				|  |  |                  if(doc.refreshQuantity==false){//清空数据
 | 
	
		
			
				|  |  |                      me.cleanQuantityDetail();
 | 
	
	
		
			
				|  | @@ -165,16 +170,18 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |                      if(batchCallback){
 | 
	
		
			
				|  |  |                          batchCallback(args)
 | 
	
		
			
				|  |  |                      }else if(data.node){
 | 
	
		
			
				|  |  | -                      me.refreshRationOrBillNodes(data.node);
 | 
	
		
			
				|  |  | +                        me.refreshRationOrBillNodes(data.node);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      //gljOprObj.detailSheet.setActiveCell(0,0);
 | 
	
		
			
				|  |  |                      //gljOprObj.detailSheet.clearSelection();
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            CommonAjax.post(url,doc,callback,function () {
 | 
	
		
			
				|  |  | +            },function () {
 | 
	
		
			
				|  |  |                  $.bootstrapLoading.end();
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          quantity_detail.prototype.refreshRationOrBillNodes=function(node){//工程量明细更新后触发定额或清单工程量改变,进行相应的更新
 | 
	
		
			
				|  |  |              var nodes = gljOprObj.refreshTreeNode(node);
 | 
	
		
			
				|  |  |              if(nodes.length>0){//触发计算
 | 
	
	
		
			
				|  | @@ -275,7 +282,7 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |              return str.replace(regExp, RepText);
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          quantity_detail.prototype.updateQuantityDetail=function (args,dataCode,recode,selected,batchCallback) {
 | 
	
		
			
				|  |  | -            var doc ={};
 | 
	
		
			
				|  |  | +            var doc ={},me = this;
 | 
	
		
			
				|  |  |              var query={
 | 
	
		
			
				|  |  |                  ID:recode.ID,
 | 
	
		
			
				|  |  |                  projectID:recode.projectID
 | 
	
	
		
			
				|  | @@ -291,19 +298,21 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |                  query.refreshQuantity=true;
 | 
	
		
			
				|  |  |                  if(!selected.data.hasOwnProperty('isFromDetail')||selected.data.isFromDetail==0){
 | 
	
		
			
				|  |  |                      if(!args.replace){//为了批量粘贴时不重复提示,普通编辑时不受影响
 | 
	
		
			
				|  |  | -                        var c = confirm("确定要使用工程量明细替换原工程量吗?");
 | 
	
		
			
				|  |  | -                        if(c){
 | 
	
		
			
				|  |  | +                        hintBox.infoBox('操作确认', '确定要使用工程量明细替换原工程量吗?', 2, function () {
 | 
	
		
			
				|  |  |                              args.replace = true;
 | 
	
		
			
				|  |  | -                        }else {
 | 
	
		
			
				|  |  | -                            this.cleanQuantityDetail(selected,true);
 | 
	
		
			
				|  |  | -                            return;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | +                            query.index = args.row;
 | 
	
		
			
				|  |  | +                            me.updateQuantityRegex(query,doc,args,batchCallback)
 | 
	
		
			
				|  |  | +                        }, function () {
 | 
	
		
			
				|  |  | +                            me.cleanQuantityDetail(selected,true);
 | 
	
		
			
				|  |  | +                        },['确定','取消']);
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  query.index = args.row;
 | 
	
		
			
				|  |  | -                this.updateQuantityRegex(query,doc,args,batchCallback)
 | 
	
		
			
				|  |  | +                me.updateQuantityRegex(query,doc,args,batchCallback);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              }else {
 | 
	
		
			
				|  |  | -                this.normalUpdate(query,doc,args,batchCallback);
 | 
	
		
			
				|  |  | +                me.normalUpdate(query,doc,args,batchCallback);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          quantity_detail.prototype.updateQuantityRegex=function(query,doc,args,batchCallback){
 | 
	
	
		
			
				|  | @@ -444,7 +453,7 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              return invalidate;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          quantity_detail.prototype.replaceSqr = function(text) {
 | 
	
		
			
				|  |  |              var squarRegex = /\([^\^]+\)\^\d+/g;
 | 
	
	
		
			
				|  | @@ -511,7 +520,7 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          quantity_detail.prototype.cleanQuantityDetail = function (node,needSave) {
 | 
	
		
			
				|  |  |             node =node?node:projectObj.project.mainTree.selected;
 | 
	
		
			
				|  |  | -           var query={projectID:node.data.projectID};
 | 
	
		
			
				|  |  | +           let query={projectID:node.data.projectID};
 | 
	
		
			
				|  |  |              if(node.sourceType === project.Bills.getSourceType()){
 | 
	
		
			
				|  |  |                  query.billID = node.data.ID;
 | 
	
		
			
				|  |  |                  this.deleteByBills([{type:'delete',data:node.data}]);
 | 
	
	
		
			
				|  | @@ -574,7 +583,7 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |              if(node.sourceType === project.Ration.getSourceType()&&data.unit){
 | 
	
		
			
				|  |  |                  let times = parseInt(data.unit);
 | 
	
		
			
				|  |  |                  if (isNaN(times)) {
 | 
	
		
			
				|  |  | -                    times = 1
 | 
	
		
			
				|  |  | +                    times = 1;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  value = value * times;
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -587,22 +596,30 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |                  projectObj.mainController.refreshTreeNode([node]);
 | 
	
		
			
				|  |  |              }else {
 | 
	
		
			
				|  |  |                  value=value?value:0;
 | 
	
		
			
				|  |  | -                setTimeout(function () {//spreadjs事件和提示窗口会有冲突,所以要用延时的方法
 | 
	
		
			
				|  |  | -                    if(project.quantity_detail.quantityEditChecking(value,node,fieldName)){
 | 
	
		
			
				|  |  | +                if(node.data.hasOwnProperty('isFromDetail')&&node.data.isFromDetail==1){
 | 
	
		
			
				|  |  | +                    hintBox.infoBox('操作确认', '已有工程量明细,是否清空明细表,采用手工输入的表达式?', 2, function () {
 | 
	
		
			
				|  |  |                          node.data.isFromDetail=0;
 | 
	
		
			
				|  |  | -                        project.quantity_detail.cleanQuantityDetail(node,true);
 | 
	
		
			
				|  |  | -                        if(node.sourceType === project.Bills.getSourceType()){
 | 
	
		
			
				|  |  | -                            me.updateBillQuantity(value,node,null,editingText);
 | 
	
		
			
				|  |  | -                        }else {
 | 
	
		
			
				|  |  | -                            me.updateRationQuantity(value,node,null,editingText);
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        gljOprObj.refreshView();
 | 
	
		
			
				|  |  | -                    }else {
 | 
	
		
			
				|  |  | +                        me.updateMainTreeNodeQuantity(value,node,editingText);
 | 
	
		
			
				|  |  | +                    }, function () {
 | 
	
		
			
				|  |  |                          projectObj.mainController.refreshTreeNode([node]);
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                },100);
 | 
	
		
			
				|  |  | +                    },['确定','取消']);
 | 
	
		
			
				|  |  | +                    return;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                me.updateMainTreeNodeQuantity(value,node,editingText);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  | +        quantity_detail.prototype.updateMainTreeNodeQuantity = function(value,node,editingText){
 | 
	
		
			
				|  |  | +            let me = this;
 | 
	
		
			
				|  |  | +            project.quantity_detail.cleanQuantityDetail(node,true);
 | 
	
		
			
				|  |  | +            if(node.sourceType === project.Bills.getSourceType()){
 | 
	
		
			
				|  |  | +                me.updateBillQuantity(value,node,null,editingText);
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                me.updateRationQuantity(value,node,null,editingText);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            gljOprObj.refreshView();
 | 
	
		
			
				|  |  | +        };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          quantity_detail.prototype.updateBillQuantity=function (value,node,quantityEXP,editingText) {
 | 
	
		
			
				|  |  |              node.data.quantityEXP = quantityEXP?quantityEXP:editingText;
 | 
	
		
			
				|  |  |              value = scMathUtil.roundForObj(value,getDecimal("quantity",node));
 | 
	
	
		
			
				|  | @@ -706,7 +723,7 @@ var quantity_detail = {
 | 
	
		
			
				|  |  |              }else {
 | 
	
		
			
				|  |  |                  decimal = decimalObj.ration.quantity
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | +            return decimal;
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          return new quantity_detail(project);
 | 
	
		
			
				|  |  |      }
 |