Jiarenxiang | 38dcb05 | 2025-03-13 16:40:09 +0800 | [diff] [blame^] | 1 | import { request } from '@umijs/max'; |
| 2 | import { downLoadXlsx } from '@/utils/downloadfile'; |
| 3 | |
| 4 | // 查询参数配置列表 |
| 5 | export async function getConfigList(params?: API.System.ConfigListParams) { |
| 6 | return request<API.System.ConfigPageResult>('/api/system/config/list', { |
| 7 | method: 'GET', |
| 8 | headers: { |
| 9 | 'Content-Type': 'application/json;charset=UTF-8', |
| 10 | }, |
| 11 | params |
| 12 | }); |
| 13 | } |
| 14 | |
| 15 | // 查询参数配置详细 |
| 16 | export function getConfig(configId: number) { |
| 17 | return request<API.System.ConfigInfoResult>(`/api/system/config/${configId}`, { |
| 18 | method: 'GET' |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | // 新增参数配置 |
| 23 | export async function addConfig(params: API.System.Config) { |
| 24 | return request<API.Result>('/api/system/config', { |
| 25 | method: 'POST', |
| 26 | headers: { |
| 27 | 'Content-Type': 'application/json;charset=UTF-8', |
| 28 | }, |
| 29 | data: params |
| 30 | }); |
| 31 | } |
| 32 | |
| 33 | // 修改参数配置 |
| 34 | export async function updateConfig(params: API.System.Config) { |
| 35 | return request<API.Result>('/api/system/config', { |
| 36 | method: 'PUT', |
| 37 | headers: { |
| 38 | 'Content-Type': 'application/json;charset=UTF-8', |
| 39 | }, |
| 40 | data: params |
| 41 | }); |
| 42 | } |
| 43 | |
| 44 | // 删除参数配置 |
| 45 | export async function removeConfig(ids: string) { |
| 46 | return request<API.Result>(`/api/system/config/${ids}`, { |
| 47 | method: 'DELETE' |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | // 导出参数配置 |
| 52 | export function exportConfig(params?: API.System.ConfigListParams) { |
| 53 | return downLoadXlsx(`/api/system/config/export`, { params }, `config_${new Date().getTime()}.xlsx`); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | // 刷新参数缓存 |
| 58 | export function refreshConfigCache() { |
| 59 | return request<API.Result>('/api/system/config/refreshCache', { |
| 60 | method: 'delete' |
| 61 | }) |
| 62 | } |