index.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import request from '@/utils/request';
  2. import { ConfigForm, ConfigQuery, ConfigVO } from './types';
  3. import { AxiosPromise } from 'axios';
  4. // 查询参数列表
  5. export function listConfig(query: ConfigQuery): AxiosPromise<ConfigVO[]> {
  6. return request({
  7. url: '/system/config/list',
  8. method: 'get',
  9. params: query
  10. });
  11. }
  12. // 查询参数详细
  13. export function getConfig(configId: string | number): AxiosPromise<ConfigVO> {
  14. return request({
  15. url: '/system/config/' + configId,
  16. method: 'get'
  17. });
  18. }
  19. // 根据参数键名查询参数值
  20. export function getConfigKey(configKey: string): AxiosPromise<string> {
  21. return request({
  22. url: '/system/config/configKey/' + configKey,
  23. method: 'get'
  24. });
  25. }
  26. // 新增参数配置
  27. export function addConfig(data: ConfigForm) {
  28. return request({
  29. url: '/system/config',
  30. method: 'post',
  31. data: data
  32. });
  33. }
  34. // 修改参数配置
  35. export function updateConfig(data: ConfigForm) {
  36. return request({
  37. url: '/system/config',
  38. method: 'put',
  39. data: data
  40. });
  41. }
  42. // 修改参数配置
  43. export function updateConfigByKey(key: string, value: any) {
  44. return request({
  45. url: '/system/config/updateByKey',
  46. method: 'put',
  47. data: {
  48. configKey: key,
  49. configValue: value
  50. }
  51. });
  52. }
  53. // 删除参数配置
  54. export function delConfig(configId: string | number | Array<string | number>) {
  55. return request({
  56. url: '/system/config/' + configId,
  57. method: 'delete'
  58. });
  59. }
  60. // 刷新参数缓存
  61. export function refreshCache() {
  62. return request({
  63. url: '/system/config/refreshCache',
  64. method: 'delete'
  65. });
  66. }