feat(@vben/web-antd): 用户-项目绑定管理双入口
- 用户管理页:下拉操作新增 "分配项目" 按钮 + assign-project-form.vue 弹窗 沿用现有 assign-role-form 的交互(多选 + 覆盖写入) - 项目管理页:行操作新增 "管理成员" 按钮 + assign-user-form.vue 弹窗 下拉支持搜索用户 nickname/username - 新建 api/system/user-project/ 封装 4 个接口 - api/system/project 新增 getAllProjectSimpleList: 顶栏 simple-list 已改为用户授权过滤,管理员分配场景需要全量下拉 - 空集保存二次确认:清空所有分配/成员时弹 AntModal.confirm,防误操作 - 权限点:system:user:assign-project / system:project:assign-user 设计文档:docs/design/2026-04-23-user-project-binding.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
46
apps/web-antd/src/api/system/user-project/index.ts
Normal file
46
apps/web-antd/src/api/system/user-project/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemUserProjectApi {
|
||||
export interface AssignUserProjectsReq {
|
||||
userId: number;
|
||||
projectIds: number[];
|
||||
}
|
||||
export interface AssignProjectUsersReq {
|
||||
projectId: number;
|
||||
userIds: number[];
|
||||
}
|
||||
}
|
||||
|
||||
/** 给用户覆盖式分配项目 */
|
||||
export function assignUserProjects(
|
||||
data: SystemUserProjectApi.AssignUserProjectsReq,
|
||||
) {
|
||||
return requestClient.post<boolean>(
|
||||
'/system/user-project/assign-user-projects',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 给项目覆盖式分配成员 */
|
||||
export function assignProjectUsers(
|
||||
data: SystemUserProjectApi.AssignProjectUsersReq,
|
||||
) {
|
||||
return requestClient.post<boolean>(
|
||||
'/system/user-project/assign-project-users',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询某用户已绑定的项目编号集合 */
|
||||
export function getProjectIdsByUserId(userId: number) {
|
||||
return requestClient.get<number[]>(
|
||||
`/system/user-project/list-project-ids-by-user?userId=${userId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询某项目下绑定的用户编号集合 */
|
||||
export function getUserIdsByProjectId(projectId: number) {
|
||||
return requestClient.get<number[]>(
|
||||
`/system/user-project/list-user-ids-by-project?projectId=${projectId}`,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user