Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions frontend/src/components/drawer-filter/src/DrawerFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,28 @@ const props = defineProps({
),
index: propTypes.number,
title: propTypes.string,
single: propTypes.bool,
property: {
type: Object,
default: () => ({}),
},
})

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)
)
}

Expand All @@ -37,7 +44,7 @@ const optionListNotSelect = computed(() => {
})
const clear = (index: number) => {
if (index !== props.index) return
state.activeStatus = []
state.activeStatus = props.single ? undefined : []
}

useEmitt({
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/drawer-main/src/DrawerMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const props = defineProps({
field: propTypes.string,
option: propTypes.array,
title: propTypes.string,
single: propTypes.bool,
property: propTypes.shape({}),
})
),
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/system/training/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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') },
},
{
Expand Down
Loading