refactor:代码重构(表结构分析的过于复杂,优化了表结构)
parent
6f1fa2f31d
commit
5f2f48513c
|
@ -1,59 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询数据源信息列表
|
|
||||||
export function listSource(query) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询数据源信息详细
|
|
||||||
export function getSource(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source/' + id,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增数据源信息
|
|
||||||
export function addSource(data) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改数据源信息
|
|
||||||
export function updateSource(data) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除数据源信息
|
|
||||||
export function delSource(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source/' + id,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 测试数据源连接
|
|
||||||
export function testConnection(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source/testConnection/' + id,
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 资产同步
|
|
||||||
export function assetSynchronization(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/source/assetSynchronization/' + id,
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询数据资产列表
|
|
||||||
export function listAssetStructure() {
|
|
||||||
return request({
|
|
||||||
url: '/data/structure/list',
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询数据资产表列表
|
|
||||||
export function selectAssetSouructureTableList(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/structureTable/list/' + id,
|
|
||||||
method: 'post'
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 查询数据源类型列表
|
|
||||||
export function listType(query) {
|
|
||||||
return request({
|
|
||||||
url: '/data/type/list',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询数据源类型详细
|
|
||||||
export function getType(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/type/' + id,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增数据源类型
|
|
||||||
export function addType(data) {
|
|
||||||
return request({
|
|
||||||
url: '/data/type',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 修改数据源类型
|
|
||||||
export function updateType(data) {
|
|
||||||
return request({
|
|
||||||
url: '/data/type',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除数据源类型
|
|
||||||
export function delType(id) {
|
|
||||||
return request({
|
|
||||||
url: '/data/type/' + id,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
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'
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getDataSourceList(dataSourceQueryReq) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/list',
|
||||||
|
method: 'post',
|
||||||
|
data: dataSourceQueryReq
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAllDataType() {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dataType/getAllDataType',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertDataSource(dataSource) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/insertDataSource',
|
||||||
|
method: 'post',
|
||||||
|
data: dataSource
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function dataSynchronization(dataSourceResp) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/dataSynchronization',
|
||||||
|
method: 'post',
|
||||||
|
data: dataSourceResp
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function testConnect(dataSourceResp) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/testConnect',
|
||||||
|
method: 'post',
|
||||||
|
data: dataSourceResp
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryStructure(dataSourceResp) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/queryStructure',
|
||||||
|
method: 'post',
|
||||||
|
data: dataSourceResp
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryBigStructure() {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/queryBigStructure',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function queryTableStructure(tableStructureQueryReq) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/source/queryTableStructure',
|
||||||
|
method: 'post',
|
||||||
|
data: tableStructureQueryReq
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getDictionaryRespByDataSourceId(id) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/getDictionaryRespByDataSourceId?dataSourceId='+id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertDictionary(dictionary) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/insertDictionary',
|
||||||
|
method: 'post',
|
||||||
|
data: dictionary
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function insertDictionaryInfo(dictionaryInfo) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/insertDictionaryInfo',
|
||||||
|
method: 'post',
|
||||||
|
data: dictionaryInfo
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,571 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="数据源类型" prop="typeId">
|
|
||||||
<el-select v-model="queryParams.typeId" placeholder="请选择数据源类型">
|
|
||||||
<el-option
|
|
||||||
v-for="item in typeList"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.dataType"
|
|
||||||
:value="item.id"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数据源名称" prop="dataSourceName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.dataSourceName"
|
|
||||||
placeholder="请输入数据源名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数据源系统名称" prop="dataSourceSystemName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.dataSourceSystemName"
|
|
||||||
placeholder="请输入数据源系统名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['data:source:add']"
|
|
||||||
>新增
|
|
||||||
</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['data:source:edit']"
|
|
||||||
>修改
|
|
||||||
</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['data:source:remove']"
|
|
||||||
>删除
|
|
||||||
</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['data:source:export']"
|
|
||||||
>导出
|
|
||||||
</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="sourceList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center"/>
|
|
||||||
<el-table-column label="主键id" align="center" prop="id"/>
|
|
||||||
<el-table-column label="数据源名称" align="center" prop="dataSourceName"/>
|
|
||||||
<el-table-column label="数据源系统名称" align="center" prop="dataSourceSystemName"/>
|
|
||||||
<el-table-column label="数据源类型" align="center" prop="dataType"/>
|
|
||||||
<el-table-column label="数据源ip地址" align="center" prop="dataSourceIp"/>
|
|
||||||
<el-table-column label="端口号" align="center" prop="dataSourcePort"/>
|
|
||||||
<el-table-column label="连接数据库名称" align="center" prop="dataSourceDatabaseName"/>
|
|
||||||
<el-table-column label="状态" align="center" prop="status"/>
|
|
||||||
<el-table-column label="备注说明" align="center" prop="remark"/>
|
|
||||||
<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-edit"
|
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['data:source:edit']"
|
|
||||||
>修改
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="testConnection(scope.row.id)"
|
|
||||||
v-hasPermi="['data:source:testConnection']"
|
|
||||||
>测试链接
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="assetSynchronization(scope.row.id)"
|
|
||||||
v-hasPermi="['data:source:assetSynchronization']"
|
|
||||||
>同步数据结构
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['data:source:remove']"
|
|
||||||
>删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改数据源信息对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
|
||||||
<el-card>
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span>基础配置信息</span>
|
|
||||||
</div>
|
|
||||||
<el-row>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="数据源名称" prop="dataSourceName">
|
|
||||||
<el-input v-model="form.dataSourceName" placeholder="请输入数据源名称"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="数据源系统名称" prop="dataSourceSystemName">
|
|
||||||
<el-input v-model="form.dataSourceSystemName" placeholder="请输入数据源系统名称"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="数据源ip地址" prop="dataSourceIp">
|
|
||||||
<el-input v-model="form.dataSourceIp" placeholder="请输入数据源ip地址"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="端口号" prop="dataSourcePort">
|
|
||||||
<el-input v-model="form.dataSourcePort" placeholder="请输入端口号"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="数据源类型" prop="typeId">
|
|
||||||
<el-select v-model="form.typeId" placeholder="请选择数据源类型">
|
|
||||||
<el-option
|
|
||||||
v-for="item in typeList"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.dataType"
|
|
||||||
:value="item.id"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="连接数据库名称" prop="dataSourceDatabaseName">
|
|
||||||
<el-input v-model="form.dataSourceDatabaseName" placeholder="请输入连接数据库名称"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-card>
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span>数据链接参数</span>
|
|
||||||
</div>
|
|
||||||
<el-row>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="用户名" prop="dataSourceUsername">
|
|
||||||
<el-input v-model="form.dataSourceUsername" placeholder="请输入用户名"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="密码" prop="dataSourcePassword">
|
|
||||||
<el-input v-model="form.dataSourcePassword" placeholder="请输入密码"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-col :sm="24">
|
|
||||||
<el-form-item label="额外配置" prop="connectionParam">
|
|
||||||
<el-input v-model="form.additionalConfiguration" placeholder="请输入内容"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-row :gutter="10" style="margin: 10px 0">
|
|
||||||
<el-col :span="2">
|
|
||||||
<el-button type="primary" @click="addParam()">新增参数</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="2">
|
|
||||||
<el-button type="danger" @click="deleteParam(null)">清空参数</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="10">
|
|
||||||
<el-col :md="8" :xs="12" style="margin: 10px 0"
|
|
||||||
v-for="(dataSourceParam, dataSourceParamIndex) in dataSourceParamList">
|
|
||||||
<el-col :span="10">
|
|
||||||
<el-input v-model="dataSourceParam.name" placeholder="请输入参数键" @keyup.native="processParam"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1"><span style="font-size: 28px; margin: 0 3px 0 0;">:</span></el-col>
|
|
||||||
<el-col :span="10">
|
|
||||||
<el-input v-model="dataSourceParam.val" placeholder="请输入参数值" @keyup.native="processParam"/>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="3">
|
|
||||||
<el-button type="danger" @click="deleteParam(dataSourceParamIndex)">删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<el-card>
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span>连接池配置</span>
|
|
||||||
</div>
|
|
||||||
<el-row>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="初始化连接数量" prop="initialNumberOfConnections">
|
|
||||||
<el-input v-model="form.initialNumberOfConnections" placeholder="请输入初始化连接数量"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="最大连接数量" prop="maximumNumberOfConnections">
|
|
||||||
<el-input v-model="form.maximumNumberOfConnections" placeholder="请输入最大连接数量"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="最大等待时间" prop="maximumWaitingTime">
|
|
||||||
<el-input v-model="form.maximumWaitingTime" placeholder="请输入最大等待时间"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="最大等待次数" prop="maximumWaitingTimes">
|
|
||||||
<el-input v-model="form.maximumWaitingTimes" placeholder="请输入最大等待次数"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<el-card>
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span>其他信息</span>
|
|
||||||
</div>
|
|
||||||
<el-row>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="状态" prop="status">
|
|
||||||
<el-radio v-model="form.status" label="Y">启用</el-radio>
|
|
||||||
<el-radio v-model="form.status" label="N">禁用</el-radio>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :md="12" :sm="24">
|
|
||||||
<el-form-item label="备注说明" prop="remark">
|
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注说明"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
listSource,
|
|
||||||
getSource,
|
|
||||||
delSource,
|
|
||||||
addSource,
|
|
||||||
updateSource,
|
|
||||||
testConnection,
|
|
||||||
assetSynchronization
|
|
||||||
} from "@/api/data/source";
|
|
||||||
import {listType} from "@/api/data/type";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Source",
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 数据源信息表格数据
|
|
||||||
sourceList: [],
|
|
||||||
// 数据源类型信息表格数据
|
|
||||||
typeList: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
dataSourceName: null,
|
|
||||||
dataSourceSystemName: null,
|
|
||||||
dataSourceDatabaseName: null
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
dataSourceName: [
|
|
||||||
{required: true, message: "接入源名称不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
dataSourceSystemName: [
|
|
||||||
{required: true, message: "数据来源系统名称不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
typeId: [
|
|
||||||
{required: true, message: "数据接入类型不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
dataSourceIp: [
|
|
||||||
{required: true, message: "主机地址不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
dataSourcePort: [
|
|
||||||
{required: true, message: "主机地址不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
dataSourceDatabaseName: [
|
|
||||||
{required: true, message: "数据库名称不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
additionalConfiguration: [
|
|
||||||
{required: true, message: "数据连接参数不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
initialNumberOfConnections: [
|
|
||||||
{required: true, message: "初始连接数量不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
maximumNumberOfConnections: [
|
|
||||||
{required: true, message: "最大连接数量不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
maximumWaitingTime: [
|
|
||||||
{required: true, message: "最大等待时间不能为空", trigger: "blur"}
|
|
||||||
],
|
|
||||||
maximumWaitingTimes: [
|
|
||||||
{required: true, message: "最大等待次数不能为空", trigger: "blur"}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
// 条件参数内容
|
|
||||||
dataSourceParamList: [
|
|
||||||
{
|
|
||||||
name: null,
|
|
||||||
val: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getList();
|
|
||||||
this.getTypeList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 同步数据结构
|
|
||||||
assetSynchronization(id) {
|
|
||||||
assetSynchronization(id).then(response => {
|
|
||||||
console.log(response)
|
|
||||||
if (response.data) {
|
|
||||||
this.$modal.msgSuccess("同步成功");
|
|
||||||
} else {
|
|
||||||
this.$modal.msgError("同步失败");
|
|
||||||
}
|
|
||||||
this.getList();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 测试链接
|
|
||||||
testConnection(id) {
|
|
||||||
testConnection(id).then(response => {
|
|
||||||
console.log(response)
|
|
||||||
if (response.data) {
|
|
||||||
this.$modal.msgSuccess("测试成功");
|
|
||||||
} else {
|
|
||||||
this.$modal.msgError("测试失败");
|
|
||||||
}
|
|
||||||
this.getList();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 添加参数
|
|
||||||
addParam() {
|
|
||||||
this.dataSourceParamList.push({
|
|
||||||
name: null,
|
|
||||||
val: null
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 删除参数
|
|
||||||
deleteParam(index) {
|
|
||||||
if (index != null) {
|
|
||||||
this.dataSourceParamList.splice(index, 1);
|
|
||||||
} else {
|
|
||||||
this.dataSourceParamList = []
|
|
||||||
}
|
|
||||||
this.processParam();
|
|
||||||
},
|
|
||||||
// 处理参数
|
|
||||||
processParam() {
|
|
||||||
this.form.additionalConfiguration = this.dataSourceParamList
|
|
||||||
.filter(item => item.name != null || item.val != null)
|
|
||||||
.map(item => {
|
|
||||||
return item.name + "=" + item.val;
|
|
||||||
}).join("&")
|
|
||||||
console.log(this.form.additionalConfiguration)
|
|
||||||
},
|
|
||||||
/** 查询数据源信息列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
listSource(this.queryParams).then(response => {
|
|
||||||
this.sourceList = response.data.rows;
|
|
||||||
this.sourceList.forEach(item => {
|
|
||||||
if (item.status === 'Y') {
|
|
||||||
item.status = '启用'
|
|
||||||
} else if (item.status === 'N') {
|
|
||||||
item.status = '禁用'
|
|
||||||
} else if (item.status === 'S') {
|
|
||||||
item.status = '成功'
|
|
||||||
} else if (item.status === 'E') {
|
|
||||||
item.status = '失败'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.total = response.data.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 查询数据源类型列表 */
|
|
||||||
getTypeList() {
|
|
||||||
this.loading = true;
|
|
||||||
listType(this.queryParams).then(response => {
|
|
||||||
this.typeList = response.data.rows;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
dataSourceName: null,
|
|
||||||
dataSourceSystemName: null,
|
|
||||||
typeId: null,
|
|
||||||
dataSourceIp: null,
|
|
||||||
dataSourcePort: null,
|
|
||||||
dataSourceDatabaseName: null,
|
|
||||||
dataSourceUsername: null,
|
|
||||||
dataSourcePassword: null,
|
|
||||||
additionalConfiguration: null,
|
|
||||||
status: null,
|
|
||||||
remark: null,
|
|
||||||
initialNumberOfConnections: null,
|
|
||||||
maximumNumberOfConnections: null,
|
|
||||||
maximumWaitingTime: null,
|
|
||||||
maximumWaitingTimes: null,
|
|
||||||
createBy: null,
|
|
||||||
createTime: null,
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.id)
|
|
||||||
this.single = selection.length !== 1
|
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.reset();
|
|
||||||
this.open = true;
|
|
||||||
this.title = "添加数据源信息";
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id || this.ids
|
|
||||||
getSource(id).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改数据源信息";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateSource(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addSource(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const ids = row.id || this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除数据源信息编号为"' + ids + '"的数据项?').then(function () {
|
|
||||||
return delSource(ids);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('data/source/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `source_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
|
@ -1,326 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-row :gutter="40" class="panel-group">
|
|
||||||
<div class="title-header">
|
|
||||||
{{title}} - 资产结构概述
|
|
||||||
</div>
|
|
||||||
<el-col :sm="12" :xs="12" class="card-panel-col">
|
|
||||||
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
|
||||||
<div class="card-panel-icon-wrapper icon-message">
|
|
||||||
<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="3000" :end-val="15" :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"/>
|
|
||||||
</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"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-tabs v-model="activeName" type="border-card">
|
|
||||||
<el-tab-pane label="sys_user(用户表)" name="first">
|
|
||||||
<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>
|
|
||||||
<el-card style=" margin-top: 20px;">
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span>资产模型详细信息</span>
|
|
||||||
</div>
|
|
||||||
<el-table
|
|
||||||
:data="tableData"
|
|
||||||
style="width: 100%;">
|
|
||||||
<el-table-column prop="name" label="名称" />
|
|
||||||
<el-table-column prop="comment" label="注释" />
|
|
||||||
<el-table-column prop="isPrimaryKey" label="是否主键" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag size="small" :type="scope.row.isPrimaryKey === 'Y' ? 'success' : ''">
|
|
||||||
{{scope.row.isPrimaryKey}}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="type" label="类型" />
|
|
||||||
<el-table-column prop="mappingType" label="映射类型" />
|
|
||||||
<el-table-column prop="length" label="长度" />
|
|
||||||
<el-table-column prop="decimalPlaces" label="小数位" />
|
|
||||||
<el-table-column prop="isNull" label="是否为空" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag size="small" :type="scope.row.isNull === 'Y' ? 'success' : 'danger'">
|
|
||||||
{{scope.row.isNull}}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="defaultValue" label="默认值" />
|
|
||||||
<el-table-column prop="isDict" label="是否字典" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-tag v-if="scope.row.isDict === 'Y'" size="small" type="success">
|
|
||||||
{{scope.row.isDict}}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dictKey" label="映射字典" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-popover
|
|
||||||
v-if="scope.row.isDict === 'Y'"
|
|
||||||
placement="left"
|
|
||||||
width="200"
|
|
||||||
trigger="hover">
|
|
||||||
<el-table :data="[
|
|
||||||
{ label: '男', value: '1' },
|
|
||||||
{ label: '女', value: '2' },
|
|
||||||
{ label: '未知', value: '0' },
|
|
||||||
]">
|
|
||||||
<el-table-column property="label" label="字典标签"/>
|
|
||||||
<el-table-column property="value" label="字典值"/>
|
|
||||||
</el-table>
|
|
||||||
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
|
||||||
</el-popover>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="id" label="操作" >
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button type="text">编辑</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-card>
|
|
||||||
</el-tab-pane>
|
|
||||||
<el-tab-pane label="配置管理" name="second">配置管理</el-tab-pane>
|
|
||||||
<el-tab-pane label="角色管理" name="third">角色管理</el-tab-pane>
|
|
||||||
<el-tab-pane label="定时任务补偿" name="fourth">定时任务补偿</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import CountTo from 'vue-count-to'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
default: "-"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
activeName: 'first',
|
|
||||||
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: "-",
|
|
||||||
}, ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
CountTo
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleSetLineChartData(type) {
|
|
||||||
this.$emit('handleSetLineChartData', type)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</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>
|
|
|
@ -1,148 +0,0 @@
|
||||||
<template>
|
|
||||||
<el-container :style="{height: mainHeight + 'px'}">
|
|
||||||
<el-aside style="width: 400px">
|
|
||||||
<el-tree :data="assetStructureList"
|
|
||||||
:load="expandTable"
|
|
||||||
lazy
|
|
||||||
@node-click="showAssetsFun"
|
|
||||||
:props="defaultProps">
|
|
||||||
<div class="custom-tree-node" slot-scope="{ node, data }">
|
|
||||||
<div v-if="data.type === 'dataSource'">
|
|
||||||
{{ data.dataSourceName + '(' + data.dataSourceDatabaseName + '-' + data.dataSourceSystemName + ')' }}
|
|
||||||
</div>
|
|
||||||
<div v-if="data.type === 'dataTable'">
|
|
||||||
{{ data.tableName + '-' + data.tableNameAnnotation + '(' + data.tableDataCount + '条)' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</el-tree>
|
|
||||||
</el-aside>
|
|
||||||
<el-container>
|
|
||||||
<el-main>
|
|
||||||
<OverallAssets v-if="showAssets == null" :assetStructureDataCount="assetStructureDataCount"/>
|
|
||||||
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
</el-container>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import {listAssetStructure, selectAssetSouructureTableList} from "@/api/data/structure";
|
|
||||||
import OverallAssets from "@/views/data/structure/dashlboard/OverallAssets.vue";
|
|
||||||
import OverallSpecificAssets from "@/views/data/structure/dashlboard/OverallSpecificAssets.vue";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'assetStructure',
|
|
||||||
components: {OverallSpecificAssets, OverallAssets},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
mainHeight: window.innerHeight - 85,
|
|
||||||
defaultProps: {
|
|
||||||
children: 'childrenList',
|
|
||||||
label: 'name'
|
|
||||||
},
|
|
||||||
// 数据库
|
|
||||||
assetStructureList: [],
|
|
||||||
// 数据库表
|
|
||||||
childrenList: [],
|
|
||||||
|
|
||||||
showAssets: null,
|
|
||||||
title: null,
|
|
||||||
// 数据接入数量
|
|
||||||
assetStructureDataCount: {
|
|
||||||
dataCount: null,
|
|
||||||
assetStructureTableCount: null ,
|
|
||||||
assetStructureTableDataCount: null ,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.listAssetStructure();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 同步数据结构
|
|
||||||
listAssetStructure() {
|
|
||||||
listAssetStructure().then(response => {
|
|
||||||
// console.log(response)
|
|
||||||
// console.log(response.data)
|
|
||||||
this.assetStructureList = response.data.assetStructureList
|
|
||||||
this.assetStructureList.forEach(
|
|
||||||
item => {
|
|
||||||
item.type = "dataSource"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
// 数据接入数量
|
|
||||||
this.assetStructureDataCount.dataCount = this.assetStructureList.length
|
|
||||||
this.assetStructureDataCount.assetStructureTableCount = response.data.assetStructureTableCount
|
|
||||||
console.log(response)
|
|
||||||
this.assetStructureDataCount.assetStructureTableDataCount = response.data.assetStructureTableDataCount
|
|
||||||
|
|
||||||
})
|
|
||||||
},
|
|
||||||
expandTable(node, resolve) {
|
|
||||||
/**
|
|
||||||
* 节点展开回调函数,接受两个参数:
|
|
||||||
* node: 当前展开节点的信息对象,包含节点级别(level)、数据(data)等属性
|
|
||||||
* resolve: 一个函数,用于异步加载完成时传递子节点数据,通知 `el-tree` 组件更新节点状态
|
|
||||||
*/
|
|
||||||
|
|
||||||
// 如果当前节点为根节点(level === 0),直接返回 assetStructureList 作为其子节点数据
|
|
||||||
if (node.level === 0) {
|
|
||||||
return resolve(this.assetStructureList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从节点信息对象中解构出 data 属性
|
|
||||||
const {data} = node;
|
|
||||||
|
|
||||||
// 异步调用 selectAssetSouructureTableList API 函数,传入当前节点的 id 作为参数
|
|
||||||
selectAssetSouructureTableList(data.id).then((response) => {
|
|
||||||
// 打印 API 返回的响应数据
|
|
||||||
// console.log(response);
|
|
||||||
|
|
||||||
// 将 API 返回的 data 属性赋值给 this.childrenList
|
|
||||||
this.childrenList = response.data;
|
|
||||||
|
|
||||||
// 遍历 this.childrenList,为每个元素添加 type 属性,值为 "dataTable"
|
|
||||||
this.childrenList.forEach((item) => {
|
|
||||||
item.type = "dataTable";
|
|
||||||
});
|
|
||||||
|
|
||||||
// 调用 resolve 函数,传递处理后的 this.childrenList 作为子节点数据
|
|
||||||
resolve(this.childrenList);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 如果当前节点的数据类型为 "dataTable",返回空数组,不加载任何子节点
|
|
||||||
if (data.type === 'dataTable') {
|
|
||||||
return resolve([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果当前节点级别大于 1,返回空数组,不加载任何子节点
|
|
||||||
if (node.level > 1) return resolve([]);
|
|
||||||
|
|
||||||
// 使用 setTimeout 延迟 500ms 执行以下代码块
|
|
||||||
setTimeout(() => {
|
|
||||||
// 定义一个局部变量 data,赋值为 this.childrenList
|
|
||||||
const data = this.childrenList;
|
|
||||||
|
|
||||||
// 调用 resolve 函数,传递 data 作为子节点数据
|
|
||||||
resolve(data);
|
|
||||||
}, 500);
|
|
||||||
},
|
|
||||||
showAssetsFun(data){
|
|
||||||
this.title = data.dataSourceName + '('+data.dataSourceDatabaseName + '-' + data.dataSourceSystemName+')'
|
|
||||||
this.showAssets = data.type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.el-aside {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 600px;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-main {
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,264 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="数据源类型" prop="dataType">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.dataType"
|
|
||||||
placeholder="请输入数据源类型"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['data:type:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['data:type:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['data:type:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['data:type:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="编号" align="center" prop="id" />
|
|
||||||
<el-table-column label="数据源类型" align="center" prop="dataType" />
|
|
||||||
<el-table-column label="注册驱动" align="center" prop="driverManager" />
|
|
||||||
<el-table-column label="jdbc前缀" align="center" prop="jdbcPre" />
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<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-edit"
|
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['data:type:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['data:type:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改数据源类型对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="数据源类型" prop="dataType">
|
|
||||||
<el-input v-model="form.dataType" placeholder="请输入数据源类型" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="注册驱动" prop="driverManager">
|
|
||||||
<el-input v-model="form.driverManager" placeholder="请输入注册驱动" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="jdbc前缀" prop="jdbcPre">
|
|
||||||
<el-input v-model="form.jdbcPre" placeholder="请输入jdbc前缀" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注" prop="remark">
|
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { listType, getType, delType, addType, updateType } from "@/api/data/type";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Type",
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 数据源类型表格数据
|
|
||||||
typeList: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
dataType: null,
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 查询数据源类型列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
listType(this.queryParams).then(response => {
|
|
||||||
this.typeList = response.data.rows;
|
|
||||||
this.total = response.data.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
dataType: null,
|
|
||||||
driverManager: null,
|
|
||||||
jdbcPre: null,
|
|
||||||
remark: null,
|
|
||||||
createBy: null,
|
|
||||||
createTime: null,
|
|
||||||
updateBy: null,
|
|
||||||
updateTime: null
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.id)
|
|
||||||
this.single = selection.length!==1
|
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.reset();
|
|
||||||
this.open = true;
|
|
||||||
this.title = "添加数据源类型";
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id || this.ids
|
|
||||||
getType(id).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改数据源类型";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateType(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addType(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const ids = row.id || this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除数据源类型编号为"' + ids + '"的数据项?').then(function() {
|
|
||||||
return delType(ids);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('data/type/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `type_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>资产模型基本信息</span>
|
||||||
|
</div>
|
||||||
|
<el-descriptions border :column="2">
|
||||||
|
<el-descriptions-item label="表名称">{{ tableInfo.tableName }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="表备注">{{tableInfo.tableAnnotation}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="数据量">{{ tableInfo.recordCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否核心">
|
||||||
|
<el-tag size="small">是</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-card>
|
||||||
|
<el-card style=" margin-top: 20px;">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>资产模型详细信息</span>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="assetsModelList"
|
||||||
|
style="width: 100%;">
|
||||||
|
<el-table-column prop="fieldsName" label="名称" />
|
||||||
|
<el-table-column prop="fieldsAnnotation" label="注释" />
|
||||||
|
<el-table-column prop="isDictionary" label="是否主键" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="small" :type="scope.row.isDictionary === 1 ? 'success' : ''">
|
||||||
|
{{scope.row.isDictionary}}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="baseType" label="类型" />
|
||||||
|
<el-table-column prop="javaType" label="映射类型" />
|
||||||
|
<el-table-column prop="fieldsLength" label="长度" />
|
||||||
|
<el-table-column prop="decimalPlace" label="小数位" />
|
||||||
|
<el-table-column prop="isEmpty" label="是否为空" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag size="small" :type="scope.row.isNull === 1 ? 'success' : 'danger'">
|
||||||
|
{{scope.row.isEmpty}}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="defaultValue" label="默认值" />
|
||||||
|
<el-table-column prop="isDict" label="是否字典" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag v-if="scope.row.isDictionary === 1" size="small" type="success">
|
||||||
|
{{scope.row.isDictionary}}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="reflectionDictionary" label="映射字典" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-popover
|
||||||
|
v-if="scope.row.isDictionary === 1"
|
||||||
|
placement="left"
|
||||||
|
width="200"
|
||||||
|
trigger="hover">
|
||||||
|
<el-table :data="[
|
||||||
|
{ label: '男', value: '1' },
|
||||||
|
{ label: '女', value: '2' },
|
||||||
|
{ label: '未知', value: '0' },
|
||||||
|
]">
|
||||||
|
<el-table-column property="label" label="字典标签"/>
|
||||||
|
<el-table-column property="value" label="字典值"/>
|
||||||
|
</el-table>
|
||||||
|
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
||||||
|
</el-popover>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="id" label="操作" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text">编辑</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'OverallAssetStructure',
|
||||||
|
props: {
|
||||||
|
assetsModelList: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
tableInfo: {
|
||||||
|
type: Object
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
|
@ -12,7 +12,7 @@
|
||||||
<div class="card-panel-text">
|
<div class="card-panel-text">
|
||||||
数据接入
|
数据接入
|
||||||
</div>
|
</div>
|
||||||
<count-to :duration="2600" :end-val="assetStructureDataCount.dataCount" :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="assetStructureDataCount.assetStructureTableCount" :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="assetStructureDataCount.assetStructureTableDataCount" :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>
|
||||||
|
@ -50,10 +50,14 @@ import CountTo from 'vue-count-to'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
assetStructureDataCount: {
|
dataSourceCount: {
|
||||||
dataCount: null,
|
type :Number
|
||||||
assetStructureTableCount: null ,
|
},
|
||||||
assetStructureTableDataCount: null ,
|
allTableCount: {
|
||||||
|
type :Number
|
||||||
|
},
|
||||||
|
allDataModelCount: {
|
||||||
|
type :Number
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
@ -62,7 +66,6 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
handleSetLineChartData(type) {
|
handleSetLineChartData(type) {
|
||||||
this.$emit('handleSetLineChartData', type)
|
this.$emit('handleSetLineChartData', type)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,318 @@
|
||||||
|
<template>
|
||||||
|
<el-row :gutter="40" class="panel-group">
|
||||||
|
<div class="title-header">
|
||||||
|
{{dataSourceObj.dataSource.fromSystem}} - 资产结构概述
|
||||||
|
</div>
|
||||||
|
<el-col :sm="12" :xs="12" class="card-panel-col">
|
||||||
|
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
||||||
|
<div class="card-panel-icon-wrapper icon-message">
|
||||||
|
<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="3000" :end-val="dataSourceObj.dataSource.tableCount" :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"/>
|
||||||
|
</div>
|
||||||
|
<div class="card-panel-description">
|
||||||
|
<div class="card-panel-text">
|
||||||
|
数据模型
|
||||||
|
</div>
|
||||||
|
<count-to :duration="3200" :end-val="dataSourceObj.dataSource.dataModelCount" :start-val="0" class="card-panel-num"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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="dictionary.dictionaryName"></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="dictionaryInfoResp in dictionaryInfoRespList" :md="8" :sm="24" :xs="12">
|
||||||
|
<el-card class="box-card" style="height: 300px">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>{{dictionaryInfoResp.dictionary.dictionaryName}}</span>
|
||||||
|
<el-button style="float: right; padding: 3px 0"
|
||||||
|
type="text"
|
||||||
|
@click="dictionaryInfoResp.dictionaryInfoList.push({ dictionaryInfoTag: null, dictionaryInfoValue: null, isEdit: true })"
|
||||||
|
>新增</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="dictionaryInfoResp.dictionaryInfoList" style="width: 100%" height="280px">
|
||||||
|
<el-table-column label="标签">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="!scope.row.isEdit">{{scope.row.dictionaryInfoTag}}</span>
|
||||||
|
<el-input v-if="scope.row.isEdit" v-model="scope.row.dictionaryInfoTag" size="mini"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="值">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="!scope.row.isEdit">{{scope.row.dictionaryInfoValue}}</span>
|
||||||
|
<el-input v-if="scope.row.isEdit" v-model="scope.row.dictionaryInfoValue" size="mini"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="!scope.row.isEdit"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="updateEdit(scope.row.id)"
|
||||||
|
:key="scope.row.id + this.nowTime"
|
||||||
|
>修改</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-tabs v-model="activeName" type="border-card" >
|
||||||
|
<el-tab-pane :label="assetsModelResp.dataTable.tableName" :key="assetsModelResp.dataTable.id" v-for="assetsModelResp in assetsModelRespArrayList">
|
||||||
|
<overall-asset-structure :tableInfo="assetsModelResp.dataTable" :assetsModelList="assetsModelResp.assetsModelList" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CountTo from 'vue-count-to'
|
||||||
|
import OverallAssetStructure from './OverallAssetStructure.vue'
|
||||||
|
import {getDictionaryRespByDataSourceId} from "@/api/dataSource/dictionary";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
watch:{
|
||||||
|
dataSourceId:{
|
||||||
|
// 此处监听variable变量,当期有变化时执行
|
||||||
|
handler(item1,item2){
|
||||||
|
console.log("新值",item1)
|
||||||
|
console.log("旧址",item2)
|
||||||
|
getDictionaryRespByDataSourceId(item1).then(
|
||||||
|
res => {
|
||||||
|
console.log("字典表响应对象:",res.data)
|
||||||
|
this.dictionaryInfoRespList = res.data
|
||||||
|
this.dictionaryInfoRespList.forEach(dictionaryInfoResp => {
|
||||||
|
dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
|
||||||
|
dictionaryInfo.isEdit = false;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
assetsModelRespArrayList: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
dataSourceObj: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
dataSourceId: {
|
||||||
|
type: Number,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
nowTime: null,
|
||||||
|
dictionaryInfoRespList: [],
|
||||||
|
activeName: 'first',
|
||||||
|
dictionary: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
OverallAssetStructure,
|
||||||
|
CountTo
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
updateEdit(row) {
|
||||||
|
console.log("行对象:"+row)
|
||||||
|
this.dictionaryInfoRespList.forEach(dictionaryInfoResp => {
|
||||||
|
dictionaryInfoResp.dictionaryInfoList.forEach(dictionaryInfo => {
|
||||||
|
if (dictionaryInfo.id == row){
|
||||||
|
console.log("进来了",dictionaryInfo.isEdit)
|
||||||
|
dictionaryInfo.isEdit = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.$forceUpdate()
|
||||||
|
this.nowTime = new Date()
|
||||||
|
},
|
||||||
|
editConfirm(row){
|
||||||
|
if (!row.dictionaryInfoTag || !row.dictionaryInfoValue) {
|
||||||
|
this.$message.error('字典标签或字典值,不可为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
row.isEdit = false;
|
||||||
|
},
|
||||||
|
handleSetLineChartData(type) {
|
||||||
|
this.$emit('handleSetLineChartData', type)
|
||||||
|
},
|
||||||
|
addDict(){
|
||||||
|
if (!this.dictionary.dictionaryName){
|
||||||
|
this.$message.error('数据字典,不可为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(this.dictionary.dictionaryName)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</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>
|
|
@ -0,0 +1,133 @@
|
||||||
|
<template>
|
||||||
|
<el-container :style="{height: mainHeight + 'px'}">
|
||||||
|
<el-aside>
|
||||||
|
<el-tree :data="assetStructureList"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:load="expandTable"
|
||||||
|
lazy
|
||||||
|
@node-click="(data) => showAssets=data.type"
|
||||||
|
:props="defaultProps">
|
||||||
|
<div class="custom-tree-node" slot-scope="{ node, data }">
|
||||||
|
<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.dataTable.tableName + '-'+data.dataTable.tableAnnotation + '(' + data.dataTable.recordCount+'条)' }}</div>
|
||||||
|
</div>
|
||||||
|
</el-tree>
|
||||||
|
</el-aside>
|
||||||
|
<el-container>
|
||||||
|
<el-main>
|
||||||
|
<OverallAssets :dataSourceCount="dataSourceCount" :allTableCount="allTableCount" :allDataModelCount="allDataModelCount" v-if="showAssets == null"/>
|
||||||
|
<overall-specific-assets :dataSourceId="dataSourceId" :dataSourceObj="dataSourceObj" :assetsModelRespArrayList="assetsModelRespArrayList" v-if="showAssets === 'dataSource'" :title="title"/>
|
||||||
|
<overall-asset-structure :tableInfo="tableInfo" :assetsModelList="assetsModelList" v-if="showAssets === 'dataTable'" :title="title"/>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import OverallAssets from './dashboard/OverallAssets.vue'
|
||||||
|
import OverallSpecificAssets from './dashboard/OverallSpecificAssets.vue'
|
||||||
|
import OverallAssetStructure from './dashboard/OverallAssetStructure.vue'
|
||||||
|
import {getAssetsModelByDataTableId, getAssetsModelListByTableIds} from "@/api/dataSource/assets";
|
||||||
|
import {queryBigStructure} from "@/api/dataSource/data";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'assetStructure',
|
||||||
|
components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataSourceId: null,
|
||||||
|
tableInfo: {},
|
||||||
|
assetsModelList: [],
|
||||||
|
dataSourceObj: null,
|
||||||
|
tableCount:0,
|
||||||
|
dataModelCount:0,
|
||||||
|
dataSourceCount: 0,
|
||||||
|
allTableCount: 0,
|
||||||
|
allDataModelCount: 0,
|
||||||
|
dataBaseConnectObj: {},
|
||||||
|
tableData: [],
|
||||||
|
mainHeight: window.innerHeight - 85,
|
||||||
|
defaultProps: {
|
||||||
|
children: 'childrenList',
|
||||||
|
label: 'name'
|
||||||
|
},
|
||||||
|
assetStructureList: [],
|
||||||
|
childrenList: [],
|
||||||
|
showAssets: null,
|
||||||
|
title: null,
|
||||||
|
tableIds: [],
|
||||||
|
assetsModelRespArrayList: [],
|
||||||
|
dictionaryInfoRespList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getNowDataSource(data) {
|
||||||
|
console.log(data)
|
||||||
|
this.tableIds = data.dataTableList.map(dataTable => dataTable.dataTable.id);
|
||||||
|
console.log("idList",this.tableIds)
|
||||||
|
getAssetsModelListByTableIds(this.tableIds).then(
|
||||||
|
res => {
|
||||||
|
this.assetsModelRespArrayList = res.data
|
||||||
|
console.log("this.assetsModelRespArrayList",this.assetsModelRespArrayList)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
this.dataSourceId = data.dataSource.id
|
||||||
|
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() {
|
||||||
|
queryBigStructure().then(
|
||||||
|
res => {
|
||||||
|
this.assetStructureList = res.data.dataSourceDecorationList
|
||||||
|
this.dataSourceCount = this.assetStructureList.length
|
||||||
|
this.allTableCount = res.data.allTableCount
|
||||||
|
this.allDataModelCount = res.data.allDataModelCount
|
||||||
|
console.log("BigStructure",this.assetStructureList)
|
||||||
|
this.assetsModelList = this.assetStructureList
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
expandTable( node, resolve){
|
||||||
|
if (node.level === 0) return resolve(this.assetStructureList);
|
||||||
|
if (node.level > 1) return resolve([]);
|
||||||
|
const {data} = node;
|
||||||
|
if (data.type === 'dataSource') {
|
||||||
|
this.title = data.name + '('+data.dataSource.dataSourceDatabaseName + '-' + data.dataSource.fromSystem+')'
|
||||||
|
}
|
||||||
|
if (data.type === 'dataTable') {
|
||||||
|
this.title = data.tableName + '('+data.dataTable.tableAnnotation + '-' + data.dataTable.recordCount+')'
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(data.dataTableList)
|
||||||
|
this.showAuth = data.type;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getBigStructure()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.el-aside {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 400px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.el-main {
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,553 @@
|
||||||
|
<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-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入接入源名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据来源系统名称" prop="fromSystem">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.fromSystem"
|
||||||
|
placeholder="请输入数据来源系统名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据库名称" prop="dataSourceDatabaseName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dataSourceDatabaseName"
|
||||||
|
placeholder="请输入数据库名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:access:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:access:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:access:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:access: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-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="接入源名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="数据来源系统名称" align="center" prop="fromSystem" />
|
||||||
|
<el-table-column label="主机地址" align="center" prop="dataSourceIp" />
|
||||||
|
<el-table-column label="端口号" align="center" prop="dataSourcePort" />
|
||||||
|
<el-table-column label="数据接入类型" align="center" prop="dataType" />
|
||||||
|
<el-table-column label="数据库名称" align="center" prop="dataSourceDatabaseName" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<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-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:access:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:access:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="testConnect(scope.row)"
|
||||||
|
v-hasPermi="['system:access:remove']"
|
||||||
|
>测试连接</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="dataSynchronization(scope.row)"
|
||||||
|
v-hasPermi="['system:access:remove']"
|
||||||
|
>同步数据</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="queryDataBase(scope.row)"
|
||||||
|
v-hasPermi="['system:access:remove']"
|
||||||
|
>查询此数据库</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改数据接入对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>基础配置信息</span>
|
||||||
|
</div>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="接入源名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入接入源名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="数据来源系统名称" prop="systemName">
|
||||||
|
<el-input v-model="form.fromSystem" placeholder="请输入数据来源系统名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="主机地址" prop="host">
|
||||||
|
<el-input v-model="form.dataSourceIp" placeholder="请输入主机地址" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="端口号" prop="port">
|
||||||
|
<el-input v-model="form.dataSourcePort" placeholder="请输入主机地址" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="数据接入类型" prop="type">
|
||||||
|
<el-select style="width: 100%" v-model="form.typeId">
|
||||||
|
<el-option v-for="type in typeList" :label="type.dataType" :value="type.id" ></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="数据库名称" prop="databaseName">
|
||||||
|
<el-input v-model="form.dataSourceDatabaseName" placeholder="请输入数据库名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>数据连接参数</span>
|
||||||
|
</div>
|
||||||
|
<el-col :sm="24">
|
||||||
|
<el-form-item label="数据连接参数" prop="additionalConfiguration">
|
||||||
|
<el-input v-model="form.additionalConfiguration" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-row :gutter="10" style="margin: 10px 0">
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-button type="primary" @click="addParam()">新增参数</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-button type="danger" @click="deleteParam(null)">清空参数</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :md="8" :xs="12" style="margin: 10px 0" v-for="(dataSourceParam, dataSourceParamIndex) in dataSourceParamList">
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-input v-model="dataSourceParam.name" placeholder="请输入参数键" @keyup.native="processParam"/>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1"><span style="font-size: 28px; margin: 0 3px 0 0;">:</span></el-col>
|
||||||
|
<el-col :span="10">
|
||||||
|
<el-input v-model="dataSourceParam.val" placeholder="请输入参数值" @keyup.native="processParam"/>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3">
|
||||||
|
<el-button type="danger" @click="deleteParam(dataSourceParamIndex)">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
<el-card style="margin-top: 20px">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>连接池配置</span>
|
||||||
|
</div>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="初始连接数量" prop="initialNumberOfConnections">
|
||||||
|
<el-input v-model="form.initialNumberOfConnections" placeholder="请输入初始连接数量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="最大连接数量" prop="maximumNumberOfConnections">
|
||||||
|
<el-input v-model="form.maximumNumberOfConnections" placeholder="请输入最大连接数量" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="最大等待时间" prop="maximumWaitingTime">
|
||||||
|
<el-input v-model="form.maximumWaitingTime" placeholder="请输入最大等待时间" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :md="12" :sm="24">
|
||||||
|
<el-form-item label="最大等待次数" prop="maximumWaitingTimes">
|
||||||
|
<el-input v-model="form.maximumWaitingTimes" placeholder="请输入最大等待次数" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card style="margin-top: 20px">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>其他信息</span>
|
||||||
|
</div>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-card>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<el-dialog title="查询结构" :visible.sync="dialogTableVisible">
|
||||||
|
<el-form>
|
||||||
|
<el-form-item label="选择表" prop="type">
|
||||||
|
<el-select style="width: 100%" v-model="selectTableName">
|
||||||
|
<el-option v-for="table in tableList" :label="table" :value="table" ></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-button @click="queryTableStructure">查询</el-button>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
dataSynchronization,
|
||||||
|
getAllDataType,
|
||||||
|
getDataSourceList,
|
||||||
|
insertDataSource,
|
||||||
|
queryStructure, testConnect
|
||||||
|
} from "@/api/dataSource/data";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Access",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectTableName: "",
|
||||||
|
tableList:[],
|
||||||
|
dialogTableVisible: false,
|
||||||
|
dataSourceQueryReq: {
|
||||||
|
typeId: null,
|
||||||
|
name: "",
|
||||||
|
dataSourceDatabaseName: ""
|
||||||
|
},
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 数据接入表格数据
|
||||||
|
accessList: [],
|
||||||
|
//数据库类型
|
||||||
|
typeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
name: null,
|
||||||
|
fromSystem: null,
|
||||||
|
dataSourceDatabaseName: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: "接入源名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
fromSystem: [
|
||||||
|
{required: true, message: "数据来源系统名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
typeId: [
|
||||||
|
{required: true, message: "数据接入类型不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
dataSourceIp: [
|
||||||
|
{required: true, message: "主机地址不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
dataSourcePort: [
|
||||||
|
{required: true, message: "主机地址不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
dataSourceDatabaseName: [
|
||||||
|
{required: true, message: "数据库名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
additionalConfiguration: [
|
||||||
|
{required: true, message: "数据连接参数不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
initialNumberOfConnections: [
|
||||||
|
{required: true, message: "初始连接数量不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
maximumNumberOfConnections: [
|
||||||
|
{required: true, message: "最大连接数量不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
maximumWaitingTime: [
|
||||||
|
{required: true, message: "最大等待时间不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
maximumWaitingTimes: [
|
||||||
|
{required: true, message: "最大等待次数不能为空", trigger: "blur"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 条件参数内容
|
||||||
|
dataSourceParamList: [
|
||||||
|
{
|
||||||
|
name: null,
|
||||||
|
val: null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getDataTypeList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 添加参数
|
||||||
|
addParam(){
|
||||||
|
this.dataSourceParamList.push({
|
||||||
|
name: null,
|
||||||
|
val: null
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 删除参数
|
||||||
|
deleteParam(index){
|
||||||
|
if (index != null){
|
||||||
|
this.dataSourceParamList.splice(index, 1);
|
||||||
|
}else {
|
||||||
|
this.dataSourceParamList = []
|
||||||
|
}
|
||||||
|
this.processParam();
|
||||||
|
},
|
||||||
|
// 处理参数
|
||||||
|
processParam(){
|
||||||
|
this.form.additionalConfiguration = this.dataSourceParamList
|
||||||
|
.filter(item => item.name != null || item.val != null)
|
||||||
|
.map(item => {
|
||||||
|
return item.name + "=" + item.val;
|
||||||
|
}).join("&")
|
||||||
|
console.log(this.form.additionalConfiguration)
|
||||||
|
},
|
||||||
|
/** 查询数据接入列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
getDataSourceList(this.queryParams).then(res => {
|
||||||
|
this.accessList = res.data;
|
||||||
|
console.log(res.data)
|
||||||
|
})
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
getDataTypeList() {
|
||||||
|
getAllDataType().then(
|
||||||
|
res => {
|
||||||
|
this.typeList = res.data
|
||||||
|
console.log("typeList:",this.typeList)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
typeId: null,
|
||||||
|
fromSystem: null,
|
||||||
|
dataSourceIp: null,
|
||||||
|
dataSourcePort: null,
|
||||||
|
dataSourceDatabaseName: null,
|
||||||
|
additionalConfiguration: null,
|
||||||
|
initialNumberOfConnections: 5,
|
||||||
|
maximumNumberOfConnections: 20,
|
||||||
|
maximumWaitingTime: 3000,
|
||||||
|
maximumWaitingTimes: 3,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
remark: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加数据接入";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
this.form = row;
|
||||||
|
this.dataSourceParamList = [];
|
||||||
|
this.form.additionalConfiguration.split("&").forEach(param => {
|
||||||
|
let paramArr = param.split("=");
|
||||||
|
this.dataSourceParamList.push({
|
||||||
|
name: paramArr[0],
|
||||||
|
val: paramArr[1]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改数据接入";
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 查询表结构
|
||||||
|
*/
|
||||||
|
queryTableStructure(){
|
||||||
|
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
console.log('from:',this.form)
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
} else {
|
||||||
|
insertDataSource(this.form).then(
|
||||||
|
res => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除数据接入编号为"' + ids + '"的数据项?').then(() => {
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
queryDataBase(row) {
|
||||||
|
queryStructure(row).then(
|
||||||
|
res => {
|
||||||
|
console.log(res.data)
|
||||||
|
this.tableList = res.data
|
||||||
|
this.dialogTableVisible = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
dataSynchronization(row) {
|
||||||
|
dataSynchronization(row).then(
|
||||||
|
res => {
|
||||||
|
if (res.code ===200){
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
}else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
testConnect(row) {
|
||||||
|
testConnect(row).then(
|
||||||
|
res => {
|
||||||
|
if (res.code ===200){
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
}else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
console.log("test:",row)
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.$modal.msgSuccess("导出成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue