Import the supplied management frontend, including request encryption, withdrawal updates, and vendored dependencies. Use incoming versions for overlapping source files and retain existing environment configuration absent from the supplied directory.
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import request from '@/config/axios'
|
|
|
|
export interface SubAccountVO {
|
|
id: number
|
|
userId: number
|
|
username: string
|
|
nickname: string
|
|
status: number
|
|
loginDate: Date
|
|
createTime: Date
|
|
menuIds: number[]
|
|
}
|
|
|
|
export interface SubAccountMenuVO {
|
|
id: number
|
|
parentId: number
|
|
name: string
|
|
type: number
|
|
sort: number
|
|
}
|
|
|
|
// 查询子账号列表
|
|
export const getSubAccountList = () => {
|
|
return request.get({ url: '/system/sub-account/list' })
|
|
}
|
|
|
|
// 查询当前账号拥有的菜单(用于给子账号勾选)
|
|
export const getHolderMenuList = () => {
|
|
return request.get({ url: '/system/sub-account/menu-list' })
|
|
}
|
|
|
|
// 创建子账号
|
|
export const createSubAccount = (data: SubAccountVO & { password: string }) => {
|
|
return request.post({ url: '/system/sub-account/create', data })
|
|
}
|
|
|
|
// 修改子账号(昵称 + 可见菜单)
|
|
export const updateSubAccount = (userId: number, data: SubAccountVO) => {
|
|
return request.put({ url: '/system/sub-account/update?userId=' + userId, data })
|
|
}
|
|
|
|
// 修改子账号状态
|
|
export const updateSubAccountStatus = (userId: number, status: number) => {
|
|
return request.put({ url: '/system/sub-account/update-status', data: { userId, status } })
|
|
}
|
|
|
|
// 重置子账号密码
|
|
export const resetSubAccountPassword = (userId: number, password: string) => {
|
|
return request.put({ url: '/system/sub-account/reset-password', data: { userId, password } })
|
|
}
|
|
|
|
// 删除子账号
|
|
export const deleteSubAccount = (userId: number) => {
|
|
return request.delete({ url: '/system/sub-account/delete?userId=' + userId })
|
|
}
|