mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 01:19:19 +08:00
refactor: 岗位改名为职位
- 数据库 sys_menu:岗位管理 → 职位管理,岗位菜单分配 → 职位菜单分配,岗位权限分配 → 职位权限分配 - 路由:所有 position-related route titles 更新 - 前端页面:职位列表、职位菜单分配、职位权限分配 - 表单:职位名称、职位ID 等 label 更新 - API 注释同步更新
This commit is contained in:
+4
-4
@@ -1,8 +1,8 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 岗位权限分配API
|
||||
* 用于管理岗位分配的精确权限码(控制接口访问)
|
||||
* 职位权限分配API
|
||||
* 用于管理职位分配的精确权限码(控制接口访问)
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -20,14 +20,14 @@ export async function getPositionPermissionCodesApi(positionId: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位权限列表(含详情)
|
||||
* 获取职位权限列表(含详情)
|
||||
*/
|
||||
export async function getPositionPermissionsApi(positionId: number) {
|
||||
return requestClient.get<any[]>(`/position-permission/permissions/${positionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新岗位权限
|
||||
* 批量更新职位权限
|
||||
*/
|
||||
export async function batchUpdatePositionPermissionsApi(
|
||||
positionId: number,
|
||||
|
||||
+4
-4
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* 岗位权限分配相关类型
|
||||
* 职位权限分配相关类型
|
||||
*/
|
||||
|
||||
export namespace PositionPermissionAssignVO {
|
||||
/**
|
||||
* 岗位权限关联信息
|
||||
* 职位权限关联信息
|
||||
*/
|
||||
export interface PositionPermissionInfo {
|
||||
/** 主键ID */
|
||||
id: number;
|
||||
/** 岗位ID */
|
||||
/** 职位ID */
|
||||
positionId: number;
|
||||
/** 岗位名称 */
|
||||
/** 职位名称 */
|
||||
positionName: string;
|
||||
/** 权限ID */
|
||||
permissionId: number;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 岗位菜单管理API
|
||||
* 用于管理岗位分配的菜单(控制侧边栏展示)
|
||||
* 职位菜单管理API
|
||||
* 用于管理职位分配的菜单(控制侧边栏展示)
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ export async function getPositionMenuIdsApi(positionId: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新岗位菜单
|
||||
* 批量更新职位菜单
|
||||
*/
|
||||
export async function batchUpdatePositionMenusApi(positionId: number, menuIds: number[]) {
|
||||
return requestClient.post<void>(`/position-menu/batch-update/${positionId}`, menuIds);
|
||||
|
||||
@@ -29,26 +29,26 @@ const routes: RouteRecordRaw[] = [
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'PositionManagement',
|
||||
name: 'JobManagement',
|
||||
path: '/organization/position-management',
|
||||
component: () => import('#/views/organization/position/index.vue'),
|
||||
meta: {
|
||||
icon: 'lucide:briefcase',
|
||||
title: '岗位管理',
|
||||
title: '职位管理',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'PositionMenuAssign',
|
||||
name: 'JobMenuAssign',
|
||||
path: '/organization/position-menu-assign',
|
||||
component: () =>
|
||||
import('#/views/organization/position-permission/index.vue'),
|
||||
meta: {
|
||||
icon: 'lucide:layoutDashboard',
|
||||
title: '岗位菜单分配',
|
||||
title: '职位菜单分配',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'PositionPermissionAssign',
|
||||
name: 'JobPermissionAssign',
|
||||
path: '/organization/position-permission-assign',
|
||||
component: () =>
|
||||
import(
|
||||
@@ -56,7 +56,7 @@ const routes: RouteRecordRaw[] = [
|
||||
),
|
||||
meta: {
|
||||
icon: 'lucide:shield-check',
|
||||
title: '岗位权限分配',
|
||||
title: '职位权限分配',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
+2
-2
@@ -243,11 +243,11 @@ defineExpose({
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="岗位ID" name="positionId">
|
||||
<Form.Item label="职位ID" name="positionId">
|
||||
<Input
|
||||
v-model:value="formData.positionId"
|
||||
type="number"
|
||||
placeholder="请输入岗位ID"
|
||||
placeholder="请输入职位ID"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
+2
-2
@@ -172,8 +172,8 @@ async function loadPositionOptions() {
|
||||
value: item.id,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('获取岗位列表失败:', error);
|
||||
message.error('获取岗位列表失败');
|
||||
console.error('获取职位列表失败:', error);
|
||||
message.error('获取职位列表失败');
|
||||
allPositionOptions.value = [];
|
||||
} finally {
|
||||
positionOptionsLoading.value = false;
|
||||
|
||||
+15
-15
@@ -35,7 +35,7 @@ const searchForm = ref({
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
// 岗位列表
|
||||
// 职位列表
|
||||
const positionList = ref<PositionVO.PositionInfoVO[]>([]);
|
||||
const positionLoading = ref(false);
|
||||
const positionPagination = ref({
|
||||
@@ -44,7 +44,7 @@ const positionPagination = ref({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 当前选中的岗位
|
||||
// 当前选中的职位
|
||||
const currentPosition = ref<null | PositionVO.PositionInfoVO>(null);
|
||||
|
||||
// 所有权限列表
|
||||
@@ -55,7 +55,7 @@ const permissionLoading = ref(false);
|
||||
const assignedPermissionIds = ref<number[]>([]);
|
||||
const selectedPermissionIds = ref<number[]>([]);
|
||||
|
||||
// 搜索岗位列表
|
||||
// 搜索职位列表
|
||||
async function searchPositions() {
|
||||
positionLoading.value = true;
|
||||
try {
|
||||
@@ -71,7 +71,7 @@ async function searchPositions() {
|
||||
positionList.value = result.records;
|
||||
positionPagination.value.total = result.total;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取岗位列表失败');
|
||||
message.error(error?.message || '获取职位列表失败');
|
||||
} finally {
|
||||
positionLoading.value = false;
|
||||
}
|
||||
@@ -90,13 +90,13 @@ async function loadAllPermissions() {
|
||||
}
|
||||
}
|
||||
|
||||
// 选择岗位
|
||||
// 选择职位
|
||||
async function selectPosition(position: PositionVO.PositionInfoVO) {
|
||||
currentPosition.value = position;
|
||||
await loadAssignedPermissions();
|
||||
}
|
||||
|
||||
// 加载岗位已分配的权限ID列表
|
||||
// 加载职位已分配的权限ID列表
|
||||
async function loadAssignedPermissions() {
|
||||
if (!currentPosition.value?.id) return;
|
||||
|
||||
@@ -106,7 +106,7 @@ async function loadAssignedPermissions() {
|
||||
assignedPermissionIds.value = result;
|
||||
selectedPermissionIds.value = [...result];
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取岗位权限失败');
|
||||
message.error(error?.message || '获取职位权限失败');
|
||||
} finally {
|
||||
permissionLoading.value = false;
|
||||
}
|
||||
@@ -193,9 +193,9 @@ onMounted(() => {
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<Flex gap="middle" class="h-full">
|
||||
<!-- 左栏:岗位列表 -->
|
||||
<!-- 左栏:职位列表 -->
|
||||
<Card
|
||||
title="岗位列表"
|
||||
title="职位列表"
|
||||
class="flex h-full max-w-[400px] flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
@@ -208,7 +208,7 @@ onMounted(() => {
|
||||
<Flex class="flex-wrap gap-2">
|
||||
<Input
|
||||
v-model:value="searchForm.name"
|
||||
placeholder="请输入岗位名称"
|
||||
placeholder="请输入职位名称"
|
||||
allow-clear
|
||||
style="width: 200px; margin-right: 8px"
|
||||
/>
|
||||
@@ -225,7 +225,7 @@ onMounted(() => {
|
||||
<Button @click="resetSearch"> 重置 </Button>
|
||||
</Flex>
|
||||
|
||||
<!-- 岗位列表区域 -->
|
||||
<!-- 职位列表区域 -->
|
||||
<Flex vertical class="flex-1">
|
||||
<Spin :spinning="positionLoading">
|
||||
<div class="flex-1">
|
||||
@@ -290,14 +290,14 @@ onMounted(() => {
|
||||
</Flex>
|
||||
</Card>
|
||||
|
||||
<!-- 右栏:岗位权限分配 -->
|
||||
<!-- 右栏:职位权限分配 -->
|
||||
<Card
|
||||
title="岗位权限分配"
|
||||
title="职位权限分配"
|
||||
class="flex h-full flex-1 flex-col"
|
||||
:body-style="{ height: '100%' }"
|
||||
>
|
||||
<template v-if="currentPosition">
|
||||
<!-- 岗位信息 + 统计与操作 -->
|
||||
<!-- 职位信息 + 统计与操作 -->
|
||||
<div class="mb-4 rounded bg-gray-50 p-4 dark:bg-neutral-800">
|
||||
<div class="mb-3 flex items-center justify-between gap-2">
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -415,7 +415,7 @@ onMounted(() => {
|
||||
<div v-else class="flex h-full flex-1 items-center justify-center">
|
||||
<div class="text-center text-gray-500">
|
||||
<div class="mb-4 text-5xl">👈</div>
|
||||
<div class="text-base">请先选择一个岗位</div>
|
||||
<div class="text-base">请先选择一个职位</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
+17
-17
@@ -35,7 +35,7 @@ const searchForm = ref({
|
||||
status: undefined as number | undefined,
|
||||
});
|
||||
|
||||
// 岗位列表
|
||||
// 职位列表
|
||||
const positionList = ref<PositionVO.PositionInfoVO[]>([]);
|
||||
const positionLoading = ref(false);
|
||||
const positionPagination = ref({
|
||||
@@ -44,14 +44,14 @@ const positionPagination = ref({
|
||||
total: 0,
|
||||
});
|
||||
|
||||
// 当前选中的岗位
|
||||
// 当前选中的职位
|
||||
const currentPosition = ref<null | PositionVO.PositionInfoVO>(null);
|
||||
|
||||
// 公司菜单树数据
|
||||
const companyMenuTree = ref<CompanyMenuVO.CompanyMenuInfo[]>([]);
|
||||
const menuTreeLoading = ref(false);
|
||||
|
||||
// 岗位权限菜单ID列表
|
||||
// 职位权限菜单ID列表
|
||||
const positionMenuIds = ref<number[]>([]);
|
||||
const permissionLoading = ref(false);
|
||||
|
||||
@@ -61,7 +61,7 @@ const expandedKeys = ref<number[]>([]);
|
||||
|
||||
// 不区分超管与普通菜单
|
||||
|
||||
// 搜索岗位列表
|
||||
// 搜索职位列表
|
||||
async function searchPositions() {
|
||||
positionLoading.value = true;
|
||||
try {
|
||||
@@ -78,7 +78,7 @@ async function searchPositions() {
|
||||
positionList.value = result.records;
|
||||
positionPagination.value.total = result.total;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取岗位列表失败');
|
||||
message.error(error?.message || '获取职位列表失败');
|
||||
} finally {
|
||||
positionLoading.value = false;
|
||||
}
|
||||
@@ -130,13 +130,13 @@ function convertToTreeData(menus: CompanyMenuVO.CompanyMenuInfo[]): any[] {
|
||||
}));
|
||||
}
|
||||
|
||||
// 选择岗位
|
||||
// 选择职位
|
||||
async function selectPosition(position: PositionVO.PositionInfoVO) {
|
||||
currentPosition.value = position;
|
||||
await loadPositionPermissions();
|
||||
}
|
||||
|
||||
// 加载岗位权限
|
||||
// 加载职位权限
|
||||
async function loadPositionPermissions() {
|
||||
if (!currentPosition.value?.id) return;
|
||||
|
||||
@@ -149,7 +149,7 @@ async function loadPositionPermissions() {
|
||||
const leafMenuIds = cleanRootNodes(result);
|
||||
checkedKeys.value = leafMenuIds;
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取岗位菜单失败');
|
||||
message.error(error?.message || '获取职位菜单失败');
|
||||
} finally {
|
||||
permissionLoading.value = false;
|
||||
}
|
||||
@@ -222,7 +222,7 @@ function ensureParentMenuIds(menuIds: number[]): number[] {
|
||||
return [...result];
|
||||
}
|
||||
|
||||
// 保存岗位权限
|
||||
// 保存职位权限
|
||||
async function savePositionPermissions() {
|
||||
if (!currentPosition.value?.id) return;
|
||||
|
||||
@@ -332,9 +332,9 @@ onMounted(() => {
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<Flex gap="middle" class="h-full">
|
||||
<!-- 左栏:岗位列表 -->
|
||||
<!-- 左栏:职位列表 -->
|
||||
<Card
|
||||
title="岗位列表"
|
||||
title="职位列表"
|
||||
class="flex h-full max-w-[400px] flex-col"
|
||||
:body-style="{
|
||||
height: '100%',
|
||||
@@ -347,7 +347,7 @@ onMounted(() => {
|
||||
<Flex class="flex-wrap gap-2">
|
||||
<Input
|
||||
v-model:value="searchForm.name"
|
||||
placeholder="请输入岗位名称"
|
||||
placeholder="请输入职位名称"
|
||||
allow-clear
|
||||
style="width: 200px; margin-right: 8px"
|
||||
/>
|
||||
@@ -364,9 +364,9 @@ onMounted(() => {
|
||||
<Button @click="resetSearch"> 重置 </Button>
|
||||
</Flex>
|
||||
|
||||
<!-- 岗位列表区域 -->
|
||||
<!-- 职位列表区域 -->
|
||||
<Flex vertical class="flex-1">
|
||||
<!-- 岗位列表 -->
|
||||
<!-- 职位列表 -->
|
||||
<Flex vertical class="flex-1">
|
||||
<Spin :spinning="positionLoading">
|
||||
<Card
|
||||
@@ -431,12 +431,12 @@ onMounted(() => {
|
||||
|
||||
<!-- 右栏:权限管理 -->
|
||||
<Card
|
||||
title="岗位菜单分配"
|
||||
title="职位菜单分配"
|
||||
class="flex h-full flex-1 flex-col"
|
||||
:body-style="{ height: '100%' }"
|
||||
>
|
||||
<template v-if="currentPosition">
|
||||
<!-- 岗位信息 + 统计与操作 -->
|
||||
<!-- 职位信息 + 统计与操作 -->
|
||||
<div class="mb-4 rounded bg-gray-50 p-4 dark:bg-neutral-800">
|
||||
<div class="mb-3 flex items-center justify-between gap-2">
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -512,7 +512,7 @@ onMounted(() => {
|
||||
<div v-else class="flex h-full flex-1 items-center justify-center">
|
||||
<div class="text-center text-gray-500">
|
||||
<div class="mb-4 text-5xl">👈</div>
|
||||
<div class="text-base">请先选择一个岗位</div>
|
||||
<div class="text-base">请先选择一个职位</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
+9
-9
@@ -63,7 +63,7 @@ const formData = ref<FormData>({
|
||||
// 开关组件不需要选项数组
|
||||
|
||||
// 模态框标题
|
||||
const modalTitle = computed(() => (isEdit.value ? '编辑岗位' : '添加岗位'));
|
||||
const modalTitle = computed(() => (isEdit.value ? '编辑职位' : '添加职位'));
|
||||
|
||||
// 重置表单
|
||||
function resetForm() {
|
||||
@@ -105,8 +105,8 @@ async function handleSubmit() {
|
||||
emit('success');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error('保存岗位失败:', error);
|
||||
message.error('保存岗位失败');
|
||||
console.error('保存职位失败:', error);
|
||||
message.error('保存职位失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -150,15 +150,15 @@ defineExpose({
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<Form.Item
|
||||
label="岗位名称"
|
||||
label="职位名称"
|
||||
name="name"
|
||||
:rules="[{ required: true, message: '请输入岗位名称' }]"
|
||||
:rules="[{ required: true, message: '请输入职位名称' }]"
|
||||
>
|
||||
<Input v-model:value="formData.name" placeholder="请输入岗位名称" />
|
||||
<Input v-model:value="formData.name" placeholder="请输入职位名称" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="岗位编码" name="code">
|
||||
<Input v-model:value="formData.code" placeholder="请输入岗位编码" />
|
||||
<Form.Item label="职位编码" name="code">
|
||||
<Input v-model:value="formData.code" placeholder="请输入职位编码" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="所属部门" name="departmentId">
|
||||
@@ -173,7 +173,7 @@ defineExpose({
|
||||
<Form.Item label="描述" name="remark">
|
||||
<Input.TextArea
|
||||
v-model:value="formData.remark"
|
||||
placeholder="请输入岗位描述"
|
||||
placeholder="请输入职位描述"
|
||||
:rows="3"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
@@ -57,13 +57,13 @@ const gridOptions: VxeGridProps<any> = {
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '岗位名称',
|
||||
title: '职位名称',
|
||||
minWidth: 150,
|
||||
showOverflow: 'tooltip' as const,
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
title: '岗位编码',
|
||||
title: '职位编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
@@ -149,8 +149,8 @@ const gridOptions: VxeGridProps<any> = {
|
||||
total: data.total,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('获取岗位列表失败:', error);
|
||||
message.error('获取岗位列表失败');
|
||||
console.error('获取职位列表失败:', error);
|
||||
message.error('获取职位列表失败');
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
@@ -169,10 +169,10 @@ const formOptions = computed(() => ({
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入岗位名称',
|
||||
placeholder: '请输入职位名称',
|
||||
},
|
||||
fieldName: 'name',
|
||||
label: '岗位名称',
|
||||
label: '职位名称',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
@@ -197,25 +197,25 @@ function refreshTable() {
|
||||
}
|
||||
}
|
||||
|
||||
// 处理添加岗位
|
||||
// 处理添加职位
|
||||
function handleAdd() {
|
||||
positionModalRef.value?.open(false);
|
||||
}
|
||||
|
||||
// 处理编辑岗位
|
||||
// 处理编辑职位
|
||||
function handleEdit(record: PositionVO.PositionInfoVO) {
|
||||
positionModalRef.value?.open(true, record);
|
||||
}
|
||||
|
||||
// 处理删除岗位
|
||||
// 处理删除职位
|
||||
async function handleDelete(record: PositionVO.PositionInfoVO) {
|
||||
try {
|
||||
await deletePositionApi(record.id);
|
||||
message.success('删除成功');
|
||||
refreshTable();
|
||||
} catch (error) {
|
||||
console.error('删除岗位失败:', error);
|
||||
message.error('删除岗位失败');
|
||||
console.error('删除职位失败:', error);
|
||||
message.error('删除职位失败');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,15 +229,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
formOptions: formOptions.value,
|
||||
showSearchForm: true,
|
||||
tableTitle: '岗位管理',
|
||||
tableTitle: '职位管理',
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page title="岗位管理" auto-content-height>
|
||||
<Page title="职位管理" auto-content-height>
|
||||
<template #description>
|
||||
<div class="text-foreground/80 mt-2">
|
||||
管理岗位信息,包括岗位名称、编码、所属部门和描述
|
||||
管理职位信息,包括职位名称、编码、所属部门和描述
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -248,7 +248,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<Space>
|
||||
<Button type="primary" @click="handleAdd">
|
||||
<PlusIcon />
|
||||
添加岗位
|
||||
添加职位
|
||||
</Button>
|
||||
</Space>
|
||||
</template>
|
||||
@@ -276,7 +276,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<Space>
|
||||
<Button size="small" @click="handleEdit(row)"> 编辑 </Button>
|
||||
<Popconfirm
|
||||
title="确定要删除这个岗位吗?"
|
||||
title="确定要删除这个职位吗?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<Button size="small" danger> 删除 </Button>
|
||||
@@ -285,7 +285,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 岗位模态框组件 -->
|
||||
<!-- 职位模态框组件 -->
|
||||
<PositionModal
|
||||
ref="positionModalRef"
|
||||
:department-options="departmentOptions"
|
||||
|
||||
Reference in New Issue
Block a user