From 28101cb2f1bffbaa5d622fc2935c562dd2e65830 Mon Sep 17 00:00:00 2001 From: AN <1983933789@qq.com> Date: Fri, 19 Sep 2025 16:14:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(projects):=20=E6=96=B0=E5=A2=9E=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E9=83=A8=E9=97=A8=E6=A0=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/api/system/post.ts | 7 +++++++ src/views/system/post/index.vue | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) 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() {