/** * 字典API服务 * 用于获取动态字典数据 */ import request from '~/service/request' // 字典项接口 export interface DictItem { label: string value: string | number disabled?: boolean color?: string order?: number [key: string]: any } // 字典响应数据接口 export interface DictData { type: string items: DictItem[] } /** * 获取字典列表 * @param types 字典类型列表,如果为空则获取所有字典 * @returns 字典数据列表 */ export function getDictionaryList(types?: string[]): Promise { const params: any = {} if (types && types.length > 0) { params.types = types.join(',') } return request.get('/dict/list', { params, showLoading: false }) } /** * 获取单个字典类型的数据 * @param type 字典类型 * @returns 字典项列表 */ export function getDictionaryByType(type: string): Promise { return request.get(`/dict/type/${type}`, { showLoading: false }) } // 如果需要其他字典相关API,可以在这里添加