Commit 54b1ec53 authored by 邓超's avatar 邓超

fix: 修改数据库初始化选择对应产品方式,初始化后日志模块,二次初始化接口调用

parent fd923672
Pipeline #33719 passed with stages
in 32 minutes 47 seconds
......@@ -19,9 +19,15 @@ const RadioBox = props => {
<div className={styles.radioBox}>
<div className={styles.radioTitle}>{radioTitle}:</div>
<div className={styles.radioContent}>
<Radio.Group onChange={onChange} value={currentVal}>
<Radio.Group value={currentVal}>
{radioOptions.map((item, num) => (
<Radio value={item.version} key={num} className={styles.radio}>
<Radio
disabled={item.disabled}
value={item.version}
key={num}
className={styles.radio}
onClick={onChange}
>
{item.functionName + item.version}
</Radio>
))}
......
......@@ -34,6 +34,7 @@ import {
GetProductList, // 获取产品列表
GetDbProduct, // 获取产品方案配置
InitAddDataBase, // 数据库初始化
InitEditDataBase, // 二次初始化
} from '@/services/database/api';
import styles from './InitDataBase.less';
......@@ -148,6 +149,7 @@ const InitDataBase = props => {
.split(/(\r\n)|(\n)/)
.map((item, index) => <p key={index}>{item}</p>),
);
console.log(arr);
setInitContent(arr);
scroll.current.scrollTop = scroll.current.scrollHeight;
}
......@@ -426,7 +428,7 @@ const InitDataBase = props => {
});
return;
}
setDbExists(res[1].DBExists);
setDbExists(res[1].data.DBExists);
let fileList = res[0].data ? res[0].data : [];
let dataList = res[1].data.Product ? res[1].data.Product : [];
// 没有库或者dataList为[]直接用fileList作为回显
......@@ -468,14 +470,22 @@ const InitDataBase = props => {
mapCheckVersion.check === undefined
? null
: mapCheckVersion.check;
if (item.check) {
item.hasCheck = true;
}
item.functionrSolutions.forEach(val => {
// 根据三级目录对应的选中key匹配isCheck
let isCheck = mapList.get(val.key);
val.isCheck = isCheck === undefined ? null : isCheck;
// 版本号低于当前版本号禁止选用
if (item.checkVersion && val.version < item.checkVersion) {
val.disabled = true;
} else {
val.disabled = false;
}
});
});
});
console.log(fileList);
setInitList(fileList);
setInitLoading(false);
})
......@@ -512,18 +522,25 @@ const InitDataBase = props => {
const radioChange = (index, value) => {
setInitList(val => {
const list = JSON.parse(JSON.stringify(val));
// 修改一级菜单的check字段
list[index.tabIndex].check = true;
// 修改二级菜单的check字段
list[index.tabIndex].modularSolutions[index.radioIndex].check = true;
const secondList =
list[index.tabIndex].modularSolutions[index.radioIndex];
// 取消功能 一开始未选中的才能取消
if (value === secondList.checkVersion && !secondList.hasCheck) {
secondList.checkVersion = null;
value = null;
secondList.check = false;
} else {
// 修改选中的checkVersion值
list[index.tabIndex].modularSolutions[
index.radioIndex
].checkVersion = value;
secondList.checkVersion = value;
// 修改二级菜单的check字段
secondList.check = true;
}
// 修改一级菜单的check字段
list[index.tabIndex].check = !list[index.tabIndex].modularSolutions.every(
version => version.checkVersion === null,
);
// 修改单选isCheck字段
list[index.tabIndex].modularSolutions[
index.radioIndex
].functionrSolutions.forEach(item => {
secondList.functionrSolutions.forEach(item => {
if (item.version === value) {
item.isCheck = true;
} else {
......@@ -533,15 +550,17 @@ const InitDataBase = props => {
return list;
});
};
// 数据库初始化
const initDatabasePro = () => {
// handleShowModal('versionVisible', true);
let productSetting = initList;
let obj = form.getFieldsValue();
console.log({ ...obj, productSetting });
// 数据库存在调用编辑接口否则调用新增接口
setInitLoading(true);
handleShowModal('initVisible', false);
setInitVisible(true);
doInitLog();
if (dbExists) {
InitAddDataBase({ ...obj, productSetting }).then(res => {
InitEditDataBase({ ...obj, productSetting }).then(res => {
setInitLoading(false);
if (res.code === 0) {
notification.success({
......@@ -549,7 +568,6 @@ const InitDataBase = props => {
duration: 3,
description: '操作成功',
});
handleShowModal('initVisible', false);
} else {
notification.error({
message: '提示',
......@@ -568,7 +586,6 @@ const InitDataBase = props => {
duration: 3,
description: '操作成功',
});
handleShowModal('initVisible', false);
} else {
notification.error({
message: '提示',
......@@ -791,7 +808,7 @@ const InitDataBase = props => {
width={800}
maskClosable={false}
bodyStyle={{
height: '600px',
height: '500px',
// overflowY: 'auto',
}}
footer={[
......@@ -809,7 +826,7 @@ const InitDataBase = props => {
<div
ref={scroll}
style={{
maxHeight: '570px',
maxHeight: '470px',
overflowY: 'auto',
marginRight: ' -24px',
}}
......@@ -854,15 +871,6 @@ const InitDataBase = props => {
</Col>
</Row>
</Modal>
{/* 检查版本弹窗 */}
<Modal
title="版本检查"
visible={modalVisible.versionVisible}
onOk={() => modalOkCallback()}
onCancel={() => handleShowModal('versionVisible', false)}
>
<p>当前版本运行正常</p>
</Modal>
{/* 初始化选择产品弹窗 */}
<Modal
title="初始化"
......
......@@ -16,7 +16,7 @@ import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
*/
// 测试数据库连接
export const connectionTest = params =>
get(`${PUBLISH_SERVICE}/DBManager/ConnectionTest`, params);
post(`${PUBLISH_SERVICE}/DBManager/TestConnetions`, params);
// 获取数据库配置信息
export const getDataBaseConfigNew = params =>
......@@ -213,3 +213,6 @@ export const GetDbProduct = params =>
// 数据库初始化
export const InitAddDataBase = params =>
post(`${PUBLISH_SERVICE}/DBManager/InitAddDataBase`, params);
// 二次初始化
export const InitEditDataBase = params =>
post(`${PUBLISH_SERVICE}/DBManager/InitEditDataBase`, params);
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