Commit 32ec6209 authored by mayongxin's avatar mayongxin

数据库管理接口替换

parent faa1c9e6
Pipeline #26926 skipped with stages
This diff is collapsed.
......@@ -13,8 +13,10 @@ import PageContainer from '@/components/BasePageContainer';
import styles from './ManagementDataBase.less';
import {
tableCheck,
tableCheckNew,
updateDateBase,
databaseStandardGetLog,
databaseStandardGetLogNew
} from '@/services/database/api';
const ManagementDataBase = () => {
......@@ -31,22 +33,47 @@ const ManagementDataBase = () => {
// 检查数据库表
useEffect(() => {
setCheckLoading(true);
tableCheck({
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
// tableCheck({
// _version: 9999,
// _dc: new Date().getTime(),
// })
// .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);
console.log(res);
if (res.sucess) {
const { list, messageList } = res;
console.log(resnew);
if (resnew.code == 0) {
let res = resnew.data
const { Autolist, ManualList } = res;
// 自动检测列表
let arr = list.map((item, index) => {
let arr = Autolist.map((item, index) => {
item.key = index;
return item;
});
// 手动检查列表
let arr2 = messageList.map((item, index) => {
let arr2 = ManualList.map((item, index) => {
item.key = index;
return item;
});
......@@ -62,13 +89,30 @@ const ManagementDataBase = () => {
// 获取数据库升级记录
useEffect(() => {
setLogLoading(true);
databaseStandardGetLog({
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
// databaseStandardGetLog({
// _version: 9999,
// _dc: new Date().getTime(),
// })
// .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);
if (res) {
if (resnew.code == 0) {
let res = resnew.data.list
let arr = [];
res.map((item, index) => {
item.key = index;
......@@ -116,6 +160,16 @@ const ManagementDataBase = () => {
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) => {
setModalTitle(val);
let arr = [];
......@@ -150,74 +204,74 @@ const ManagementDataBase = () => {
const checkColumns = [
{
title: '表名称',
dataIndex: 'tableName',
key: 'tableName',
dataIndex: 'TableName',
key: 'TableName',
width: 200,
ellipsis: true,
},
{
title: '差异比较',
dataIndex: 'message',
key: 'message',
dataIndex: 'Message',
key: 'Message',
ellipsis: true,
},
];
const logColumns = [
{
title: '登录名',
dataIndex: 'updateBy',
key: 'updateBy',
dataIndex: 'UpdateBy',
key: 'UpdateBy',
width: 200,
ellipsis: true,
},
{
title: '数据库名称',
dataIndex: 'name',
key: 'name',
dataIndex: 'Name',
key: 'Name',
width: 200,
ellipsis: true,
},
{
title: '解决方案',
dataIndex: 'solutionName',
key: 'solutionName',
width: 200,
ellipsis: true,
},
{
title: '数据库版本',
dataIndex: 'version',
key: 'version',
dataIndex: 'DbProductName',
key: 'DbProductName',
width: 200,
ellipsis: true,
},
// {
// title: '数据库版本',
// dataIndex: 'Version',
// key: 'Version',
// width: 200,
// ellipsis: true,
// },
{
title: '升级时间',
dataIndex: 'updateTime',
key: 'updateTime',
dataIndex: 'UpdateTime',
key: 'UpdateTime',
width: 200,
ellipsis: true,
},
// {
// title: '版本日志',
// dataIndex: 'Oklog',
// key: 'Oklog',
// render: text => (
// <Button
// size="small"
// disabled={!text}
// onClick={() => {
// handleLog(text, '版本日志');
// }}
// >
// 日志
// </Button>
// ),
// },
{
title: '版本日志',
dataIndex: 'despersion',
key: 'despersion',
render: text => (
<Button
size="small"
disabled={!text}
onClick={() => {
handleLog(text, '版本日志');
}}
>
日志
</Button>
),
},
{
title: '升级内容',
dataIndex: 'content',
key: 'content',
title: '成功日志',
dataIndex: 'Oklog',
key: 'Oklog',
ellipsis: true,
render: text => (
<Button
......@@ -231,6 +285,28 @@ const ManagementDataBase = () => {
</Button>
),
},
{
title: '错误日志',
dataIndex: 'Errlog',
key: 'Errlog',
ellipsis: true,
render: text => {
if (text.length > 0) {
return (
<Button
size="small"
type="primary"
onClick={() => {
handleLog(text, '详细信息');
}}
style={{ backgroundColor: "red" }}
>
错误内容
</Button>
)
}
},
},
];
return (
......@@ -268,17 +344,6 @@ const ManagementDataBase = () => {
</div>
</Spin>
</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}>
<div className={styles.tableTitle}>
手动修复
......@@ -293,6 +358,18 @@ const ManagementDataBase = () => {
size="small"
/>
</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>
<Modal
......
......@@ -5,6 +5,9 @@ import {
getMongoDBConnString,
deleteConnString,
getMongoDBConnectionTest,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api';
import AddModal from './AddModal';
const MongDBTable = props => {
......@@ -17,19 +20,31 @@ const MongDBTable = props => {
useEffect(() => {
setTableLoading(true);
getMongoDBConnString({
_version: 9999,
_dc: Date.now(),
// getMongoDBConnString({
// _version: 9999,
// _dc: Date.now(),
// })
// .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"MongoDB"
}).then(resnew => {
setTableLoading(false);
if (resnew.code == 0) {
let res = resnew.data
setDataList(res);
}
})
.then(res => {
setTableLoading(false);
if (res) {
setDataList(res);
}
})
.catch(err => {
setTableLoading(false);
});
.catch(err => {
setTableLoading(false);
});
}, [flag]);
// 新增
const handleAdd = (val, item) => {
......@@ -39,57 +54,99 @@ const MongDBTable = props => {
// 测试连接
const handleCon = (val, item) => {
setTableLoading(true);
getMongoDBConnectionTest({
name: item.name,
_version: 9999,
_dc: Date.now(),
// getMongoDBConnectionTest({
// name: item.name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.code == 0) {
notification.success({
message: '提示',
description: '连接成功',
duration: 3,
});
} else {
notification.error({
message: '提示',
description: res.msg || '连接失败',
duration: 3,
});
}
})
.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);
});
.catch(err => {
setTableLoading(false);
console.error(err);
});
};
// 删除
const handleDel = (val, item) => {
const { name = '' } = item;
deleteConnString({
name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// deleteConnString({
// name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
duration: 3,
description: res.message || '删除成功',
description: res.msg || '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || '删除失败',
description: res.msg || '删除失败',
});
}
})
.catch(err => console.error(err));
};
// 编辑
const handleEdit = (val, item) => {
......
......@@ -5,6 +5,9 @@ import {
getMySQLConnString,
getMySQLConnectionTest,
deleteConnString,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api';
import AddModal from './AddModal';
const MySQLTable = props => {
......@@ -17,13 +20,25 @@ const MySQLTable = props => {
useEffect(() => {
setTableLoading(true);
getMySQLConnString({
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// getMySQLConnString({
// _version: 9999,
// _dc: Date.now(),
// })
// .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"MySQL"
}).then(resnew => {
setTableLoading(false);
if (res) {
if (resnew.code == 0) {
let res = resnew.data
setDataList(res);
}
})
......@@ -39,14 +54,37 @@ const MySQLTable = props => {
// 测试连接
const handleCon = (val, item) => {
setTableLoading(true);
getMySQLConnectionTest({
name: item.name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// getMySQLConnectionTest({
// name: item.name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
description: '连接成功',
......@@ -55,8 +93,8 @@ const MySQLTable = props => {
} else {
notification.error({
message: '提示',
description: res.message || '连接失败',
duration: 15,
description: res.msg || '连接失败',
duration: 3,
});
}
})
......@@ -68,28 +106,46 @@ const MySQLTable = props => {
// 删除
const handleDel = (val, item) => {
const { name = '' } = item;
deleteConnString({
name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// deleteConnString({
// name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
duration: 3,
description: res.message || '删除成功',
description: res.msg || '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || '删除失败',
description: res.msg || '删除失败',
});
}
})
.catch(err => console.error(err));
};
// 编辑
const handleEdit = (val, item) => {
......
......@@ -5,6 +5,9 @@ import {
getOracleConnString,
getOracleConnectionTest,
deleteConnString,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api';
import AddModal from './AddModal';
const OracleTable = props => {
......@@ -17,13 +20,25 @@ const OracleTable = props => {
useEffect(() => {
setTableLoading(true);
getOracleConnString({
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// getOracleConnString({
// _version: 9999,
// _dc: Date.now(),
// })
// .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"Oracle"
}).then(resnew => {
setTableLoading(false);
if (res) {
if (resnew.code == 0) {
let res = resnew.data
setDataList(res);
}
})
......@@ -39,14 +54,37 @@ const OracleTable = props => {
// 测试连接
const handleCon = (val, item) => {
setTableLoading(true);
getOracleConnectionTest({
name: item.name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// getOracleConnectionTest({
// name: item.name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
description: '连接成功',
......@@ -55,7 +93,7 @@ const OracleTable = props => {
} else {
notification.error({
message: '提示',
description: res.message || '连接失败',
description: res.msg || '连接失败',
duration: 3,
});
}
......@@ -68,28 +106,46 @@ const OracleTable = props => {
// 删除
const handleDel = (val, item) => {
const { name = '' } = item;
deleteConnString({
name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// deleteConnString({
// name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
duration: 3,
description: res.message || '删除成功',
description: res.msg || '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || '删除失败',
description: res.msg || '删除失败',
});
}
})
.catch(err => console.error(err));
};
// 编辑
const handleEdit = (val, item) => {
......
......@@ -5,6 +5,9 @@ import {
getSQLServerConnString,
deleteConnString,
getSQLServerConnectionTest,
GetConnString,
DeleteConnString,
GetConnTest
} from '@/services/database/api';
import AddModal from './AddModal';
const SQLServerTable = props => {
......@@ -17,13 +20,25 @@ const SQLServerTable = props => {
useEffect(() => {
setTableLoading(true);
getSQLServerConnString({
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// getSQLServerConnString({
// _version: 9999,
// _dc: Date.now(),
// })
// .then(res => {
// setTableLoading(false);
// if (res) {
// setDataList(res);
// }
// })
// .catch(err => {
// setTableLoading(false);
// });
GetConnString({
Type:"SQLServer"
}).then(resnew => {
setTableLoading(false);
if (res) {
if (resnew.code == 0) {
let res = resnew.data
setDataList(res);
}
})
......@@ -39,14 +54,37 @@ const SQLServerTable = props => {
// 测试连接
const handleCon = (val, item) => {
setTableLoading(true);
getSQLServerConnectionTest({
name: item.name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// getSQLServerConnectionTest({
// name: item.name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
description: '连接成功',
......@@ -55,7 +93,7 @@ const SQLServerTable = props => {
} else {
notification.error({
message: '提示',
description: res.message || '连接失败',
description: res.msg || '连接失败',
duration: 3,
});
}
......@@ -68,28 +106,46 @@ const SQLServerTable = props => {
// 删除
const handleDel = (val, item) => {
const { name = '' } = item;
deleteConnString({
name,
_version: 9999,
_dc: Date.now(),
})
.then(res => {
// deleteConnString({
// name,
// _version: 9999,
// _dc: Date.now(),
// })
// .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);
if (res.success) {
if (res.code == 0) {
notification.success({
message: '提示',
duration: 3,
description: res.message || '删除成功',
description: res.msg || '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || '删除失败',
description: res.msg || '删除失败',
});
}
})
.catch(err => console.error(err));
};
// 编辑
const handleEdit = (val, item) => {
......
......@@ -20,10 +20,14 @@ export const connectionTest = params =>
// 获取数据库配置信息
export const getDataBaseConfig = params =>
get(`${CITY_SERVICE}/OMS.svc/S_GetDataBaseConfig`, params);
export const getDataBaseConfigNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetDataBaseConfig`, params)
// 获取数据库连接记录
export const getConnRecord = params =>
get(`${CITY_SERVICE}/OMS.svc/S_GetConnRecord`, params);
export const getConnRecordNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetConnRecord`, params);
// 测试连接
export const getConnectionTest = params =>
......@@ -32,6 +36,8 @@ export const getConnectionTest = params =>
// 保存数据库连接
export const 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 =>
// 数据库初始化
export const initDBv4 = params =>
get(`${CITY_SERVICE}/OMS.svc/S_InitDBv4`, params);
export const initDBv4new = params =>
get(`${PUBLISH_SERVICE}/DBManager/InitDB`, params);
// 更新描述
export const updateConnDesc = params =>
get(`${CITY_SERVICE}/OMS.svc/S_UpdateConnDesc`, params);
export const updateConnDescNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/UpdateConnDesc`, params);
// 获取日志
export const getInitDBLog = params =>
get(`${CITY_SERVICE}/OMS.svc/S_GetInitDBLog`, params);
export const getInitDBLogNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetInitDBLog`, params);
// 删除初始化日志
export const deleteInitDBLog = params =>
get(`${CITY_SERVICE}/OMS.svc/S_DeleteInitDBLog`, params);
export const deleteInitDBLogNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/DeleteInitDBLog`, params);
// 修改产品解决方案
export const setTableSQLDirName = params =>
......@@ -61,6 +75,8 @@ export const setTableSQLDirName = params =>
// 删除数据库连接记录
export const 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 =>
// 检查数据库表
export const tableCheck = params =>
get(`${CITY_SERVICE}/OMS.svc/TableCheck`, params);
export const tableCheckNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/TableCheck`, params);
// 获取数据库升级记录
export const databaseStandardGetLog = params =>
get(`${CITY_SERVICE}/OMS.svc/DatabaseStandard_GetLog`, params);
export const databaseStandardGetLogNew = params =>
get(`${PUBLISH_SERVICE}/DBManager/GetUpdateDBLog`, params);
// 更新
export const updateDateBase = params =>
......@@ -164,3 +184,17 @@ export const editMySQLConnString = params =>
get(`${CITY_SERVICE}/OMS.svc/S_EditMySQLConnString`, params, {
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