refactor(api): 优化菜单API类型定义和接口
- 将MenuVo和MenuForm的ID字段类型从number改为string,避免大整数精度丢失 - 完善菜单相关类型定义,添加enName、name等字段 - 统一菜单API接口的参数类型 - 更新级联选择器和路由相关类型定义
This commit is contained in:
parent
2678b5e358
commit
da0a69c3b6
@ -40,7 +40,7 @@ export function getMenuList(params?: MenuQueryBo) {
|
||||
/**
|
||||
* 根据ID查询菜单详情
|
||||
*/
|
||||
export function getMenuById(id: number) {
|
||||
export function getMenuById(id: string) {
|
||||
return request.Get<Service.ResponseResult<MenuVo>>(`/coder/sysMenu/getById/${id}`)
|
||||
}
|
||||
|
||||
@ -61,28 +61,28 @@ export function updateMenu(data: MenuForm) {
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
export function deleteMenu(id: number) {
|
||||
export function deleteMenu(id: string) {
|
||||
return request.Post<Service.ResponseResult<null>>(`/coder/sysMenu/deleteById/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除菜单
|
||||
*/
|
||||
export function batchDeleteMenu(ids: number[]) {
|
||||
export function batchDeleteMenu(ids: string[]) {
|
||||
return request.Post<Service.ResponseResult<null>>('/coder/sysMenu/batchDelete', ids)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单状态
|
||||
*/
|
||||
export function updateMenuStatus(id: number, menuStatus: string) {
|
||||
export function updateMenuStatus(id: string, menuStatus: string) {
|
||||
return request.Post<Service.ResponseResult<null>>(`/coder/sysMenu/updateStatus/${id}/${menuStatus}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单展开状态
|
||||
*/
|
||||
export function updateMenuSpread(id: number, isSpread: string) {
|
||||
export function updateMenuSpread(id: string, isSpread: string) {
|
||||
return request.Post<Service.ResponseResult<null>>(`/coder/sysMenu/updateSpread/${id}/${isSpread}`)
|
||||
}
|
||||
|
||||
@ -112,14 +112,14 @@ export function getMenuPermissionData() {
|
||||
/**
|
||||
* 根据角色ID查询菜单权限ID列表
|
||||
*/
|
||||
export function getMenuIdsByRoleId(roleId: number) {
|
||||
return request.Get<Service.ResponseResult<number[]>>(`/coder/sysMenu/listMenuIdsByRoleId/${roleId}`)
|
||||
export function getMenuIdsByRoleId(roleId: string) {
|
||||
return request.Get<Service.ResponseResult<string[]>>(`/coder/sysMenu/listMenuIdsByRoleId/${roleId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色和菜单权限之间的关系
|
||||
*/
|
||||
export function saveRoleMenuPermission(roleId: number, menuIds: number[]) {
|
||||
export function saveRoleMenuPermission(roleId: string, menuIds: string[]) {
|
||||
const menuIdsStr = menuIds.length > 0 ? menuIds.join(',') : '-1'
|
||||
return request.Post<Service.ResponseResult<string>>(`/coder/sysMenu/saveRoleMenu/${roleId}/${menuIdsStr}`)
|
||||
}
|
||||
|
||||
@ -13,52 +13,60 @@ export interface MenuQueryBo {
|
||||
|
||||
// 菜单响应数据
|
||||
export interface MenuVo {
|
||||
menuId: number
|
||||
menuId: string // 改为字符串避免大整数精度丢失
|
||||
menuName: string
|
||||
parentId: number
|
||||
enName?: string
|
||||
parentId: string // 改为字符串避免大整数精度丢失
|
||||
menuType: string
|
||||
path?: string
|
||||
name?: string
|
||||
component?: string
|
||||
auth?: string
|
||||
icon?: string
|
||||
sorted: number
|
||||
auth?: string
|
||||
menuStatus: string
|
||||
activeMenu?: string
|
||||
isHide: string
|
||||
isLink?: string
|
||||
isKeepAlive: string
|
||||
isFull?: string
|
||||
isAffix: string
|
||||
isSpread: string
|
||||
isLink?: string
|
||||
menuStatus: string
|
||||
remark?: string
|
||||
createTime?: string
|
||||
updateTime?: string
|
||||
sorted: number
|
||||
createBy?: string
|
||||
createTime?: string
|
||||
updateBy?: string
|
||||
updateTime?: string
|
||||
remark?: string
|
||||
children?: MenuVo[]
|
||||
}
|
||||
|
||||
// 菜单表单数据
|
||||
export interface MenuForm {
|
||||
menuId?: number
|
||||
menuId?: string // 改为字符串避免大整数精度丢失
|
||||
menuName: string
|
||||
parentId: number
|
||||
enName?: string
|
||||
parentId: string // 改为字符串避免大整数精度丢失
|
||||
menuType: string
|
||||
path?: string
|
||||
name?: string
|
||||
component?: string
|
||||
auth?: string
|
||||
icon?: string
|
||||
sorted: number
|
||||
auth?: string
|
||||
menuStatus: string
|
||||
activeMenu?: string
|
||||
isHide: string
|
||||
isLink?: string
|
||||
isKeepAlive: string
|
||||
isFull?: string
|
||||
isAffix: string
|
||||
isSpread: string
|
||||
isLink?: string
|
||||
menuStatus: string
|
||||
sorted: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 菜单路由数据
|
||||
export interface MenuRouterBo {
|
||||
menuId: number
|
||||
menuId: string // 改为字符串避免大整数精度丢失
|
||||
menuName: string
|
||||
path: string
|
||||
component?: string
|
||||
@ -77,7 +85,7 @@ export interface MenuRouterBo {
|
||||
|
||||
// 级联选择器数据
|
||||
export interface MenuCascaderBo {
|
||||
value: number
|
||||
value: string // 改为字符串避免大整数精度丢失
|
||||
label: string
|
||||
children?: MenuCascaderBo[]
|
||||
}
|
||||
@ -85,5 +93,5 @@ export interface MenuCascaderBo {
|
||||
// 菜单正常数据返回结构
|
||||
export interface MenuNormalResponse {
|
||||
menuList: MenuVo[]
|
||||
spreadList: number[]
|
||||
spreadList: string[] // 改为字符串数组避免大整数精度丢失
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user