Showing
1 changed file
with
16 additions
and
5 deletions
| @@ -8,9 +8,10 @@ | @@ -8,9 +8,10 @@ | ||
| 8 | 8 | ||
| 9 | const [registerDrawer, { openDrawer }] = useDrawer(); | 9 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 10 | 10 | ||
| 11 | - withDefaults( | 11 | + const props = withDefaults( |
| 12 | defineProps<{ | 12 | defineProps<{ |
| 13 | - apiTreeSelect?: Recordable; | 13 | + value?: string | string[]; |
| 14 | + apiTreeSelectProps?: Recordable; | ||
| 14 | showCreate?: boolean; | 15 | showCreate?: boolean; |
| 15 | }>(), | 16 | }>(), |
| 16 | { | 17 | { |
| @@ -18,6 +19,8 @@ | @@ -18,6 +19,8 @@ | ||
| 18 | } | 19 | } |
| 19 | ); | 20 | ); |
| 20 | 21 | ||
| 22 | + const emit = defineEmits(['change']); | ||
| 23 | + | ||
| 21 | const handleOpenCreate = () => { | 24 | const handleOpenCreate = () => { |
| 22 | openDrawer(true, { isUpdate: false }); | 25 | openDrawer(true, { isUpdate: false }); |
| 23 | }; | 26 | }; |
| @@ -25,12 +28,20 @@ | @@ -25,12 +28,20 @@ | ||
| 25 | const timespan = ref(Date.now()); | 28 | const timespan = ref(Date.now()); |
| 26 | 29 | ||
| 27 | const getBindProps = computed(() => { | 30 | const getBindProps = computed(() => { |
| 31 | + const { value, apiTreeSelectProps = {} } = props; | ||
| 32 | + const { params = {} } = apiTreeSelectProps; | ||
| 28 | return { | 33 | return { |
| 29 | - maxLength: 250, | 34 | + replaceFields: { children: 'children', key: 'id', title: 'name', value: 'id' }, |
| 35 | + getPopupContainer: () => document.body, | ||
| 30 | placeholder: '请选择所属组织', | 36 | placeholder: '请选择所属组织', |
| 37 | + maxLength: 250, | ||
| 38 | + ...apiTreeSelectProps, | ||
| 39 | + value, | ||
| 31 | api: getOrganizationList, | 40 | api: getOrganizationList, |
| 32 | - params: { _t: unref(timespan) }, | ||
| 33 | - replaceFields: { children: 'children', key: 'id', title: 'name', value: 'id' }, | 41 | + params: { ...params, _t: unref(timespan) }, |
| 42 | + onChange: (...args: any[]) => { | ||
| 43 | + emit('change', ...args); | ||
| 44 | + }, | ||
| 34 | }; | 45 | }; |
| 35 | }); | 46 | }); |
| 36 | 47 |