From b30f6c2eb04dcc73bb3ebdf0785f03288ada2b84 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 21 Sep 2023 23:43:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=AE=8C=E5=96=84=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=85=8D=E7=BD=AE=E6=81=A2=E5=A4=8D=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=88=E4=BB=85=E5=89=8D=E7=AB=AF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- continew-admin-ui/src/api/system/config.ts | 4 ++ .../config/components/basic-setting.vue | 41 +++++++++---------- .../changelog/v1.2.0/continew-admin_data.sql | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/continew-admin-ui/src/api/system/config.ts b/continew-admin-ui/src/api/system/config.ts index 99e44c15..ae2df164 100644 --- a/continew-admin-ui/src/api/system/config.ts +++ b/continew-admin-ui/src/api/system/config.ts @@ -29,3 +29,7 @@ export function list(params: ListParam) { }, }); } + +export function resetValue(params: ListParam) { + return axios.patch(`${BASE_URL}/value`, params); +} diff --git a/continew-admin-ui/src/views/system/config/components/basic-setting.vue b/continew-admin-ui/src/views/system/config/components/basic-setting.vue index df673935..85b6c7e0 100644 --- a/continew-admin-ui/src/views/system/config/components/basic-setting.vue +++ b/continew-admin-ui/src/views/system/config/components/basic-setting.vue @@ -122,10 +122,10 @@ - 恢复默认值 + 恢复默认 重置 @@ -164,6 +164,7 @@ DataRecord, ListParam, list, + resetValue, } from '@/api/system/config'; const { proxy } = getCurrentInstance() as any; @@ -188,13 +189,6 @@ }); const { queryParams, form, rules } = toRefs(data); - /** - * 重置表单 - */ - const reset = () => { - proxy.$refs.formRef?.resetFields(); - }; - /** * 查询配置 */ @@ -284,23 +278,26 @@ }; /** - * 恢复默认值 + * 恢复默认 */ - const handleRestore = () => { - console.log('恢复默认值'); + const handleResetValue = async () => { + await resetValue(queryParams.value); + proxy.$message.success('恢复成功'); + await getConfig(); }; /** - * 点击恢复默认值 + * 点击恢复默认 */ - const toRestore = () => { + const toResetValue = () => { proxy.$modal.warning({ title: '警告', titleAlign: 'start', - content: '确定要恢复基础配置为默认值吗?', + content: '确认恢复基础配置为默认值吗?', + okText: '确认恢复', hideCancel: false, onOk: () => { - handleRestore(); + handleResetValue(); }, }); }; @@ -313,10 +310,10 @@ }; /** - * 重置 + * 重置表单 */ - const handleReset = () => { - reset(); + const reset = () => { + proxy.$refs.formRef?.resetFields(); }; /** @@ -324,7 +321,7 @@ */ const handleCancel = () => { isEdit.value = false; - handleReset(); + reset(); }; diff --git a/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql index c6227da2..0c38bcee 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql @@ -12,7 +12,7 @@ VALUES (1064, '字典导出', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:export', 4, 1, 1, NOW(), NULL, NULL), (1070, '系统配置', 1000, 2, '/system/config', 'Config', 'system/config/index', 'desktop', b'0', b'0', b'0', 'system:config:list', 7, 1, 1, NOW(), NULL, NULL), (1071, '修改配置', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:update', 1, 1, 1, NOW(), NULL, NULL), -(1072, '恢复默认', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:delete', 2, 1, 1, NOW(), NULL, NULL); +(1072, '恢复默认', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:reset', 2, 1, 1, NOW(), NULL, NULL); -- 初始化默认字典 INSERT IGNORE INTO `sys_dict`