From 51c1deab44f4ed681d05a6719b5c98f0e7854d9c Mon Sep 17 00:00:00 2001 From: valarchie <343928303@qq.com> Date: Thu, 20 Jul 2023 14:53:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + src/api/system/config.ts | 76 ++++++++ src/views/system/config/form.vue | 98 ++++++++++ src/views/system/config/index.vue | 112 ++++------- src/views/system/config/utils/hook.tsx | 259 ++++++++++--------------- src/views/system/config/utils/rule.ts | 9 + 6 files changed, 328 insertions(+), 229 deletions(-) create mode 100644 src/api/system/config.ts create mode 100644 src/views/system/config/form.vue create mode 100644 src/views/system/config/utils/rule.ts diff --git a/.gitignore b/.gitignore index f387679..91361d9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ npm-debug.log* .pnpm-debug.log tests/**/coverage/ +# 本机调试debug配置文件 +.vscode/launch.json + # Editor directories and files .idea *.suo diff --git a/src/api/system/config.ts b/src/api/system/config.ts new file mode 100644 index 0000000..f21e0da --- /dev/null +++ b/src/api/system/config.ts @@ -0,0 +1,76 @@ +import { http } from "@/utils/http"; + +export interface ConfigQuery extends BasePageQuery { + /** + * 配置key + */ + configKey?: string; + /** + * 配置名称 + */ + configName?: string; + /** + * 是否允许更改配置 + */ + isAllowChange?: string; +} + +/** + * ConfigDTO, 配置信息 + */ +export interface ConfigDTO { + configId?: string; + configKey?: string; + configName?: string; + configOptions?: string[]; + configValue?: string; + createTime?: Date; + isAllowChange?: string; + isAllowChangeStr?: string; + remark?: string; +} + +/** + * ConfigUpdateCommand + */ +export interface UpdateConfigRequest { + configValue: string; +} + +/** 获取配置列表 */ +export const getConfigListApi = (params?: ConfigQuery) => { + return http.request>>( + "get", + "/system/configs", + { + params + } + ); +}; + +/** 获取配置信息 */ +export const getConfigInfoApi = (configId: string) => { + return http.request>( + "get", + `/system/config/${configId}` + ); +}; + +/** 刷新配置缓存 */ +export const updateConfigApi = ( + configId: number, + data: UpdateConfigRequest +) => { + return http.request>>( + "put", + `/system/config/${configId}`, + { + data + } + ); +}; + +/** 刷新配置缓存 */ +export const refreshConfigCacheApi = () => { + return http.request>("delete", "/system/configs/cache"); +}; diff --git a/src/views/system/config/form.vue b/src/views/system/config/form.vue new file mode 100644 index 0000000..5e35021 --- /dev/null +++ b/src/views/system/config/form.vue @@ -0,0 +1,98 @@ + + + diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index ab32c30..7511b33 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -1,24 +1,21 @@