fix: 左边部门树错误emit导致会调用两次列表api
This commit is contained in:
parent
8dc00185ea
commit
5ffa2be89a
@ -13,6 +13,7 @@
|
||||
**BUG FIXES**
|
||||
|
||||
- 语言 漏加Content-Language请求头
|
||||
- 用户管理/岗位管理 左边部门树错误emit导致会调用两次列表api
|
||||
|
||||
# 1.1.1
|
||||
|
||||
|
@ -133,7 +133,8 @@ function handleDownloadExcel() {
|
||||
<DeptTree
|
||||
v-model:select-dept-id="selectDeptId"
|
||||
class="w-[260px]"
|
||||
@select="() => tableApi.query()"
|
||||
@reload="() => tableApi.reload()"
|
||||
@select="() => tableApi.reload()"
|
||||
/>
|
||||
<BasicTable class="flex-1 overflow-hidden" table-title="岗位列表">
|
||||
<template #toolbar-tools>
|
||||
|
@ -10,7 +10,16 @@ import { getDeptTree } from '#/api/system/user';
|
||||
|
||||
defineOptions({ inheritAttrs: false });
|
||||
|
||||
const emit = defineEmits<{ select: [] }>();
|
||||
const emit = defineEmits<{
|
||||
/**
|
||||
* 点击刷新按钮的事件
|
||||
*/
|
||||
reload: [];
|
||||
/**
|
||||
* 点击节点的事件
|
||||
*/
|
||||
select: [];
|
||||
}>();
|
||||
|
||||
const selectDeptId = defineModel('selectDeptId', {
|
||||
required: true,
|
||||
@ -28,19 +37,23 @@ const deptTreeArray = ref<DeptTreeArray>([]);
|
||||
/** 骨架屏加载 */
|
||||
const showTreeSkeleton = ref<boolean>(true);
|
||||
|
||||
async function reload() {
|
||||
async function loadTree() {
|
||||
showTreeSkeleton.value = true;
|
||||
searchValue.value = '';
|
||||
selectDeptId.value = [];
|
||||
|
||||
const ret = await getDeptTree();
|
||||
emit('select');
|
||||
|
||||
deptTreeArray.value = ret;
|
||||
showTreeSkeleton.value = false;
|
||||
}
|
||||
|
||||
onMounted(reload);
|
||||
async function handleReload() {
|
||||
await loadTree();
|
||||
emit('reload');
|
||||
}
|
||||
|
||||
onMounted(loadTree);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -62,7 +75,7 @@ onMounted(reload);
|
||||
size="small"
|
||||
>
|
||||
<template #enterButton>
|
||||
<a-button @click="reload">
|
||||
<a-button @click="handleReload">
|
||||
<SyncOutlined class="text-primary" />
|
||||
</a-button>
|
||||
</template>
|
||||
|
@ -202,7 +202,8 @@ const { hasAccessByCodes } = useAccess();
|
||||
<DeptTree
|
||||
v-model:select-dept-id="selectDeptId"
|
||||
class="w-[260px]"
|
||||
@select="() => tableApi.query()"
|
||||
@reload="() => tableApi.reload()"
|
||||
@select="() => tableApi.reload()"
|
||||
/>
|
||||
<BasicTable class="flex-1 overflow-hidden" table-title="用户列表">
|
||||
<template #toolbar-tools>
|
||||
|
Loading…
Reference in New Issue
Block a user