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