Browse Source

客户管理-特征部分调整

Zhouzhendong 5 years ago
parent
commit
3e961308d7

+ 1 - 1
app/Http/Controllers/PriceModelController.php

@@ -100,7 +100,7 @@ class PriceModelController extends Controller
         if(!Gate::allows('计费模型-作业-查询')){ return ["success"=>false,"data"=>"无权操作"];  }
         /** @var OwnerOutStorageRuleService $service */
         $service = app('OwnerOutStorageRuleService');
-        $ownerOutStorageRules = $service->get(["owner_price_operation_id"=>$request->input("id")],["unit"],true);
+        $ownerOutStorageRules = $service->get(["owner_price_operation_id"=>$request->input("id")],["unit"],true)->append("featureFormat");
         return ["success"=>true,"data"=>$ownerOutStorageRules];
     }
     /* 修改出库模型规则 */

+ 2 - 1
app/OwnerOutStorageRule.php

@@ -43,8 +43,9 @@ class OwnerOutStorageRule extends Model
 
 
     /* 格式化依据静态参数,在调用前设置  */
-    public function getFeatureFormatAttribute($value)
+    public function getFeatureFormatAttribute()
     {
+        $value = $this->feature;
         if ($this->strategy == '默认')return "/";
         if (!self::$features)return $value;
         $result = [];

+ 8 - 0
app/Services/FeatureService.php

@@ -29,6 +29,10 @@ Class FeatureService
                 $model[] = array_slice($result[0],$sign,($index-$sign)+1);
                 $sign = $index+1;
                 $ids[] = $str;
+                continue;
+            }
+            if ($index == count($result[0])-1 && $str == ')'){
+                $model[] = [")"];
             }
         }//以数字为标准切割策略组
         $features = Feature::query()->find($ids);//查询出现的特征
@@ -71,6 +75,10 @@ Class FeatureService
                         break;
                 }
             }
+            if (!$arr["id"]){
+                unset($model[$index]);
+                continue;
+            }
             $m = $arr;//变更当前指针为翻译结果
         }
         return $model;

+ 1 - 1
app/Services/OwnerOutStorageRuleService.php

@@ -18,7 +18,7 @@ Class OwnerOutStorageRuleService
         foreach ($params as $column=>$param){
             $rule->where($column,$param);
         }
-        return $rule->get()->append("featureFormat");
+        return $rule->get();
     }
 
     public function update(array $params, array $values)

+ 7 - 9
resources/views/maintenance/priceModel/operation/_addFeature.blade.php

@@ -11,11 +11,10 @@
                         <label class="col-4">特征内容</label>
                         <label class="col-2">特征组结束标记</label>
                     </div>
-                    <div class="row" v-for="feature in features">
-                        <div class="form-check col-2">
-                            <label class="form-check-label">
-                                <input type="checkbox" class="form-check-input" :checked="feature.strategyGroupStartSign">
-                            </label>
+                    <div class="row" v-for="(feature,i) in features">
+                        <div class="col-2 text-center custom-control custom-checkbox" >
+                            <input type="checkbox" class="custom-control-input" :id="'checkStart-'+i" :checked="feature.strategyGroupStartSign">
+                            <label class="custom-control-label" :for="'checkStart-'+i"></label>
                         </div>
                         <label class="col-1">
                             <select class="form-control form-control-sm" v-model="feature.calculation">
@@ -36,10 +35,9 @@
                         <label class="col-4">
                             <input class="form-control form-control-sm" v-model="feature.describe">
                         </label>
-                        <div class="form-check col-2">
-                            <label class="form-check-label">
-                                <input type="checkbox" class="form-check-input" :checked="feature.strategyGroupEndSign">
-                            </label>
+                        <div class="col-2 text-center custom-control custom-checkbox">
+                            <input type="checkbox" class="custom-control-input" :id="'checkEnd-'+i" :checked="feature.strategyGroupEndSign">
+                            <label class="custom-control-label" :for="'checkEnd-'+i"></label>
                         </div>
                     </div>
                 </div>

+ 0 - 1
resources/views/maintenance/priceModel/operation/index.blade.php

@@ -112,7 +112,6 @@
                                 <label v-else>@{{ item.priority }}</label>
                             </td>
                             <td>@{{ item.featureFormat }}</td>
-                            <td>@{{ item.feature }}</td>
                             <td>
                                 <button class="btn btn-sm btn-success" v-if="item.strategy == '特征'" @click="showAddFeatureModal(i,item.feature)">维护特征</button>
                             </td>