From 7daa2690e7c9d2d63be56a2dfd6c6ae9e1d0b3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=91=E7=BF=94?= <971366405@qq.com> Date: Tue, 30 Jul 2024 16:23:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加系统配置功能,优化form表单的input输入框的问题 --- src/api/config.ts | 104 ++++++++++ src/styles/index.scss | 4 + src/views/system/config/index.vue | 308 ++++++++++++++++++++++++++++++ src/views/system/dict/index.vue | 6 - 4 files changed, 416 insertions(+), 6 deletions(-) create mode 100644 src/api/config.ts create mode 100644 src/views/system/config/index.vue diff --git a/src/api/config.ts b/src/api/config.ts new file mode 100644 index 00000000..7f706734 --- /dev/null +++ b/src/api/config.ts @@ -0,0 +1,104 @@ +import request from "@/utils/request"; + +const CONFIG_BASE_URL = "/api/v1/config"; + +class ConfigAPI { + /** 获取系统配置分页数据 */ + static getPage(queryParams?: ConfigPageQuery) { + return request>({ + url: `${CONFIG_BASE_URL}/page`, + method: "get", + params: queryParams, + }); + } + /** + * 获取系统配置表单数据 + * + * @param id ConfigID + * @returns Config表单数据 + */ + static getFormData(id: number) { + return request({ + url: `${CONFIG_BASE_URL}/${id}/form`, + method: "get", + }); + } + + /** 添加系统配置*/ + static add(data: ConfigForm) { + return request({ + url: `${CONFIG_BASE_URL}`, + method: "post", + data: data, + }); + } + + /** + * 更新系统配置 + * + * @param id ConfigID + * @param data Config表单数据 + */ + static update(id: number, data: ConfigForm) { + return request({ + url: `${CONFIG_BASE_URL}/${id}`, + method: "put", + data: data, + }); + } + + /** + * 删除系统配置 + * + * @param ids 系统配置ID + */ + static deleteById(id: number) { + return request({ + url: `${CONFIG_BASE_URL}/${id}`, + method: "delete", + }); + } + + static refreshCache() { + return request({ + url: `${CONFIG_BASE_URL}`, + method: "patch", + }); + } +} + +export default ConfigAPI; + +/** $系统配置分页查询参数 */ +export interface ConfigPageQuery extends PageQuery { + /** 搜索关键字 */ + keywords?: string; +} + +/** 系统配置表单对象 */ +export interface ConfigForm { + /** 主键 */ + id?: number; + /** 配置名称 */ + sysName?: string; + /** 配置key */ + sysKey?: string; + /** 配置值 */ + sysValue?: string; + /** 描述、备注 */ + remark?: string; +} + +/** 系统配置分页对象 */ +export interface ConfigPageVO { + /** 主键 */ + id?: number; + /** 配置名称 */ + sysName?: string; + /** 配置key */ + sysKey?: string; + /** 配置值 */ + sysValue?: string; + /** 描述、备注 */ + remark?: string; +} diff --git a/src/styles/index.scss b/src/styles/index.scss index b431308c..64346ed4 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -26,3 +26,7 @@ color: rgb(32 160 255); } } + +.el-form .el-input { + width: 16rem !important; +} diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue new file mode 100644 index 00000000..dced0787 --- /dev/null +++ b/src/views/system/config/index.vue @@ -0,0 +1,308 @@ + + + + diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index 68160b70..60d32252 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -386,9 +386,3 @@ onMounted(() => { handleQuery(); }); - -