| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { ApiInstance } from '../type'
- // 字典实体(与后端 SysDictVo 对应)
- export interface SysDictVo {
- id?: string
- typeId?: string
- typeCode?: string
- parentValue?: string
- value?: string
- label?: string
- description?: string
- sort?: string
- remarks?: string
- child?: SysDictVo[]
- // 前端扩展字段
- isEditing?: boolean
- tempLabel?: string
- }
- // 添加字典参数
- export interface AddDictParams {
- typeId?: string // 类型ID
- typeCode?: string // 类型编码
- parentValue?: string // 父级value
- value: string // 字典值(编码)
- label: string // 字典标签(名称)
- description?: string // 描述
- sort?: string // 排序
- remarks?: string // 备注
- }
- // 更新字典参数(所有字段可选,但必须传id)
- export interface UpdateDictParams {
- id: string
- typeId?: string
- typeCode?: string
- parentValue?: string
- value?: string
- label?: string
- description?: string
- sort?: string
- remarks?: string
- }
- const dictApi = (axiosInstance: ApiInstance) => ({
- // 树级查询列表
- queryTree: () => axiosInstance.post('/dict/queryTree'),
- // 添加字典
- addDict: (data: AddDictParams) => axiosInstance.post('/dict/addDict', data),
- // 修改字典
- updateDict: (data: UpdateDictParams) => axiosInstance.post('/dict/updateDict', data),
- // 删除字典
- deleteDict: (id: string) => axiosInstance.post('/dict/deleteDict', { id })
- })
- export default dictApi
|