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