refactor: 完善系统配置恢复默认功能(仅前端)
This commit is contained in:
parent
c344bceb3f
commit
b30f6c2eb0
@ -29,3 +29,7 @@ export function list(params: ListParam) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function resetValue(params: ListParam) {
|
||||
return axios.patch(`${BASE_URL}/value`, params);
|
||||
}
|
||||
|
@ -122,10 +122,10 @@
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="!isEdit"
|
||||
v-permission="['system:config:delete']"
|
||||
@click="toRestore"
|
||||
v-permission="['system:config:reset']"
|
||||
@click="toResetValue"
|
||||
>
|
||||
<template #icon><icon-redo /></template>恢复默认值
|
||||
<template #icon><icon-redo /></template>恢复默认
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="isEdit"
|
||||
@ -138,7 +138,7 @@
|
||||
<a-button
|
||||
v-if="isEdit"
|
||||
v-permission="['system:config:update']"
|
||||
@click="handleReset"
|
||||
@click="reset"
|
||||
>
|
||||
<template #icon><icon-refresh /></template>重置
|
||||
</a-button>
|
||||
@ -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();
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -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`
|
||||
|
Loading…
Reference in New Issue
Block a user