feat: 增加岗位管理中部门树接口并调整相关组件
- 在 post api 中添加 postDeptTreeSelect 接口 - 在 post 组件中使用新的 postDeptTreeSelect 接口 - 修改 dept-tree 组件,增加 api 属性以支持不同的数据源
This commit is contained in:
parent
7f08c11ab7
commit
498f846560
@ -1,3 +1,4 @@
|
|||||||
|
import type { DeptTree } from '../user/model';
|
||||||
import type { Post } from './model';
|
import type { Post } from './model';
|
||||||
|
|
||||||
import type { ID, IDS, PageQuery } from '#/api/common';
|
import type { ID, IDS, PageQuery } from '#/api/common';
|
||||||
@ -74,3 +75,11 @@ export function postRemove(postIds: IDS) {
|
|||||||
export function postOptionSelect(deptId: ID) {
|
export function postOptionSelect(deptId: ID) {
|
||||||
return requestClient.get<Post[]>(Api.postSelect, { params: { deptId } });
|
return requestClient.get<Post[]>(Api.postSelect, { params: { deptId } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岗位专用 - 获取部门树
|
||||||
|
* @returns 部门树
|
||||||
|
*/
|
||||||
|
export function postDeptTreeSelect() {
|
||||||
|
return requestClient.get<DeptTree[]>('/system/post/deptTree');
|
||||||
|
}
|
||||||
|
|||||||
@ -12,7 +12,12 @@ import { getVxePopupContainer } from '@vben/utils';
|
|||||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||||
import { postExport, postList, postRemove } from '#/api/system/post';
|
import {
|
||||||
|
postDeptTreeSelect,
|
||||||
|
postExport,
|
||||||
|
postList,
|
||||||
|
postRemove,
|
||||||
|
} from '#/api/system/post';
|
||||||
import { commonDownloadExcel } from '#/utils/file/download';
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
import DeptTree from '#/views/system/user/dept-tree.vue';
|
import DeptTree from '#/views/system/user/dept-tree.vue';
|
||||||
|
|
||||||
@ -122,6 +127,7 @@ function handleDownloadExcel() {
|
|||||||
<template>
|
<template>
|
||||||
<Page :auto-content-height="true" content-class="flex gap-[8px] w-full">
|
<Page :auto-content-height="true" content-class="flex gap-[8px] w-full">
|
||||||
<DeptTree
|
<DeptTree
|
||||||
|
:api="postDeptTreeSelect"
|
||||||
v-model:select-dept-id="selectDeptId"
|
v-model:select-dept-id="selectDeptId"
|
||||||
class="w-[260px]"
|
class="w-[260px]"
|
||||||
@reload="() => tableApi.reload()"
|
@reload="() => tableApi.reload()"
|
||||||
|
|||||||
@ -12,7 +12,10 @@ import { getDeptTree } from '#/api/system/user';
|
|||||||
|
|
||||||
defineOptions({ inheritAttrs: false });
|
defineOptions({ inheritAttrs: false });
|
||||||
|
|
||||||
withDefaults(defineProps<{ showSearch?: boolean }>(), { showSearch: true });
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
showSearch: true,
|
||||||
|
api: getDeptTree,
|
||||||
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
/**
|
/**
|
||||||
@ -25,6 +28,17 @@ const emit = defineEmits<{
|
|||||||
select: [];
|
select: [];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/**
|
||||||
|
* 调用的接口
|
||||||
|
*/
|
||||||
|
api?: () => Promise<DeptTree[]>;
|
||||||
|
/**
|
||||||
|
* 是否显示搜索框
|
||||||
|
*/
|
||||||
|
showSearch?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const selectDeptId = defineModel('selectDeptId', {
|
const selectDeptId = defineModel('selectDeptId', {
|
||||||
required: true,
|
required: true,
|
||||||
type: Array as PropType<string[]>,
|
type: Array as PropType<string[]>,
|
||||||
@ -46,7 +60,7 @@ async function loadTree() {
|
|||||||
searchValue.value = '';
|
searchValue.value = '';
|
||||||
selectDeptId.value = [];
|
selectDeptId.value = [];
|
||||||
|
|
||||||
const ret = await getDeptTree();
|
const ret = await props.api();
|
||||||
|
|
||||||
deptTreeArray.value = ret;
|
deptTreeArray.value = ret;
|
||||||
showTreeSkeleton.value = false;
|
showTreeSkeleton.value = false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user