|  | @@ -454,9 +454,10 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |          if(me.sheet.getTag(args.row,args.col)=="locked") return false;//如果是双击树节点编号里设置了锁定标记,不能编辑
 | 
	
		
			
				|  |  |          if (_.includes(me.setting.view.lockColumns, args.col))  return false;//如果是锁定的列,不能编辑
 | 
	
		
			
				|  |  |          if(recode != undefined){
 | 
	
		
			
				|  |  | -            if(recode.isMixRatio){//对于组成物列
 | 
	
		
			
				|  |  | -               return dataCode == 'marketPrice'//允许修改组成物市单价,其它的不可以
 | 
	
		
			
				|  |  | +            if(recode.isMixRatio){//对于组成物列 - 可修改市场价和
 | 
	
		
			
				|  |  | +              return dataCode == 'marketPrice' || dataCode == 'rationItemQuantity'
 | 
	
		
			
				|  |  |              }else {
 | 
	
		
			
				|  |  | +                if(dataCode == 'rationItemQuantity') return false;
 | 
	
		
			
				|  |  |                  if (dataCode && dataCode == 'marketPrice') {
 | 
	
		
			
				|  |  |                      return !me.marketPriceReadOnly({data:me.sheetData[args.row]});
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -775,7 +776,7 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |                      ration_gljs[i]=this.setGLJPrice(ration_gljs[i],glj);//设置工料机价格
 | 
	
		
			
				|  |  |                      let connect_index = this.getIndex(glj, gljKeyArray);
 | 
	
		
			
				|  |  |                      if (needRatio==true&&mixRatioMap.hasOwnProperty(connect_index)) {
 | 
	
		
			
				|  |  | -                        let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs);
 | 
	
		
			
				|  |  | +                        let mixRatios = this.getMixRationShowDatas(mixRatioMap[connect_index], projectGljs,glj);
 | 
	
		
			
				|  |  |                          ration_gljs[i].subList = mixRatios;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      if(ration) gljOprObj.getTotalQuantity(ration_gljs[i], ration);
 | 
	
	
		
			
				|  | @@ -843,7 +844,7 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return obj;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    getMixRationShowDatas: function (mixRatioList, projectGljs) {
 | 
	
		
			
				|  |  | +    getMixRationShowDatas: function (mixRatioList, projectGljs,parentGLJ) {
 | 
	
		
			
				|  |  |          var temRationGLJs = [];
 | 
	
		
			
				|  |  |          for (var i = 0; i < mixRatioList.length; i++) {
 | 
	
		
			
				|  |  |              let mIndex = gljOprObj.getIndex(mixRatioList[i],gljKeyArray);
 | 
	
	
		
			
				|  | @@ -852,6 +853,7 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |              });//改关联关系
 | 
	
		
			
				|  |  |              if(pg){
 | 
	
		
			
				|  |  |                  let tem = {
 | 
	
		
			
				|  |  | +                    mixRatioId:mixRatioList[i].id,
 | 
	
		
			
				|  |  |                      projectGLJID: pg.id,
 | 
	
		
			
				|  |  |                      code: pg.code,
 | 
	
		
			
				|  |  |                      name: pg.name,
 | 
	
	
		
			
				|  | @@ -868,7 +870,8 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |                      //isEstimate: pg.is_evaluate,
 | 
	
		
			
				|  |  |                      isMixRatio: true,
 | 
	
		
			
				|  |  |                      isAdd: pg.unit_price.is_add,
 | 
	
		
			
				|  |  | -                    GLJID: pg.glj_id
 | 
	
		
			
				|  |  | +                    GLJID: pg.glj_id,
 | 
	
		
			
				|  |  | +                    parentGLJ:parentGLJ
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  if(projectObj.project.projectGLJ.isEstimateType(pg.type)){
 | 
	
		
			
				|  |  |                      tem.isEstimate =  pg.is_evaluate;
 | 
	
	
		
			
				|  | @@ -924,7 +927,7 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |              if (args.editingText == null) {
 | 
	
		
			
				|  |  |                  updateField == 'marketPrice' ? newval = 0 : newval = "";
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | -                var decimal = updateField == 'customQuantity' ? getDecimal("glj.quantity") : 6;//对于市场价和定额价,这里只是中间的小数位数,后面更新前会根据有没有组成物再取值
 | 
	
		
			
				|  |  | +                var decimal = updateField == 'customQuantity'||updateField == 'rationItemQuantity'  ? getDecimal("glj.quantity") : 6;//对于市场价和定额价,这里只是中间的小数位数,后面更新前会根据有没有组成物再取值
 | 
	
		
			
				|  |  |                  newval = number_util.checkNumberValue(args.editingText, decimal);
 | 
	
		
			
				|  |  |                  if (newval == null) {
 | 
	
		
			
				|  |  |                      me.sheet.getCell(args.row, args.col).value(recode[updateField]);
 | 
	
	
		
			
				|  | @@ -956,6 +959,9 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |              projectObj.project.ration_glj.updateRationGLJByChangeCode(recode, updateField, newval);
 | 
	
		
			
				|  |  |          }else if(me.setting.navigationRightCol.indexOf(updateField) != -1){//对于名称、规格、单位先跳到下一列,保存至缓存
 | 
	
		
			
				|  |  |              me.setToEditCache(recode,updateField, newval,args);
 | 
	
		
			
				|  |  | +        }else if(updateField == 'rationItemQuantity'){//修改组成物的消耗量
 | 
	
		
			
				|  |  | +            me.updateRatio(recode,{consumption:newval})
 | 
	
		
			
				|  |  | +            console.log(recode);
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              projectObj.project.ration_glj.updateRationGLJByEdit(recode, updateField, newval);
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -986,6 +992,100 @@ var gljOprObj = {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |         return false;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    getParentPrice:function(subList,value,radio,type = 'modify'){
 | 
	
		
			
				|  |  | +      let marketPrice = 0,basePrice=0; 
 | 
	
		
			
				|  |  | +      let decimal = getDecimal('glj.unitPrice');
 | 
	
		
			
				|  |  | +      for(let s of subList){
 | 
	
		
			
				|  |  | +        let c = parseFloat(s.consumption);
 | 
	
		
			
				|  |  | +        if(s.mixRatioId == radio.mixRatioId) c = value;
 | 
	
		
			
				|  |  | +        if(type == 'delete' && s.mixRatioId == radio.mixRatioId) continue;
 | 
	
		
			
				|  |  | +        let m = scMathUtil.roundForObj(s.marketPrice *  c,decimal);
 | 
	
		
			
				|  |  | +        let b = scMathUtil.roundForObj(s.basePrice *  c,decimal);
 | 
	
		
			
				|  |  | +        marketPrice += m;
 | 
	
		
			
				|  |  | +        basePrice +=b;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return [scMathUtil.roundForObj(marketPrice,decimal),scMathUtil.roundForObj(basePrice,decimal)]
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    deleteRatio:async function(row){
 | 
	
		
			
				|  |  | +      let ratio = this.sheetData[row];
 | 
	
		
			
				|  |  | +      let pgljData = projectObj.project.projectGLJ.datas;
 | 
	
		
			
				|  |  | +      for(let rg of  this.sheetData){
 | 
	
		
			
				|  |  | +        if(rg.projectGLJID == ratio.parentGLJ.id) {
 | 
	
		
			
				|  |  | +          subList = rg.subList;
 | 
	
		
			
				|  |  | +          break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }  
 | 
	
		
			
				|  |  | +      let [marketPrice,basePrice] = this.getParentPrice(subList,0,ratio,"delete");
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        $.bootstrapLoading.start()
 | 
	
		
			
				|  |  | +        projectData = await ajaxPost('/glj/updateRatio', {id: ratio.mixRatioId,type:'delete',pid:ratio.parentGLJ.id,market_price: marketPrice,base_price: basePrice});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //更新缓存
 | 
	
		
			
				|  |  | +        let pk = gljUtil.getIndex(ratio.parentGLJ);
 | 
	
		
			
				|  |  | +        if(pgljData.mixRatioMap && pgljData.mixRatioMap[pk]){
 | 
	
		
			
				|  |  | +          _.remove(pgljData.mixRatioMap[pk],{"id":ratio.mixRatioId});
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        for(let r of ratio.parentGLJ.ratio_data){
 | 
	
		
			
				|  |  | +          _.remove(ratio.parentGLJ.ratio_data,{"id":ratio.mixRatioId});
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        ratio.parentGLJ.unit_price.market_price = marketPrice;
 | 
	
		
			
				|  |  | +        ratio.parentGLJ.unit_price.base_price = basePrice;
 | 
	
		
			
				|  |  | +        //重新计算消耗量
 | 
	
		
			
				|  |  | +        projectObj.project.projectGLJ.calcQuantity();
 | 
	
		
			
				|  |  | +        let priceData = {};
 | 
	
		
			
				|  |  | +        priceData =this.setGLJPrice(priceData,ratio.parentGLJ);
 | 
	
		
			
				|  |  | +        projectGljObject.updateParentNodes(ratio.parentGLJ.id,priceData.marketPrice);
 | 
	
		
			
				|  |  | +        projectGljObject.onUnitFileChange(ratio);
 | 
	
		
			
				|  |  | +      } catch (error) {
 | 
	
		
			
				|  |  | +        console.log(error)
 | 
	
		
			
				|  |  | +      }finally{
 | 
	
		
			
				|  |  | +        $.bootstrapLoading.end()
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    updateRatio:async function(ratio,doc){
 | 
	
		
			
				|  |  | +      let pgljData = projectObj.project.projectGLJ.datas;
 | 
	
		
			
				|  |  | +      let subList = [];
 | 
	
		
			
				|  |  | +      for(let rg of  this.sheetData){
 | 
	
		
			
				|  |  | +        if(rg.projectGLJID == ratio.parentGLJ.id) {
 | 
	
		
			
				|  |  | +          subList = rg.subList;
 | 
	
		
			
				|  |  | +          break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }  
 | 
	
		
			
				|  |  | +      let [marketPrice,basePrice] = this.getParentPrice(subList,doc.consumption,ratio);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        $.bootstrapLoading.start()
 | 
	
		
			
				|  |  | +        projectData = await ajaxPost('/glj/updateRatio', {id: ratio.mixRatioId, doc:doc,pid:ratio.parentGLJ.id,market_price: marketPrice,base_price: basePrice});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //更新缓存
 | 
	
		
			
				|  |  | +        let pk = gljUtil.getIndex(ratio.parentGLJ);
 | 
	
		
			
				|  |  | +        if(pgljData.mixRatioMap && pgljData.mixRatioMap[pk]){
 | 
	
		
			
				|  |  | +          for(let m of pgljData.mixRatioMap[pk]){
 | 
	
		
			
				|  |  | +            if(m.id == ratio.mixRatioId) gljUtil.setProperty(m,doc);
 | 
	
		
			
				|  |  | +          } 
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        for(let r of ratio.parentGLJ.ratio_data){
 | 
	
		
			
				|  |  | +          if(r.id == ratio.mixRatioId) gljUtil.setProperty(r,doc);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        ratio.parentGLJ.unit_price.market_price = marketPrice;
 | 
	
		
			
				|  |  | +        ratio.parentGLJ.unit_price.base_price = basePrice;
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //重新计算消耗量
 | 
	
		
			
				|  |  | +        projectObj.project.projectGLJ.calcQuantity();
 | 
	
		
			
				|  |  | +        let priceData = {};
 | 
	
		
			
				|  |  | +        priceData =this.setGLJPrice(priceData,ratio.parentGLJ);
 | 
	
		
			
				|  |  | +        projectGljObject.updateParentNodes(ratio.parentGLJ.id,priceData.marketPrice);
 | 
	
		
			
				|  |  | +        projectGljObject.onUnitFileChange(ratio);
 | 
	
		
			
				|  |  | +      } catch (error) {
 | 
	
		
			
				|  |  | +        console.log(error)
 | 
	
		
			
				|  |  | +      }finally{
 | 
	
		
			
				|  |  | +        $.bootstrapLoading.end()
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      updateRationTypeGLJ: function (value, node, fieldName,editingText) {
 | 
	
		
			
				|  |  |          let newval;
 | 
	
		
			
				|  |  |          let updatePrice = false;
 | 
	
	
		
			
				|  | @@ -1637,6 +1737,7 @@ $(function () {
 | 
	
		
			
				|  |  |      $('#glj_tree_div').on('hidden.bs.modal', function () {
 | 
	
		
			
				|  |  |          // 清空搜索框
 | 
	
		
			
				|  |  |          $('#gljSearchKeyword').val('');
 | 
	
		
			
				|  |  | +        projectGljObject.subList = [];
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      $('#glj_tree_div').on('shown.bs.modal', function (e) {
 | 
	
		
			
				|  |  |          if (gljOprObj.gljLibSpresd == undefined) {
 |