Compare commits

...

2 Commits

Author SHA1 Message Date
20300 61d5f4b1e3 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/views/dataAssets/assetStructure/dashboard/OverallAssetStructure.vue
#	src/views/dataAssets/assetStructure/dashboard/OverallAssets.vue
#	src/views/dataAssets/assetStructure/dashboard/OverallSpecificAssets.vue
#	src/views/dataAssets/assetStructure/index.vue
#	src/views/dataAssets/dataAccess/index.vue
2024-04-24 15:14:50 +08:00
20300 6e34b1e2d0 feat(DataManagerService): 数据同步功能 2024-04-24 15:13:29 +08:00
6 changed files with 207 additions and 126 deletions

16
src/api/assets.js 100644
View File

@ -0,0 +1,16 @@
import request from '@/utils/request'
export function getAssetsModelListByTableIds(ids) {
return request({
url: '/data/assets/getAssetsModelList',
method: 'post',
data: ids
})
}
export function getAssetsModelByDataTableId(id) {
return request({
url: '/data/assets/getAssetsModelByDataTableId?id='+id,
method: 'get'
})
}

View File

@ -5,9 +5,9 @@
<span>资产模型基本信息</span> <span>资产模型基本信息</span>
</div> </div>
<el-descriptions border :column="2"> <el-descriptions border :column="2">
<el-descriptions-item label="表名称">sys_user</el-descriptions-item> <el-descriptions-item label="表名称">{{ tableInfo.tableName }}</el-descriptions-item>
<el-descriptions-item label="表备注">用户表</el-descriptions-item> <el-descriptions-item label="表备注">{{tableInfo.tableAnnotation}}</el-descriptions-item>
<el-descriptions-item label="数据量">12536</el-descriptions-item> <el-descriptions-item label="数据量">{{ tableInfo.recordCount }}</el-descriptions-item>
<el-descriptions-item label="是否核心"> <el-descriptions-item label="是否核心">
<el-tag size="small"></el-tag> <el-tag size="small"></el-tag>
</el-descriptions-item> </el-descriptions-item>
@ -18,40 +18,40 @@
<span>资产模型详细信息</span> <span>资产模型详细信息</span>
</div> </div>
<el-table <el-table
:data="tableData" :data="assetsModelList"
style="width: 100%;"> style="width: 100%;">
<el-table-column prop="name" label="名称" /> <el-table-column prop="fieldsName" label="名称" />
<el-table-column prop="comment" label="注释" /> <el-table-column prop="fieldsAnnotation" label="注释" />
<el-table-column prop="isPrimaryKey" label="是否主键" > <el-table-column prop="isDictionary" label="是否主键" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="small" :type="scope.row.isPrimaryKey === 'Y' ? 'success' : ''"> <el-tag size="small" :type="scope.row.isDictionary === 1 ? 'success' : ''">
{{scope.row.isPrimaryKey}} {{scope.row.isDictionary}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="type" label="类型" /> <el-table-column prop="baseType" label="类型" />
<el-table-column prop="mappingType" label="映射类型" /> <el-table-column prop="javaType" label="映射类型" />
<el-table-column prop="length" label="长度" /> <el-table-column prop="fieldsLength" label="长度" />
<el-table-column prop="decimalPlaces" label="小数位" /> <el-table-column prop="decimalPlace" label="小数位" />
<el-table-column prop="isNull" label="是否为空" > <el-table-column prop="isEmpty" label="是否为空" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="small" :type="scope.row.isNull === 'Y' ? 'success' : 'danger'"> <el-tag size="small" :type="scope.row.isNull === 1 ? 'success' : 'danger'">
{{scope.row.isNull}} {{scope.row.isEmpty}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="defaultValue" label="默认值" /> <el-table-column prop="defaultValue" label="默认值" />
<el-table-column prop="isDict" label="是否字典" > <el-table-column prop="isDict" label="是否字典" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.isDict === 'Y'" size="small" type="success"> <el-tag v-if="scope.row.isDictionary === 1" size="small" type="success">
{{scope.row.isDict}} {{scope.row.isDictionary}}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="dictKey" label="映射字典" > <el-table-column prop="reflectionDictionary" label="映射字典" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
v-if="scope.row.isDict === 'Y'" v-if="scope.row.isDictionary === 1"
placement="left" placement="left"
width="200" width="200"
trigger="hover"> trigger="hover">
@ -80,8 +80,11 @@
export default { export default {
name: 'OverallAssetStructure', name: 'OverallAssetStructure',
props: { props: {
tableData: { assetsModelList: {
type: Array type: Array
},
tableInfo: {
type: Object
} }
}, },
data() { data() {

View File

@ -12,7 +12,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
数据接入 数据接入
</div> </div>
<count-to :duration="2600" :end-val="4" :start-val="0" class="card-panel-num"/> <count-to :duration="2600" :end-val="dataSourceCount" :start-val="0" class="card-panel-num"/>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -25,7 +25,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
资产模型 资产模型
</div> </div>
<count-to :duration="3000" :end-val="96" :start-val="0" class="card-panel-num"/> <count-to :duration="3000" :end-val="allTableCount" :start-val="0" class="card-panel-num"/>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -38,7 +38,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
数据模型 数据模型
</div> </div>
<count-to :duration="3200" :end-val="560" :start-val="0" class="card-panel-num"/> <count-to :duration="3200" :end-val="allDataModelCount" :start-val="0" class="card-panel-num"/>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -49,6 +49,17 @@
import CountTo from 'vue-count-to' import CountTo from 'vue-count-to'
export default { export default {
props: {
dataSourceCount: {
type :Number
},
allTableCount: {
type :Number
},
allDataModelCount: {
type :Number
}
},
components: { components: {
CountTo CountTo
}, },

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
<div class="title-header"> <div class="title-header">
{{title}} - 资产结构概述 {{dataSourceObj.dataSource.fromSystem}} - 资产结构概述
</div> </div>
<el-col :sm="12" :xs="12" class="card-panel-col"> <el-col :sm="12" :xs="12" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')"> <div class="card-panel" @click="handleSetLineChartData('messages')">
@ -12,7 +12,7 @@
<div class="card-panel-text"> <div class="card-panel-text">
资产模型 资产模型
</div> </div>
<count-to :duration="3000" :end-val="15" :start-val="0" class="card-panel-num"/> <count-to :duration="3000" :end-val="dataSourceObj.dataSource.tableCount" :start-val="0" class="card-panel-num"/>
</div> </div>
</div> </div>
</el-col> </el-col>
@ -25,16 +25,90 @@
<div class="card-panel-text"> <div class="card-panel-text">
数据模型 数据模型
</div> </div>
<count-to :duration="3200" :end-val="230" :start-val="0" class="card-panel-num"/> <count-to :duration="3200" :end-val="dataSourceObj.dataSource.dataModelCount" :start-val="0" class="card-panel-num"/>
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :span="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>基础字典</span>
<el-popover
placement="top-start"
title="基础字典"
width="200"
trigger="hover"
content="这个字典是数据资产项目当中的字典内容,而不是本项目当中的字典内容。主要作用为数据清洗过程中数据字典映射作用">
<i class="el-icon-question" slot="reference"></i>
</el-popover>
<el-popover
placement="right"
width="400"
trigger="click">
<el-row :gutter="20">
<el-col :span="18">
<el-input v-model="dictAddName"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="addDict"></el-button>
</el-col>
</el-row>
<el-button style="float: right; padding: 3px 0" type="text" slot="reference">新增字典</el-button>
</el-popover>
</div>
<el-row :gutter="20">
<el-col v-for="(val,key) in dictMap" :md="8" :sm="24" :xs="12">
<el-card class="box-card" style="height: 300px">
<div slot="header" class="clearfix">
<span>{{key}}</span>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="val.push({ label: null, val: null, isEdit: true })"
>新增</el-button>
</div>
<el-table :data="val" style="width: 100%" height="280px">
<el-table-column prop="label" label="标签">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{scope.row.label}}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.label" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="值">
<template slot-scope="scope">
<span v-if="!scope.row.isEdit">{{scope.row.val}}</span>
<el-input v-if="scope.row.isEdit" v-model="scope.row.val" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="操作">
<template slot-scope="scope">
<el-button
v-if="!scope.row.isEdit"
size="mini"
type="text"
icon="el-icon-edit"
@click="scope.row.isEdit = true"
>修改</el-button>
<el-button
v-if="scope.row.isEdit"
@click="editConfirm(scope.row)"
size="mini"
type="text"
icon="el-icon-finished"
>确定</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-tabs v-model="activeName" type="border-card" > <el-tabs v-model="activeName" type="border-card" >
<el-tab-pane label="sys_user(用户表)" name="first"> <el-tab-pane :label="assetsModelResp.dataTable.tableName" :key="assetsModelResp.dataTable.id" v-for="assetsModelResp in assetsModelRespArrayList">
<overall-asset-structure/> <overall-asset-structure :tableInfo="assetsModelResp.dataTable" :assetsModelList="assetsModelResp.assetsModelList" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="sys_dept(部门表)" name="second">sys_dept(部门表)</el-tab-pane>
</el-tabs> </el-tabs>
</el-col> </el-col>
</el-row> </el-row>
@ -47,13 +121,27 @@ import OverallAssetStructure from './OverallAssetStructure.vue'
export default { export default {
props: { props: {
title: { dataSourceObj: {
type: String, type: Object
default: "-" },
assetsModelRespArrayList: {
type: Array
} }
}, },
data() { data() {
return { return {
dictAddName: null,
dictMap: {
"性别(system_sex)": [
{ label: '男', val: '1', isEdit: false },
{ label: '女', val: '2', isEdit: false },
{ label: '未知', val: '0', isEdit: false },
],
"开关(system_y_n)": [
{ label: '是', val: '1', isEdit: false },
{ label: '否', val: '0', isEdit: false }
],
},
activeName: 'first', activeName: 'first',
} }
}, },
@ -64,7 +152,15 @@ export default {
methods: { methods: {
handleSetLineChartData(type) { handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type) this.$emit('handleSetLineChartData', type)
},
addDict(){
if (!this.dictAddName){
this.$message.error('数据字典,不可为空');
return;
} }
this.dictMap[this.dictAddName] = []
this.dictAddName = null
},
} }
} }
</script> </script>

View File

@ -8,16 +8,16 @@
@node-click="(data) => showAssets=data.type" @node-click="(data) => showAssets=data.type"
:props="defaultProps"> :props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }"> <div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 'dataSource'">{{ data.name + '('+data.dataSourceDatabaseName + '-' + data.fromSystem+')' }}</div> <div @click="getNowDataSource(data)" v-if="data.type === 'dataSource'">{{ data.dataSource.name + '('+data.dataSource.dataSourceDatabaseName + '-' + data.dataSource.fromSystem+')' }}</div>
<div @click="getTableStructure(data)" v-if="data.type === 'dataTable'">{{ data.tableName + '-'+data.dataAnnotation + '(' + data.dataCount+')' }}</div> <div @click="getTableStructure(data)" v-if="data.type === 'dataTable'">{{ data.dataTable.tableName + '-'+data.dataTable.tableAnnotation + '(' + data.dataTable.recordCount+')' }}</div>
</div> </div>
</el-tree> </el-tree>
</el-aside> </el-aside>
<el-container> <el-container>
<el-main> <el-main>
<OverallAssets v-if="showAssets == null"/> <OverallAssets :dataSourceCount="dataSourceCount" :allTableCount="allTableCount" :allDataModelCount="allDataModelCount" v-if="showAssets == null"/>
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/> <overall-specific-assets :dataSourceObj="dataSourceObj" :assetsModelRespArrayList="assetsModelRespArrayList" v-if="showAssets === 'dataSource'" :title="title"/>
<overall-asset-structure :tableData="tableData" v-if="showAssets === 'dataTable'" :title="title"/> <overall-asset-structure :tableInfo="tableInfo" :assetsModelList="assetsModelList" v-if="showAssets === 'dataTable'" :title="title"/>
</el-main> </el-main>
</el-container> </el-container>
</el-container> </el-container>
@ -27,80 +27,23 @@ import OverallAssets from './dashboard/OverallAssets.vue'
import OverallSpecificAssets from './dashboard/OverallSpecificAssets.vue' import OverallSpecificAssets from './dashboard/OverallSpecificAssets.vue'
import OverallAssetStructure from './dashboard/OverallAssetStructure.vue' import OverallAssetStructure from './dashboard/OverallAssetStructure.vue'
import {queryBigStructure, queryTableStructure} from "@/api/data"; import {queryBigStructure, queryTableStructure} from "@/api/data";
import {getAssetsModelByDataTableId, getAssetsModelListByTableIds} from "@/api/assets";
export default { export default {
name: 'assetStructure', name: 'assetStructure',
components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets }, components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets },
data() { data() {
return { return {
tableInfo: {},
assetsModelList: [],
dataSourceObj: null,
tableCount:0,
dataModelCount:0,
dataSourceCount: 0,
allTableCount: 0,
allDataModelCount: 0,
dataBaseConnectObj: {}, dataBaseConnectObj: {},
tableData: [ 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: "-",
}, ],
mainHeight: window.innerHeight - 85, mainHeight: window.innerHeight - 85,
defaultProps: { defaultProps: {
children: 'childrenList', children: 'childrenList',
@ -109,31 +52,44 @@ export default {
assetStructureList: [], assetStructureList: [],
childrenList: [], childrenList: [],
showAssets: null, showAssets: null,
title: null title: null,
tableIds: [],
assetsModelRespArrayList: []
} }
}, },
methods: { methods: {
getTableStructure(data) { getNowDataSource(data) {
this.assetStructureList.forEach(asset => { console.log(data)
asset.tableInfoList.forEach(tableInfo => { this.tableIds = data.dataTableList.map(dataTable => dataTable.dataTable.id);
if (tableInfo == data){ console.log("idList",this.tableIds)
this.dataBaseConnectObj = asset getAssetsModelListByTableIds(this.tableIds).then(
}
})
})
this.dataBaseConnectObj.tableName = data.tableName
console.log("数据库连接对象:",this.dataBaseConnectObj)
queryTableStructure(this.dataBaseConnectObj).then(
res => { res => {
console.log(res) this.assetsModelRespArrayList = res.data
console.log("this.assetsModelRespArrayList",this.assetsModelRespArrayList)
}
)
this.dataSourceObj = data
},
getTableStructure(data) {
console.log(data.dataTable.id)
getAssetsModelByDataTableId(data.dataTable.id).then(
res => {
console.log("根据表ID",res.data)
this.assetsModelList = res.data.assetsModelList
this.tableInfo = res.data.dataTable
console.log(this.tableInfo)
} }
) )
}, },
getBigStructure() { getBigStructure() {
queryBigStructure().then( queryBigStructure().then(
res => { res => {
this.assetStructureList = res.data this.assetStructureList = res.data.dataSourceDecorationList
console.log("BigStructure",res.data) this.dataSourceCount = this.assetStructureList.length
this.allTableCount = res.data.allTableCount
this.allDataModelCount = res.data.allDataModelCount
console.log("BigStructure",this.assetStructureList)
this.assetsModelList = this.assetStructureList
} }
) )
}, },
@ -142,13 +98,13 @@ export default {
if (node.level > 1) return resolve([]); if (node.level > 1) return resolve([]);
const {data} = node; const {data} = node;
if (data.type === 'dataSource') { if (data.type === 'dataSource') {
this.title = data.name + '('+data.dataSourceDatabaseName + '-' + data.fromSystem+')' this.title = data.name + '('+data.dataSource.dataSourceDatabaseName + '-' + data.dataSource.fromSystem+')'
} }
if (data.type === 'dataTable') { if (data.type === 'dataTable') {
this.title = data.tableName + '('+data.dataAnnotation + '-' + data.dataCount+')' this.title = data.tableName + '('+data.dataTable.tableAnnotation + '-' + data.dataTable.recordCount+')'
} }
setTimeout(() => { setTimeout(() => {
resolve(data.tableInfoList) resolve(data.dataTableList)
this.showAuth = data.type; this.showAuth = data.type;
}, 500); }, 500);
} }

View File

@ -540,7 +540,6 @@ export default {
}else { }else {
this.$message.error(res.msg) this.$message.error(res.msg)
} }
} }
) )
console.log("test:",row) console.log("test:",row)