Просмотр исходного кода

费用规则全选优化完善

祁鹏飞 1 месяц назад
Родитель
Сommit
cd40b8ff9c
1 измененных файлов с 17 добавлено и 4 удалено
  1. 17 4
      src/components/ruleConditionContainer/index.vue

+ 17 - 4
src/components/ruleConditionContainer/index.vue

@@ -70,15 +70,16 @@
           </template>
           <template v-if="item.attrType == 'select'">
             <el-select v-model="item.minArray" placeholder="选择值" clearable filterable multiple :disabled="disabled"
-              @change="change($event, index, item)">
+              @change="change($event, index, item)" :filter-method="(query) => filterMethod(query, item)">
               <template #header>
                 <el-checkbox v-model="item.checkAll" :indeterminate="item.indeterminate" :disabled="disabled"
                   @change="(val) => handleCheckAll(item, index, val)">
                   全选
                 </el-checkbox>
               </template>
-              <el-option v-for="dictLabalitem in item.dictLabal" :key="dictLabalitem.id" :label="dictLabalitem.name"
-                :value="['车辆类型','交强不浮动原因','商业不浮动原因'].includes(item.attrName) ? dictLabalitem.code : dictLabalitem.name" />
+              <el-option v-for="dictLabalitem in showDictLabal(item)" :key="dictLabalitem.id"
+                :label="dictLabalitem.name"
+                :value="['车辆类型', '交强不浮动原因', '商业不浮动原因'].includes(item.attrName) ? dictLabalitem.code : dictLabalitem.name" />
             </el-select>
           </template>
           <template v-if="item.attrType == 'inputTag'">
@@ -148,6 +149,7 @@
 
 <!-- 行为区域 -->
 <script lang='ts' setup>
+import Item from '@/layouts/components/Breadcrumb/item.vue';
 import type { CheckboxValueType } from 'element-plus'
 const props = defineProps<{
   rulesAttrList: any[],//list集合
@@ -193,11 +195,22 @@ const licenseNoSelect = (e, item) => {
   }
 }
 
+const showDictLabal = (item) => {
+  if (item.dictLabalFilter) return item.dictLabalFilter
+  return item.dictLabal
+}
+
+const filterMethod = (query, item) => {
+  item.dictLabalFilter = item.dictLabal.filter(v => v.name.includes(query))
+}
+
 const handleCheckAll = (item, index: number, val: boolean) => {
 
   item.indeterminate = false
   if (val) {
-    item.minArray = item.dictLabal.map((_) => _.attrName == '车辆类型' ? _.code : _.name)
+    let arr = item.dictLabal
+    if (item.dictLabalFilter) arr = item.dictLabalFilter
+    item.minArray = arr.map((_) => ['车辆类型', '交强不浮动原因', '商业不浮动原因'].includes(_.attrName) ? _.code : _.name)
   } else {
     item.minArray = []
   }