3 changed files with 67 additions and 5 deletions
@ -0,0 +1,34 @@ |
|||||
|
import request from '@/utils/request'; |
||||
|
import type { ApiResult } from '@/api'; |
||||
|
import type { UserRole, UserRoleParam } from './model'; |
||||
|
import { SERVER_API_URL } from '@/config/setting'; |
||||
|
|
||||
|
/** |
||||
|
* 查询用户列表 |
||||
|
*/ |
||||
|
export async function listUserRole(params?: UserRoleParam) { |
||||
|
const res = await request.get<ApiResult<UserRole[]>>( |
||||
|
SERVER_API_URL + '/system/user-role-role', |
||||
|
{ |
||||
|
params |
||||
|
} |
||||
|
); |
||||
|
if (res.data.code === 0 && res.data.data) { |
||||
|
return res.data.data; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改用户 |
||||
|
*/ |
||||
|
export async function updateUser(data: UserRole) { |
||||
|
const res = await request.put<ApiResult<unknown>>( |
||||
|
SERVER_API_URL + '/system/user-role', |
||||
|
data |
||||
|
); |
||||
|
if (res.data.code === 0) { |
||||
|
return res.data.message; |
||||
|
} |
||||
|
return Promise.reject(new Error(res.data.message)); |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
import type { PageParam } from '@/api'; |
||||
|
|
||||
|
/** |
||||
|
* 用户 |
||||
|
*/ |
||||
|
export interface UserRole { |
||||
|
id?: number; |
||||
|
// 用户id
|
||||
|
userId?: number; |
||||
|
// 角色ID
|
||||
|
roleId?: number; |
||||
|
// 创建时间
|
||||
|
createTime?: string; |
||||
|
// 修改时间
|
||||
|
updateTime?: string; |
||||
|
// 角色名称
|
||||
|
roleName?: string; |
||||
|
// 租户ID
|
||||
|
tenantId?: number; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 用户搜索条件 |
||||
|
*/ |
||||
|
export interface UserRoleParam extends PageParam { |
||||
|
keywords?: any; |
||||
|
userId?: number; |
||||
|
} |
Loading…
Reference in new issue