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`