feat:(初级) 同步数据结构
parent
4f85ab264c
commit
b51ae0cbe2
|
@ -61,6 +61,7 @@ export function assetsList(data) {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
export function structureList(data) {
|
||||
return request({
|
||||
url: '/kvt/jdbc/StructureList',
|
||||
|
@ -68,3 +69,38 @@ export function structureList(data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function structure(data) {
|
||||
return request({
|
||||
url: '/kvt/jdbc/getDataBig',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
|
||||
|
||||
export function dataAssetList(data) {
|
||||
return request({
|
||||
url: '/kvt/jdbc/dataAsseList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function assetModelList(data) {
|
||||
return request({
|
||||
url: '/kvt/jdbc/assrtModelList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function synchronousData(data) {
|
||||
return request({
|
||||
url: '/etl/source/SynchronousData',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<template>
|
||||
<<<<<<< HEAD
|
||||
<div>
|
||||
<el-container style="height: 80%; border: 1px solid #eee">
|
||||
<el-aside width="300px" style="background-color: rgb(238, 241, 246)">
|
||||
|
@ -124,11 +125,169 @@ export default {
|
|||
activated() {
|
||||
} //如果页面有keep-alive缓存功能,这个函数会触发",
|
||||
}
|
||||
=======
|
||||
<div>
|
||||
<el-container style="height: 80%; border: 1px solid #eee">
|
||||
<el-aside width="400px" style="background-color: rgb(238, 241, 246)">
|
||||
<el-menu :default-openeds="['1', '3']">
|
||||
<el-tree :data="sourceList" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
|
||||
<el-container>
|
||||
|
||||
<el-main style="height: 100%">
|
||||
<el-tabs v-model="activeName">
|
||||
<el-tab-pane label="资产结构" name="structure">
|
||||
<OverallAssets v-if="showAssets == null" :assets-compute="assetsCompute"/>
|
||||
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/>
|
||||
<overall-asset-structure v-if="showAssets === 'dataTable'" :title="title"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="资产数据" name="data">
|
||||
<el-card style="height: 280px">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>查询语句</span>
|
||||
</div>
|
||||
<el-input type="textarea" v-model="source.sql" style="width: 1080px;" :rows="6"></el-input>
|
||||
<el-button style="float: right;margin-top: 20px" @click="sql()">查询</el-button>
|
||||
|
||||
</el-card>
|
||||
<br>
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>数据资产</span>
|
||||
</div>
|
||||
<el-table :data="structureList" v-if="structureList!=null">
|
||||
<el-table-column v-for="(assets,index) in assetsList" :label="index+' ('+assets+')'" width="140">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row[index].value}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||
//例如:import 《组件名称》 from '《组件路径》,
|
||||
|
||||
|
||||
import {dataAssetList, listJdbc} from "@/api/kvt/jdbc";
|
||||
|
||||
export default {
|
||||
//import引入的组件需要注入到对象中才能使用"
|
||||
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
assetsCompute:{
|
||||
assetsModuleSum: 0,
|
||||
dataModuleSum: 0,
|
||||
dataSourceSum: 0
|
||||
},
|
||||
showAssets: null,
|
||||
title: {},
|
||||
activeName: 'structure',
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
dataSourceName: null,
|
||||
linkAddress: null
|
||||
},
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 【请填写功能名称】表格数据
|
||||
sourceList: [],
|
||||
assetsList:[],
|
||||
structureList:[],
|
||||
tableAssets:[],
|
||||
defaultProps: {
|
||||
children: 'tableList',
|
||||
label: 'label'
|
||||
},
|
||||
sourceData:{},
|
||||
source: {
|
||||
sql: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
//计算属性 类似于data概念",
|
||||
computed: {},
|
||||
//监控data中的数据变化",
|
||||
watch: {},
|
||||
//方法集合",
|
||||
methods: {
|
||||
test(data){
|
||||
this.sourceData = data
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
if (data.dataType === 'dataSource'){
|
||||
dataAssetList(data).then(res => {
|
||||
res.data.forEach(table => {
|
||||
table.dataType = "dataTable"
|
||||
table.label=table.tableName+"-"+table.tableComment+"("+table.tableCount+"条)"
|
||||
})
|
||||
data.tableList = res.data
|
||||
this.sourceList[this.sourceList.indexOf(data)].tableList = res.data
|
||||
this.title = data
|
||||
})
|
||||
|
||||
}else{
|
||||
this.title= data
|
||||
}
|
||||
this.showAssets = data.dataType
|
||||
},
|
||||
sql(){
|
||||
listJdbc(this.source).then(res => {
|
||||
this.structureList = res.data.kvtList
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
this.assetsCompute={
|
||||
assetsModuleSum: 0,
|
||||
dataModuleSum: 0,
|
||||
dataSourceSum: 0
|
||||
}
|
||||
listJdbc(this.queryParams).then(response => {
|
||||
this.sourceList = response.data.rows;
|
||||
console.log(this.sourceList)
|
||||
this.sourceList.forEach(source => {
|
||||
source.label=source.dataSourceName+'('+source.databaseName+'-'+source.systemName+')'
|
||||
source.dataType = 'dataSource'
|
||||
if (source.tableList!=null){
|
||||
source.tableList.forEach(table => {
|
||||
table.label = table.tableName+'-'+table.tableComment+'('+table.tableCount+'条)'
|
||||
table.dataType = 'dataTable'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.total = response.data.total;
|
||||
});
|
||||
}
|
||||
},
|
||||
//生命周期 - 创建完成(可以访问当前this实例)",
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
//生命周期 - 挂载完成(可以访问DOM元素)",
|
||||
mounted() {
|
||||
>>>>>>> f5eb707 (feat:(初级) 同步数据结构)
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
el-header {
|
||||
<<<<<<< HEAD
|
||||
background-color: #B3C0D1;
|
||||
color: #333;
|
||||
line-height: 60px;
|
||||
|
@ -136,5 +295,14 @@ el-header {
|
|||
|
||||
el-aside {
|
||||
color: #333;
|
||||
=======
|
||||
background-color: #B3C0D1;
|
||||
color: #333;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
el-aside {
|
||||
color: #333;
|
||||
>>>>>>> f5eb707 (feat:(初级) 同步数据结构)
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -86,7 +86,18 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="testConnection(scope.row)"
|
||||
<<<<<<< HEAD
|
||||
>测试连接</el-button><el-button
|
||||
=======
|
||||
>测试连接</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="synchronousData(scope.row)"
|
||||
>同步资产</el-button>
|
||||
<el-button
|
||||
>>>>>>> f5eb707 (feat:(初级) 同步数据结构)
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
|
@ -257,7 +268,11 @@
|
|||
|
||||
<script>
|
||||
|
||||
<<<<<<< HEAD
|
||||
import {addJdbc, delJdbc, getJdbc, listJdbc, textConn} from "@/api/kvt/jdbc";
|
||||
=======
|
||||
import {addJdbc, delJdbc, getJdbc, listJdbc, synchronousData, textConn} from "@/api/kvt/jdbc";
|
||||
>>>>>>> f5eb707 (feat:(初级) 同步数据结构)
|
||||
|
||||
export default {
|
||||
name: "Source",
|
||||
|
@ -338,6 +353,21 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//同步
|
||||
synchronousData(data){
|
||||
synchronousData(data).then(res=>{
|
||||
if (res.code===200){
|
||||
this.$message({message:"同步成功",type:"success"})
|
||||
}else {
|
||||
this.$message({message:"同步失败",type:"error"})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
>>>>>>> f5eb707 (feat:(初级) 同步数据结构)
|
||||
// 添加参数
|
||||
addParam(){
|
||||
this.dataSourceParamList.push({
|
||||
|
|
|
@ -1 +1,180 @@
|
|||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>资产模型基本信息</span>
|
||||
</div>
|
||||
<el-descriptions border :column="2">
|
||||
<el-descriptions-item label="表名称">{{title.tableName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="表备注">{{title.tableComment}}</el-descriptions-item>
|
||||
<el-descriptions-item label="数据量">{{title.tableCount}}</el-descriptions-item>
|
||||
<el-descriptions-item label="是否核心">
|
||||
<el-tag size="small">是</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
<el-card style=" margin-top: 20px;">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>资产模型详细信息</span>
|
||||
</div>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%;">
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="comment" label="注释" />
|
||||
<el-table-column prop="isPrimaryKey" label="是否主键" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" :type="scope.row.isPrimaryKey === 'Y' ? 'success' : ''">
|
||||
{{scope.row.isPrimaryKey}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="类型" />
|
||||
<el-table-column prop="mappingType" label="映射类型" />
|
||||
<el-table-column prop="length" label="长度" />
|
||||
<el-table-column prop="decimalPlaces" label="小数位" />
|
||||
<el-table-column prop="isNull" label="是否为空" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" :type="scope.row.isNull === 'Y' ? 'success' : 'danger'">
|
||||
{{scope.row.isNull}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="defaultValue" label="默认值" />
|
||||
<el-table-column prop="isDict" label="是否字典" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.isDict === 'Y'" size="small" type="success">
|
||||
{{scope.row.isDict}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dictKey" label="映射字典" >
|
||||
<template slot-scope="scope">
|
||||
<el-popover
|
||||
v-if="scope.row.isDict === 'Y'"
|
||||
placement="left"
|
||||
width="200"
|
||||
trigger="hover">
|
||||
<el-table :data="[
|
||||
{ label: '男', value: '1' },
|
||||
{ label: '女', value: '2' },
|
||||
{ label: '未知', value: '0' },
|
||||
]">
|
||||
<el-table-column property="label" label="字典标签"/>
|
||||
<el-table-column property="value" label="字典值"/>
|
||||
</el-table>
|
||||
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="操作" >
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
|
||||
import {assetModelList} from "@/api/kvt/jdbc";
|
||||
|
||||
export default {
|
||||
name: 'OverallAssetStructure',
|
||||
watch:{
|
||||
'title': {
|
||||
handler(val) {
|
||||
console.log(val)
|
||||
assetModelList(val).then(res => {
|
||||
this.tableData = res.data
|
||||
})
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [
|
||||
{
|
||||
id: 1,
|
||||
name: "id",
|
||||
comment: "主键",
|
||||
isPrimaryKey: "Y",
|
||||
type: "bigint",
|
||||
mappingType: "Long",
|
||||
length: "-",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, {
|
||||
id: 2,
|
||||
name: "name",
|
||||
comment: "姓名",
|
||||
isPrimaryKey: "N",
|
||||
type: "varchar",
|
||||
mappingType: "String",
|
||||
length: "64",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, {
|
||||
id: 3,
|
||||
name: "sex",
|
||||
comment: "性别",
|
||||
isPrimaryKey: "N",
|
||||
type: "char",
|
||||
mappingType: "String",
|
||||
length: "1",
|
||||
decimalPlaces: "-",
|
||||
isNull: "N",
|
||||
defaultValue: "-",
|
||||
isDict: "Y",
|
||||
dictKey: "system_sex",
|
||||
}, {
|
||||
id: 4,
|
||||
name: "price",
|
||||
comment: "金额",
|
||||
isPrimaryKey: "N",
|
||||
type: "double",
|
||||
mappingType: "BigDecimal",
|
||||
length: "10",
|
||||
decimalPlaces: "2",
|
||||
isNull: "N",
|
||||
defaultValue: "0.00",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, {
|
||||
id: 5,
|
||||
name: "create_time",
|
||||
comment: "创建时间",
|
||||
isPrimaryKey: "N",
|
||||
type: "datetime",
|
||||
mappingType: "Date",
|
||||
length: "-",
|
||||
decimalPlaces: "-",
|
||||
isNull: "Y",
|
||||
defaultValue: "-",
|
||||
isDict: "N",
|
||||
dictKey: "-",
|
||||
}, ]
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
>>>>>>> f5eb707 (feat:(初级) 同步数据结构)
|
||||
|
|
Loading…
Reference in New Issue