Commit 32ec6209 authored by mayongxin's avatar mayongxin

数据库管理接口替换

parent faa1c9e6
Pipeline #26926 skipped with stages
...@@ -19,15 +19,23 @@ import { connect } from 'react-redux'; ...@@ -19,15 +19,23 @@ import { connect } from 'react-redux';
import { import {
setTableSQLDirName, setTableSQLDirName,
deleteConn, deleteConn,
deleteConnNew,
initDBv4, initDBv4,
initDBv4new,
getInitDBLog, getInitDBLog,
getInitDBLogNew,
getConnRecord, getConnRecord,
getConnRecordNew,
getDataBaseConfig, getDataBaseConfig,
getDataBaseConfigNew,
saveConnection, saveConnection,
saveConnectionNew,
getConnectionTest, getConnectionTest,
getDataBaseList, getDataBaseList,
updateConnDesc, updateConnDesc,
updateConnDescNew,
deleteInitDBLog, deleteInitDBLog,
deleteInitDBLogNew,
connectionTest, connectionTest,
} from '@/services/database/api'; } from '@/services/database/api';
import styles from './InitDataBase.less'; import styles from './InitDataBase.less';
...@@ -64,21 +72,35 @@ const InitDataBase = props => { ...@@ -64,21 +72,35 @@ const InitDataBase = props => {
// 获取数据库链接记录 // 获取数据库链接记录
useEffect(() => { useEffect(() => {
setTableLoading(true); setTableLoading(true);
getConnRecord({ // getConnRecord({
_version: 9999, // _version: 9999,
dc: Date.now(), // dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res.length > 0) {
// let arr = res.map((item, index) => {
// item.key = index;
// return item;
// });
// setData(arr);
// }
// })
// .catch(err => {
// setTableLoading(false);
// console.error(err);
// });
getConnRecordNew().then(resnew => {
setTableLoading(false); setTableLoading(false);
if (res.length > 0) { if (resnew.code == 0) {
let res = resnew.data
let arr = res.map((item, index) => { let arr = res.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}); });
setData(arr); setData(arr);
} }
}) }).catch(err => {
.catch(err => {
setTableLoading(false); setTableLoading(false);
console.error(err); console.error(err);
}); });
...@@ -86,14 +108,41 @@ const InitDataBase = props => { ...@@ -86,14 +108,41 @@ const InitDataBase = props => {
// 获取数据库配置信息 // 获取数据库配置信息
useEffect(() => { useEffect(() => {
setCardLoading(true); setCardLoading(true);
getDataBaseConfig({ // getDataBaseConfig({
_version: 9999, // _version: 9999,
dc: Date.now(), // dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setCardLoading(false);
// if (res.success) {
// const { inUse } = res;
// let obj = {};
// Object.keys(dbForm).forEach(k => {
// obj[k] = res[k];
// });
// form.setFieldsValue(obj);
// setDbForm(val => ({ ...val, ...obj }));
// setAllSqulDir(res.allSqlDir);
// if (res.allSqlDir.some(item => item === inUse)) {
// setDefaultSqlDir(res.tableSQLDirName);
// } else {
// // 默认切换到第一个产品方案
// handeleChangeSQLDirName(res.allSqlDir[0]);
// setDefaultSqlDir(res.allSqlDir[0]);
// }
// }
// })
// .catch(err => {
// setCardLoading(false);
// console.error(err);
// });
getDataBaseConfigNew().then(
resnew => {
setCardLoading(false); setCardLoading(false);
if (res.success) { let res = resnew.data
if (resnew.code == 0) {
const { inUse } = res; const { inUse } = res;
let obj = {}; let obj = {};
Object.keys(dbForm).forEach(k => { Object.keys(dbForm).forEach(k => {
obj[k] = res[k]; obj[k] = res[k];
...@@ -109,11 +158,8 @@ const InitDataBase = props => { ...@@ -109,11 +158,8 @@ const InitDataBase = props => {
setDefaultSqlDir(res.allSqlDir[0]); setDefaultSqlDir(res.allSqlDir[0]);
} }
} }
}) }
.catch(err => { )
setCardLoading(false);
console.error(err);
});
}, []); }, []);
// 获取日志 // 获取日志
const doInitLog = () => { const doInitLog = () => {
...@@ -143,6 +189,30 @@ const InitDataBase = props => { ...@@ -143,6 +189,30 @@ const InitDataBase = props => {
.catch(err => { .catch(err => {
setFinish(true); setFinish(true);
}); });
// getInitDBLogNew().
// then(resnew => {
// if (resnew.code == 0) {
// let res = resnew.data
// if (res.content) {
// let arr = [];
// arr.push(
// res.content
// .split(/(\r\n)|(\n)/)
// .map((item, index) => <p key={index}>{item}</p>),
// );
// setInitContent(arr);
// scroll.current.scrollTop = scroll.current.scrollHeight;
// }
// if (!res.finish) {
// setTimeout(() => {
// doInitLog();
// }, 600);
// }
// }
// })
// .catch(err => {
// setFinish(true);
// });
}; };
// 数据库初始化 // 数据库初始化
const initClick = () => { const initClick = () => {
...@@ -151,20 +221,38 @@ const InitDataBase = props => { ...@@ -151,20 +221,38 @@ const InitDataBase = props => {
setInitVisible(true); setInitVisible(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
doInitLog(); doInitLog();
initDBv4({ // initDBv4({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
...obj, // ...obj,
}) // })
.then(res => { // .then(res => {
// setCardLoading(false);
// if (res.GetMe) {
// console.log(res);
// } else {
// notification.error({
// message: '提示',
// duration: 15,
// description: res.Say.Message || '初始化失败',
// });
// }
// })
// .catch(err => {
// setCardLoading(false);
// console.log(err);
// });
initDBv4new({
...obj
}).then(res => {
setCardLoading(false); setCardLoading(false);
if (res.GetMe) { if (res.code == 0) {
console.log(res); console.log(res);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 15, duration: 15,
description: res.Say.Message || '初始化失败', description: res.msg || '初始化失败',
}); });
} }
}) })
...@@ -186,17 +274,16 @@ const InitDataBase = props => { ...@@ -186,17 +274,16 @@ const InitDataBase = props => {
const onFinish = values => { const onFinish = values => {
setCardLoading(true); setCardLoading(true);
const obj = values; const obj = values;
saveConnection({
_version: 9999, saveConnectionNew({
_dc: new Date().getTime(),
ip: obj.ip, ip: obj.ip,
dbName: obj.dbName, dbName: obj.dbName,
userName: obj.userName, userName: obj.userName,
password: obj.password, password: obj.password,
}) }).then(
.then(res => { resnew => {
setCardLoading(false); setCardLoading(false);
if (res.GetMe === true) { if (resnew.code == 0) {
setUpData(upData + 1); setUpData(upData + 1);
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -207,14 +294,43 @@ const InitDataBase = props => { ...@@ -207,14 +294,43 @@ const InitDataBase = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 15, duration: 15,
description: res.Say.Message || '保存失败', description: resnew.msg,
}); });
} }
}) }
.catch(err => { ).catch(err => {
setCardLoading(false); setCardLoading(false);
console.log(err); console.log(err);
}); });
// saveConnection({
// _version: 9999,
// _dc: new Date().getTime(),
// ip: obj.ip,
// dbName: obj.dbName,
// userName: obj.userName,
// password: obj.password,
// })
// .then(res => {
// setCardLoading(false);
// if (res.GetMe === true) {
// setUpData(upData + 1);
// notification.success({
// message: '提示',
// duration: 3,
// description: '保存成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 15,
// description: res.Say.Message || '保存失败',
// });
// }
// })
// .catch(err => {
// setCardLoading(false);
// console.log(err);
// });
}; };
// 测试连接 // 测试连接
const onCheck = e => { const onCheck = e => {
...@@ -328,18 +444,34 @@ const InitDataBase = props => { ...@@ -328,18 +444,34 @@ const InitDataBase = props => {
setInitVisible(false); setInitVisible(false);
setInitContent(''); setInitContent('');
setFinish(false); setFinish(false);
deleteInitDBLog({ // deleteInitDBLog({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}); // });
deleteInitDBLogNew()
}; };
// 弹窗确认回调 // 弹窗确认回调
const modalOkCallback = () => { const modalOkCallback = () => {
const obj = form.getFieldsValue(); const obj = form.getFieldsValue();
// 更新描述 // 更新描述
updateConnDesc({ // updateConnDesc({
_version: 9999, // _version: 9999,
_dc: new Date().getTime(), // _dc: new Date().getTime(),
// ip: obj.ip,
// dbName: obj.dbName,
// userName: obj.userName,
// password: obj.password,
// desc,
// })
// .then(res => {
// setModalVisible(false);
// setUpData(upData + 1);
// })
// .catch(err => {
// console.error(err);
// setModalVisible(false);
// });
updateConnDescNew({
ip: obj.ip, ip: obj.ip,
dbName: obj.dbName, dbName: obj.dbName,
userName: obj.userName, userName: obj.userName,
...@@ -385,6 +517,25 @@ const InitDataBase = props => { ...@@ -385,6 +517,25 @@ const InitDataBase = props => {
setTableLoading(false); setTableLoading(false);
console.error(err); console.error(err);
}); });
// deleteConnNew({
// rowIndex: key
// }).then(res => {
// setTableLoading(false);
// if (res.code == 0) {
// setUpData(upData + 1);
// notification.success({
// message: '提示',
// duration: 3,
// description: '操作成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 15,
// description: res.msg,
// });
// }
// })
}; };
const columns = [ const columns = [
{ {
...@@ -588,10 +739,11 @@ const InitDataBase = props => { ...@@ -588,10 +739,11 @@ const InitDataBase = props => {
onCancel={() => { onCancel={() => {
setInitVisible(false); setInitVisible(false);
setInitContent(''); setInitContent('');
deleteInitDBLog({ // deleteInitDBLog({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}); // });
deleteInitDBLogNew()
}} }}
width={800} width={800}
maskClosable={false} maskClosable={false}
......
...@@ -13,8 +13,10 @@ import PageContainer from '@/components/BasePageContainer'; ...@@ -13,8 +13,10 @@ import PageContainer from '@/components/BasePageContainer';
import styles from './ManagementDataBase.less'; import styles from './ManagementDataBase.less';
import { import {
tableCheck, tableCheck,
tableCheckNew,
updateDateBase, updateDateBase,
databaseStandardGetLog, databaseStandardGetLog,
databaseStandardGetLogNew
} from '@/services/database/api'; } from '@/services/database/api';
const ManagementDataBase = () => { const ManagementDataBase = () => {
...@@ -31,22 +33,47 @@ const ManagementDataBase = () => { ...@@ -31,22 +33,47 @@ const ManagementDataBase = () => {
// 检查数据库表 // 检查数据库表
useEffect(() => { useEffect(() => {
setCheckLoading(true); setCheckLoading(true);
tableCheck({ // tableCheck({
_version: 9999, // _version: 9999,
_dc: new Date().getTime(), // _dc: new Date().getTime(),
}) // })
.then(res => { // .then(res => {
// setCheckLoading(false);
// console.log(res);
// if (res.sucess) {
// const { list, messageList } = res;
// // 自动检测列表
// let arr = list.map((item, index) => {
// item.key = index;
// return item;
// });
// // 手动检查列表
// let arr2 = messageList.map((item, index) => {
// item.key = index;
// return item;
// });
// setAutoCheckList(arr);
// setCheckList(arr2);
// }
// })
// .catch(err => {
// setCheckLoading(false);
// console.error(err);
// });
tableCheckNew()
.then(resnew => {
setCheckLoading(false); setCheckLoading(false);
console.log(res); console.log(resnew);
if (res.sucess) { if (resnew.code == 0) {
const { list, messageList } = res; let res = resnew.data
const { Autolist, ManualList } = res;
// 自动检测列表 // 自动检测列表
let arr = list.map((item, index) => { let arr = Autolist.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}); });
// 手动检查列表 // 手动检查列表
let arr2 = messageList.map((item, index) => { let arr2 = ManualList.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}); });
...@@ -62,13 +89,30 @@ const ManagementDataBase = () => { ...@@ -62,13 +89,30 @@ const ManagementDataBase = () => {
// 获取数据库升级记录 // 获取数据库升级记录
useEffect(() => { useEffect(() => {
setLogLoading(true); setLogLoading(true);
databaseStandardGetLog({ // databaseStandardGetLog({
_version: 9999, // _version: 9999,
_dc: new Date().getTime(), // _dc: new Date().getTime(),
}) // })
.then(res => { // .then(res => {
// setLogLoading(false);
// if (res) {
// let arr = [];
// res.map((item, index) => {
// item.key = index;
// arr.push(item);
// });
// setLogList(res);
// }
// })
// .catch(err => {
// setLogLoading(false);
// console.error(err);
// });
databaseStandardGetLogNew()
.then(resnew => {
setLogLoading(false); setLogLoading(false);
if (res) { if (resnew.code == 0) {
let res = resnew.data.list
let arr = []; let arr = [];
res.map((item, index) => { res.map((item, index) => {
item.key = index; item.key = index;
...@@ -116,6 +160,16 @@ const ManagementDataBase = () => { ...@@ -116,6 +160,16 @@ const ManagementDataBase = () => {
console.error(err); console.error(err);
}); });
}; };
const handleErrLog = (text, val) => {
setModalTitle(val);
let arr = [];
arr.push(
text.split(/(\r\n)|(\n)/).map((item, index) => <p key={index}>{item}</p>),
);
setModalVisible(true);
// setContent(text);
setContent(arr);
}
const handleLog = (text, val) => { const handleLog = (text, val) => {
setModalTitle(val); setModalTitle(val);
let arr = []; let arr = [];
...@@ -150,86 +204,108 @@ const ManagementDataBase = () => { ...@@ -150,86 +204,108 @@ const ManagementDataBase = () => {
const checkColumns = [ const checkColumns = [
{ {
title: '表名称', title: '表名称',
dataIndex: 'tableName', dataIndex: 'TableName',
key: 'tableName', key: 'TableName',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
{ {
title: '差异比较', title: '差异比较',
dataIndex: 'message', dataIndex: 'Message',
key: 'message', key: 'Message',
ellipsis: true, ellipsis: true,
}, },
]; ];
const logColumns = [ const logColumns = [
{ {
title: '登录名', title: '登录名',
dataIndex: 'updateBy', dataIndex: 'UpdateBy',
key: 'updateBy', key: 'UpdateBy',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
{ {
title: '数据库名称', title: '数据库名称',
dataIndex: 'name', dataIndex: 'Name',
key: 'name', key: 'Name',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
{ {
title: '解决方案', title: '解决方案',
dataIndex: 'solutionName', dataIndex: 'DbProductName',
key: 'solutionName', key: 'DbProductName',
width: 200,
ellipsis: true,
},
{
title: '数据库版本',
dataIndex: 'version',
key: 'version',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
// {
// title: '数据库版本',
// dataIndex: 'Version',
// key: 'Version',
// width: 200,
// ellipsis: true,
// },
{ {
title: '升级时间', title: '升级时间',
dataIndex: 'updateTime', dataIndex: 'UpdateTime',
key: 'updateTime', key: 'UpdateTime',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
// {
// title: '版本日志',
// dataIndex: 'Oklog',
// key: 'Oklog',
// render: text => (
// <Button
// size="small"
// disabled={!text}
// onClick={() => {
// handleLog(text, '版本日志');
// }}
// >
// 日志
// </Button>
// ),
// },
{ {
title: '版本日志', title: '成功日志',
dataIndex: 'despersion', dataIndex: 'Oklog',
key: 'despersion', key: 'Oklog',
ellipsis: true,
render: text => ( render: text => (
<Button <Button
size="small" size="small"
disabled={!text} type="primary"
onClick={() => { onClick={() => {
handleLog(text, '版本日志'); handleLog(text, '详细信息');
}} }}
> >
日志 升级内容
</Button> </Button>
), ),
}, },
{ {
title: '升级内容', title: '错误日志',
dataIndex: 'content', dataIndex: 'Errlog',
key: 'content', key: 'Errlog',
ellipsis: true, ellipsis: true,
render: text => ( render: text => {
if (text.length > 0) {
return (
<Button <Button
size="small" size="small"
type="primary" type="primary"
onClick={() => { onClick={() => {
handleLog(text, '详细信息'); handleLog(text, '详细信息');
}} }}
style={{ backgroundColor: "red" }}
> >
升级内容 错误内容
</Button> </Button>
), )
}
},
}, },
]; ];
...@@ -268,17 +344,6 @@ const ManagementDataBase = () => { ...@@ -268,17 +344,6 @@ const ManagementDataBase = () => {
</div> </div>
</Spin> </Spin>
</Card> </Card>
<Card className={styles.mgTop20}>
<div className={styles.tableTitle}>数据库版本记录</div>
<Table
className={styles.mgTop20}
columns={logColumns}
dataSource={logList}
bordered
loading={logLoading}
size="small"
/>
</Card>
<Card className={styles.mgTop20}> <Card className={styles.mgTop20}>
<div className={styles.tableTitle}> <div className={styles.tableTitle}>
手动修复 手动修复
...@@ -293,6 +358,18 @@ const ManagementDataBase = () => { ...@@ -293,6 +358,18 @@ const ManagementDataBase = () => {
size="small" size="small"
/> />
</Card> </Card>
<Card className={styles.mgTop20}>
<div className={styles.tableTitle}>数据库版本记录</div>
<Table
className={styles.mgTop20}
columns={logColumns}
dataSource={logList}
bordered
loading={logLoading}
size="small"
/>
</Card>
</PageContainer> </PageContainer>
<Modal <Modal
......
...@@ -5,6 +5,9 @@ import { ...@@ -5,6 +5,9 @@ import {
getMongoDBConnString, getMongoDBConnString,
deleteConnString, deleteConnString,
getMongoDBConnectionTest, getMongoDBConnectionTest,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const MongDBTable = props => { const MongDBTable = props => {
...@@ -17,13 +20,25 @@ const MongDBTable = props => { ...@@ -17,13 +20,25 @@ const MongDBTable = props => {
useEffect(() => { useEffect(() => {
setTableLoading(true); setTableLoading(true);
getMongoDBConnString({ // getMongoDBConnString({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"MongoDB"
}).then(resnew => {
setTableLoading(false); setTableLoading(false);
if (res) { if (resnew.code == 0) {
let res = resnew.data
setDataList(res); setDataList(res);
} }
}) })
...@@ -39,14 +54,37 @@ const MongDBTable = props => { ...@@ -39,14 +54,37 @@ const MongDBTable = props => {
// 测试连接 // 测试连接
const handleCon = (val, item) => { const handleCon = (val, item) => {
setTableLoading(true); setTableLoading(true);
getMongoDBConnectionTest({ // getMongoDBConnectionTest({
name: item.name, // name: item.name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res.success) {
// notification.success({
// message: '提示',
// description: '连接成功',
// duration: 3,
// });
// } else {
// notification.error({
// message: '提示',
// description: res.message || '连接失败',
// duration: 3,
// });
// }
// })
// .catch(err => {
// setTableLoading(false);
// console.error(err);
// });
GetConnTest({
Type:"MongoDB",
name:item.name
}).then(res => {
setTableLoading(false); setTableLoading(false);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
description: '连接成功', description: '连接成功',
...@@ -55,7 +93,7 @@ const MongDBTable = props => { ...@@ -55,7 +93,7 @@ const MongDBTable = props => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
description: res.message || '连接失败', description: res.msg || '连接失败',
duration: 3, duration: 3,
}); });
} }
...@@ -64,32 +102,51 @@ const MongDBTable = props => { ...@@ -64,32 +102,51 @@ const MongDBTable = props => {
setTableLoading(false); setTableLoading(false);
console.error(err); console.error(err);
}); });
}; };
// 删除 // 删除
const handleDel = (val, item) => { const handleDel = (val, item) => {
const { name = '' } = item; const { name = '' } = item;
deleteConnString({ // deleteConnString({
name, // name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setFlag(flag + 1);
// if (res.success) {
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '删除成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '删除失败',
// });
// }
// })
// .catch(err => console.error(err));
DeleteConnString({
name:name
}).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) })
.catch(err => console.error(err));
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
......
...@@ -5,6 +5,9 @@ import { ...@@ -5,6 +5,9 @@ import {
getMySQLConnString, getMySQLConnString,
getMySQLConnectionTest, getMySQLConnectionTest,
deleteConnString, deleteConnString,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const MySQLTable = props => { const MySQLTable = props => {
...@@ -17,13 +20,25 @@ const MySQLTable = props => { ...@@ -17,13 +20,25 @@ const MySQLTable = props => {
useEffect(() => { useEffect(() => {
setTableLoading(true); setTableLoading(true);
getMySQLConnString({ // getMySQLConnString({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"MySQL"
}).then(resnew => {
setTableLoading(false); setTableLoading(false);
if (res) { if (resnew.code == 0) {
let res = resnew.data
setDataList(res); setDataList(res);
} }
}) })
...@@ -39,14 +54,37 @@ const MySQLTable = props => { ...@@ -39,14 +54,37 @@ const MySQLTable = props => {
// 测试连接 // 测试连接
const handleCon = (val, item) => { const handleCon = (val, item) => {
setTableLoading(true); setTableLoading(true);
getMySQLConnectionTest({ // getMySQLConnectionTest({
name: item.name, // name: item.name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res.success) {
// notification.success({
// message: '提示',
// description: '连接成功',
// duration: 3,
// });
// } else {
// notification.error({
// message: '提示',
// description: res.message || '连接失败',
// duration: 15,
// });
// }
// })
// .catch(err => {
// setTableLoading(false);
// console.error(err);
// });
GetConnTest({
Type:"MySQL",
name:item.name
}).then(res => {
setTableLoading(false); setTableLoading(false);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
description: '连接成功', description: '连接成功',
...@@ -55,8 +93,8 @@ const MySQLTable = props => { ...@@ -55,8 +93,8 @@ const MySQLTable = props => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
description: res.message || '连接失败', description: res.msg || '连接失败',
duration: 15, duration: 3,
}); });
} }
}) })
...@@ -68,28 +106,46 @@ const MySQLTable = props => { ...@@ -68,28 +106,46 @@ const MySQLTable = props => {
// 删除 // 删除
const handleDel = (val, item) => { const handleDel = (val, item) => {
const { name = '' } = item; const { name = '' } = item;
deleteConnString({ // deleteConnString({
name, // name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setFlag(flag + 1);
// if (res.success) {
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '删除成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '删除失败',
// });
// }
// })
// .catch(err => console.error(err));
DeleteConnString({
name:name
}).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) })
.catch(err => console.error(err));
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
......
...@@ -5,6 +5,9 @@ import { ...@@ -5,6 +5,9 @@ import {
getOracleConnString, getOracleConnString,
getOracleConnectionTest, getOracleConnectionTest,
deleteConnString, deleteConnString,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const OracleTable = props => { const OracleTable = props => {
...@@ -17,13 +20,25 @@ const OracleTable = props => { ...@@ -17,13 +20,25 @@ const OracleTable = props => {
useEffect(() => { useEffect(() => {
setTableLoading(true); setTableLoading(true);
getOracleConnString({ // getOracleConnString({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"Oracle"
}).then(resnew => {
setTableLoading(false); setTableLoading(false);
if (res) { if (resnew.code == 0) {
let res = resnew.data
setDataList(res); setDataList(res);
} }
}) })
...@@ -39,14 +54,37 @@ const OracleTable = props => { ...@@ -39,14 +54,37 @@ const OracleTable = props => {
// 测试连接 // 测试连接
const handleCon = (val, item) => { const handleCon = (val, item) => {
setTableLoading(true); setTableLoading(true);
getOracleConnectionTest({ // getOracleConnectionTest({
name: item.name, // name: item.name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res.success) {
// notification.success({
// message: '提示',
// description: '连接成功',
// duration: 3,
// });
// } else {
// notification.error({
// message: '提示',
// description: res.message || '连接失败',
// duration: 3,
// });
// }
// })
// .catch(err => {
// setTableLoading(false);
// console.error(err);
// });
GetConnTest({
Type:"Oracle",
name:item.name
}).then(res => {
setTableLoading(false); setTableLoading(false);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
description: '连接成功', description: '连接成功',
...@@ -55,7 +93,7 @@ const OracleTable = props => { ...@@ -55,7 +93,7 @@ const OracleTable = props => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
description: res.message || '连接失败', description: res.msg || '连接失败',
duration: 3, duration: 3,
}); });
} }
...@@ -68,28 +106,46 @@ const OracleTable = props => { ...@@ -68,28 +106,46 @@ const OracleTable = props => {
// 删除 // 删除
const handleDel = (val, item) => { const handleDel = (val, item) => {
const { name = '' } = item; const { name = '' } = item;
deleteConnString({ // deleteConnString({
name, // name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setFlag(flag + 1);
// if (res.success) {
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '删除成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '删除失败',
// });
// }
// })
// .catch(err => console.error(err));
DeleteConnString({
name:name
}).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) })
.catch(err => console.error(err));
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
......
...@@ -5,6 +5,9 @@ import { ...@@ -5,6 +5,9 @@ import {
getSQLServerConnString, getSQLServerConnString,
deleteConnString, deleteConnString,
getSQLServerConnectionTest, getSQLServerConnectionTest,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api'; } from '@/services/database/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
const SQLServerTable = props => { const SQLServerTable = props => {
...@@ -17,13 +20,25 @@ const SQLServerTable = props => { ...@@ -17,13 +20,25 @@ const SQLServerTable = props => {
useEffect(() => { useEffect(() => {
setTableLoading(true); setTableLoading(true);
getSQLServerConnString({ // getSQLServerConnString({
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"SQLServer"
}).then(resnew => {
setTableLoading(false); setTableLoading(false);
if (res) { if (resnew.code == 0) {
let res = resnew.data
setDataList(res); setDataList(res);
} }
}) })
...@@ -39,14 +54,37 @@ const SQLServerTable = props => { ...@@ -39,14 +54,37 @@ const SQLServerTable = props => {
// 测试连接 // 测试连接
const handleCon = (val, item) => { const handleCon = (val, item) => {
setTableLoading(true); setTableLoading(true);
getSQLServerConnectionTest({ // getSQLServerConnectionTest({
name: item.name, // name: item.name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setTableLoading(false);
// if (res.success) {
// notification.success({
// message: '提示',
// description: '连接成功',
// duration: 3,
// });
// } else {
// notification.error({
// message: '提示',
// description: res.message || '连接失败',
// duration: 3,
// });
// }
// })
// .catch(err => {
// setTableLoading(false);
// console.error(err);
// });
GetConnTest({
Type:"SQLServer",
name:item.name
}).then(res => {
setTableLoading(false); setTableLoading(false);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
description: '连接成功', description: '连接成功',
...@@ -55,7 +93,7 @@ const SQLServerTable = props => { ...@@ -55,7 +93,7 @@ const SQLServerTable = props => {
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
description: res.message || '连接失败', description: res.msg || '连接失败',
duration: 3, duration: 3,
}); });
} }
...@@ -68,28 +106,46 @@ const SQLServerTable = props => { ...@@ -68,28 +106,46 @@ const SQLServerTable = props => {
// 删除 // 删除
const handleDel = (val, item) => { const handleDel = (val, item) => {
const { name = '' } = item; const { name = '' } = item;
deleteConnString({ // deleteConnString({
name, // name,
_version: 9999, // _version: 9999,
_dc: Date.now(), // _dc: Date.now(),
}) // })
.then(res => { // .then(res => {
// setFlag(flag + 1);
// if (res.success) {
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '删除成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '删除失败',
// });
// }
// })
// .catch(err => console.error(err));
DeleteConnString({
name:name
}).then(res => {
setFlag(flag + 1); setFlag(flag + 1);
if (res.success) { if (res.code == 0) {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除成功', description: res.msg || '删除成功',
}); });
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.message || '删除失败', description: res.msg || '删除失败',
}); });
} }
}) })
.catch(err => console.error(err));
}; };
// 编辑 // 编辑
const handleEdit = (val, item) => { const handleEdit = (val, item) => {
......
...@@ -20,10 +20,14 @@ export const connectionTest = params => ...@@ -20,10 +20,14 @@ export const connectionTest = params =>
// 获取数据库配置信息 // 获取数据库配置信息
export const getDataBaseConfig = params => export const getDataBaseConfig = params =>
get(`${CITY_SERVICE}/OMS.svc/S_GetDataBaseConfig`, params); get(`${CITY_SERVICE}/OMS.svc/S_GetDataBaseConfig`, params);
export const getDataBaseConfigNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetDataBaseConfig`, params)
// 获取数据库连接记录 // 获取数据库连接记录
export const getConnRecord = params => export const getConnRecord = params =>
get(`${CITY_SERVICE}/OMS.svc/S_GetConnRecord`, params); get(`${CITY_SERVICE}/OMS.svc/S_GetConnRecord`, params);
export const getConnRecordNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetConnRecord`, params);
// 测试连接 // 测试连接
export const getConnectionTest = params => export const getConnectionTest = params =>
...@@ -32,6 +36,8 @@ export const getConnectionTest = params => ...@@ -32,6 +36,8 @@ export const getConnectionTest = params =>
// 保存数据库连接 // 保存数据库连接
export const saveConnection = params => export const saveConnection = params =>
get(`${CITY_SERVICE}/OMS.svc/S_SaveConnection`, params); get(`${CITY_SERVICE}/OMS.svc/S_SaveConnection`, params);
export const saveConnectionNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/SaveConnection`, params);
// 获取数据库列表 // 获取数据库列表
...@@ -41,18 +47,26 @@ export const getDataBaseList = params => ...@@ -41,18 +47,26 @@ export const getDataBaseList = params =>
// 数据库初始化 // 数据库初始化
export const initDBv4 = params => export const initDBv4 = params =>
get(`${CITY_SERVICE}/OMS.svc/S_InitDBv4`, params); get(`${CITY_SERVICE}/OMS.svc/S_InitDBv4`, params);
export const initDBv4new = params =>
get(`${PUBLISH_SERVICE}/DBManager/InitDB`, params);
// 更新描述 // 更新描述
export const updateConnDesc = params => export const updateConnDesc = params =>
get(`${CITY_SERVICE}/OMS.svc/S_UpdateConnDesc`, params); get(`${CITY_SERVICE}/OMS.svc/S_UpdateConnDesc`, params);
export const updateConnDescNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/UpdateConnDesc`, params);
// 获取日志 // 获取日志
export const getInitDBLog = params => export const getInitDBLog = params =>
get(`${CITY_SERVICE}/OMS.svc/S_GetInitDBLog`, params); get(`${CITY_SERVICE}/OMS.svc/S_GetInitDBLog`, params);
export const getInitDBLogNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetInitDBLog`, params);
// 删除初始化日志 // 删除初始化日志
export const deleteInitDBLog = params => export const deleteInitDBLog = params =>
get(`${CITY_SERVICE}/OMS.svc/S_DeleteInitDBLog`, params); get(`${CITY_SERVICE}/OMS.svc/S_DeleteInitDBLog`, params);
export const deleteInitDBLogNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/DeleteInitDBLog`, params);
// 修改产品解决方案 // 修改产品解决方案
export const setTableSQLDirName = params => export const setTableSQLDirName = params =>
...@@ -61,6 +75,8 @@ export const setTableSQLDirName = params => ...@@ -61,6 +75,8 @@ export const setTableSQLDirName = params =>
// 删除数据库连接记录 // 删除数据库连接记录
export const deleteConn = params => export const deleteConn = params =>
get(`${CITY_SERVICE}/OMS.svc/S_DeleteConn`, params); get(`${CITY_SERVICE}/OMS.svc/S_DeleteConn`, params);
export const deleteConnNew = params =>
get(`${PUBLISH_SERVICE}/DBManage/DeleteConnection`, params);
/** /**
* *
...@@ -83,10 +99,14 @@ export const changeSolution = params => ...@@ -83,10 +99,14 @@ export const changeSolution = params =>
// 检查数据库表 // 检查数据库表
export const tableCheck = params => export const tableCheck = params =>
get(`${CITY_SERVICE}/OMS.svc/TableCheck`, params); get(`${CITY_SERVICE}/OMS.svc/TableCheck`, params);
export const tableCheckNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/TableCheck`, params);
// 获取数据库升级记录 // 获取数据库升级记录
export const databaseStandardGetLog = params => export const databaseStandardGetLog = params =>
get(`${CITY_SERVICE}/OMS.svc/DatabaseStandard_GetLog`, params); get(`${CITY_SERVICE}/OMS.svc/DatabaseStandard_GetLog`, params);
export const databaseStandardGetLogNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetUpdateDBLog`, params);
// 更新 // 更新
export const updateDateBase = params => export const updateDateBase = params =>
...@@ -164,3 +184,17 @@ export const editMySQLConnString = params => ...@@ -164,3 +184,17 @@ export const editMySQLConnString = params =>
get(`${CITY_SERVICE}/OMS.svc/S_EditMySQLConnString`, params, { get(`${CITY_SERVICE}/OMS.svc/S_EditMySQLConnString`, params, {
timeout: 300000, timeout: 300000,
}); });
export const GetConnString = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetConnString`, params);
export const AddConnString = params =>
get(`${PUBLISH_SERVICE}/DBManager/AddConnString`, params);
export const EditConnString = params =>
get(`${PUBLISH_SERVICE}/DBManager/EditConnString`, params);
export const DeleteConnString = params =>
get(`${PUBLISH_SERVICE}/DBManager/DeleteConnString`, params);
export const GetConnTest = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetConnectionTest`, 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