mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-24 18:58:42 +08:00
feat: 新增字典管理
This commit is contained in:
54
src/apis/system/dict.ts
Normal file
54
src/apis/system/dict.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import http from '@/utils/http'
|
||||
import type * as System from './type'
|
||||
|
||||
const BASE_URL = '/system/dict'
|
||||
|
||||
/** @desc 查询字典列表 */
|
||||
export function listDict(query: System.DictQuery) {
|
||||
return http.get<PageRes<System.DictResp[]>>(`${BASE_URL}`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询字典详情 */
|
||||
export function getDict(id: string) {
|
||||
return http.get<System.DictResp>(`${BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 新增字典 */
|
||||
export function addDict(data: any) {
|
||||
return http.post(`${BASE_URL}`, data)
|
||||
}
|
||||
|
||||
/** @desc 修改字典 */
|
||||
export function updateDict(data: any, id: string) {
|
||||
return http.put(`${BASE_URL}/${id}`, data)
|
||||
}
|
||||
|
||||
/** @desc 删除字典 */
|
||||
export function deleteDict(id: string) {
|
||||
return http.del(`${BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 查询字典项列表 */
|
||||
export function listDictItem(query: System.DictItemQuery) {
|
||||
return http.get<PageRes<System.DictItemResp[]>>(`${BASE_URL}/item`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询字典项详情 */
|
||||
export function getDictItem(id: string) {
|
||||
return http.get<System.DictItemResp>(`${BASE_URL}/item/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 新增字典项 */
|
||||
export function addDictItem(data: any) {
|
||||
return http.post(`${BASE_URL}/item`, data)
|
||||
}
|
||||
|
||||
/** @desc 修改字典项 */
|
||||
export function updateDictItem(data: any, id: string) {
|
||||
return http.put(`${BASE_URL}/item/${id}`, data)
|
||||
}
|
||||
|
||||
/** @desc 删除字典项 */
|
||||
export function deleteDictItem(id: string) {
|
||||
return http.del(`${BASE_URL}/item/${id}`)
|
||||
}
|
@@ -1,3 +1,4 @@
|
||||
export * from './dept'
|
||||
export * from './log'
|
||||
export * from './dict'
|
||||
export * from './storage'
|
||||
|
@@ -56,6 +56,41 @@ export interface LogQuery{
|
||||
status?: number
|
||||
}
|
||||
|
||||
/** 系统字典类型 */
|
||||
export interface DictResp {
|
||||
id: string
|
||||
name: string
|
||||
code: string
|
||||
isSystem: boolean
|
||||
description: string
|
||||
createUserString: string
|
||||
createTime: string
|
||||
updateUserString: string
|
||||
updateTime: string
|
||||
}
|
||||
export interface DictQuery extends PageQuery {
|
||||
description?: string
|
||||
}
|
||||
export type DictItemResp = {
|
||||
id: string
|
||||
label: string
|
||||
value: string
|
||||
color: string
|
||||
sort: number
|
||||
description: string
|
||||
status: 1 | 2
|
||||
dictId: number
|
||||
createUserString: string
|
||||
createTime: string
|
||||
updateUserString: string
|
||||
updateTime: string
|
||||
}
|
||||
export interface DictItemQuery extends PageQuery {
|
||||
description?: string
|
||||
status?: number
|
||||
dictId: string
|
||||
}
|
||||
|
||||
/** 系统存储类型 */
|
||||
export type StorageResp = {
|
||||
id: string
|
||||
|
Reference in New Issue
Block a user