parent
7afc89fef8
commit
6f1fa2f31d
|
@ -0,0 +1,59 @@
|
|||
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'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
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'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
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'
|
||||
})
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询【请填写功能名称】列表
|
||||
export function listSource(query) {
|
||||
return request({
|
||||
url: '/dataSource/source/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询【请填写功能名称】详细
|
||||
export function getSource(id) {
|
||||
return request({
|
||||
url: '/dataSource/source/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增【请填写功能名称】
|
||||
export function addSource(data) {
|
||||
return request({
|
||||
url: '/dataSource/source',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改【请填写功能名称】
|
||||
export function updateSource(data) {
|
||||
return request({
|
||||
url: '/dataSource/source',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除【请填写功能名称】
|
||||
export function delSource(id) {
|
||||
return request({
|
||||
url: '/dataSource/source/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -73,7 +73,6 @@ service.interceptors.request.use(config => {
|
|||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(res => {
|
||||
debugger
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
// 获取错误信息
|
||||
|
|
|
@ -0,0 +1,571 @@
|
|||
<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>
|
|
@ -0,0 +1,186 @@
|
|||
<template>
|
||||
<el-row :gutter="40" class="panel-group">
|
||||
<div class="title-header">
|
||||
整体数据资产结构概述
|
||||
</div>
|
||||
<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"/>
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
数据接入
|
||||
</div>
|
||||
<count-to :duration="2600" :end-val="assetStructureDataCount.dataCount" :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('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="assetStructureDataCount.assetStructureTableCount" :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"/>
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
数据模型
|
||||
</div>
|
||||
<count-to :duration="3200" :end-val="assetStructureDataCount.assetStructureTableDataCount" :start-val="0" class="card-panel-num"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CountTo from 'vue-count-to'
|
||||
|
||||
export default {
|
||||
props:{
|
||||
assetStructureDataCount: {
|
||||
dataCount: null,
|
||||
assetStructureTableCount: null ,
|
||||
assetStructureTableDataCount: null ,
|
||||
}
|
||||
},
|
||||
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>
|
|
@ -0,0 +1,326 @@
|
|||
<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>
|
|
@ -0,0 +1,148 @@
|
|||
<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>
|
|
@ -0,0 +1,264 @@
|
|||
<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>
|
|
@ -1,459 +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="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入接入源名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据来源系统名称" prop="systemName">
|
||||
<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="请输入数据库名称"
|
||||
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="['dataSource: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="['dataSource: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="['dataSource: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="['dataSource: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="主键" align="center" prop="id" />
|
||||
<el-table-column label="接入源名称" align="center" prop="name" />
|
||||
<el-table-column label="数据来源系统名称" align="center" prop="systemName" />
|
||||
<el-table-column label="主机ip地址" align="center" prop="host" />
|
||||
<el-table-column label="端口" align="center" prop="port" />
|
||||
<el-table-column label="用户名" align="center" prop="username" />
|
||||
<el-table-column label="密码" align="center" prop="password" />
|
||||
<el-table-column label="数据接入类型" align="center" prop="type" />
|
||||
<el-table-column label="数据库名称" align="center" prop="databaseName" />
|
||||
<el-table-column label="数据连接参数" align="center" prop="connectionParam" />
|
||||
<el-table-column label="初始连接数量" align="center" prop="initNum" />
|
||||
<el-table-column label="最大连接数量" align="center" prop="maxNum" />
|
||||
<el-table-column label="最大等待时间" align="center" prop="maxWaitTime" />
|
||||
<el-table-column label="最大等待次数" align="center" prop="maxWaitSize" />
|
||||
<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="['dataSource:source:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['dataSource: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="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<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.systemName" placeholder="请输入数据来源系统名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="主机ip地址" prop="host">
|
||||
<el-input v-model="form.host" placeholder="请输入主机ip地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="端口" prop="port">
|
||||
<el-input v-model="form.port" 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>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="数据接入类型" prop="type">
|
||||
<el-input v-model="form.type" placeholder="请输入数据接入类型" />
|
||||
<el-option label="MySql" value="MySql">MySql</el-option>
|
||||
<el-option label="Oracle" value="Oracle">Oracle</el-option>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="数据库名称" prop="databaseName">
|
||||
<el-input v-model="form.databaseName" 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="connectionParam">
|
||||
<el-input v-model="form.connectionParam" 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="initNum">
|
||||
<el-input v-model="form.initNum" placeholder="请输入初始连接数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="最大连接数量" prop="maxNum">
|
||||
<el-input v-model="form.maxNum" placeholder="请输入最大连接数量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="最大等待时间" prop="maxWaitTime">
|
||||
<el-input v-model="form.maxWaitTime" placeholder="请输入最大等待时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="最大等待次数" prop="maxWaitSize">
|
||||
<el-input v-model="form.maxWaitSize" 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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSource, getSource, delSource, addSource, updateSource } from "@/api/dataSource/source";
|
||||
|
||||
export default {
|
||||
name: "Source",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 【请填写功能名称】表格数据
|
||||
sourceList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
systemName: null,
|
||||
host: null,
|
||||
port: null,
|
||||
username: null,
|
||||
password: null,
|
||||
type: null,
|
||||
databaseName: null,
|
||||
connectionParam: null,
|
||||
initNum: null,
|
||||
maxNum: null,
|
||||
maxWaitTime: null,
|
||||
maxWaitSize: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
// 条件参数内容
|
||||
dataSourceParamList: [
|
||||
{
|
||||
name: null,
|
||||
val: null
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
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.connectionParam = this.dataSourceParamList
|
||||
.filter(item => item.name != null || item.val != null)
|
||||
.map(item => {
|
||||
return item.name + "=" + item.val;
|
||||
}).join("&")
|
||||
console.log(this.form.connectionParam)
|
||||
},
|
||||
/** 查询【请填写功能名称】列表 */
|
||||
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;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
systemName: null,
|
||||
host: null,
|
||||
port: null,
|
||||
username: null,
|
||||
password: null,
|
||||
type: null,
|
||||
databaseName: null,
|
||||
connectionParam: null,
|
||||
initNum: null,
|
||||
maxNum: null,
|
||||
maxWaitTime: null,
|
||||
maxWaitSize: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: 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('dataSource/source/export', {
|
||||
...this.queryParams
|
||||
}, `source_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue