mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
feat: change SQL sample search filter
This commit is contained in:
@@ -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') },
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user