feat:数据授权

master_fei
Yunfei Du 2024-05-03 16:01:42 +08:00
parent 7a77754b15
commit 6b6063da8a
18 changed files with 1411 additions and 1140 deletions

View File

@ -0,0 +1,30 @@
import request from '@/utils/request'
// 根据表id查询授权信息
export function getAssetAccreditByDataAssetId(id) {
return request({
url: '/dataSource/assetAccredit/GetAssetAccreditByDataAssetId?id='+id,
method: 'get'
})
}
// 新增【请填写功能名称】
export function addAssetAccredit(data) {
return request({
url: '/dataSource/assetAccredit',
method: 'post',
data: data
})
}
// 新增【请填写功能名称】
export function deleteAssetAccreditByAssetIds(data) {
return request({
url: '/dataSource/assetAccredit/DeleteAssetAccreditByAssetIds',
method: 'post',
data: data
})
}

View File

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

View File

@ -0,0 +1,21 @@
import request from '@/utils/request'
// 新增【请填写功能名称】
export function addData(data) {
return request({
url: '/dataSource/data/insert',
method: 'post',
data: data
})
}
// 修改【请填写功能名称】
export function updateData(data) {
return request({
url: '/dataSource/data/update',
method: 'post',
data: data
})
}

View File

@ -1,24 +1,28 @@
import request from '@/utils/request'
export function getDictionaryRespByDataSourceId(id) {
// 根据key删除字典详细
export function deleteDictionary(id) {
return request({
url: '/dataSource/dict/getDictionaryByDataSourceId?dataSourceId='+id,
url: '/dataSource/dictionary/DeleteDictionary?id=' + id,
method: 'get'
})
}
export function insertDictionary(dictionary) {
// 新增【请填写功能名称】
export function addDictionary(data) {
return request({
url: '/dataSource/dict/insertDictionary',
url: '/dataSource/dictionary',
method: 'post',
data: dictionary
data: data
})
}
export function insertDictionaryInfo(dictionaryInfo) {
export function getDictionaryList(id) {
return request({
url: '/dataSource/dict/insertDictionarySelect',
method: 'post',
data: dictionaryInfo
url: '/dataSource/dictionary/GetDictionaryList?dataSourceId=' + id,
method: 'get'
})
}

View File

@ -1,63 +1,109 @@
import request from '@/utils/request'
export function getDataSourceList(dataSourceQueryReq) {
// 查询【请填写功能名称】列表
export function listSource(query) {
return request({
url: '/dataSource/source/getDataSourceList',
url: '/dataSource/source/list',
method: 'post',
data: dataSourceQueryReq
data: query
})
}
export function getAllDataType() {
export function statisticsInfo(){
return request({
url: '/dataSource/dataType/getAllDataType',
url: '/dataSource/source/Statistics',
method: 'get'
})
}
export function editDataSource(dataSource) {
export function dataAssetList(data) {
return request({
url: '/dataSource/source/editDataSource',
url: '/dataSource/source/DataAssetList',
method: 'post',
data: dataSource
data
})
}
export function dataSynchronization(dataSourceResp) {
export function assetModelList(data) {
return request({
url: '/dataSource/source/dataSynchronization',
url: '/dataSource/source/AssetModelList',
method: 'post',
data: dataSourceResp
data
})
}
export function testConnect(dataSourceResp) {
export function assetsList(data) {
return request({
url: '/dataSource/source/testConnect',
url: '/dataSource/source/AssetsList',
method: 'post',
data: dataSourceResp
data
})
}
export function queryStructure(dataSourceResp) {
export function synchronousData(data) {
return request({
url: '/dataSource/source/queryStructure',
url: '/dataSource/source/SynchronousData',
method: 'post',
data: dataSourceResp
data
})
}
export function queryBigStructure() {
export function structureList(data) {
return request({
url: '/dataSource/source/queryBigStructure',
method: 'post'
url: '/dataSource/source/StructureList',
method: 'post',
data
})
}
export function queryTableStructure(tableStructureQueryReq) {
// 查询【请填写功能名称】详细
export function getSource(id) {
return request({
url: '/dataSource/source/queryTableStructure',
method: 'post',
data: tableStructureQueryReq
url: '/dataSource/source/' + id,
method: 'get'
})
}
// 新增【请填写功能名称】
export function addSource(data) {
return request({
url: '/dataSource/source',
method: 'post',
data: data
})
}
// 测试连接
export function testConnection(data) {
return request({
url: '/dataSource/source/TestConnection',
method: 'post',
data: data
})
}
// 修改【请填写功能名称】
export function updateSource(data) {
return request({
url: '/dataSource/source/handleDelete/id',
method: 'post',
data: data
})
}
// 修改字段数据
export function updateAssetModel(data) {
return request({
url: '/dataSource/model/UpdateAssetModel',
method: 'post',
data: data
})
}
// 删除【请填写功能名称】
export function delSource(id) {
return request({
url: '/dataSource/source/handleDelete' + id,
method: 'get'
})
}

View File

@ -0,0 +1,30 @@
import request from '@/utils/request'
// 根据数据源id查询授权信息
export function getSourceAccreditByDataSourceId(id) {
return request({
url: '/dataSource/sourceAccredit/GetSourceAccreditByDataSourceId?id='+id,
method: 'get'
})
}
// 新增【请填写功能名称】
export function addSourceAccredit(data) {
return request({
url: '/dataSource/sourceAccredit/insertSourceAccredit',
method: 'post',
data: data
})
}
// 新增【请填写功能名称】
export function deleteSourceAccreditBySourceIds(data) {
return request({
url: '/dataSource/sourceAccredit/DeleteSourceAccreditBySourceIds',
method: 'post',
data: data
})
}

View File

@ -5,17 +5,17 @@
<el-row>
<el-col :offset="2" :span="8">
<el-form-item label="数据接入名称" prop="nickName">
<el-input v-model="baseInfo.name" disabled/>
<el-input v-model="title.dataSourceName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="系统名称" prop="userName">
<el-input v-model="baseInfo.systemName" disabled/>
<el-input v-model="title.systemName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="数据库名称" prop="nickName">
<el-input v-model="baseInfo.databaseName" disabled/>
<el-input v-model="title.databaseName" disabled/>
</el-form-item>
</el-col>
</el-row>
@ -44,6 +44,7 @@
<el-switch
style="display: block"
v-model="scope.row.isAuth"
@change="authChange(scope.row)"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
@ -52,7 +53,6 @@
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
</el-tab-pane>
<el-tab-pane label="用户授权" name="user">
<el-table ref="table" v-loading="loading" :data="userList">
@ -67,6 +67,7 @@
<el-switch
style="display: block"
v-model="scope.row.isAuth"
@change="authChange(scope.row)"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
@ -75,7 +76,7 @@
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
<pagination v-show="userQueryParams.total> 0" :limit.sync="userQueryParams.pageSize" :page.sync="userQueryParams.pageNum" :total="userQueryParams.total"/>
</el-tab-pane>
</el-tabs>
</div>
@ -84,262 +85,144 @@
<script>
import { parseTime } from '@/utils/muyu'
import {listDept} from "@/api/system/dept";
import {listUser} from "@/api/system/user";
import {
addAccredit,
addSourceAccredit,
deleteSourceAccreditBySourceIds,
getSourceAccreditByDataSourceId
} from "@/api/dataSource/sourceAccredit";
export default {
watch:{
'title':{
handler(val) {
this.getSourceAccreditByDataSourceId()
},
immediate: true
}
},
props:{
title:{}
},
name: "AuthDataSource",
data() {
return {
//
loading: true,
activeName: "dept",
//
total: 0,
pageNum: 1,
pageSize: 1,
//
userQueryParams: {
pageNum: 1,
pageSize: 10,
total: 0
},
sourceAccreditReq:{
deptIds: null,
userId: null,
dataSourceId: null
},
//
baseInfo: {
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
},
//
deptList: [],
//
userList: []
userList: [],
userAccreditIds: [],
deptAccreditIds: []
};
},
created() {
this.loading = true;
setTimeout(() => this.loading = false, 200)
this.init()
// this.loading = true;
// setTimeout(() => this.loading = false, 200)
},
methods: {
parseTime,
init(){
let response = {
"code": 200,
"msg": "操作成功",
"data": [
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 100,
"parentId": 0,
"ancestors": "0",
"deptName": "muyu牧鱼科技",
"orderNum": 0,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 101,
"parentId": 100,
"ancestors": "0,100",
"deptName": "深圳总公司",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 102,
"parentId": 100,
"ancestors": "0,100",
"deptName": "长沙分公司",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 103,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "研发部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 104,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "市场部门",
"isAuth": true,
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "测试部门",
"orderNum": 3,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 106,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "财务部门",
"orderNum": 4,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 107,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "运维部门",
"orderNum": 5,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 108,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "市场部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 109,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "财务部门",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
recursion(deptInfo){
let ids =[]
ids.push(deptInfo.deptId)
if (deptInfo.children){
deptInfo.children.forEach(item => {
ids.push(item.deptId)
if (item.children){
ids.push(...this.recursion(item))
}
]
})
}
this.deptList = this.handleTree(response.data, "deptId");
this.userList = [
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "管理员",
"userId": 1,
"deptId": 103,
"userName": "admin",
"nickName": "数据处理",
"email": "ry@163.com",
"phonenumber": "15888888888",
"isAuth": true,
"dept": {
"deptName": "研发部门"
}
},
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "测试员",
"userId": 2,
"deptId": 105,
"userName": "ry",
"nickName": "数据处理",
"email": "ry@qq.com",
"phonenumber": "15666666666",
"dept": {
"deptName": "测试部门"
return ids
},
authChange(row) {
this.loading = true
this.sourceAccreditReq={
deptIds:null,
userId: null,
dataSourceId: null
}
if (row.nickName){
this.sourceAccreditReq.userId = row.userId
this.sourceAccreditReq.dataSourceId = this.title.id
}else{
let ids=this.recursion(row)
const uniqueIds = [...new Set(ids)];
this.sourceAccreditReq.deptIds = uniqueIds
this.sourceAccreditReq.dataSourceId = this.title.id
}
if (row.isAuth){
addSourceAccredit(this.sourceAccreditReq).then(res => {
this.getSourceAccreditByDataSourceId()
})
}else{
deleteSourceAccreditBySourceIds(this.sourceAccreditReq).then(res => {
this.getSourceAccreditByDataSourceId()
})
}
},
parseTime,
getSourceAccreditByDataSourceId(){
if (this.title.id != undefined){
getSourceAccreditByDataSourceId(this.title.id).then(response => {
this.deptAccreditIds = response.data.deptAccreditModelIds
this.userAccreditIds = response.data.userAccreditModelIds
setTimeout(() => this.getList(), 50)
setTimeout(() => this.getUserList(), 50)
this.loading = false
})
}
},
recursionAuth(deptInfo){
deptInfo.isAuth = this.deptAccreditIds.indexOf(deptInfo.deptId) > -1
if (deptInfo.children){
deptInfo.children.forEach(item => {
item.isAuth = this.deptAccreditIds.indexOf(item.deptId) > -1
if (item.children){
this.recursionAuth(item)
}
})
}
},
/** 查询部门列表 */
getList() {
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "deptId");
this.deptList.forEach(dept => {
// dept.isAuth = this.deptAccreditIds.indexOf(dept.deptId) > -1
this.recursionAuth(dept)
})
});
},
/** 查询用户列表 */
getUserList() {
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
this.userList = response.data.rows;
this.userList.forEach(user => {
user.isAuth = this.userAccreditIds.indexOf(user.userId) > -1
})
this.userQueryParams.total = response.data.total;
}
]
}
);
},
},
};
</script>

View File

@ -1,36 +1,36 @@
<template>
<div class="app-container">
<h4 class="form-header h4">基本信息</h4>
<el-form ref="form" :model="baseInfo" label-width="120px">
<el-form ref="form" :model="title" label-width="120px">
<el-row>
<el-col :offset="2" :span="8">
<el-form-item label="数据接入名称" prop="nickName">
<el-input v-model="baseInfo.name" disabled/>
<el-input v-model="title.dataSourceName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="系统名称" prop="userName">
<el-input v-model="baseInfo.systemName" disabled/>
<el-input v-model="title.systemName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="数据库名称" prop="nickName">
<el-input v-model="baseInfo.databaseName" disabled/>
<el-input v-model="title.databaseName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="表名称" prop="nickName">
<el-input v-model="baseInfo.tableName" disabled/>
<el-input v-model="title.tableName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="表中文名" prop="nickName">
<el-input v-model="baseInfo.tableAsName" disabled/>
<el-input v-model="title.tableComment" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="数据量" prop="nickName">
<el-input v-model="baseInfo.total" disabled/>
<el-input v-model="title.tableCount" disabled/>
</el-form-item>
</el-col>
</el-row>
@ -39,7 +39,6 @@
<el-tabs type="border-card" v-model="activeName">
<el-tab-pane label="部门授权" name="dept">
<el-table
ref="deptTable"
v-loading="loading"
:data="deptList"
:default-expand-all="true"
@ -47,18 +46,20 @@
row-key="deptId"
>
<el-table-column label="部门名称" prop="deptName" ></el-table-column>
<el-table-column label="部门负责人" prop="leader" ></el-table-column>
<el-table-column label="排序" prop="orderNum" ></el-table-column>
<el-table-column label="负责人" prop="leader" ></el-table-column>
<el-table-column label="邮箱" prop="email" ></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" prop="createTime" >
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
@change="authChange(scope.row)"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
@ -67,7 +68,6 @@
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
</el-tab-pane>
<el-tab-pane label="用户授权" name="user">
<el-table ref="table" v-loading="loading" :data="userList">
@ -82,6 +82,7 @@
<el-switch
style="display: block"
v-model="scope.row.isAuth"
@change="authChange(scope.row)"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
@ -90,7 +91,7 @@
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
<pagination v-show="userQueryParams.total> 0" :limit.sync="userQueryParams.pageSize" :page.sync="userQueryParams.pageNum" :total="userQueryParams.total"/>
</el-tab-pane>
</el-tabs>
</div>
@ -99,265 +100,137 @@
<script>
import { parseTime } from '@/utils/muyu'
import {listDept} from "@/api/system/dept";
import {listUser} from "@/api/system/user";
import {addAccredit, deleteSourceAccreditBySourceIds, getSourceAccreditByDataSourceId} from "@/api/dataSource/sourceAccredit";
import {addAssetAccredit, deleteAssetAccreditByAssetIds, getAssetAccreditByDataAssetId} from "@/api/dataSource/assetAccredit";
export default {
watch:{
'title':{
handler(val) {
this.getAssetAccreditByDataAssetId()
},
immediate: true
}
},
props:{
title:{}
},
name: "AuthTable",
data() {
return {
refreshTable: true,
//
loading: true,
activeName: "dept",
//
total: 0,
pageNum: 1,
pageSize: 1,
//
baseInfo: {
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
tableName: "sys_user",
tableAsName: "用户表",
total: "12546条",
//
userQueryParams: {
pageNum: 1,
pageSize: 10,
total: 0
},
//
deptList: [],
//
userList: []
userList: [],
deptAccreditIds:[],
userAccreditIds:[],
AssetAccreditReq:{
deptIds: null,
userId: null,
dataAssetId: null
},
};
},
created() {
this.loading = true;
setTimeout(() => this.loading = false, 200)
this.init()
},
methods: {
parseTime,
init(){
let response = {
"code": 200,
"msg": "操作成功",
"data": [
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 100,
"parentId": 0,
"ancestors": "0",
"deptName": "muyu牧鱼科技",
"orderNum": 0,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 101,
"parentId": 100,
"ancestors": "0,100",
"deptName": "深圳总公司",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 102,
"parentId": 100,
"ancestors": "0,100",
"deptName": "长沙分公司",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 103,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "研发部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 104,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "市场部门",
"isAuth": true,
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "测试部门",
"orderNum": 3,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 106,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "财务部门",
"orderNum": 4,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 107,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "运维部门",
"orderNum": 5,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 108,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "市场部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 109,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "财务部门",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
recursion(deptInfo){
let ids =[]
ids.push(deptInfo.deptId)
if (deptInfo.children){
deptInfo.children.forEach(item => {
ids.push(item.deptId)
if (item.children){
ids.push(...this.recursion(item))
}
]
})
}
this.deptList = this.handleTree(response.data, "deptId");
this.userList = [
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "管理员",
"userId": 1,
"deptId": 103,
"userName": "admin",
"nickName": "数据处理",
"email": "ry@163.com",
"phonenumber": "15888888888",
"isAuth": true,
"dept": {
"deptName": "研发部门"
}
},
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "测试员",
"userId": 2,
"deptId": 105,
"userName": "ry",
"nickName": "数据处理",
"email": "ry@qq.com",
"phonenumber": "15666666666",
"dept": {
"deptName": "测试部门"
return ids
},
authChange(row) {
this.loading = true
this.AssetAccreditReq={
deptIds:null,
userId: null,
dataAssetId: null
}
if (row.nickName){
this.AssetAccreditReq.userId = row.userId
this.AssetAccreditReq.dataAssetId = this.title.id
}else{
let ids=this.recursion(row)
const uniqueIds = [...new Set(ids)];
this.AssetAccreditReq.deptIds = uniqueIds
this.AssetAccreditReq.dataAssetId = this.title.id
}
if (row.isAuth){
addAssetAccredit(this.AssetAccreditReq).then(res => {
this.getAssetAccreditByDataAssetId()
})
}else{
deleteAssetAccreditByAssetIds(this.AssetAccreditReq).then(res => {
this.getAssetAccreditByDataAssetId()
})
}
},
recursionAuth(deptInfo){
deptInfo.isAuth = this.deptAccreditIds.indexOf(deptInfo.deptId) > -1
if (deptInfo.children){
deptInfo.children.forEach(item => {
item.isAuth = this.deptAccreditIds.indexOf(item.deptId) > -1
if (item.children){
this.recursionAuth(item)
}
})
}
},
getAssetAccreditByDataAssetId() {
if (this.title.id != undefined) {
getAssetAccreditByDataAssetId(this.title.id).then(response => {
this.deptAccreditIds = response.data.deptAccreditModelIds
this.userAccreditIds = response.data.userAccreditModelIds
setTimeout(() => this.getList(), 50)
setTimeout(() => this.getUserList(), 50)
this.loading = false
})
}
},
/** 查询部门列表 */
getList() {
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "deptId");
this.deptList.forEach(dept => {
this.recursionAuth(dept)
})
});
},
/** 查询用户列表 */
getUserList() {
listUser(this.addDateRange(this.userQueryParams, [])).then(response => {
this.userList = response.data.rows;
this.userList.forEach(user => {
user.isAuth = this.userAccreditIds.indexOf(user.userId) > -1
})
this.userQueryParams.total = response.data.total;
}
]
}
);
},
parseTime,
},
};
</script>

View File

@ -1,22 +1,14 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
<el-tree :data="assetStructureList"
:load="expandTable"
:expand-on-click-node="false"
lazy
@node-click="(data) => showAuth=data.type"
:props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 'dataSource'">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div>
<div v-if="data.type === 'dataTable'">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
</el-tree>
<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>
<auth-data-source v-if="showAuth === 'dataSource'"/>
<auth-table v-else-if="showAuth === 'dataTable'"/>
<auth-data-source v-if="showAuth === 'dataSource'" :title="title"/>
<auth-table v-else-if="showAuth === 'dataTable'" :title="title"/>
</el-main>
</el-container>
</el-container>
@ -25,70 +17,58 @@
import AuthDataSource from './auth/AuthDataSource.vue'
import AuthTable from './auth/AuthTable.vue'
import {dataAssetList, listSource} from "@/api/dataSource/source";
export default {
name: 'assetStructure',
components: { AuthTable, AuthDataSource },
data() {
return {
req:{
pageNum: 1,
pageSize: 10,
dataSourceName: null,
linkAddress: null
},
title: {},
sourceList: [],
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'childrenList',
label: 'name'
children: 'tableList',
label: 'label'
},
showAuth: null,
assetStructureList: [
{
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
type: "dataSource"
},
{
name: "测试2",
systemName: "网站系统",
databaseName: "wangzhan",
type: "dataSource"
},
{
name: "测试3",
systemName: "物联网系统",
databaseName: "wulianwang",
type: "dataSource"
},
{
name: "测试4",
systemName: "传媒系统",
databaseName: "chuanmei",
type: "dataSource"
},
],
childrenList: [
{
name: "sys_user",
as: "用户表",
dataTotal: 635847,
type: "dataTable",
childrenList: []
},
{
name: "sys_dept",
as: "部门表",
dataTotal: 362548,
type: "dataTable",
childrenList: []
},
{
name: "sys_notice",
as: "通知公告",
dataTotal: 6347,
type: "dataTable",
childrenList: []
}
]
showAuth: null
}
},
methods: {
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.sourceList.forEach(source => {
if (source.tableList!=null){
source.tableList.forEach(table => {
if (table.tableName === data.tableName){
data.dataSourceName = source.dataSourceName
data.systemName = source.systemName
data.databaseName = source.databaseName
}
})
}
})
this.title= data
}
this.showAuth = data.dataType
},
expandTable( node, resolve){
if (node.level === 0) return resolve(this.assetStructureList);
const {data} = node;
@ -98,8 +78,32 @@ export default {
setTimeout(() => {
resolve(this.childrenList)
}, 500);
},
getList() {
this.assetsCompute={
assetsModuleSum: 0,
dataModuleSum: 0,
dataSourceSum: 0
}
listSource(this.req).then(response => {
this.sourceList = response.data.rows;
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;
});
}
}
},
created() {
this.getList()
},
}
</script>
<style scoped lang="scss">

View File

@ -1,50 +1,52 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
<el-tree :data="assetStructureList"
:load="expandTable"
:expand-on-click-node="false"
lazy
@node-click="(data) => showAuth=data.type"
:props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 'dataSource'">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div>
<div v-if="data.type === 'dataTable'">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
</el-tree>
<el-tree style="background-color: white" :data="sourceList" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</el-aside>
<el-container>
<el-main>
<el-card>
<div slot="header" class="clearfix">
<span>资产模型基本信息</span>
</div>
<el-descriptions border :column="2">
<el-descriptions-item label="表名称">sys_user</el-descriptions-item>
<el-descriptions-item label="表备注">用户表</el-descriptions-item>
<el-descriptions-item label="数据量">12536</el-descriptions-item>
<el-descriptions-item label="是否核心">
<el-tag size="small"></el-tag>
</el-descriptions-item>
</el-descriptions>
</el-card>
<data-source-show v-if="showAssets === 'dataSource'" :source="source"></data-source-show>
<data-asset-show v-if="showAssets === 'dataTable'" :asset="asset" :source="source"></data-asset-show>
<!-- <el-card>-->
<!-- <div slot="header" class="clearfix">-->
<!-- <span>资产模型基本信息</span>-->
<!-- </div>-->
<!-- <el-descriptions border :column="2">-->
<!-- <el-descriptions-item label="表名称">{{asset.tableName}}</el-descriptions-item>-->
<!-- <el-descriptions-item label="表备注">{{asset.tableComment}}</el-descriptions-item>-->
<!-- <el-descriptions-item label="数据量">{{asset.tableCount}}</el-descriptions-item>-->
<!-- <el-descriptions-item label="是否核心">-->
<!-- <el-tag size="small"></el-tag>-->
<!-- </el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- </el-card>-->
<el-card class="box-card" style="margin-top: 20px">
<div slot="header" class="clearfix">
<span>模型数据</span>
</div>
<el-row :gutter="20">
<el-col :span="6" v-for="asset in assetShowList" style="margin-top: 20px">
<el-descriptions :title="asset.key" direction="vertical" border :column="1">
<el-descriptions-item label="Type">
<el-tag size="small">{{asset.type}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="Value">{{asset.value}}</el-descriptions-item>
</el-descriptions>
</el-col>
</el-row>
<!-- <el-card class="box-card" style="margin-top: 20px">-->
<!-- <div slot="header" class="clearfix">-->
<!-- <span>模型数据</span>-->
<!-- </div>-->
<!-- <el-row v-if="kvtList.length > 0" :gutter="20">-->
<!-- <el-col :span="6" v-for="(kvt,index) in kvtList[0]" style="margin-top: 20px">-->
<!-- <el-descriptions :title="source.dataSourceName+'.'+asset.tableName+'.'+index" direction="vertical" border :column="1">-->
<!-- <el-descriptions-item label="Type">-->
<!-- <el-tag size="small">{{kvt.type}}</el-tag>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item label="Value">{{kvt.value=='' ? 'null':kvt.value}}</el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- <el-row v-if="kvtList.length == 0" :gutter="20">-->
<!-- <el-col :span="6" v-for="(value,index) in structure" style="margin-top: 20px">-->
<!-- <el-descriptions :title="source.dataSourceName+'.'+asset.tableName+'.'+index" direction="vertical" border :column="1">-->
<!-- <el-descriptions-item label="Type">-->
<!-- <el-tag size="small">{{value}}</el-tag>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item label="Value">null</el-descriptions-item>-->
<!-- </el-descriptions>-->
<!-- </el-col>-->
<!-- </el-row>-->
</el-card>
<!-- </el-card>-->
</el-main>
</el-container>
</el-container>
@ -52,77 +54,101 @@
<script>
import {dataAssetList, listSource, structureList} from "@/api/dataSource/source";
import DataSourceShow from "@/views/dataSource/assetShow/modules/dataSourceShow.vue";
import DataAssetShow from "@/views/dataSource/assetShow/modules/dataAssetShow.vue";
export default {
name: "AssetShow",
components: {DataAssetShow, DataSourceShow},
data() {
return {
showAssets: '',
source: {},
asset: {},
sourceList: [],
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'childrenList',
label: 'name'
children: 'tableList',
label: 'label'
},
showAuth: null,
assetStructureList: [
{
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
type: "dataSource"
},
{
name: "测试2",
systemName: "网站系统",
databaseName: "wangzhan",
type: "dataSource"
},
{
name: "测试3",
systemName: "物联网系统",
databaseName: "wulianwang",
type: "dataSource"
},
{
name: "测试4",
systemName: "传媒系统",
databaseName: "chuanmei",
type: "dataSource"
},
],
childrenList: [
{
name: "sys_user",
as: "用户表",
dataTotal: 635847,
type: "dataTable",
childrenList: []
},
{
name: "sys_dept",
as: "部门表",
dataTotal: 362548,
type: "dataTable",
childrenList: []
},
{
name: "sys_notice",
as: "通知公告",
dataTotal: 6347,
type: "dataTable",
childrenList: []
}
],
assetShowList: [
{key: "测试.sys_user.id", type: "String", value: 1},
{key: "测试.sys_user.name", type: "String", value: "张三"},
{key: "测试.sys_user.age", type: "Integer", value: 18},
{key: "测试.sys_user.email", type: "String", value: "123@136.com"},
{key: "测试.sys_user.sex", type: "String", value: "Y"},
]
],
kvtList: [],
structure: []
}
},
created() {
this.getList()
},
methods: {
getList() {
listSource({}).then(response => {
this.sourceList = response.data.rows;
this.sourceList.forEach(source => {
if (source.type=='PostGreSql'){
source.label=source.dataSourceName+'('+source.databaseName+'-'+source.modeName+'-'+source.systemName+')'
}else{
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;
});
},
// structureList(){
// structureList(this.source).then(res => {
// console.log(res)
// this.kvtList = res.data.kvtList
// this.structure = res.data.structure
// })
// },
handleNodeClick(data) {
if (data.dataType === 'dataSource'){
this.source = data
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.asset= data
this.sourceList.forEach(source => {
if (source.tableList!=null){
source.tableList.forEach(table => {
if (table.tableName === data.tableName){
this.source = source
}
})
}
})
// console.log(this.source)
// this.source.sql = 'select * from '+(data.modeName == null ? '' : data.modeName+'.')+data.tableName +' limit 1'
// setTimeout(() => {
// this.structureList()
// }, 50);
}
this.showAssets = data.dataType
},
expandTable( node, resolve){
if (node.level === 0) return resolve(this.assetStructureList);
const {data} = node;

View File

@ -0,0 +1,115 @@
<template>
<div>
<el-card>
<div slot="header" class="clearfix">
<span>资产模型基本信息</span>
</div>
<el-descriptions border :column="2">
<el-descriptions-item label="表名称">{{asset.tableName}}</el-descriptions-item>
<el-descriptions-item label="表备注">{{asset.tableComment}}</el-descriptions-item>
<el-descriptions-item label="数据量">{{asset.tableCount}}</el-descriptions-item>
<el-descriptions-item label="是否核心">
<el-tag size="small"></el-tag>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="box-card" style="margin-top: 20px">
<div slot="header" class="clearfix">
<span>模型数据</span>
</div>
<el-row v-if="kvtList.length > 0" :gutter="20">
<el-col :span="6" v-for="(kvt,index) in kvtList[0]" style="margin-top: 20px">
<el-descriptions :title="source.dataSourceName+'.'+asset.tableName+'.'+index" direction="vertical" border :column="1">
<el-descriptions-item label="Type">
<el-tag size="small">{{kvt.type}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="Value">{{kvt.value=='' ? 'null':kvt.value}}</el-descriptions-item>
</el-descriptions>
</el-col>
</el-row>
<el-row v-if="kvtList.length == 0" :gutter="20">
<el-col :span="6" v-for="(value,index) in structure" style="margin-top: 20px">
<el-descriptions :title="source.dataSourceName+'.'+asset.tableName+'.'+index" direction="vertical" border :column="1">
<el-descriptions-item label="Type">
<el-tag size="small">{{value}}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="Value">null</el-descriptions-item>
</el-descriptions>
</el-col>
</el-row>
</el-card>
</div>
</template>
<script>
import {dataAssetList, listSource, structureList} from "@/api/dataSource/source";
export default {
watch:{
'asset':{
handler(val){
},
immediate: true
},
'source':{
handler(val){
this.structureList()
},
immediate: true
}
},
props:{
asset:{},
source: {}
},
name: "dataAssetShow",
data() {
return {
sourceList: [],
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'tableList',
label: 'label'
},
showAuth: null,
assetShowList: [
{key: "测试.sys_user.id", type: "String", value: 1},
{key: "测试.sys_user.name", type: "String", value: "张三"},
{key: "测试.sys_user.age", type: "Integer", value: 18},
{key: "测试.sys_user.email", type: "String", value: "123@136.com"},
{key: "测试.sys_user.sex", type: "String", value: "Y"},
],
kvtList: [],
structure: []
}
},
created() {
},
methods: {
structureList(){
this.source.sql = 'select * from '+(this.source.modeName == null ? '' : this.source.modeName+'.')+this.asset.tableName +' limit 1'
structureList(this.source).then(res => {
console.log(res)
this.kvtList = res.data.kvtList
this.structure = res.data.structure
})
},
expandTable( node, resolve){
if (node.level === 0) return resolve(this.assetStructureList);
const {data} = node;
if (data.type === 'dataTable') {
return resolve([])
}
setTimeout(() => {
resolve(this.childrenList)
}, 500);
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,160 @@
<template>
<div>
<el-row :gutter="40" class="panel-group">
<el-col :span="24">
<el-tabs v-model="activeName" type="border-card">
<el-tab-pane v-for="tableAsset in source.tableList" :label="tableAsset.tableName+'('+tableAsset.tableComment+')'" :name="tableAsset.tableName">
<data-asset-show v-if="activeName == tableAsset.tableName" :asset="tableAsset" :source="source"/>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</div>
</template>
<script>
import DataAssetShow from "./dataAssetShow.vue";
export default {
watch:{
'source':{
handler(val){
setTimeout(() => this.inio(), 200)
},
immediate: true
}
},
props:{
source:{}
},
name: "dataSourceShow",
components: {DataAssetShow},
data() {
return {
activeName: ''
}
},
methods:{
inio(){
this.activeName = this.source.tableList[0].tableName
}
}
}
</script>
<style lang="scss" scoped>
.panel-group {
margin-top: 18px;
.card-panel-col {
margin-bottom: 32px;
}
.card-panel {
height: 108px;
cursor: pointer;
font-size: 12px;
position: relative;
overflow: hidden;
color: #666;
background: #fff;
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
border-color: rgba(0, 0, 0, .05);
&:hover {
.card-panel-icon-wrapper {
color: #fff;
}
.icon-people {
background: #40c9c6;
}
.icon-message {
background: #36a3f7;
}
.icon-money {
background: #f4516c;
}
.icon-shopping {
background: #34bfa3
}
}
.icon-people {
color: #40c9c6;
}
.icon-message {
color: #36a3f7;
}
.icon-money {
color: #f4516c;
}
.icon-shopping {
color: #34bfa3
}
.card-panel-icon-wrapper {
float: left;
margin: 14px 0 0 14px;
padding: 16px;
transition: all 0.38s ease-out;
border-radius: 6px;
}
.card-panel-icon {
float: left;
font-size: 48px;
}
.card-panel-description {
float: right;
font-weight: bold;
margin: 26px;
margin-left: 0px;
.card-panel-text {
line-height: 18px;
color: rgba(0, 0, 0, 0.45);
font-size: 16px;
margin-bottom: 12px;
}
.card-panel-num {
font-size: 20px;
}
}
}
}
@media (max-width: 550px) {
.card-panel-description {
display: none;
}
.card-panel-icon-wrapper {
float: none !important;
width: 100%;
height: 100%;
margin: 0 !important;
.svg-icon {
display: block;
margin: 14px auto !important;
float: none !important;
}
}
}
.title-header{
text-align: center;
width: 100%;
font-size: 46px;
font-weight: 600;
line-height: 100px;
}
</style>

View File

@ -1,13 +1,13 @@
<template>
<div v-if="tableParams != null">
<div>
<el-card>
<div slot="header" class="clearfix">
<span>资产模型基本信息</span>
</div>
<el-descriptions border :column="2">
<el-descriptions-item label="表名称">{{tableParams.tableName}}</el-descriptions-item>
<el-descriptions-item label="表备注">{{tableParams.tableAsName}}</el-descriptions-item>
<el-descriptions-item label="数据量">12536</el-descriptions-item>
<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>
@ -55,13 +55,9 @@
placement="left"
width="200"
trigger="hover">
<el-table :data="[
{ label: '男', value: '1' },
{ label: '女', value: '2' },
{ label: '未知', value: '0' },
]">
<el-table :data="scope.row.dictionaryDatas">
<el-table-column property="label" label="字典标签"/>
<el-table-column property="value" label="字典值"/>
<el-table-column property="val" label="字典值"/>
</el-table>
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
</el-popover>
@ -150,13 +146,13 @@
<el-col :span="24">
<el-form-item label="字典">
<el-select v-model="form.dictKey">
<el-option v-for="(value, key) in dictMap" :key="key" :label="key" :value="key"></el-option>
<el-option v-for="dict in dictMap" :key="dict.id" :label="dict.dictionaryName+'('+dict.dictionaryKey+')'" :value="dict.dictionaryKey"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<el-table :data="dictMap[form.dictKey]" striped border>
<el-table :data="dictionaryDataList" striped border>
<el-table-column property="label" label="字典标签"/>
<el-table-column property="val" label="字典值"/>
</el-table>
@ -166,120 +162,75 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="formStatus = false"> </el-button>
<el-button type="primary" @click="formStatus = false"> </el-button>
<el-button type="primary" @click="updDict()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {assetModelList, updateAssetModel, updateSource} from "@/api/dataSource/source";
import {getDictionaryList} from "@/api/dataSource/dictionary";
export default {
name: 'OverallAssetStructure',
props: {
tableParams: {
type: Object,
default: null
watch:{
'title': {
handler(val) {
this.getDictionaryList()
this.assetModelList()
},
immediate: true
},
'form.dictKey':{
handler(val) {
this.dictMap.forEach(dict => {
if (dict.dictionaryKey === val){
this.dictionaryDataList = dict.dictionaryDataList
this.form.dictionaryId = dict.id
}
})
}
}
},
watch: {
tableParams: {
handler(val) {
if (val != null){
this.init()
}
},
deep: true,
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: "-",
}, ],
form: {},
dictionaryDataList:[],
form:{},
formStatus: false,
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 }
],
}
tableData: [],
dictMap: {}
}
},
created() {
},
methods: {
init(){
console.log("查询")
assetModelList(){
assetModelList(this.title).then(res => {
this.tableData = res.data
this.formStatus = false
console.log(this.tableData)
})
},
update(row) {
updDict(){
console.log(this.form)
updateAssetModel(this.form).then(res => {
this.assetModelList()
})
},
getDictionaryList() {
getDictionaryList(this.title.dataSourceId).then(res => {
this.dictMap = res.data
console.log(this.dictMap)
})
},
async update(row) {
this.getDictionaryList()
this.form = row;
this.formStatus = true;
}

View File

@ -6,13 +6,13 @@
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel-icon-wrapper icon-people">
<svg-icon class-name="card-panel-icon" icon-class="database"/>
<svg-icon class-name="card-panel-icon" icon-class="table"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
数据接入
</div>
<count-to :duration="2600" :end-val="4" :start-val="0" class="card-panel-num"/>
<count-to :duration="2600" :end-val="statisticsInfo.dataAsset" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -25,20 +25,20 @@
<div class="card-panel-text">
资产模型
</div>
<count-to :duration="3000" :end-val="96" :start-val="0" class="card-panel-num"/>
<count-to :duration="3000" :end-val="statisticsInfo.assetModel" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
<el-col :lg="8" :sm="12" :xs="12" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('purchases')">
<div class="card-panel-icon-wrapper icon-money">
<svg-icon class-name="card-panel-icon" icon-class="field"/>
<svg-icon class-name="card-panel-icon" icon-class="table"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
数据模型
</div>
<count-to :duration="3200" :end-val="560" :start-val="0" class="card-panel-num"/>
<count-to :duration="3200" :end-val="statisticsInfo.dataModel" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -47,15 +47,30 @@
<script>
import CountTo from 'vue-count-to'
import {statisticsInfo} from "@/api/dataSource/source";
export default {
components: {
CountTo
},
data() {
return {
statisticsInfo: {}
}
},
methods: {
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
},
statistics(){
statisticsInfo().then(res => {
this.statisticsInfo = res.data
})
}
},
created() {
this.statistics()
}
}
</script>

View File

@ -1,7 +1,7 @@
<template>
<el-row :gutter="40" class="panel-group">
<div class="title-header">
{{title}} - 资产结构概述
{{title.dataSourceName+'('+title.databaseName+'-'+title.systemName+')'}} - 资产结构概述
</div>
<el-col :sm="12" :xs="12" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')">
@ -12,20 +12,20 @@
<div class="card-panel-text">
资产模型
</div>
<count-to :duration="3000" :end-val="15" :start-val="0" class="card-panel-num"/>
<count-to :duration="3000" :end-val="assetModel" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
<el-col :sm="12" :xs="12" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('purchases')">
<div class="card-panel-icon-wrapper icon-money">
<svg-icon class-name="card-panel-icon" icon-class="field"/>
<svg-icon class-name="card-panel-icon" icon-class="table"/>
</div>
<div class="card-panel-description">
<div class="card-panel-text">
数据模型
</div>
<count-to :duration="3200" :end-val="230" :start-val="0" class="card-panel-num"/>
<count-to :duration="3200" :end-val="dataModel" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
@ -43,54 +43,63 @@
</el-popover>
<el-popover
placement="right"
width="400"
width="200px"
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-form :inline="true" :model="dictInfo" class="demo-form-inline">
<el-form-item label="字典名称:">
<el-input v-model="dictInfo.dictionaryName" style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="字典Key:">
<el-input v-model="dictInfo.dictionaryKey" style="width: 150px"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="addDict"></el-button>
</el-form-item>
</el-form>
<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-col v-for="dict in dictMap" :md="8" :sm="24" :xs="12">
<el-card class="box-card" style="height: 300px">
<div slot="header" class="clearfix">
<span>{{key}}</span>
<span>{{dict.dictionaryName+'('+dict.dictionaryKey+')'}}</span>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="val.push({ label: null, val: null, isEdit: true })"
@click="deleteDictionary(dict.id)"
>删除</el-button>
<el-button style="float: right; padding: 3px 0;margin-right: 8px"
type="text"
@click="dict.dictionaryDataList.push({ label: null, val: null, edit: true })"
>新增</el-button>
</div>
<el-table :data="val" style="width: 100%" height="280px">
<el-table :data="dict.dictionaryDataList" 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>
<span v-if="!scope.row.edit">{{scope.row.label}}</span>
<el-input v-if="scope.row.edit" 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>
<span v-if="!scope.row.edit">{{scope.row.val}}</span>
<el-input v-if="scope.row.edit" 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"
v-if="!scope.row.edit"
size="mini"
type="text"
icon="el-icon-edit"
@click="scope.row.isEdit = true"
@click="scope.row.edit = true"
>修改</el-button>
<el-button
v-if="scope.row.isEdit"
@click="editConfirm(scope.row)"
v-if="scope.row.edit"
@click="editConfirm(dict,scope.row)"
size="mini"
type="text"
icon="el-icon-finished"
@ -104,11 +113,10 @@
</el-card>
</el-col>
<el-col :span="24" style="margin-top: 20px">
<el-tabs v-model="activeName" type="border-card" @tab-click="checkTableName">
<el-tab-pane v-for="table in tableList" :label="table.tableName+'('+table.tableAsName+')'"
:name="table.tableName">
<overall-asset-structure v-if="table.tableName === tableParams.tableName" :table-params="tableParams"/>
<el-col :span="24">
<el-tabs v-model="activeName" type="border-card">
<el-tab-pane v-for="tableAsset in title.tableList" :label="tableAsset.tableName+'('+tableAsset.tableComment+')'" :name="tableAsset.tableName">
<overall-asset-structure ref="assetStru" v-if="activeName == tableAsset.tableName" :title="tableAsset"/>
</el-tab-pane>
</el-tabs>
</el-col>
@ -119,73 +127,111 @@
<script>
import CountTo from 'vue-count-to'
import OverallAssetStructure from './OverallAssetStructure.vue'
import {addDictionary, deleteDictionary, getDictionaryList} from "@/api/dataSource/dictionary";
import {addData, updateData} from "@/api/dataSource/data";
export default {
props: {
title: {
type: String,
default: "-"
watch:{
'title':{
handler(val){
this.getDictionaryList()
this.activeName = val.tableList[0].tableName
this.assetModel = 0
this.dataModel = 0
val.tableList.forEach(table => {
if (table.tableCount!=null){
this.dataModel = parseInt(this.dataModel) + parseInt(table.tableCount);
}
if (table.fields!=null){
this.assetModel = parseInt(this.assetModel) + parseInt(table.fields);
}
})
}
}
},
props: {
title:{}
},
data() {
return {
activeName: null,
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 }
],
dictInfo: {
dictionaryName: null,
dictionaryKey: null,
dataSourceId: null
},
tableList: [],
tableParams: null
dictMap: {},
activeName: '',
assetModel: 0,
dataModel: 0
}
},
components: {
OverallAssetStructure,
CountTo
},
created() {
this.init();
},
methods: {
checkTableName(checkTab){
this.tableParams = this.tableList.findLast(item => item.tableName === checkTab.name)
deleteDictionary(id) {
deleteDictionary(id).then(res => {
this.getDictionaryList()
// this.$nextTick(() => {
// this.$refs.assetStru.assetModelList()
// })
})
},
init(){
let rows = [
{
tableName: "sys_user",
tableAsName: "用户表"
},
{
tableName: "sys_dept",
tableAsName: "部门表"
},
];
this.tableList = rows;
this.activeName = rows[0].tableName;
this.tableParams = rows[0]
getDictionaryList() {
getDictionaryList(this.title.id).then(res => {
this.dictMap = res.data
})
},
editConfirm(row){
editConfirm(dict,row){
if (!row.label || !row.val) {
this.$message.error('字典标签或字典值,不可为空');
return;
}
row.isEdit = false;
console.log(row)
if (row.id) {
console.log('修改')
updateData(row).then(res => {
row.edit = false;
this.getDictionaryList()
// this.$nextTick(() => {
// this.$refs.assetStru.assetModelList()
// })
})
}else{
console.log('添加')
row.dictionaryId=dict.id
addData(row).then(res => {
row.edit = false;
this.getDictionaryList()
// this.$nextTick(() => {
// this.$refs.assetStru.assetModelList()
// })
})
}
},
addDict(){
if (!this.dictAddName){
this.$message.error('数据字典,不可为空');
if (!this.dictInfo.dictionaryName){
this.$message.error('字典名称,不可为空');
return;
}
this.dictMap[this.dictAddName] = []
this.dictAddName = null
if (!this.dictInfo.dictionaryKey){
this.$message.error('字典Key不可为空');
return;
}
this.dictInfo.dataSourceId = this.title.id
addDictionary(this.dictInfo).then(res => {
this.dictInfo = {
dictionaryName: null,
dictionaryKey: null,
dataSourceId: null
}
this.getDictionaryList()
})
},
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)

View File

@ -1,126 +1,178 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
<el-tree :data="assetStructureList"
:expand-on-click-node="false"
:load="expandTable"
lazy
@node-click="showAssetsFun"
:props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 'dataSource'">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div>
<div v-if="data.type === 'dataTable'">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
</el-tree>
</el-aside>
<el-container>
<el-main>
<OverallAssets v-if="showAssets == null"/>
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/>
<overall-asset-structure v-if="showAssets === 'dataTable'" :table-params="tableParams" :title="title"/>
</el-main>
<div>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside width="400px" style="background-color: rgb(238, 241, 246);height: 80%">
<el-tree style="background-color: white" :data="sourceList" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</el-aside>
<el-container>
<el-main>
<el-tabs v-model="activeName">
<el-tab-pane label="资产结构" name="structure">
<OverallAssets v-if="showAssets == null"/>
<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>
</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>
import OverallAssets from './dashboard/OverallAssets.vue'
import OverallSpecificAssets from './dashboard/OverallSpecificAssets.vue'
import OverallAssetStructure from './dashboard/OverallAssetStructure.vue'
//jsjsjson,
//import from ',
import {assetModelList, assetsList, dataAssetList, listSource, statisticsInfo, structureList} from "@/api/dataSource/source";
import OverallAssetStructure from "@/views/dataSource/assetStructure/dashboard/OverallAssetStructure.vue";
import OverallSpecificAssets from "@/views/dataSource/assetStructure/dashboard/OverallSpecificAssets.vue";
import OverallAssets from "@/views/dataSource/assetStructure/dashboard/OverallAssets.vue";
export default {
name: 'assetStructure',
components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets },
data() {
return {
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'childrenList',
label: 'name'
},
assetStructureList: [
{
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
type: "dataSource"
//import使"
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets},
props: {},
data() {
return {
mainHeight: window.innerHeight - 85,
assetsCompute:{
assetsModuleSum: 0,
dataModuleSum: 0,
dataSourceSum: 0
},
{
name: "测试2",
systemName: "网站系统",
databaseName: "wangzhan",
type: "dataSource"
showAssets: null,
title: {},
activeName: 'structure',
queryParams: {
pageNum: 1,
pageSize: 10,
dataSourceName: null,
linkAddress: null
},
{
name: "测试3",
systemName: "物联网系统",
databaseName: "wulianwang",
type: "dataSource"
//
total: 0,
//
sourceList: [],
assetsList:[],
structureList:[],
tableAssets:[],
defaultProps: {
children: 'tableList',
label: 'label'
},
{
name: "测试4",
systemName: "传媒系统",
databaseName: "chuanmei",
type: "dataSource"
sourceData:{},
source: {
sql: ''
},
],
childrenList: [
{
name: "sys_user",
as: "用户表",
dataTotal: 635847,
type: "dataTable",
childrenList: []
},
{
name: "sys_dept",
as: "部门表",
dataTotal: 362548,
type: "dataTable",
childrenList: []
},
{
name: "sys_notice",
as: "通知公告",
dataTotal: 6347,
type: "dataTable",
childrenList: []
}
],
showAssets: null,
title: null,
tableParams: null
}
},
methods: {
expandTable( node, resolve){
if (node.level === 0) return resolve(this.assetStructureList);
const {data} = node;
this.showAssets = data.type;
if (data.type === 'dataTable') {
this.tableParams = {
tableName: data.name,
tableAsName: data.as
}
return resolve([])
}
setTimeout(() => {
resolve(this.childrenList)
}, 500);
statisticsInfo:{}
};
},
showAssetsFun(data){
this.title = data.name + '('+data.databaseName + '-' + data.systemName+')'
this.showAssets = data.type;
if (data.type === "dataTable"){
this.tableParams = {
tableName: data.name,
tableAsName: data.as
// data",
computed: {},
//data",
watch: {},
//",
methods: {
test(data){
this.sourceData = data
},
handleNodeClick(data) {
this.source = 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 => {
console.log(res)
this.structureList = res.data.kvtList
})
},
getList() {
listSource({}).then(response => {
this.sourceList = response.data.rows;
this.sourceList.forEach(source => {
if (source.type=='PostGreSql'){
source.label=source.dataSourceName+'('+source.databaseName+'-'+source.modeName+'-'+source.systemName+')'
}else{
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() {
}
}
}
};
</script>
<style scoped lang="scss">
<style scoped>
.el-aside {
margin: 0;
padding: 0;

View File

@ -1,27 +1,18 @@
<template>
<!-- 数据访问(数据接人)-->
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="130px">
<el-form-item label="接入源名称" prop="name">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="数据源名称" prop="dataSourceName" label-width="100px">
<el-input
v-model="queryParams.dataSourceName"
placeholder="请输入接入源名称"
placeholder="请输入数据源名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数据来源系统名称" prop="systemName">
<el-form-item label="数据源链接地址" prop="linkAddress" label-width="120px">
<el-input
v-model="queryParams.systemName"
placeholder="请输入数据来源系统名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数据库名称" prop="databaseName">
<el-input
v-model="queryParams.databaseName"
placeholder="请输入数据库名称"
v-model="queryParams.linkAddress"
placeholder="请输入数据源链接地址"
clearable
@keyup.enter.native="handleQuery"
/>
@ -40,7 +31,7 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:access:add']"
v-hasPermi="['system:source:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
@ -51,7 +42,7 @@
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:access:remove']"
v-hasPermi="['system:source:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
@ -61,50 +52,50 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:access:export']"
v-hasPermi="['system:source:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="accessList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="sourceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="接入源名称" align="center" prop="dataSourceName" />
<el-table-column label="数据来源系统名称" align="center" prop="systemName" />
<el-table-column label="主机地址" align="center" prop="linkAddress" />
<el-table-column label="主机地址" align="center" prop="port" />
<el-table-column label="数据接入类型" align="center" prop="type" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="数据源名称" align="center" prop="dataSourceName" />
<el-table-column label="数据源连接地址" align="center" prop="linkAddress" />
<el-table-column label="数据源连接端口" align="center" prop="port" />
<el-table-column label="数据库名称" align="center" prop="databaseName" />
<el-table-column label="连接用户名" align="center" prop="username" />
<el-table-column label="连接密码" align="center" prop="password" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="模式名称" align="center" prop="modeName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-connection"
@click="syncAssetsStructure(scope.row)"
v-hasPermi="['system:access:edit']"
>同步资产结构</el-button>
icon="el-icon-edit"
@click="testConnection(scope.row)"
>测试连接</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-video-play"
@click="testConnection(scope.row)"
v-hasPermi="['system:access:edit']"
>测试</el-button>
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:access:edit']"
v-hasPermi="['system:source:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:access:remove']"
v-hasPermi="['system:source:remove']"
>删除</el-button>
</template>
</el-table-column>
@ -118,8 +109,8 @@
@pagination="getList"
/>
<!-- 添加或修改数据接入对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<!-- 添加或修改请填写功能名称对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1150px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
<el-card>
<div slot="header" class="clearfix">
@ -127,7 +118,7 @@
</div>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="接入源名称" prop="name">
<el-form-item label="接入源名称" prop="dataSourceName">
<el-input v-model="form.dataSourceName" placeholder="请输入接入源名称" />
</el-form-item>
</el-col>
@ -139,7 +130,7 @@
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="主机地址" prop="linkAddress">
<el-form-item label="主机IP" prop="linkAddress">
<el-input v-model="form.linkAddress" placeholder="请输入主机地址" />
</el-form-item>
</el-col>
@ -153,8 +144,8 @@
<el-col :md="12" :sm="24">
<el-form-item label="数据接入类型" prop="type">
<el-select style="width: 100%" v-model="form.type">
<el-option label="MySql" value="MySql">MySql</el-option>
<el-option label="Oracle" value="Oracle">Oracle</el-option>
<el-option label="MySql" value="MySql">MySql</el-option>
<el-option label="PostGreSql" value="PostGreSql">PostGreSql</el-option>
</el-select>
</el-form-item>
</el-col>
@ -164,15 +155,22 @@
</el-form-item>
</el-col>
</el-row>
<el-row v-show="form.type === 'PostGreSql'">
<el-col :md="12" :sm="24">
<el-form-item label="模式名称" prop="modeName">
<el-input v-model="form.modeName" placeholder="模式名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="数据库用户" prop="username">
<el-input v-model="form.username" placeholder="请输入数据库用户" />
<el-form-item label="连接用户名" prop="username">
<el-input v-model="form.username" placeholder="请输入连接用户名" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="数据库密码" prop="password">
<el-input v-model="form.password" placeholder="请输入数据库密码" />
<el-form-item label="连接密码" prop="password">
<el-input v-model="form.password" placeholder="请输入连接密码" />
</el-form-item>
</el-col>
</el-row>
@ -250,21 +248,39 @@
</el-form-item>
</el-card>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="testConnection(null)"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {dataSynchronization, editDataSource, getDataSourceList} from "@/api/dataSource/source";
import {
listSource,
getSource,
delSource,
addSource,
updateSource,
testConnection,
synchronousData
} from "@/api/dataSource/source";
export default {
name: "Access",
watch:{
'form.type':{
handler(val) {
if(val != 'PostGre'){
this.form.modeName = ''
}
}
}
},
name: "Source",
data() {
return {
//
@ -279,8 +295,8 @@ export default {
showSearch: true,
//
total: 0,
//
accessList: [],
//
sourceList: [],
//
title: "",
//
@ -289,74 +305,68 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
systemName: null,
databaseName: null
dataSourceName: null,
linkAddress: null
},
//
form: {},
//
rules: {
dataSourceName: [
{required: true, message: "接入源名称不能为空", trigger: "blur"}
],
systemName: [
{required: true, message: "数据来源系统名称不能为空", trigger: "blur"}
],
type: [
{required: true, message: "数据接入类型不能为空", trigger: "blur"}
],
linkAddress: [
{required: true, message: "主机地址不能为空", trigger: "blur"}
],
port: [
{required: true, message: "主机地址不能为空", trigger: "blur"}
],
username: [
{required: true, message: "数据库用户不能为空", trigger: "blur"}
],
password: [
{required: true, message: "数据库密码不能为空", trigger: "blur"}
],
databaseName: [
{required: true, message: "数据库名称不能为空", trigger: "blur"}
],
connectionParam: [
{required: true, message: "数据连接参数不能为空", trigger: "blur"}
],
initNum: [
{required: true, message: "初始连接数量不能为空", trigger: "blur"}
],
maxNum: [
{required: true, message: "最大连接数量不能为空", trigger: "blur"}
],
maxWaitTime: [
{required: true, message: "最大等待时间不能为空", trigger: "blur"}
],
maxWaitSize: [
{required: true, message: "最大等待次数不能为空", trigger: "blur"}
]
},
//
rules: {
dataSourceName: [
{required: true, message: "接入源名称不能为空", trigger: "blur"}
],
systemName: [
{required: true, message: "数据来源系统名称不能为空", trigger: "blur"}
],
type: [
{required: true, message: "数据接入类型不能为空", trigger: "blur"}
],
host: [
{required: true, message: "主机地址不能为空", trigger: "blur"}
],
port: [
{required: true, message: "主机地址不能为空", trigger: "blur"}
],
databaseName: [
{required: true, message: "数据库名称不能为空", trigger: "blur"}
],
initNum: [
{required: true, message: "初始连接数量不能为空", trigger: "blur"}
],
maxNum: [
{required: true, message: "最大连接数量不能为空", trigger: "blur"}
],
maxWaitTime: [
{required: true, message: "最大等待时间不能为空", trigger: "blur"}
],
maxWaitSize: [
{required: true, message: "最大等待次数不能为空", trigger: "blur"}
]
},
dataSourceParamList: [
{
name: null,
val: null
}
]
};
},
created() {
this.getList();
},
methods: {
syncAssetsStructure(row){
dataSynchronization(row).then(res=>{
if (res.code == 200){
this.$modal.msgSuccess("同步资产结构成功");
}else {
this.$modal.msgError("同步资产结构失败");
synchronousData(data) {
synchronousData(data).then(res => {
if (res.code === 200) {
this.$message({
message: "同步成功",
type: "success"
});
} else {
this.$message({
message: "同步失败",
type: "error"
});
}
})
},
@ -385,18 +395,31 @@ export default {
}).join("&")
console.log(this.form.connectionParam)
},
/** 查询数据接入列表 */
getList(){
getDataSourceList(this.queryParams).then(res=>{
this.loading = true;
this.accessList= res.data.rows;
this.total=res.data.total;
this.loading=false;
/** 测试连接 */
testConnection(row) {
testConnection(row).then(res => {
if (res.code === 200) {
this.$message({
message: "连接成功",
type: "success"
});
} else {
this.$message({
message: "连接失败",
type: "error"
});
}
})
},
/** 查询数据源列表 */
getList() {
this.loading = true;
listSource(this.queryParams).then(response => {
this.sourceList = response.data.rows;
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
@ -406,19 +429,20 @@ export default {
reset() {
this.form = {
id: null,
name: null,
dataSourceName: null,
type: null,
systemName: null,
host: null,
port: null,
databaseName: null,
username: null,
password: null,
linkAddress: null,
port: null,
databaseName: null,
connectionParam: null,
initNum: 5,
maxNum: 20,
maxWaitTime: 3000,
maxWaitSize: 3,
initNum: null,
maxNum: null,
maxWaitTime: null,
maxWaitSize: null,
modeName: null,
createBy: null,
createTime: null,
updateBy: null,
@ -440,66 +464,72 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.dataSourceParamList = [];
this.title = "添加数据接入";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = row;
this.dataSourceParamList = [];
this.form.connectionParam.split("&").forEach(param => {
let paramArr = param.split("=");
this.dataSourceParamList.push({
name: paramArr[0],
val: paramArr[1]
})
getSource(row.id).then(res => {
console.log(res)
this.form = res.data;
console.log(this.form)
this.dataSourceParamList = [];
if (this.form.connectionParam){
this.form.connectionParam.split("&").forEach(param => {
let paramArr = param.split("=");
this.dataSourceParamList.push({
name: paramArr[0],
val: paramArr[1]
})
})
}
this.open = true;
this.title = "修改数据接入";
})
this.open = true;
this.title = "修改数据接入";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
editDataSource(this.form).then(res=>{
this.$modal.msgSuccess("编辑成功");
if (this.form.id != null) {
updateSource(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList()
})
this.getList();
});
} else {
addSource(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 测试连接 */
testConnection(row) {
if (row){
this.$modal.msgSuccess("测试连接成功");
}else {
this.$refs["form"].validate(valid => {
if (valid) {
this.$modal.msgSuccess("测试连接成功");
}
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除数据接入编号为"' + ids + '"的数据项?').then(() => {
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
return delSource(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
});
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.$modal.msgSuccess("导出成功");
this.download('system/source/export', {
...this.queryParams
}, `source_${new Date().getTime()}.xlsx`)
}
}
};

View File

@ -229,6 +229,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
dataSourceName:undefined,
tableName: undefined,
tableComment: undefined
},