import request, { downloadExcelRequest } from '../../../utils/request'; import { Result, ResultList, _Pager_Params } from '../../../services'; export interface DictTypeFields { searchValue: string; createBy: string; createTime: string; updateBy: string; updateTime: string; remark: string; params: Record; beginTime: string; endTime: string; dictId: number; dictName: string; dictType: string; status: string; } // 字典数据 export interface DictDataFields { searchValue: string; createBy: string; createTime: string; updateBy: string; updateTime: string; remark: string; params: Record; beginTime: string; endTime: string; dictCode: number; dictSort: number; dictLabel: string; dictValue: string; dictType: string; cssClass: string; listClass: string; isDefault: string; status: string; default: boolean; } interface GetListProps extends _Pager_Params, DictDataFields { dictType: string; } export const getListApi = async (params?: Partial) => { return request>({ url: '/dict/data/list', method: 'get', params, }); }; export const delApi = async (deleteKeys: DictDataFields['dictCode'][]) => { const deleteKeysString = deleteKeys.join(','); return await request({ url: `/dict/data/delete/${deleteKeysString || ''}`, method: 'get', }); }; export const updateApi = async (data: Partial) => { return await request({ url: '/dict/data/edit', method: 'post', data, }); }; export const addApi = async ( data: Partial>, ) => { return await request({ url: '/dict/data', method: 'post', data, }); }; export const getDictTypeListApi = async () => { const { data } = await request>({ url: '/dict/type/optionselect', method: 'get', }); return (data || []).map((item) => { const { dictType: value, dictName: label } = item || {}; return { value, label }; }); }; // 导出 export const exportApi = async (data: Partial) => { return await downloadExcelRequest( { url: '/dict/data/export', method: 'post', data, }, '字典数据列表', ); };