完善前台

master
lwj 2024-09-02 21:12:33 +08:00
parent f016aaf86b
commit f9cc0e4d04
6 changed files with 888 additions and 376 deletions

View File

@ -41,7 +41,7 @@
"clipboard": "2.0.8",
"core-js": "3.25.3",
"echarts": "5.4.0",
"element-ui": "2.9.1",
"element-ui": "^2.15.14",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",

View File

@ -91,6 +91,15 @@ export function findTableInfoList(){
})
}
export function findTableInfoListAccredit(){
return request({
url: "/source/tableInfo/findTableInfoListAccredit",
method: "get",
})
}
export function findStructureByTableId(id){
return request({
url: "/source/tableInfo/findStruceure/"+id,
@ -99,3 +108,51 @@ export function findStructureByTableId(id){
}
export function findTableValueList(basicId,tableName){
return request({
url: "/source/DataValue/findTableValueList?basicId="+basicId+"&tableName="+tableName,
method: "post",
})
}
export function findAccredit(id){
return request({
url: "/source/accredit/findAccredit?tableId="+id,
method: "get",
})
}
export function findDeptListStatus(tableId,basicId){
return request({
url: "/source/accredit/findDeptListStatus?tableId="+tableId+"&basicId="+basicId,
method: "get",
})
}
export function findUserListStatus(tableId,basicId){
return request({
url: "/source/accredit/findUserListStatus?tableId="+tableId+"&basicId="+basicId,
method: "get",
})
}
export function addMiddle(data){
return request({
url: "/source/accredit/addMiddle",
method: "post",
data :data
})
}
export function remove(data){
return request({
url: "/source/accredit/remove",
method: "post",
data :data
})
}

View File

@ -0,0 +1,168 @@
<template>
<div>
<el-container>
<el-aside width="30%">
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</el-aside>
<el-main>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>资产详情</span>
</div>
<table>
<tr><td>表名称:</td><td>{{ tableBasic.tableName }}</td></tr>
<tr><td>表备注:</td><td>{{ tableBasic.tableRemark }}</td></tr>
<tr><td>数据量:</td><td>{{ tableBasic.dataNum }}</td></tr>
<tr><td>是否核心:</td><td><dict-tag :options="dict.type.yes_no" :value="tableBasic.isCenter"/></td></tr>
</table>
<!-- <el-descriptions class="margin-top" title="带边框列表" :column="2" border>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">表名称</template>-->
<!-- {{ tableBasic.tableName }}-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">表备注</template>-->
<!-- {{ tableBasic.tableRemark }}-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">数据量</template>-->
<!-- {{ tableBasic.dataNum }}-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">是否核心</template>-->
<!-- <dict-tag :options="dict.type.yes_no" :value="tableBasic.isCenter"/>-->
<!-- </el-descriptions-item>-->
<!-- </el-descriptions>-->
</el-card>
<el-card>
<el-table
:data="DataValue"
style="width: 100%">
<el-table-column
prop="key"
label="key"
width="180">
</el-table-column>
<el-table-column
prop="label"
label="label"
width="180">
</el-table-column>
<el-table-column
prop="type"
label="type">
</el-table-column>
<el-table-column
prop="value"
label="value">
</el-table-column>
</el-table>
<!-- <div v-for="data in DataValue">-->
<!-- {{data.key}}-->
<!-- <el-descriptions title="数据" direction="vertical" :column="4" border>-->
<!-- <el-descriptions-item label="用户名">{{data.type}}</el-descriptions-item>-->
<!-- <el-descriptions-item label="手机号">{{data.value}}</el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- </div>-->
</el-card>
</el-main>
</el-container>
</div>
</template>
<script>
//jsjsjson,
//import from ',
import {findTableValueList} from "@/api/etl/switch";
import {findTableInfoListAccredit} from "@/api/etl/switch";
import {findStructureByTableId} from "@/api/etl/switch";
export default {
dicts: ['yes_no'],
//import使"
components: {},
props: {},
data() {
//"
return {
DataValue:[],
data:{
},
defaultProps:{
children:"children",
label:'tableName'
},
tableBasic:{
},
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
findTAbleInfoList(){
findTableInfoListAccredit().then(res=>{
this.data=res.data;
})
},
handleNodeClick(data) {
this.tableBasic=data
if (data.children==null){
findTableValueList(data.basicId,data.tableName).then(res=>{
this.DataValue=res.data;
})
}
console.log(data);
},
},
// - 访this",
created() {
this.findTAbleInfoList();
},
// - 访DOM",
mounted() {
},
beforeCreate() {
}, // - ",
beforeMount() {
}, // - ",
beforeUpdate() {
}, // - ",
updated() {
}, // - ",
beforeDestroy() {
}, // - ",
destroyed() {
}, // - ",
activated() {
} //keep-alive",
};
</script>

View File

@ -11,29 +11,37 @@
<el-main>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>资产模型基本信息</span>
</div>
<el-descriptions class="margin-top" title="带边框列表" :column="2" border>
<el-descriptions-item>
<template slot="label">表名称</template>
{{ tableBasic.tableName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">表备注</template>
{{ tableBasic.tableRemark }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">数据量</template>
{{ tableBasic.dataNum }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">是否核心</template>
<dict-tag :options="dict.type.yes_no" :value="tableBasic.isCenter"/>
</el-descriptions-item>
<table>
<tr><td>表名称:</td><td>{{ tableBasic.tableName }}</td></tr>
<tr><td>表备注:</td><td>{{ tableBasic.tableRemark }}</td></tr>
<tr><td>数据量:</td><td>{{ tableBasic.dataNum }}</td></tr>
<tr><td>是否核心:</td><td><dict-tag :options="dict.type.yes_no" :value="tableBasic.isCenter"/></td></tr>
</table>
</el-descriptions>
<!-- <el-descriptions class="margin-top" title="带边框列表" :column="2" border>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">表名称</template>-->
<!-- {{ tableBasic.tableName }}-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">表备注</template>-->
<!-- {{ tableBasic.tableRemark }}-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">数据量</template>-->
<!-- {{ tableBasic.dataNum }}-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">是否核心</template>-->
<!-- <dict-tag :options="dict.type.yes_no" :value="tableBasic.isCenter"/>-->
<!-- </el-descriptions-item>-->
<!-- </el-descriptions>-->
</el-card>
@ -146,6 +154,4 @@ export default {
} //keep-alive",
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,306 @@
<template>
<div>
<el-container>
<el-aside width="30%">
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</el-aside>
<!-- {-->
<!-- "dataResourceName": "黑鬼",-->
<!-- "dataBaseName": "text",-->
<!-- "tableNameB": "engine_version",-->
<!-- "dataNum": 4,-->
<!-- "tableRemark": "",-->
<!-- "dataSourceSystemName": null-->
<!-- }-->
<el-main>
<el-card class="box-card">
<el-descriptions title="基本信息">
<el-descriptions-item label="数据接入名称">{{tableBasic.dataResourceName}}</el-descriptions-item>
<el-descriptions-item label="系统名称">{{tableBasic.dataSourceSystemName}}</el-descriptions-item>
<el-descriptions-item label="数据库名称">{{tableBasic.dataBaseName}}</el-descriptions-item>
<el-descriptions-item label="表名称">{{tableBasic.tableNameB}}</el-descriptions-item>
<el-descriptions-item label="表中文名称">{{tableBasic.tableRemark}}</el-descriptions-item>
<el-descriptions-item label="数据量">{{tableBasic.dataNum}}</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="部门授权" name="first">
<el-table
v-if="refreshTable"
v-loading="loading"
:data="deptList"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="deptId"
>
<el-table-column label="部门名称" prop="deptName" width="260"></el-table-column>
<el-table-column label="部门负责人" prop="leader" width="200"></el-table-column>
<el-table-column label="邮箱" prop="email" width="200"></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" prop="status" width="200"></el-table-column>
<el-table-column label="状态" width="200">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-color="#13ce66"
inactive-color="#ff4949"
:active-value='0'
:inactive-value='1'
active-text="已授权"
inactive-text="未授权"
@change="updateDeptStatus(scope.row)"
>
</el-switch>
</template>
</el-table-column>-->
</el-table>
</el-tab-pane>
<el-tab-pane label="用户授权" name="second">
<el-table
:data="userList"
>
<el-table-column label="用户名称" prop="userName" width="260"></el-table-column>
<el-table-column label="用户昵称" prop="nickName" width="200"></el-table-column>
<el-table-column label="用户部门" prop="deptName" width="200"></el-table-column>
<el-table-column label="用户邮箱" prop="email" width="200"></el-table-column>
<el-table-column label="用户手机号" prop="phoneNumber" width="200"></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" width="200">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-color="#13ce66"
inactive-color="#ff4949"
:active-value='0'
:inactive-value='1'
@change="updateDeptStatus(scope.row)"
>
</el-switch>
</template>
</el-table-column>-->
</el-table>
</el-tab-pane>
<!-- <el-tab-pane label="用户授权" name="second">-->
<!-- <el-table-->
<!-- v-if="refreshTable"-->
<!-- v-loading="loading"-->
<!-- :data="deptList"-->
<!-- :default-expand-all="isExpandAll"-->
<!-- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"-->
<!-- row-key="deptId"-->
<!-- >-->
<!-- <el-table-column label="用户名称" prop="deptName" width="260"></el-table-column>-->
<!-- <el-table-column label="用户昵称" prop="orderNum" width="200"></el-table-column>-->
<!-- <el-table-column label="用户名称" prop="orderNum" width="200"></el-table-column>-->
<!-- <el-table-column label="用户部门" prop="orderNum" width="200"></el-table-column>-->
<!-- <el-table-column label="用户邮箱" prop="orderNum" width="200"></el-table-column>-->
<!-- <el-table-column label="用户手机号" prop="orderNum" width="200"></el-table-column>-->
<!-- <el-table-column label="创建时间" prop="orderNum" width="200"></el-table-column>-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.status"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- active-value="0"-->
<!-- inactive-value="1">-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table>-->
<!-- </el-tab-pane>-->
</el-tabs>
</el-card>
</el-main>
</el-container>
</div>
</template>
<script>
//jsjsjson,
//import from ',
import {findDeptListStatus, findTableValueList, findUserListStatus} from "@/api/etl/switch";
import {findTableInfoList} from "@/api/etl/switch";
import {findAccredit} from "@/api/etl/switch";
import {addMiddle} from "@/api/etl/switch";
import {remove} from "@/api/etl/switch";
import {shouldAdd} from "script-ext-html-webpack-plugin/lib/custom-attributes";
// import {findStructureByTableId} from "@/api/etl/switch";
export default {
dicts: ['yes_no'],
//import使"
components: {},
props: {},
data() {
//"
return {
accredit:{
deptId:'',
basicId:'',
tableId:'',
userId:'',
},
userList:[
],
activeName: 'first',
//
refreshTable: true,
//
isExpandAll: true,
//
loading: true,
//
deptList:[
],
DataValue:[],
data:{
},
defaultProps:{
children:"children",
label:'tableName'
},
tableBasic:{
},
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
updateDeptStatus(row){
this.accredit.deptId=row.deptId
this.accredit.userId=row.userId
if (row.status===0){
addMiddle(this.accredit).then(res=>{
if (res.code===200){
alert("授权成功")
}
})
}
if (row.status===1){
remove(this.accredit).then(res=>{
if (res.code===200){
alert("取消授权成功")
}
})
}
console.log(row);
},
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
handleClick(tab, event) {
console.log(tab, event);
},
findTAbleInfoList(){
findTableInfoList().then(res=>{
this.data=res.data;
})
},
handleNodeClick(data) {
this.accredit.tableId = data.id;
this.accredit.basicId = data.basicId;
this.loading = true;
// if (data.children==null){
findDeptListStatus(data.id, data.basicId).then(res => {
this.deptList = this.handleTree(res.data, "deptId");
this.loading = false;
})
findUserListStatus(data.id, data.basicId).then(res => {
this.userList = res.data;
})
findAccredit(data.id).then(res => {
this.tableBasic = res;
})
// }
console.log(data);
},
},
// - 访this",
created() {
this.findTAbleInfoList();
},
// - 访DOM",
mounted() {
},
beforeCreate() {
}, // - ",
beforeMount() {
}, // - ",
beforeUpdate() {
}, // - ",
updated() {
}, // - ",
beforeDestroy() {
}, // - ",
destroyed() {
}, // - ",
activated() {
} //keep-alive",
};
</script>

View File

@ -1,114 +1,197 @@
<template>
<div>
<el-form label-width="80px" :model="SourceReq" ref="queryForm" :inline="true" class="demo-form-inline" size="small">
<el-form-item label="数据源名称">
<el-input v-model="SourceReq.dataResourceName"></el-input>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="数据来源名称" prop="name">
<el-input
v-model="queryParams.dataSourcesSystemName"
clearable
placeholder="请输入数据来源名称"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数据来源系统名称">
<el-input v-model="SourceReq.dataSourcesSystemName"></el-input>
<el-form-item label="存放数据库名称" prop="databaseName">
<el-input
v-model="queryParams.databaseName"
clearable
placeholder="请输入存放数据库名称"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数据库名称">
<el-input v-model="SourceReq.databaseName"></el-input>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
<el-button @click="findSelectSourceList()">
查询
</el-button>
</el-form>
<el-button
v-hasPermi="['tool:gen:import']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="findSelectSourceExport"
>导出
</el-button>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-hasPermi="['system:post:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- v-hasPermi="['system:post:remove']"-->
<!-- :disabled="multiple"-->
<!-- icon="el-icon-delete"-->
<!-- plain-->
<!-- size="mini"-->
<!-- type="danger"-->
<!-- @click="handleDelete"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
v-hasPermi="['system:post:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="name" label="数据来源名称" prop="dataSourcesSystemName"/>
<el-table-column align="ip" label="数据来源地址" prop="host"/>
<el-table-column align="port" label="来源地址端口号" prop="port"/>
<el-table-column align="type" label="数据接入类型" prop="databaseType"/>
<el-table-column align="databaseName" label="存放数据库名称" prop="databaseName"/>
<el-table-column align="center" label="是否初始化" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.yes_no" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:post:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
<el-button
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="insertAdd()"
>新增
</el-button>
<el-button
icon="el-icon-caret-right"
size="mini"
type="text"
@click="connectDataSources(scope.row)"
>测试
</el-button>
<el-button
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="deleteSourceByIds()"
>删除
</el-button>
<el-button
v-hasPermi="['system:post:remove']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:post:remove']"
icon="el-icon-paperclip"
size="mini"
type="text"
@click="syncAssetStructure(scope.row)"
>同步资产结构
</el-button>
<el-dialog title="title" :visible.sync="dialogFormVisible" append-to-body width="60%">
</template>
</el-table-column>
</el-table>
<el-form ref="sourceAddReq" :model="sourceAddReq" :rules="rules" label-width="140px" :inline="true" class="demo-form-inline">
<el-form-item label="接入源名称">
<el-input v-model="sourceAddReq.dataResourceName"></el-input>
</el-form-item>
<el-form-item label="数据来源系统名称">
<el-input v-model="sourceAddReq.dataSourcesSystemName"></el-input>
</el-form-item>
<el-form-item label="主机地址">
<el-input v-model="sourceAddReq.host"></el-input>
</el-form-item>
<el-form-item label="主机端口">
<el-input v-model="sourceAddReq.port"></el-input>
</el-form-item>
<el-form-item label="数据接入类型">
<el-input v-model="sourceAddReq.databaseType"></el-input>
</el-form-item>
<el-form-item label="数据库名称">
<el-input v-model="sourceAddReq.databaseName"></el-input>
</el-form-item>
<el-form-item label="数据库用户">
<el-input v-model="sourceAddReq.username"></el-input>
</el-form-item>
<el-form-item label="数据库密码">
<el-input v-model="sourceAddReq.password"></el-input>
</el-form-item>
<el-form-item label="数据连接参数">
<el-input v-model="sourceAddReq.connectionParams"></el-input>
</el-form-item>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改岗位对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="60%">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true" class="demo-form-inline">
<el-form-item label="接入来源系统名称" prop="dataSourcesSystemName">
<el-input v-model="form.dataSourcesSystemName" placeholder="请输入数据来源系统名称"/>
</el-form-item>
<el-form-item label="ip" prop="host">
<el-input v-model="form.host" placeholder="请输入ip"/>
</el-form-item>
<el-form-item label="port" prop="port">
<el-input v-model="form.port" placeholder="请输入port"/>
</el-form-item>
<el-form-item label="type" prop="databaseType">
<el-select v-model="form.databaseType" placeholder="请选择类型">
<el-option label="mysql" value="mysql"></el-option>
<el-option label="redis" value="redis"></el-option>
<el-option label="oracle" value="oracle"></el-option>
</el-select>
</el-form-item>
<el-form-item label="数据库名称" prop="databaseName">
<el-input v-model="form.databaseName" placeholder="请输入数据库名称"/>
</el-form-item>
<el-form-item label="userName" prop="username">
<el-input v-model="form.username" placeholder="请输入数据库用户"/>
</el-form-item>
<el-form-item label="userPwd" prop="password">
<el-input v-model="form.password" placeholder="请输入数据库密码"/>
</el-form-item>
</el-form>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>数据连接参数</span>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="80px" >
<el-form-item label="数据连接参数" prop="name">
<el-input v-model="form.connectionParams" placeholder="请输入数据连接参数"/>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>连接池配置</span>
</div>
<el-form :model="sourceAddReq" label-width="120px" :inline="true" class="demo-form-inline">
<el-form-item label="初始连接数量:" prop="initCount">
<el-input v-model="sourceAddReq.initLinkNum" placeholder="初始连接数量"/>
<el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true" class="demo-form-inline">
<el-form-item label="初始连接数量" prop="initCount">
<el-input v-model="form.initLinkNum" placeholder="初始连接数量"/>
</el-form-item>
<el-form-item label="最大连接数量:" prop="maxCount">
<el-input v-model="sourceAddReq.maxLinkNum" placeholder="最大连接数量"/>
<el-form-item label="最大连接数量" prop="maxCount">
<el-input v-model="form.maxLinkNum" placeholder="最大连接数量"/>
</el-form-item>
<el-form-item label="最大等待时间:" prop="maxTime">
<el-input v-model="sourceAddReq.maxWaitTime" placeholder="最大等待时间"/>
<el-form-item label="最大等待时间" prop="maxTime">
<el-input v-model="form.maxWaitTime" placeholder="最大等待时间"/>
</el-form-item>
<el-form-item label="最大等待次数:" prop="maxFrequency">
<el-input v-model="sourceAddReq.maxWaitTimes" placeholder="最大等待次数"/>
<el-form-item label="最大等待次数" prop="initCount">
<el-input v-model="form.maxWaitTimes" placeholder="最大等待次数"/>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>其他信息</span>
</div>
<el-form :model="sourceAddReq" label-width="140px" :inline="true" class="demo-form-inline">
<el-form-item label="是否初始化" prop="status">
<el-radio-group v-model="sourceAddReq.status">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true" class="demo-form-inline">
<el-form-item label="是否初始化" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.yes_no"
:key="dict.value"
@ -117,303 +200,195 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注">
<el-input type="textarea" v-model="sourceAddReq.remark"></el-input>
<el-form-item label="备注">
<el-input type="textarea" v-model="form.remark"></el-input>
</el-form-item>
</el-form>
</el-card>
<div slot="footer" class="dialog-footer">
<el-button @click="textP()"></el-button>
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addSource()"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-table
:data="source"
style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="接入源名称"
prop="dataResourceName">
</el-table-column>
<el-table-column
label="数据来源系统名称"
prop="dataSourcesSystemName">
</el-table-column>
<el-table-column
label="主机地址"
prop="host">
</el-table-column>
<el-table-column
label="端口号"
prop="port">
</el-table-column>
<el-table-column
label="数据接入类型"
prop="databaseType">
</el-table-column>
<el-table-column
label="数据库名称"
prop="databaseName">
</el-table-column>
<el-table-column align="status" label="是否初始化" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.yes_no" :value="scope.row.status"/>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- label="是否初始化"-->
<!-- prop="status">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.yes_no" :value="scope.row.status"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
label="备注"
prop="remark">
</el-table-column>
<el-table-column
align="right">
<template slot-scope="scope">
<el-button
icon="el-icon-pear"
size="mini"
type="text"
@click="update(scope.row)">修改</el-button>
<el-button
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)">删除</el-button>
<el-button
icon="el-icon-service"
size="mini"
type="text"
@click="struceure(scope.row)">同步资产结构</el-button>
<el-button
icon="el-icon-aim"
size="mini"
type="text"
@click="textConnect(scope.row)">测试连接</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
//jsjsjson,
//import from ',
import {selectSourceList, update} from "@/api/etl/switch";
import {connectionTest} from "@/api/etl/switch";
import {insertAdd} from "@/api/etl/switch";
import {deleteSource} from "@/api/etl/switch";
import {getInfo} from "@/api/etl/switch";
import {structure} from "@/api/etl/switch";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
selectSourceList,
insertAdd,
connectDataSources,
deleteDataSourcesById,
syncAssetStructure, update, getInfo, connectionTest, structure, deleteSource
} from "@/api/etl/switch";
export default {
dicts: ['yes_no', 'sys_normal_disable'],
//import使"
components: {
},
props: {},
name: "switch",
dicts: ['sys_normal_disable','yes_no'],
data() {
//"
return {
sourceAddReq:{
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dataList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: undefined,
databaseName: undefined
},
//
form: {},
//
rules: {
dataResourceName: [{required: true, message: "接入源名称不能为空", trigger: "blur"}],
dataSourcesSystemName: [{required: true, message: "数据来源系统名称不能为空", trigger: "blur"}],
host: [{required: true, message: "主机地址不能为空", trigger: "blur"}]
},
ids:[],
dialogFormVisible:false,
SourceReq:{
},
source:[],
dataSourcesSystemName: [{required: true, message: "数据来源名称不能为空", trigger: "blur"}],
host: [{required: true, message: "数据来源ip不能为空", trigger: "blur"}],
port: [{required: true, message: "来源地址端口号不能为空", trigger: "blur"}],
databaseType: [{required: true, message: "类型不能为空", trigger: "change"}],
initLinkNum: [{required: true, message: "初始连接数量不能为空", trigger: "blur"}],
maxLinkNum: [{required: true, message: "最大连接数量不能为空", trigger: "blur"}],
maxWaitTime: [{required: true, message: "最大等待时间不能为空", trigger: "blur"}],
maxWaitTimes: [{required: true, message: "最大等待次数不能为空", trigger: "blur"}],
status: [{required: true, message: "是否初始化不能为空", trigger: "change"}],
}
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
reset() {
this.sourceAddReq = {
};
this.resetForm("sourceAddReq");
},
//
update(row){
this.reset();
getInfo(row.id).then(res=>{
this.sourceAddReq=res.data;
this.dialogFormVisible=true;
this.title="修改岗位"
})
},
struceure(row){
structure(row).then(res=>{
if (res.code ===200){
alert("同步资产成功,请查询数据库")
}
})
},
deleteSourceByIds(){
deleteSource(this.ids).then(res=>{
if(res.code===200){
alert("删除成功");
}
})
},
handleDelete(row){
deleteSource(row.id).then(res=>{
if (res.code===200){
location.reload();
}
})
},
textP(){
connectionTest(this.sourceAddReq).then(res=>{
if (res.code===200){
alert("测试连接成功")
}else{
alert("连接失败")
}
})
},
addSource: function (){
this.$refs["sourceAddReq"].validate(valid=> {
if (valid){
if (this.sourceAddReq.id!=undefined){
update(this.sourceAddReq).then(res=>{
if (res.code===200){
alert("修改成功")
location.reload();
}
})
}else {
insertAdd(this.sourceAddReq).then(res=>{
if(res.code===200){
alert("添加成功")
location.reload();
}
})
}
}
});
},
//
textConnect(row){
connectionTest(row).then(res=>{
if (res.code===200){
alert("测试连接成功");
}else {
alert("测试连接失败");
}
})
},
//
insertAdd(){
this.reset();
this.dialogFormVisible=true
},
findSelectSourceList(){
selectSourceList(this.SourceReq).then(res=>{
this.source=res.data.rows;
})
},
findSelectSourceExport(){
this.download('source/source/export', {
...this.SourceReq
}, `source_${new Date().getTime()}.xlsx`)
},
handleSelectionChange(row){
this.ids=[];
for (let rowKey in row) {
this.ids.push(row[rowKey].id)
}
},
},
// - 访this",
created() {
this.findSelectSourceList();
this.getList();
},
// - 访DOM",
mounted() {
},
beforeCreate() {
}, // - ",
beforeMount() {
}, // - ",
beforeUpdate() {
}, // - ",
updated() {
}, // - ",
beforeDestroy() {
}, // - ",
destroyed() {
}, // - ",
activated() {
} //keep-alive",
methods: {
syncAssetStructure(row){
connectionTest(row).then((res)=>{
console.log(res)
if (res.code===200){
this.$modal.msgSuccess("同步成功");
}else {
this.$modal.msgError("同步失败");
}
})
},
/** 连接数据源 */
connectDataSources(row){
structure(row).then(res=>{
if (res.code===200){
this.$modal.msgSuccess("连接成功");
}else {
this.$modal.msgError("连接失败");
}
})
},
/** 查询列表 */
getList() {
this.loading = true;
selectSourceList(this.queryParams).then(response => {
this.dataList = response.data.rows;
this.total = response.data.total;
this.loading = false;
console.log(response)
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加岗位";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改岗位";
});
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
alert(this.form.id)
if (this.form.id != undefined) {
update(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
insertAdd(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id || this.ids;
this.$modal.confirm('是否确认删除该数据项?').then(function () {
return deleteSource(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('source/source/export', {
...this.queryParams
}, `post_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped>
</style>