2020-11-06 00:17:04 +00:00
|
|
|
<template>
|
|
|
|
<q-select
|
|
|
|
filled
|
|
|
|
label="Benutzer"
|
|
|
|
@input="updated"
|
|
|
|
v-model="user"
|
|
|
|
:options="users"
|
|
|
|
option-label="display_name"
|
|
|
|
option-value="userid"
|
|
|
|
map-options
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-11-14 23:23:20 +00:00
|
|
|
import { computed, defineComponent, onBeforeMount } from '@vue/composition-api';
|
2020-11-06 00:17:04 +00:00
|
|
|
import { Store } from 'vuex';
|
|
|
|
import { StateInterface } from 'src/store';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
user: FG.User;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'UserSelector',
|
|
|
|
props: ['user'],
|
|
|
|
setup(props: Props, { root, emit }) {
|
|
|
|
const store = <Store<StateInterface>>root.$store;
|
2020-11-14 23:23:20 +00:00
|
|
|
|
|
|
|
onBeforeMount(() => {
|
|
|
|
store.dispatch('user/getUsers').catch((error) => {
|
|
|
|
console.error(error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-11-06 00:17:04 +00:00
|
|
|
const users = computed(() => store.state.user.users);
|
|
|
|
const updated = (value: FG.User) => {
|
|
|
|
emit('update:user', value);
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
updated,
|
2020-11-14 23:23:20 +00:00
|
|
|
users,
|
2020-11-06 00:17:04 +00:00
|
|
|
};
|
2020-11-14 23:23:20 +00:00
|
|
|
},
|
2020-11-06 00:17:04 +00:00
|
|
|
});
|
|
|
|
</script>
|