diff --git a/src/dashboard-front/src/components/member-select/index.tsx b/src/dashboard-front/src/components/member-select/index.tsx index 8dfa8652e..c455d4db0 100644 --- a/src/dashboard-front/src/components/member-select/index.tsx +++ b/src/dashboard-front/src/components/member-select/index.tsx @@ -1,7 +1,7 @@ import { useStaffStore } from '@/store'; import { Staff, StaffType } from '@/types'; import { Loading, TagInput } from 'bkui-vue'; -import { computed, defineComponent, onMounted, PropType, ref, watch, nextTick } from 'vue'; +import { computed, defineComponent, PropType, ref, watch, nextTick } from 'vue'; import _ from 'lodash'; import './member-select.scss'; @@ -39,6 +39,7 @@ export default defineComponent({ emits: ['change', 'input', 'blur', 'focus'], setup(props, ctx) { const tagInputRef = ref(null); + // const isLoading = ref(false); const staffStore = useStaffStore(); const searchKey = ['username']; const userList: any = ref([]); @@ -50,11 +51,11 @@ export default defineComponent({ // fixOnBoundary: true, }; - onMounted(() => { - if (staffStore.list.length === 0) { - staffStore.fetchStaffs(); - } - }); + // onMounted(() => { + // if (staffStore.list.length === 0) { + // staffStore.fetchStaffs(); + // } + // }); function tpl(node: Staff) { return ( @@ -92,15 +93,20 @@ export default defineComponent({ () => staffStore.list, (list) => { if (list.length) { + // isLoading.value = false; nextTick(() => { userList.value = _.cloneDeep(list); }); + } else { + // isLoading.value = true; + staffStore.fetchStaffs(); } }, { immediate: true, deep: true }, ); - return () => ( + return () => <> + {/* v-bkloading={{ loading: isLoading, opacity: 1, color: '#fff', mode: 'spin', size: 'mini' }} */} - ); + ; }, }); diff --git a/src/dashboard-front/src/store/staff.ts b/src/dashboard-front/src/store/staff.ts index 5fbaa4b9d..5ebb9e4f3 100644 --- a/src/dashboard-front/src/store/staff.ts +++ b/src/dashboard-front/src/store/staff.ts @@ -36,6 +36,7 @@ export const useStaffStore = defineStore({ if (result) { this.fetching = false; this.list = _.unionBy(this.list, data.results, 'id'); + console.log('staffs', this.list.length); } headTag.removeChild(scriptTag); // @ts-ignore