diff --git a/src/service/api/system/post.ts b/src/service/api/system/post.ts index 87815f2e..88c3764d 100644 --- a/src/service/api/system/post.ts +++ b/src/service/api/system/post.ts @@ -43,3 +43,10 @@ export function fetchGetPostSelect(deptId?: CommonType.IdType, postIds?: CommonT params: { postIds, deptId } }); } +/** 获取部门选择框列表 */ +export function fetchGetPostDeptSelect() { + return request({ + url: '/system/post/deptTree', + method: 'get' + }); +} diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index 78e3573e..056b0829 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -2,8 +2,7 @@ import { computed, ref } from 'vue'; import { NButton, NDivider } from 'naive-ui'; import { useLoading } from '@sa/hooks'; -import { fetchBatchDeletePost, fetchGetPostList } from '@/service/api/system/post'; -import { fetchGetDeptTree } from '@/service/api/system'; +import { fetchBatchDeletePost, fetchGetPostDeptSelect, fetchGetPostList } from '@/service/api/system/post'; import { useAppStore } from '@/store/modules/app'; import { useAuth } from '@/hooks/business/auth'; import { useDownload } from '@/hooks/business/download'; @@ -191,16 +190,17 @@ const { loading: treeLoading, startLoading: startTreeLoading, endLoading: endTre const deptPattern = ref(); const deptData = ref([]); const selectedKeys = ref([]); -async function getTreeData() { + +async function getDeptOptions() { + // 加载 startTreeLoading(); - const { data: tree, error } = await fetchGetDeptTree(); + const { data: tree, error } = await fetchGetPostDeptSelect(); if (!error) { deptData.value = tree; } endTreeLoading(); } - -getTreeData(); +getDeptOptions(); function handleClickTree(keys: string[]) { searchParams.belongDeptId = keys.length ? keys[0] : null; @@ -210,7 +210,7 @@ function handleClickTree(keys: string[]) { function handleResetTreeData() { deptPattern.value = undefined; - getTreeData(); + getDeptOptions(); } function handleResetSearch() {