Commit 9d819d1e authored by 皮倩雯's avatar 皮倩雯

fix: '首页操作数据库初始化'

parent 0e46664d
Pipeline #84341 waiting for manual action with stages
......@@ -16,6 +16,7 @@ import {
Menu,
Empty,
Tabs,
Modal,
} from 'antd';
import dengPao from '@/assets/images/icons/dengpao.png';
import icon from '@/assets/images/icons/icon.png';
......@@ -49,11 +50,13 @@ import {
getDataBaseConfigNew,
connectionTest,
changeSolution,
saveConnectionNew,
} from '@/services/database/api';
import ReactEcharts from 'echarts-for-react';
import { GetBasicInfo, GetGateWay } from '@/services/hostmanager/hostmanager';
import { GetWebSiteConfig } from '@/services/gis/gis';
import { GetOMSDashboard, GetWayPages } from '@/services/homePage/api';
import DatabaseInitialization from '@/pages/database/databaseInitialization/DatabaseInitialization';
import {
GetVectorService,
GetMaplayerByTerminalType,
......@@ -93,6 +96,7 @@ const HomePage = () => {
const [loadingApi, setLoadingApi] = useState(false);
const [loadingDatabase, setLoadingDatabase] = useState(false);
const [loadingProduct, setLoadingProduct] = useState(false);
const [dataBaseVisible, setDataBaseVisible] = useState(false);
const [allTime, setAllTime] = useState([
moment().startOf('month'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
......@@ -288,6 +292,7 @@ const HomePage = () => {
});
}
} else {
setDataBaseVisible(true);
setState(false);
notification.error({
message: '提示',
......@@ -829,6 +834,41 @@ const HomePage = () => {
}
};
// 数据库连接失败时弹窗系统初始化或跳转切换数据库连接界面
const onOk = value => {
// 在首页系统初始化完成直接保存连接刷新界面
saveConnectionNew({
ip: value.ip,
dbName: value.dbName,
userName: value.userName,
password: value.password,
providerType: value.providerType,
})
.then(resnew => {
if (resnew.code === 0) {
setFlag(flag + 1);
notification.success({
message: '提示',
duration: 3,
description: '保存成功',
});
} else {
notification.error({
message: '提示',
duration: 15,
description: resnew.msg,
});
}
})
.catch(err => {
notification.error({
message: '提示',
duration: 15,
description: err,
});
});
};
return (
<div className={styles.homePage}>
<div className={styles.header}>
......@@ -1271,6 +1311,38 @@ const HomePage = () => {
</Spin>
</div>
</div>
<Modal
title={
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div
style={{
width: '3px',
height: '15px',
backgroundColor: '#096dd9',
borderRadius: '10px',
marginRight: '10px',
}}
/>
<span>系统初始化</span>
</div>
<div style={{ marginRight: '30px', color: '#096dd9', fontSize: '12px' }}>
<span style={{ cursor: 'pointer' }} onClick={() => toDataCenter()}>
已有数据库?点击进行配置
</span>
</div>
</div>
}
visible={dataBaseVisible}
onCancel={() => setDataBaseVisible(false)}
width="1400px"
className={styles.dataBaseVisible}
footer={false}
maskClosable={false}
destroyOnClose={true}
>
<DatabaseInitialization callBackSubmit={onOk} visible={dataBaseVisible} />
</Modal>
</div>
);
};
......
......@@ -773,3 +773,14 @@
}
}
}
.dataBaseVisible {
margin-top: -88px;
:global {
.ant-modal-body {
padding: 0;
}
.ant-modal-header {
height: 50px;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment