Commit 3e41c784 by ZP

feat(jcsj): 添加团队管理模块的API接口和数据模型

- 创建MesWorkTeam分页参数、返回值模型和结果类型定义
- 实现团队管理相关的增删改查API接口
- 添加分页查询、详情获取、新增、更新、删除等完整CRUD操作
- 集成基础HTTP请求工具和错误处理机制
- 定义团队管理模块的API端点枚举
- 提供批量删除功能支持
parent 0e0c2a92
import { RokeWorkTeamPageModel, RokeWorkTeamPageParams, RokeWorkTeamPageResult } from './model/BzxxModel'; import { MesWorkTeamPageModel, MesWorkTeamPageParams, MesWorkTeamPageResult } from './model/TeamManagementModel';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
enum Api { enum Api {
Page = '/jcsj/bzxx/page', Page = '/jcsj/teammanagement/page',
List = '/jcsj/bzxx/list', List = '/jcsj/teammanagement/list',
Info = '/jcsj/bzxx/info', Info = '/jcsj/teammanagement/info',
RokeWorkTeam = '/jcsj/bzxx', MesWorkTeam = '/jcsj/teammanagement',
} }
/** /**
* @description: 查询RokeWorkTeam分页列表 * @description: 查询MesWorkTeam分页列表
*/ */
export async function getRokeWorkTeamPage(params: RokeWorkTeamPageParams, mode: ErrorMessageMode = 'modal') { export async function getMesWorkTeamPage(params: MesWorkTeamPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<RokeWorkTeamPageResult>( return defHttp.get<MesWorkTeamPageResult>(
{ {
url: Api.Page, url: Api.Page,
params, params,
...@@ -29,10 +29,10 @@ export async function getRokeWorkTeamPage(params: RokeWorkTeamPageParams, mode: ...@@ -29,10 +29,10 @@ export async function getRokeWorkTeamPage(params: RokeWorkTeamPageParams, mode:
} }
/** /**
* @description: 获取RokeWorkTeam信息 * @description: 获取MesWorkTeam信息
*/ */
export async function getRokeWorkTeam(id: String, mode: ErrorMessageMode = 'modal') { export async function getMesWorkTeam(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<RokeWorkTeamPageModel>( return defHttp.get<MesWorkTeamPageModel>(
{ {
url: Api.Info, url: Api.Info,
params: { id }, params: { id },
...@@ -44,13 +44,13 @@ export async function getRokeWorkTeam(id: String, mode: ErrorMessageMode = 'moda ...@@ -44,13 +44,13 @@ export async function getRokeWorkTeam(id: String, mode: ErrorMessageMode = 'moda
} }
/** /**
* @description: 新增RokeWorkTeam * @description: 新增MesWorkTeam
*/ */
export async function addRokeWorkTeam(rokeWorkTeam: Recordable, mode: ErrorMessageMode = 'modal') { export async function addMesWorkTeam(mesWorkTeam: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>( return defHttp.post<boolean>(
{ {
url: Api.RokeWorkTeam, url: Api.MesWorkTeam,
params: rokeWorkTeam, params: mesWorkTeam,
}, },
{ {
errorMessageMode: mode, errorMessageMode: mode,
...@@ -59,13 +59,13 @@ export async function addRokeWorkTeam(rokeWorkTeam: Recordable, mode: ErrorMessa ...@@ -59,13 +59,13 @@ export async function addRokeWorkTeam(rokeWorkTeam: Recordable, mode: ErrorMessa
} }
/** /**
* @description: 更新RokeWorkTeam * @description: 更新MesWorkTeam
*/ */
export async function updateRokeWorkTeam(rokeWorkTeam: Recordable, mode: ErrorMessageMode = 'modal') { export async function updateMesWorkTeam(mesWorkTeam: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>( return defHttp.put<boolean>(
{ {
url: Api.RokeWorkTeam, url: Api.MesWorkTeam,
params: rokeWorkTeam, params: mesWorkTeam,
}, },
{ {
errorMessageMode: mode, errorMessageMode: mode,
...@@ -74,12 +74,12 @@ export async function updateRokeWorkTeam(rokeWorkTeam: Recordable, mode: ErrorMe ...@@ -74,12 +74,12 @@ export async function updateRokeWorkTeam(rokeWorkTeam: Recordable, mode: ErrorMe
} }
/** /**
* @description: 删除RokeWorkTeam(批量删除) * @description: 删除MesWorkTeam(批量删除)
*/ */
export async function deleteRokeWorkTeam(ids: string[], mode: ErrorMessageMode = 'modal') { export async function deleteMesWorkTeam(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>( return defHttp.delete<boolean>(
{ {
url: Api.RokeWorkTeam, url: Api.MesWorkTeam,
data: ids, data: ids,
}, },
{ {
......
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/** /**
* @description: RokeWorkTeam分页参数 模型 * @description: MesWorkTeam分页参数 模型
*/ */
export interface RokeWorkTeamPageParams extends BasicPageParams { export interface MesWorkTeamPageParams extends BasicPageParams {
code: string; code: string;
name: string; name: string;
...@@ -16,9 +16,9 @@ export interface RokeWorkTeamPageParams extends BasicPageParams { ...@@ -16,9 +16,9 @@ export interface RokeWorkTeamPageParams extends BasicPageParams {
} }
/** /**
* @description: RokeWorkTeam分页返回值模型 * @description: MesWorkTeam分页返回值模型
*/ */
export interface RokeWorkTeamPageModel { export interface MesWorkTeamPageModel {
id: string; id: string;
code: string; code: string;
...@@ -35,6 +35,6 @@ export interface RokeWorkTeamPageModel { ...@@ -35,6 +35,6 @@ export interface RokeWorkTeamPageModel {
0; 0;
/** /**
* @description: RokeWorkTeam分页返回值结构 * @description: MesWorkTeam分页返回值结构
*/ */
export type RokeWorkTeamPageResult = BasicFetchResult<RokeWorkTeamPageModel>; export type MesWorkTeamPageResult = BasicFetchResult<MesWorkTeamPageModel>;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import { reactive, ref, onMounted, nextTick, watch } from 'vue'; import { reactive, ref, onMounted, nextTick, watch } from 'vue';
import { formProps, formEventConfigs } from './config'; import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue'; import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addRokeWorkTeam, getRokeWorkTeam, updateRokeWorkTeam } from '/@/api/jcsj/bzxx'; import { addMesWorkTeam, getMesWorkTeam, updateMesWorkTeam } from '/@/api/jcsj/teammanagement';
import { cloneDeep, isString } from 'lodash-es'; import { cloneDeep, isString } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types'; import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission'; import { usePermission } from '/@/hooks/web/usePermission';
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】 // 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) { async function setFormDataFromId(rowId) {
try { try {
const record = await getRokeWorkTeam(rowId); const record = await getMesWorkTeam(rowId);
setFieldsValue(record); setFieldsValue(record);
state.formModel = record; state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel, await getFormDataEvent(formEventConfigs, state.formModel,
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
try { try {
values[RowKey] = rowId; values[RowKey] = rowId;
state.formModel = values; state.formModel = values;
let saveVal = await updateRokeWorkTeam(values); let saveVal = await updateMesWorkTeam(values);
await submitFormEvent(formEventConfigs, state.formModel, await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
async function add(values) { async function add(values) {
try { try {
state.formModel = values; state.formModel = values;
let saveVal = await addRokeWorkTeam(values); let saveVal = await addMesWorkTeam(values);
await submitFormEvent(formEventConfigs, state.formModel, await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value, systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单 formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
......
...@@ -3,18 +3,17 @@ export const permissionList = [ ...@@ -3,18 +3,17 @@ export const permissionList = [
required: false, required: false,
view: true, view: true,
edit: false, edit: false,
disabled: false, disabled: true,
isSaveTable: false, isSaveTable: false,
tableName: '', tableName: '',
fieldName: '编号', fieldName: '编号',
fieldId: 'code', fieldId: 'code',
isSubTable: false, isSubTable: false,
showChildren: true, showChildren: true,
type: 'input', type: 'auto-code',
key: '74656a9a548a4ebf8eea9833e58c9751', key: '89f7e227ec084427bd58504cf7184d06',
children: [], children: [],
options: {}, options: {},
defaultValue: '',
}, },
{ {
required: true, required: true,
...@@ -106,11 +105,11 @@ export const permissionList = [ ...@@ -106,11 +105,11 @@ export const permissionList = [
disabled: false, disabled: false,
isSubTable: true, isSubTable: true,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '', fieldName: '',
fieldId: 'rokeWorkTeamEmployeeRelList', fieldId: 'mesWorkTeamUserRelList',
type: 'form', type: 'form',
key: '203371e1507844af97e5b82500bfc0c8', key: '38d17aefe9d04436afcb089f13a0a5a3',
children: [ children: [
{ {
required: true, required: true,
...@@ -120,11 +119,11 @@ export const permissionList = [ ...@@ -120,11 +119,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '班组id', fieldName: 'id',
fieldId: 'workTeamId', fieldId: 'userId',
type: 'Input', type: 'Input',
key: '41c418f3422e411fba4025e1ba607791', key: '6cbbc9e327df4cccb22c7bdb74bbc001',
children: [], children: [],
}, },
{ {
...@@ -135,11 +134,11 @@ export const permissionList = [ ...@@ -135,11 +134,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '班组成员', fieldName: '班组成员',
fieldId: 'danXingWenBen1923', fieldId: 'name',
type: 'Input', type: 'Input',
key: '1beafaffe43343a0b16f99b251346fea', key: '5cca541858134efc997cfdf98bfe5f32',
children: [], children: [],
}, },
{ {
...@@ -150,11 +149,11 @@ export const permissionList = [ ...@@ -150,11 +149,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '编号', fieldName: '编号',
fieldId: 'danXingWenBen7962', fieldId: 'code',
type: 'Input', type: 'Input',
key: '6788a481e9e7433b9c36e8dad4eeccdd', key: '55598eb1e4324950ae9fcfb6302f6538',
children: [], children: [],
}, },
{ {
...@@ -165,11 +164,11 @@ export const permissionList = [ ...@@ -165,11 +164,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '工号', fieldName: '工号',
fieldId: 'gongHao4014', fieldId: 'jobNumber',
type: 'Input', type: 'Input',
key: '7b9f6f042ea340d09409b007adf681db', key: 'abfc9b9517684121bfbbe019011b6b87',
children: [], children: [],
}, },
{ {
...@@ -180,11 +179,11 @@ export const permissionList = [ ...@@ -180,11 +179,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '电话', fieldName: '电话',
fieldId: 'dianHua7940', fieldId: 'mobile',
type: 'Input', type: 'Input',
key: '9170dea64ef8410597607c96057b7eeb', key: 'b595d86fee7944b38a37be605b7b117a',
children: [], children: [],
}, },
{ {
...@@ -195,11 +194,11 @@ export const permissionList = [ ...@@ -195,11 +194,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '职位', fieldName: '职位',
fieldId: 'zhiWei8331', fieldId: 'positionId',
type: 'Input', type: 'Input',
key: '526f26d97e2e4b1f9800348c295d0d7d', key: '21de2c57b40e4a539b51bed6bb4ae019',
children: [], children: [],
}, },
{ {
...@@ -210,26 +209,11 @@ export const permissionList = [ ...@@ -210,26 +209,11 @@ export const permissionList = [
isSubTable: false, isSubTable: false,
isSaveTable: false, isSaveTable: false,
showChildren: false, showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList', tableName: 'mesWorkTeamUserRelList',
fieldName: '部门', fieldName: '部门',
fieldId: 'danXingWenBen7768', fieldId: 'departmentId',
type: 'Input',
key: 'f95aab6e4e4a46b2ba2e6b679f3521d8',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'rokeWorkTeamEmployeeRelList',
fieldName: '技能等级',
fieldId: 'jiNenDengJi2532',
type: 'Input', type: 'Input',
key: '03da44c148cb46c988a63c5d1f9f173e', key: 'a665bb78d37c409fb4d1a7cb888f1872',
children: [], children: [],
}, },
], ],
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<BzxxModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/> <TeamManagementModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getRokeWorkTeamPage, deleteRokeWorkTeam} from '/@/api/jcsj/bzxx'; import { getMesWorkTeamPage, deleteMesWorkTeam} from '/@/api/jcsj/teammanagement';
import { ResizePageWrapper } from '/@/components/Page'; import { ResizePageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue'; import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置 import { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { defHttp } from '/@/utils/http/axios';
...@@ -84,7 +83,7 @@ ...@@ -84,7 +83,7 @@
import BzxxModal from './components/BzxxModal.vue'; import TeamManagementModal from './components/TeamManagementModal.vue';
...@@ -167,8 +166,8 @@ ...@@ -167,8 +166,8 @@
const [registerTable, { reload, }] = useTable({ const [registerTable, { reload, }] = useTable({
title: 'Bzxx列表', title: 'TeamManagement列表',
api: getRokeWorkTeamPage, api: getMesWorkTeamPage,
rowKey: 'id', rowKey: 'id',
columns: filterColumns, columns: filterColumns,
pagination: { pagination: {
...@@ -185,55 +184,12 @@ ...@@ -185,55 +184,12 @@
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' } pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' }
return pageParamsInfo.value; return pageParamsInfo.value;
}, },
afterFetch: async (res) => { afterFetch: (res) => {
if (res && res.items && res.items.length > 0) {
const managerIds = [...new Set(res.items.map(item => item.managerId).filter(Boolean))];
const parentIds = [...new Set(res.items.map(item => item.parentId).filter(Boolean))];
const managerMap = new Map();
const parentMap = new Map();
if (managerIds.length > 0) {
try {
const managerRes = await defHttp.get({
url: '/bmxx/getEmployeeList',
params: { ids: managerIds.join(',') },
});
if (managerRes && managerRes.length > 0) {
managerRes.forEach(item => {
managerMap.set(item.id, item.name);
});
}
} catch (error) {
console.error('获取班组长信息失败:', error);
}
}
if (parentIds.length > 0) {
try {
const parentRes = await defHttp.get({
url: '/bmxx/getworkteamList',
params: { ids: parentIds.join(',') },
});
if (parentRes && parentRes.length > 0) {
parentRes.forEach(item => {
parentMap.set(item.id, item.name);
});
}
} catch (error) {
console.error('获取上级班组信息失败:', error);
}
}
res.items.forEach(item => {
if (item.managerId) {
item.managerName = managerMap.get(item.managerId) || item.managerId;
}
if (item.parentId) {
item.parentName = parentMap.get(item.parentId) || item.parentId;
}
});
}
}, },
useSearchForm: true, useSearchForm: true,
showTableSetting: true, showTableSetting: true,
...@@ -313,7 +269,7 @@ ...@@ -313,7 +269,7 @@
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onOk() { onOk() {
deleteRokeWorkTeam(ids).then((_) => { deleteMesWorkTeam(ids).then((_) => {
handleSuccess(); handleSuccess();
notification.success({ notification.success({
message: 'Tip', message: 'Tip',
...@@ -334,7 +290,7 @@ ...@@ -334,7 +290,7 @@
return { return {
ondblclick: () => { ondblclick: () => {
if (record.isCanEdit && hasPermission("bzxx:edit")) { if (record.isCanEdit && hasPermission("teammanagement:edit")) {
handleEdit(record); handleEdit(record);
} }
}, },
...@@ -388,7 +344,7 @@ ...@@ -388,7 +344,7 @@
actionsList.push({ actionsList.push({
...button, ...button,
auth: `bzxx:${button.code}`, auth: `teammanagement:${button.code}`,
label: button?.name, label: button?.name,
color: button.code === 'delete' ? 'error' : undefined, color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code]?.bind(null, record), onClick: btnEvent[button.code]?.bind(null, record),
...@@ -397,7 +353,7 @@ ...@@ -397,7 +353,7 @@
if (!['edit', 'delete'].includes(button.code)) { if (!['edit', 'delete'].includes(button.code)) {
actionsList.push({ actionsList.push({
auth: `bzxx:${button.code}`, auth: `teammanagement:${button.code}`,
label: button?.name, label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record), onClick: btnEvent[button.code]?.bind(null, record),
}); });
...@@ -426,4 +382,4 @@ ...@@ -426,4 +382,4 @@
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment