File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
2324const state = reactive ({
24- activeStatus: [],
25+ activeStatus: props . single ? undefined : [],
2526})
2627const 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})
3845const clear = (index : number ) => {
3946 if (index !== props .index ) return
40- state .activeStatus = []
47+ state .activeStatus = props . single ? undefined : []
4148}
4249
4350useEmitt ({
@@ -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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments