Commit 23602c5d authored by 皮倩雯's avatar 皮倩雯

fix: '数据库初始化'

parent 3087d3c4
Pipeline #56534 passed with stages
...@@ -96,6 +96,7 @@ const DatabaseInitialization = props => { ...@@ -96,6 +96,7 @@ const DatabaseInitialization = props => {
const [secordColor, setsecordColor] = useState('gray'); const [secordColor, setsecordColor] = useState('gray');
const [lastColor, setLastColor] = useState('gray'); const [lastColor, setLastColor] = useState('gray');
const [totalProduct, setTotalProduct] = useState(''); const [totalProduct, setTotalProduct] = useState('');
const [simpleProduct, setSimpleProduct] = useState('');
// 获取数据库配置信息 // 获取数据库配置信息
useEffect(() => { useEffect(() => {
...@@ -438,6 +439,12 @@ const DatabaseInitialization = props => { ...@@ -438,6 +439,12 @@ const DatabaseInitialization = props => {
duration: 5, duration: 5,
description: '数据库初始化成功', description: '数据库初始化成功',
}); });
setkeepNumber('');
setkeepNa('');
setkeepMsg('');
setkeepCo('');
setTotalProduct(res.data.productPackageSumCount);
setSimpleProduct(res.data.productPackageCount);
} else { } else {
setFinish(true); setFinish(true);
setfirstColor('red'); setfirstColor('red');
...@@ -454,6 +461,8 @@ const DatabaseInitialization = props => { ...@@ -454,6 +461,8 @@ const DatabaseInitialization = props => {
const flagChange = () => { const flagChange = () => {
console.log(888); console.log(888);
setSimpleProduct('');
setTotalProduct('');
setValue(''); setValue('');
setKeepProduct([]); setKeepProduct([]);
// GetDb(1); // GetDb(1);
...@@ -477,6 +486,7 @@ const DatabaseInitialization = props => { ...@@ -477,6 +486,7 @@ const DatabaseInitialization = props => {
if (arr && bb != -1) { if (arr && bb != -1) {
console.log(arr); console.log(arr);
} else { } else {
console.log(keepValue);
let aa = keepValue; let aa = keepValue;
aa[item] = e; aa[item] = e;
let a = Object.keys(aa); let a = Object.keys(aa);
...@@ -514,37 +524,46 @@ const DatabaseInitialization = props => { ...@@ -514,37 +524,46 @@ const DatabaseInitialization = props => {
console.log(99999999); console.log(99999999);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
CheckDatabaseIsExist({ ...obj }).then(res => { CheckDatabaseIsExist({ ...obj }).then(res => {
// 数据库不存在 if (res.code == 0) {
if (res.data === false) { // 数据库不存在
console.log(555); if (res.data === false) {
// 有授权码 console.log(555);
if (keepNumber) { // 有授权码
GetDb(1); if (keepNumber) {
setCheckboxFlag(1); GetDb(1);
setDbExists(false); setCheckboxFlag(1);
setMsg(''); setDbExists(false);
notification.warning({ setMsg('');
message: '提示', notification.warning({
duration: 5, message: '提示',
description: '已检测到License,需初始化数据库', duration: 5,
}); description: '已检测到License,需初始化数据库',
});
} else {
setCheckboxFlag(0);
setDbExists(false);
setMsg('');
notification.warning({
message: '提示',
duration: 5,
description: '未检测到License,自主选择产品进行数据库初始化',
});
}
} else { } else {
setCheckboxFlag(0); setCheckboxFlag(1);
setDbExists(false); setMsg('当前数据库已存在不可初始化');
setMsg('');
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 5, duration: 5,
description: '未检测到License,自主选择产品进行数据库初始化', description: '当前数据库已存在不可初始化',
}); });
} }
} else { } else {
setCheckboxFlag(1); setMsg(res.msg);
setMsg('当前数据库已存在不可初始化');
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 5, duration: 5,
description: '当前数据库已存在不可初始化', description: res.msg,
}); });
} }
}); });
...@@ -654,7 +673,7 @@ const DatabaseInitialization = props => { ...@@ -654,7 +673,7 @@ const DatabaseInitialization = props => {
}, },
]} ]}
> >
<Input placeholder="请输入服务器名或IP地址" onBlur={save} /> <Input placeholder="请输入服务器名或IP地址" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={`${formLables.userName}:`} label={`${formLables.userName}:`}
...@@ -681,7 +700,7 @@ const DatabaseInitialization = props => { ...@@ -681,7 +700,7 @@ const DatabaseInitialization = props => {
}, },
]} ]}
> >
<Input placeholder="请输入用户名称" onBlur={save} /> <Input placeholder="请输入用户名称" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={`${formLables.password}:`} label={`${formLables.password}:`}
...@@ -709,7 +728,7 @@ const DatabaseInitialization = props => { ...@@ -709,7 +728,7 @@ const DatabaseInitialization = props => {
}, },
]} ]}
> >
<Input placeholder="请输入用户密码" type="password" onBlur={save} /> <Input placeholder="请输入用户密码" type="password" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={`${formLables.dbName}:`} label={`${formLables.dbName}:`}
...@@ -740,7 +759,7 @@ const DatabaseInitialization = props => { ...@@ -740,7 +759,7 @@ const DatabaseInitialization = props => {
}, },
]} ]}
> >
<Input placeholder="请输入数据库名称" onBlur={save} /> <Input placeholder="请输入数据库名称" />
{/* <Select {/* <Select
showSearch showSearch
mode="tags" mode="tags"
...@@ -771,11 +790,24 @@ const DatabaseInitialization = props => { ...@@ -771,11 +790,24 @@ const DatabaseInitialization = props => {
</Select> */} </Select> */}
</Form.Item> </Form.Item>
</Form> </Form>
<div style={{ marginTop: '50px', transform: 'scal(1.5)' }}> <div style={{ float: 'right' }}>
<Button onClick={save}>环境检查</Button>
</div>
<div style={{ marginTop: '100px', transform: 'scal(1.5)' }}>
<Timeline> <Timeline>
<Timeline.Item color={firstColor}>数据库初始化完成</Timeline.Item> <Timeline.Item color={firstColor}>数据库初始化完成</Timeline.Item>
<Timeline.Item color={secordColor}> <Timeline.Item color={secordColor}>
<p>产品授权打开已初始化的产品</p> <p>产品授权打开已初始化的产品</p>
{/* {console.log(simpleProduct)}
{console.log(totalProduct)} */}
{/* {simpleProduct ? ( */}
<p>
已打开<span style={{ color: 'rgb(24 144 255)' }}>{simpleProduct}</span>/
<span style={{ color: 'rgb(24 144 255)' }}>{totalProduct}</span>个产品
</p>
{/* ) : (
<></>
)} */}
</Timeline.Item> </Timeline.Item>
<Timeline.Item color={lastColor}> <Timeline.Item color={lastColor}>
<p>平台管理员勾选所有菜单权限</p> <p>平台管理员勾选所有菜单权限</p>
......
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