Skip to content

Commit 3088e1f

Browse files
committed
feat: change SQL sample search filter
1 parent 8a1845a commit 3088e1f

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

frontend/src/components/drawer-filter/src/DrawerFilter.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,28 @@ const props = defineProps({
1414
),
1515
index: propTypes.number,
1616
title: propTypes.string,
17+
single: propTypes.bool,
1718
property: {
1819
type: Object,
1920
default: () => ({}),
2021
},
2122
})
2223
2324
const state = reactive({
24-
activeStatus: [],
25+
activeStatus: props.single ? undefined : [],
2526
})
2627
const emits = defineEmits(['filter-change'])
2728
28-
const selectStatus = (ids: any[]) => {
29+
const selectStatus = (ids: any[] | any) => {
30+
let _list
31+
if (ids instanceof Array) {
32+
_list = ids
33+
} else {
34+
_list = [ids]
35+
}
2936
emits(
3037
'filter-change',
31-
ids.map((item) => item.id || item.value)
38+
_list.map((item) => item.id || item.value)
3239
)
3340
}
3441
@@ -37,7 +44,7 @@ const optionListNotSelect = computed(() => {
3744
})
3845
const clear = (index: number) => {
3946
if (index !== props.index) return
40-
state.activeStatus = []
47+
state.activeStatus = props.single ? undefined : []
4148
}
4249
4350
useEmitt({
@@ -57,7 +64,7 @@ useEmitt({
5764
value-key="id"
5865
filterable
5966
:placeholder="t('datasource.Please_select') + props.property.placeholder"
60-
multiple
67+
:multiple="!props.single"
6168
@change="selectStatus"
6269
>
6370
<el-option

frontend/src/components/drawer-main/src/DrawerMain.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const props = defineProps({
1616
field: propTypes.string,
1717
option: propTypes.array,
1818
title: propTypes.string,
19+
single: propTypes.bool,
1920
property: propTypes.shape({}),
2021
})
2122
),
@@ -142,6 +143,7 @@ defineExpose({
142143
:title="component.title"
143144
:index="index"
144145
:property="component.property"
146+
:single="!!component.single"
145147
@filter-change="(v) => filterChange(v, component.field, 'in')"
146148
/>
147149
<drawer-enum-filter

frontend/src/views/system/training/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ const filterOption = ref<any[]>([
229229
field: 'ds_list',
230230
title: t('ds.title'),
231231
operate: 'in',
232+
single: true,
232233
property: { placeholder: t('common.empty') + t('ds.title') },
233234
},
234235
{

0 commit comments

Comments
 (0)