Browse Source

下拉框优化

hella_online_20240829
wangyufei 4 months ago
parent
commit
65a7b33f4a
  1. 14
      src/components/SearchHigh/src/SearchHigh.vue

14
src/components/SearchHigh/src/SearchHigh.vue

@ -24,7 +24,7 @@
<el-input-number v-else-if="getInputType(item.column) == 'inputNumber'" v-model="item.value" :precision="getInputPrecision(item.column)" :disabled="item.disabled"/>
<!-- 下拉框 -->
<el-select v-else-if="getInputType(item.column) == 'select'" v-model="item.value1" :placeholder="t('ts.请选择内容')" :filterable="true" clearable :disabled="item.disabled" :multiple="item.action=='in' || item.action=='notIn' ? true : false" collapse-tags collapse-tags-tooltip :key="item.action">
<el-option v-for="dict in initSelectOptions(item.column)" :key="dict.value" :label="t(`ts.${dict.label}`).replace('ts.','')"
<el-option v-for="dict in allDictOptions[item.column]" :key="dict.value" :label="t(`ts.${dict.label}`).replace('ts.','')"
:value="dict.value" />
<!-- <el-option v-for="(op, index) in initSelectOptions(item.column)" :label="op[item.optionsLabel] || op.label"
:value="op[item.optionsValue] || op.value" :key="index" /> -->
@ -265,6 +265,18 @@ const buttonBaseClick = (val) => {
}
}
watch(()=>popoverVisible.value,()=>{
if(popoverVisible.value){
getDictOptions()
}
})
const allDictOptions = ref({}) //
const getDictOptions = ()=>{
let selectList = searchOption_high.value.filter(item=>getInputType(item.field) == 'select')
selectList.forEach(item=>{
allDictOptions.value[item.field] = getStrDictOptions(item.dictType)
})
}
// option
const initSelectOptions = (item) => {
return getStrDictOptions(searchOption_high.value.find(searchOptionItem => (searchOptionItem.field == item)).dictType)

Loading…
Cancel
Save