wip(account): 开发账户管理相关

This commit is contained in:
ah--desktop
2025-10-18 00:14:40 +08:00
parent 9782570163
commit 33db3a720c
24 changed files with 1935 additions and 1042 deletions
@@ -7,57 +7,37 @@ import type { AccountDTO, AccountVO } from './types';
* 账户管理API
*/
// ==================== 超管接口 ====================
/**
* 创建账户(超管)
*/
export async function createAccountApi(data: AccountDTO.CreateAccountDTO) {
return requestClient.post<AccountVO.AccountInfoVO>('/account/create', data);
}
/**
* 分页查询账户(超管)
*/
export async function getAccountPageApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/account/page', params);
}
// ==================== 管理员接口 ====================
/**
* 创建账户(管理员)
*/
export async function createAccountForCompanyApi(data: AccountDTO.CreateAccountDTO) {
return requestClient.post<AccountVO.AccountInfoVO>('/account/company/create', data);
export async function admin_createAccountApi(data: AccountDTO.CreateAccountDTO) {
return requestClient.post<AccountVO.AccountInfoVO>('/company/account/create', data);
}
/**
* 分页查询账户(管理员)
*/
export async function getAccountPageForCompanyApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/account/company/page', params);
export async function admin_getAccountPageApi(params: PageQueryDTO<AccountDTO.AccountFilterDTO>) {
return requestClient.post<PageResultVO<AccountVO.AccountInfoVO>>('/company/account/page', params);
}
// ==================== 通用接口 ====================
/**
* 更新账户信息
*/
export async function updateAccountApi(accountId: number, data: AccountDTO.UpdateAccountDTO) {
return requestClient.put<AccountVO.AccountInfoVO>(`/account/${accountId}`, data);
export async function admin_updateAccountApi(data: AccountDTO.UpdateAccountDTO) {
return requestClient.put<AccountVO.AccountInfoVO>(`/company/account/update/${data.id}`, data);
}
/**
* 删除账户
*/
export async function deleteAccountApi(accountId: number) {
return requestClient.delete<void>(`/account/${accountId}`);
export async function admin_deleteAccountApi(accountId: number) {
return requestClient.delete<void>(`/company/account/delete/${accountId}`);
}
/**
* 获取账户详情
*/
export async function getAccountDetailApi(accountId: number) {
return requestClient.get<AccountVO.AccountInfoVO>(`/account/${accountId}`);
export async function admin_getAccountDetailApi(accountId: number) {
return requestClient.get<AccountVO.AccountInfoVO>(`/company/account/detail/${accountId}`);
}
@@ -29,6 +29,8 @@ export namespace AccountDTO {
/** 更新账户参数 */
export interface UpdateAccountDTO {
/** 账户ID */
id: number;
/** 真实姓名 */
realName?: string;
/** 邮箱 */
@@ -50,24 +52,24 @@ export namespace AccountDTO {
/** 账户过滤条件 */
export interface AccountFilterDTO {
/** 登录账号(模糊查询) */
loginCode?: string;
loginCode?: undefined | string;
/** 用户姓名(模糊查询) */
realName?: string;
realName?: undefined | string;
/** 手机号码(精确查询) */
phone?: string;
phone?: undefined | string;
/** 公司ID */
companyId?: number;
companyId?: undefined | number;
/** 部门ID */
departmentId?: number;
departmentId?: undefined | number;
/** 岗位ID */
positionId?: number;
positionId?: undefined | number;
/** 角色 */
role?: string;
role?: undefined | string;
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
status?: number;
status?: undefined | number;
/** 页码 */
pageNum?: number;
pageNum?: undefined | number;
/** 每页大小 */
pageSize?: number;
pageSize?: undefined | number;
}
}
@@ -0,0 +1,43 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { SuperAccountDTO, SuperAccountVO } from './types';
/**
* 超管账户管理API
*/
/**
* 创建账户(超管)
*/
export async function super_createAccountApi(data: SuperAccountDTO.SuperCreateAccountDTO) {
return requestClient.post<SuperAccountVO.AccountInfoVO>('/super/account/create', data);
}
/**
* 分页查询账户(超管)
*/
export async function super_getAccountPageApi(params: PageQueryDTO<SuperAccountDTO.AccountFilterDTO>) {
return requestClient.post<PageResultVO<SuperAccountVO.AccountInfoVO>>('/super/account/page', params);
}
/**
* 更新账户信息(超管)
*/
export async function super_updateAccountApi(accountId: number, data: SuperAccountDTO.SuperUpdateAccountDTO) {
return requestClient.put<SuperAccountVO.AccountInfoVO>(`/super/account/update/${accountId}`, data);
}
/**
* 删除账户(超管)
*/
export async function super_deleteAccountApi(accountId: number) {
return requestClient.delete<void>(`/super/account/delete/${accountId}`);
}
/**
* 获取账户详情(超管)
*/
export async function super_getAccountDetailApi(accountId: number) {
return requestClient.get<SuperAccountVO.AccountInfoVO>(`/super/account/detail/${accountId}`);
}
@@ -0,0 +1,6 @@
/**
* 超管账户管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 超管账户管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,77 @@
/**
* 超管账户管理模块DTO类型定义
*/
export namespace SuperAccountDTO {
/** 超管创建账户参数 */
export interface SuperCreateAccountDTO {
/** 登录账号 */
loginCode: string;
/** 密码 */
password: string;
/** 用户姓名 */
realName: string;
/** 手机号码 */
phone?: string;
/** 公司ID */
companyId: number;
/** 部门ID */
departmentId?: number;
/** 岗位ID */
positionId?: number;
/** 角色 */
role: string;
/** 头像图片ID */
avatarImageId?: number;
/** 备注 */
remark?: string;
}
/** 超管更新账户参数 */
export interface SuperUpdateAccountDTO {
/** 登录账号 */
loginCode?: string;
/** 用户姓名 */
realName?: string;
/** 手机号码 */
phone?: string;
/** 公司ID */
companyId?: number;
/** 部门ID */
departmentId?: number;
/** 岗位ID */
positionId?: number;
/** 角色 */
role?: string;
/** 头像图片ID */
avatarImageId?: number;
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
status?: number;
/** 备注 */
remark?: string;
}
/** 账户过滤条件 */
export interface AccountFilterDTO {
/** 登录账号(模糊查询) */
loginCode?: string;
/** 用户姓名(模糊查询) */
realName?: string;
/** 手机号码(精确查询) */
phone?: string;
/** 公司ID */
companyId?: number;
/** 部门ID */
departmentId?: number;
/** 岗位ID */
positionId?: number;
/** 角色 */
role?: string;
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
status?: number;
/** 页码 */
pageNum?: number;
/** 每页大小 */
pageSize?: number;
}
}
@@ -0,0 +1,41 @@
/**
* 超管账户管理模块VO类型定义
*/
export namespace SuperAccountVO {
/** 账户信息 */
export interface AccountInfoVO {
/** 账户ID */
id: number;
/** 登录账号 */
loginCode: string;
/** 用户姓名 */
realName: string;
/** 手机号码 */
phone?: string;
/** 公司ID */
companyId?: number;
/** 公司名称 */
companyName?: string;
/** 部门ID */
departmentId?: number;
/** 部门名称 */
departmentName?: string;
/** 岗位ID */
positionId?: number;
/** 岗位名称 */
positionName?: string;
/** 角色 */
role?: string;
/** 头像 */
avatar?: string;
/** 状态(0-正常 1-删除 2-停用 3-冻结) */
status: number;
/** 备注 */
remark?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
}
}