数据资产完善
parent
b638518aff
commit
d1b4c668f7
|
@ -9,6 +9,22 @@ export function listSource(query) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function dataAssetList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/source/DataAssetList',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function assetModelList(data) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/source/AssetModelList',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function assetsList(data) {
|
export function assetsList(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/etl/source/AssetsList',
|
url: '/etl/source/AssetsList',
|
||||||
|
@ -17,6 +33,14 @@ export function assetsList(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function synchronousData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/etl/source/SynchronousData',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function structureList(data) {
|
export function structureList(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/etl/source/StructureList',
|
url: '/etl/source/StructureList',
|
||||||
|
|
|
@ -1,76 +1,75 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-container style="height: 80%; border: 1px solid #eee">
|
<el-container style="height: 80%; border: 1px solid #eee">
|
||||||
<el-aside width="300px" style="background-color: rgb(238, 241, 246)">
|
<el-aside width="400px" style="background-color: rgb(238, 241, 246)">
|
||||||
<el-menu :default-openeds="['1', '3']">
|
<el-menu :default-openeds="['1', '3']">
|
||||||
<el-submenu :index="source.id" v-for="source in sourceList">
|
<el-tree :data="sourceList" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
|
||||||
<template slot="title"><i class="el-icon-message"></i>{{source.dataSourceName}}</template>
|
|
||||||
<el-menu-item-group>
|
|
||||||
<template v-if="source.tableList==null" slot="title">连接失败或数据库中没有表</template>
|
|
||||||
<el-menu-item v-for="(tableName,index) in source.tableList" :index="source.id-index" @click="selectAssets(source,tableName)">{{tableName}}</el-menu-item>
|
|
||||||
</el-menu-item-group>
|
|
||||||
</el-submenu>
|
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
|
||||||
<el-container>
|
<el-container>
|
||||||
|
|
||||||
<el-main>
|
<el-main style="height: 100%">
|
||||||
<el-card style="height: 280px">
|
<el-tabs v-model="activeName">
|
||||||
<div slot="header" class="clearfix">
|
<el-tab-pane label="资产结构" name="structure">
|
||||||
<span>查询语句</span>
|
<OverallAssets v-if="showAssets == null" :assets-compute="assetsCompute"/>
|
||||||
</div>
|
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/>
|
||||||
<el-input type="textarea" v-model="source.sql" style="width: 1080px;" :rows="6"></el-input>
|
<overall-asset-structure v-if="showAssets === 'dataTable'" :title="title"/>
|
||||||
<el-button style="float: right;margin-top: 20px" @click="dialogTableVisible = true">数据结构</el-button>
|
</el-tab-pane>
|
||||||
<el-button style="float: right;margin-top: 20px" @click="sql()">查询</el-button>
|
<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>
|
</el-card>
|
||||||
<br>
|
<br>
|
||||||
<el-card>
|
<el-card>
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>数据资产</span>
|
<span>数据资产</span>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="structureList">
|
<el-table :data="structureList" v-if="structureList!=null">
|
||||||
<el-table-column v-for="(assets,index) in assetsList" :label="index+' ('+assets+')'" width="140">
|
<el-table-column v-for="(assets,index) in assetsList" :label="index+' ('+assets+')'" width="140">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row[index].value}}
|
{{scope.row[index].value}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
||||||
<el-dialog title="数据结构" :visible.sync="dialogTableVisible">
|
|
||||||
<el-table :data="tableAssets">
|
|
||||||
<el-table-column property="field" label="字段名" width="150"></el-table-column>
|
|
||||||
<el-table-column property="type" label="类型" width="150"></el-table-column>
|
|
||||||
<el-table-column property="null" label="是否为空" width="150"></el-table-column>
|
|
||||||
<el-table-column property="key" label="键" width="150"></el-table-column>
|
|
||||||
<el-table-column property="default" label="默认值" width="150"></el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="dialogTableVisible = false">取 消</el-button>
|
|
||||||
<el-button type="primary" @click="dialogTableVisible = false">确 定</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||||
//例如:import 《组件名称》 from '《组件路径》,
|
//例如:import 《组件名称》 from '《组件路径》,
|
||||||
import {assetsList, listSource, structureList} from "@/api/etl/source";
|
import {assetModelList, assetsList, dataAssetList, listSource, structureList} from "@/api/etl/source";
|
||||||
|
import OverallAssets from "@/views/etl/assets/dashboard/OverallAssets.vue";
|
||||||
|
import OverallSpecificAssets from "@/views/etl/assets/dashboard/OverallSpecificAssets.vue";
|
||||||
|
import OverallAssetStructure from "@/views/etl/assets/dashboard/OverallAssetStructure.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
//import引入的组件需要注入到对象中才能使用"
|
//import引入的组件需要注入到对象中才能使用"
|
||||||
components: {},
|
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets},
|
||||||
props: {},
|
props: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogTableVisible: false,
|
assetsCompute:{
|
||||||
|
assetsModuleSum: 0,
|
||||||
|
dataModuleSum: 0,
|
||||||
|
dataSourceSum: 0
|
||||||
|
},
|
||||||
|
showAssets: null,
|
||||||
|
title: {},
|
||||||
|
activeName: 'structure',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -84,6 +83,11 @@ export default {
|
||||||
assetsList:[],
|
assetsList:[],
|
||||||
structureList:[],
|
structureList:[],
|
||||||
tableAssets:[],
|
tableAssets:[],
|
||||||
|
defaultProps: {
|
||||||
|
children: 'tableList',
|
||||||
|
label: 'label'
|
||||||
|
},
|
||||||
|
sourceData:{},
|
||||||
source: {
|
source: {
|
||||||
sql: ''
|
sql: ''
|
||||||
}
|
}
|
||||||
|
@ -95,31 +99,53 @@ export default {
|
||||||
watch: {},
|
watch: {},
|
||||||
//方法集合",
|
//方法集合",
|
||||||
methods: {
|
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(){
|
sql(){
|
||||||
structureList(this.source).then(res => {
|
structureList(this.source).then(res => {
|
||||||
this.structureList = res.data.kvtList
|
this.structureList = res.data.kvtList
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
selectAssets(source,tableName) {
|
|
||||||
this.structureList = []
|
|
||||||
this.assetsList = []
|
|
||||||
this.source.sql=''
|
|
||||||
source.tableName = tableName
|
|
||||||
this.source = source
|
|
||||||
assetsList(source).then(res => {
|
|
||||||
console.log(res)
|
|
||||||
this.assetsList = res.data.structure
|
|
||||||
this.tableAssets = res.data.tableAssets
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.assetsCompute={
|
||||||
|
assetsModuleSum: 0,
|
||||||
|
dataModuleSum: 0,
|
||||||
|
dataSourceSum: 0
|
||||||
|
}
|
||||||
listSource(this.queryParams).then(response => {
|
listSource(this.queryParams).then(response => {
|
||||||
this.sourceList = response.data.rows;
|
this.sourceList = response.data.rows;
|
||||||
this.total = response.data.total;
|
|
||||||
console.log(this.sourceList)
|
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实例)",
|
//生命周期 - 创建完成(可以访问当前this实例)",
|
||||||
created() {
|
created() {
|
||||||
|
|
|
@ -86,13 +86,20 @@
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="testConnection(scope.row)"
|
@click="testConnection(scope.row)"
|
||||||
>测试连接</el-button><el-button
|
>测试连接</el-button>
|
||||||
size="mini"
|
<el-button
|
||||||
type="text"
|
size="mini"
|
||||||
icon="el-icon-edit"
|
type="text"
|
||||||
@click="handleUpdate(scope.row)"
|
icon="el-icon-edit"
|
||||||
v-hasPermi="['system:source:edit']"
|
@click="synchronousData(scope.row)"
|
||||||
>修改</el-button>
|
>同步资产</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:source:edit']"
|
||||||
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -256,8 +263,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {listSource, getSource, delSource, addSource, updateSource, testConnection} from "@/api/etl/source";
|
import { listSource, getSource, delSource, addSource, updateSource, testConnection, synchronousData } from "@/api/etl/source";
|
||||||
import item from '@/layout/components/Sidebar/Item.vue'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Source",
|
name: "Source",
|
||||||
|
@ -338,6 +344,21 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
synchronousData(data) {
|
||||||
|
synchronousData(data).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message({
|
||||||
|
message: "同步成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
message: "同步失败",
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 添加参数
|
// 添加参数
|
||||||
addParam(){
|
addParam(){
|
||||||
this.dataSourceParamList.push({
|
this.dataSourceParamList.push({
|
||||||
|
|
Loading…
Reference in New Issue