数据资产完善
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) {
|
||||
return request({
|
||||
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) {
|
||||
return request({
|
||||
url: '/etl/source/StructureList',
|
||||
|
|
|
@ -1,76 +1,75 @@
|
|||
<template>
|
||||
<div>
|
||||
<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-submenu :index="source.id" v-for="source in sourceList">
|
||||
<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-tree :data="sourceList" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
|
||||
<el-container>
|
||||
|
||||
<el-main>
|
||||
<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="dialogTableVisible = true">数据结构</el-button>
|
||||
<el-button style="float: right;margin-top: 20px" @click="sql()">查询</el-button>
|
||||
<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">
|
||||
<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-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>
|
||||
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||
//例如: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 {
|
||||
//import引入的组件需要注入到对象中才能使用"
|
||||
components: {},
|
||||
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
dialogTableVisible: false,
|
||||
assetsCompute:{
|
||||
assetsModuleSum: 0,
|
||||
dataModuleSum: 0,
|
||||
dataSourceSum: 0
|
||||
},
|
||||
showAssets: null,
|
||||
title: {},
|
||||
activeName: 'structure',
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
|
@ -84,6 +83,11 @@ export default {
|
|||
assetsList:[],
|
||||
structureList:[],
|
||||
tableAssets:[],
|
||||
defaultProps: {
|
||||
children: 'tableList',
|
||||
label: 'label'
|
||||
},
|
||||
sourceData:{},
|
||||
source: {
|
||||
sql: ''
|
||||
}
|
||||
|
@ -95,31 +99,53 @@ export default {
|
|||
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(){
|
||||
structureList(this.source).then(res => {
|
||||
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() {
|
||||
this.loading = true;
|
||||
this.assetsCompute={
|
||||
assetsModuleSum: 0,
|
||||
dataModuleSum: 0,
|
||||
dataSourceSum: 0
|
||||
}
|
||||
listSource(this.queryParams).then(response => {
|
||||
this.sourceList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
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() {
|
||||
|
|
|
@ -86,13 +86,20 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="testConnection(scope.row)"
|
||||
>测试连接</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"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="synchronousData(scope.row)"
|
||||
>同步资产</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
|
||||
size="mini"
|
||||
type="text"
|
||||
|
@ -256,8 +263,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {listSource, getSource, delSource, addSource, updateSource, testConnection} from "@/api/etl/source";
|
||||
import item from '@/layout/components/Sidebar/Item.vue'
|
||||
import { listSource, getSource, delSource, addSource, updateSource, testConnection, synchronousData } from "@/api/etl/source";
|
||||
|
||||
export default {
|
||||
name: "Source",
|
||||
|
@ -338,6 +344,21 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
synchronousData(data) {
|
||||
synchronousData(data).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message({
|
||||
message: "同步成功",
|
||||
type: "success"
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: "同步失败",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加参数
|
||||
addParam(){
|
||||
this.dataSourceParamList.push({
|
||||
|
|
Loading…
Reference in New Issue