feat: change SQL sample search filter

This commit is contained in:
ulleo
2026-08-24 15:22:23 +08:00
committed by ulleo
parent 8a1845aaf4
commit 37752e9f1b
3 changed files with 15 additions and 5 deletions
@@ -14,6 +14,7 @@ const props = defineProps({
),
index: propTypes.number,
title: propTypes.string,
single: propTypes.bool,
property: {
type: Object,
default: () => ({}),
@@ -21,14 +22,20 @@ const props = defineProps({
})
const state = reactive({
activeStatus: [],
activeStatus: props.single ? undefined : [],
})
const emits = defineEmits(['filter-change'])
const selectStatus = (ids: any[]) => {
const selectStatus = (ids: any[] | any) => {
let _list
if (ids instanceof Array) {
_list = ids
} else {
_list = [ids]
}
emits(
'filter-change',
ids.map((item) => item.id || item.value)
_list.map((item) => item.id || item.value)
)
}
@@ -37,7 +44,7 @@ const optionListNotSelect = computed(() => {
})
const clear = (index: number) => {
if (index !== props.index) return
state.activeStatus = []
state.activeStatus = props.single ? undefined : []
}
useEmitt({
@@ -57,7 +64,7 @@ useEmitt({
value-key="id"
filterable
:placeholder="t('datasource.Please_select') + props.property.placeholder"
multiple
:multiple="!props.single"
@change="selectStatus"
>
<el-option
@@ -16,6 +16,7 @@ const props = defineProps({
field: propTypes.string,
option: propTypes.array,
title: propTypes.string,
single: propTypes.bool,
property: propTypes.shape({}),
})
),
@@ -142,6 +143,7 @@ defineExpose({
:title="component.title"
:index="index"
:property="component.property"
:single="!!component.single"
@filter-change="(v) => filterChange(v, component.field, 'in')"
/>
<drawer-enum-filter
@@ -229,6 +229,7 @@ const filterOption = ref<any[]>([
field: 'ds_list',
title: t('ds.title'),
operate: 'in',
single: true,
property: { placeholder: t('common.empty') + t('ds.title') },
},
{