添加测试连接功能
parent
3c3c125516
commit
fc1208cc82
|
@ -8,6 +8,14 @@ export function listSource(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
// 测试连接
|
||||
export function testConnection(data) {
|
||||
return request({
|
||||
url: '/source/source/test',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询数据源详细
|
||||
export function getSource(id) {
|
||||
|
|
|
@ -97,6 +97,12 @@
|
|||
<el-table-column label="数据库名称" align="center" prop="databaseName" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-link"
|
||||
@click="handleConnect(scope.row)"
|
||||
>测试连接</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
@ -111,6 +117,7 @@
|
|||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['source:source:remove']"
|
||||
>删除</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -178,7 +185,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listSource, getSource, delSource, addSource, updateSource } from "@/api/source/source";
|
||||
import {listSource, getSource, delSource, addSource, updateSource, testConnection} from "@/api/source/source";
|
||||
|
||||
export default {
|
||||
name: "Source",
|
||||
|
@ -279,6 +286,17 @@ export default {
|
|||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handleConnect(dataSource) {
|
||||
testConnection(dataSource).then(res => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
this.$message.success(res.msg)
|
||||
this.getList()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
|
|
Loading…
Reference in New Issue