增加数据备份功能

This commit is contained in:
whyour
2023-07-16 00:23:29 +08:00
parent 8affff96f3
commit 88b87de391
7 changed files with 110 additions and 13 deletions
+17
View File
@@ -5,6 +5,7 @@ import config from '@/utils/config';
import { request } from '@/utils/http';
import CheckUpdate from './checkUpdate';
import { SharedContext } from '@/layouts';
import { saveAs } from 'file-saver';
import './index.less';
const optionsWithDisabled = [
@@ -76,6 +77,17 @@ const Other = ({
});
};
const exportData = () => {
request
.put(`${config.apiPrefix}system/data/export`, { responseType: 'blob' })
.then((res) => {
saveAs(res, 'data.tgz');
})
.catch((error: any) => {
console.log(error);
});
};
useEffect(() => {
getSystemConfig();
}, []);
@@ -127,6 +139,11 @@ const Other = ({
</Button>
</Input.Group>
</Form.Item>
<Form.Item label="数据备份还原" name="frequency">
<Button type="primary" onClick={exportData}>
</Button>
</Form.Item>
<Form.Item label="检查更新" name="update">
<CheckUpdate systemInfo={systemInfo} socketMessage={socketMessage} />
</Form.Item>