feat(DataManagerService): 数据同步功能

master
20300 2024-04-23 10:07:28 +08:00
parent 7bc96b0b41
commit 158664de5e
15 changed files with 2333 additions and 1 deletions

63
src/api/data.js 100644
View File

@ -0,0 +1,63 @@
import request from '@/utils/request'
export function getDataSourceList(dataSourceQueryReq) {
return request({
url: '/data/data/list',
method: 'post',
data: dataSourceQueryReq
})
}
export function getAllDataType() {
return request({
url: '/data/dataType/getAllDataType',
method: 'get'
})
}
export function insertDataSource(dataSource) {
return request({
url: '/data/data/insertDataSource',
method: 'post',
data: dataSource
})
}
export function dataSynchronization(dataSourceResp) {
return request({
url: '/data/data/dataSynchronization',
method: 'post',
data: dataSourceResp
})
}
export function testConnect(dataSourceResp) {
return request({
url: '/data/data/testConnect',
method: 'post',
data: dataSourceResp
})
}
export function queryStructure(dataSourceResp) {
return request({
url: '/data/data/queryStructure',
method: 'post',
data: dataSourceResp
})
}
export function queryBigStructure() {
return request({
url: '/data/data/queryBigStructure',
method: 'post'
})
}
export function queryTableStructure(tableStructureQueryReq) {
return request({
url: '/data/data/queryTableStructure',
method: 'post',
data: tableStructureQueryReq
})
}

View File

@ -0,0 +1,25 @@
import request from '@/utils/request'
export function getGoodsList(query) {
return request({
url: '/goods/goods/list',
method: 'get',
params: query
})
}
export function addGoods(goods) {
return request({
url: '/goods/goods/addGoods',
method: 'post',
data: goods
})
}
export function deleteGoodsById(ids) {
return request({
url: '/goods/goods/deleteGoodsById',
method: 'post',
data: ids
})
}

View File

@ -0,0 +1 @@
<svg width="40px" height="40px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="layersIconTitle" stroke="#2329D6" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" color="#2329D6"> <title id="layersIconTitle">Layers</title> <path d="M12 4L20 8.00004L12 12L4 8.00004L12 4Z"/> <path d="M20 12L12 16L4 12"/> <path d="M20 16L12 20L4 16"/> </svg>

After

Width:  |  Height:  |  Size: 393 B

View File

@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Electron Fiddle</title><path d="M8 0c-.6312 0-1.1429.5117-1.1429 1.1429v13.8583c-1.9716.5075-3.4285 2.2973-3.4285 4.4274C3.4286 21.9533 5.4753 24 8 24c2.5247 0 4.5714-2.0467 4.5714-4.5714 0-2.1301-1.4569-3.92-3.4285-4.4274v-4.7155h4.7346c.541 0 .9796-.5117.9796-1.1428 0-.6312-.4386-1.1429-.9796-1.1429H9.143V2.2857h10.2857c.6312 0 1.1428-.5117 1.1428-1.1428C20.5714.5117 20.0598 0 19.4286 0Zm0 17.1429c1.2624 0 2.2857 1.0233 2.2857 2.2857 0 1.2623-1.0233 2.2857-2.2857 2.2857-1.2624 0-2.2857-1.0234-2.2857-2.2857 0-1.2624 1.0233-2.2857 2.2857-2.2857z"/></svg>

After

Width:  |  Height:  |  Size: 638 B

View File

@ -73,7 +73,6 @@ service.interceptors.request.use(config => {
// 响应拦截器 // 响应拦截器
service.interceptors.response.use(res => { service.interceptors.response.use(res => {
debugger
// 未设置状态码则默认成功状态 // 未设置状态码则默认成功状态
const code = res.data.code || 200; const code = res.data.code || 200;
// 获取错误信息 // 获取错误信息

View File

@ -0,0 +1,345 @@
<template>
<div class="app-container">
<h4 class="form-header h4">基本信息</h4>
<el-form ref="form" :model="baseInfo" label-width="120px">
<el-row>
<el-col :offset="2" :span="8">
<el-form-item label="数据接入名称" prop="nickName">
<el-input v-model="baseInfo.name" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="系统名称" prop="userName">
<el-input v-model="baseInfo.systemName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="数据库名称" prop="nickName">
<el-input v-model="baseInfo.databaseName" disabled/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-model="activeName">
<el-tab-pane label="部门授权" name="dept">
<el-table
ref="deptTable"
v-loading="loading"
:data="deptList"
:default-expand-all="true"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="deptId"
>
<el-table-column label="部门名称" prop="deptName" ></el-table-column>
<el-table-column label="部门负责人" prop="leader" ></el-table-column>
<el-table-column label="邮箱" prop="email" ></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" prop="createTime" >
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
inactive-text="未授权">
</el-switch>
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
</el-tab-pane>
<el-tab-pane label="用户授权" name="user">
<el-table ref="table" v-loading="loading" :data="userList">
<el-table-column align="center" label="用户名称" prop="userName"/>
<el-table-column align="center" label="用户昵称" prop="nickName"/>
<el-table-column align="center" label="用户部门" prop="dept.deptName"/>
<el-table-column align="center" label="用户邮箱" prop="email"/>
<el-table-column align="center" label="用户手机号" prop="phonenumber"/>
<el-table-column align="center" label="创建时间" prop="createTime" />
<el-table-column align="center" label="操作" prop="createTime" >
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
inactive-text="未授权">
</el-switch>
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { parseTime } from '@/utils/muyu'
export default {
name: "AuthDataSource",
data() {
return {
//
loading: true,
activeName: "dept",
//
total: 0,
pageNum: 1,
pageSize: 1,
//
baseInfo: {
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
},
//
deptList: [],
//
userList: []
};
},
created() {
this.loading = true;
setTimeout(() => this.loading = false, 200)
this.init()
},
methods: {
parseTime,
init(){
let response = {
"code": 200,
"msg": "操作成功",
"data": [
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 100,
"parentId": 0,
"ancestors": "0",
"deptName": "muyu牧鱼科技",
"orderNum": 0,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 101,
"parentId": 100,
"ancestors": "0,100",
"deptName": "深圳总公司",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 102,
"parentId": 100,
"ancestors": "0,100",
"deptName": "长沙分公司",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 103,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "研发部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 104,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "市场部门",
"isAuth": true,
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "测试部门",
"orderNum": 3,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 106,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "财务部门",
"orderNum": 4,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 107,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "运维部门",
"orderNum": 5,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 108,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "市场部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 109,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "财务部门",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
}
]
}
this.deptList = this.handleTree(response.data, "deptId");
this.userList = [
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "管理员",
"userId": 1,
"deptId": 103,
"userName": "admin",
"nickName": "智能车联",
"email": "ry@163.com",
"phonenumber": "15888888888",
"isAuth": true,
"dept": {
"deptName": "研发部门"
}
},
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "测试员",
"userId": 2,
"deptId": 105,
"userName": "ry",
"nickName": "智能车联",
"email": "ry@qq.com",
"phonenumber": "15666666666",
"dept": {
"deptName": "测试部门"
}
}
]
}
},
};
</script>

View File

@ -0,0 +1,363 @@
<template>
<div class="app-container">
<h4 class="form-header h4">基本信息</h4>
<el-form ref="form" :model="baseInfo" label-width="120px">
<el-row>
<el-col :offset="2" :span="8">
<el-form-item label="数据接入名称" prop="nickName">
<el-input v-model="baseInfo.name" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="系统名称" prop="userName">
<el-input v-model="baseInfo.systemName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="数据库名称" prop="nickName">
<el-input v-model="baseInfo.databaseName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="表名称" prop="nickName">
<el-input v-model="baseInfo.tableName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="表中文名" prop="nickName">
<el-input v-model="baseInfo.tableAsName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="数据量" prop="nickName">
<el-input v-model="baseInfo.total" disabled/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-model="activeName">
<el-tab-pane label="部门授权" name="dept">
<el-table
ref="deptTable"
v-loading="loading"
:data="deptList"
:default-expand-all="true"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="deptId"
>
<el-table-column label="部门名称" prop="deptName" ></el-table-column>
<el-table-column label="部门负责人" prop="leader" ></el-table-column>
<el-table-column label="邮箱" prop="email" ></el-table-column>
<el-table-column align="center" label="创建时间" prop="createTime" >
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" prop="createTime" >
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
inactive-text="未授权">
</el-switch>
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
</el-tab-pane>
<el-tab-pane label="用户授权" name="user">
<el-table ref="table" v-loading="loading" :data="userList">
<el-table-column align="center" label="用户名称" prop="userName"/>
<el-table-column align="center" label="用户昵称" prop="nickName"/>
<el-table-column align="center" label="用户部门" prop="dept.deptName"/>
<el-table-column align="center" label="用户邮箱" prop="email"/>
<el-table-column align="center" label="用户手机号" prop="phonenumber"/>
<el-table-column align="center" label="创建时间" prop="createTime" />
<el-table-column align="center" label="操作" prop="createTime" >
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
active-color="#13ce66"
inactive-color="#ff4949"
active-text="已授权"
inactive-text="未授权">
</el-switch>
</template>
</el-table-column>
</el-table>
<pagination v-show="total> 0" :limit.sync="pageSize" :page.sync="pageNum" :total="total"/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { parseTime } from '@/utils/muyu'
export default {
name: "AuthTable",
data() {
return {
//
loading: true,
activeName: "dept",
//
total: 0,
pageNum: 1,
pageSize: 1,
//
baseInfo: {
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
tableName: "sys_user",
tableAsName: "用户表",
total: "12546条",
},
//
deptList: [],
//
userList: []
};
},
created() {
this.loading = true;
setTimeout(() => this.loading = false, 200)
this.init()
},
methods: {
parseTime,
init(){
let response = {
"code": 200,
"msg": "操作成功",
"data": [
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 100,
"parentId": 0,
"ancestors": "0",
"deptName": "muyu牧鱼科技",
"orderNum": 0,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 101,
"parentId": 100,
"ancestors": "0,100",
"deptName": "深圳总公司",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 102,
"parentId": 100,
"ancestors": "0,100",
"deptName": "长沙分公司",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 103,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "研发部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 104,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "市场部门",
"isAuth": true,
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 105,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "测试部门",
"orderNum": 3,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 106,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "财务部门",
"orderNum": 4,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 107,
"parentId": 101,
"ancestors": "0,100,101",
"deptName": "运维部门",
"orderNum": 5,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 108,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "市场部门",
"orderNum": 1,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
},
{
"createBy": 1,
"createTime": "2023-09-29 11:47:27",
"updateBy": null,
"updateTime": null,
"deptId": 109,
"parentId": 102,
"ancestors": "0,100,102",
"deptName": "财务部门",
"orderNum": 2,
"leader": "muyu牧鱼",
"phone": "15888888888",
"email": "ry@qq.com",
"status": "0",
"delFlag": "0",
"parentName": null,
"children": []
}
]
}
this.deptList = this.handleTree(response.data, "deptId");
this.userList = [
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "管理员",
"userId": 1,
"deptId": 103,
"userName": "admin",
"nickName": "智能车联",
"email": "ry@163.com",
"phonenumber": "15888888888",
"isAuth": true,
"dept": {
"deptName": "研发部门"
}
},
{
"createBy": "admin",
"createTime": "2023-04-23 16:11:38",
"updateBy": null,
"updateTime": null,
"remark": "测试员",
"userId": 2,
"deptId": 105,
"userName": "ry",
"nickName": "智能车联",
"email": "ry@qq.com",
"phonenumber": "15666666666",
"dept": {
"deptName": "测试部门"
}
}
]
}
},
};
</script>

View File

@ -0,0 +1,124 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
<el-tree :data="assetStructureList"
:load="expandTable"
:expand-on-click-node="false"
lazy
@node-click="(data) => showAuth=data.type"
:props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 'dataSource'">{{ data.name + '('+data.databaseName + '-' + data.systemName+')' }}</div>
<div @click="getTableStructure" v-if="data.type === 'dataTable'">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
</el-tree>
</el-aside>
<el-container>
<el-main>
<auth-data-source v-if="showAuth === 'dataSource'"/>
<auth-table v-else-if="showAuth === 'dataTable'"/>
</el-main>
</el-container>
</el-container>
</template>
<script>
import AuthDataSource from './auth/AuthDataSource.vue'
import AuthTable from './auth/AuthTable.vue'
import {Table} from "element-ui";
export default {
name: 'assetStructure',
computed: {
Table() {
return Table
}
},
components: { AuthTable, AuthDataSource },
data() {
return {
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'childrenList',
label: 'name'
},
showAuth: null,
assetStructureList: [
{
name: "测试1",
systemName: "云计算系统",
databaseName: "yunjisuan",
type: "dataSource"
},
{
name: "测试2",
systemName: "网站系统",
databaseName: "wangzhan",
type: "dataSource"
},
{
name: "测试3",
systemName: "物联网系统",
databaseName: "wulianwang",
type: "dataSource"
},
{
name: "测试4",
systemName: "传媒系统",
databaseName: "chuanmei",
type: "dataSource"
},
],
childrenList: [
{
name: "sys_user",
as: "用户表",
dataTotal: 635847,
type: "dataTable",
childrenList: []
},
{
name: "sys_dept",
as: "部门表",
dataTotal: 362548,
type: "dataTable",
childrenList: []
},
{
name: "sys_notice",
as: "通知公告",
dataTotal: 6347,
type: "dataTable",
childrenList: []
}
]
}
},
methods: {
expandTable( node, resolve){
if (node.level === 0) return resolve(this.assetStructureList);
const {data} = node;
if (data.type === 'dataTable') {
return resolve([])
}
setTimeout(() => {
resolve(this.childrenList)
}, 500);
}
}
}
</script>
<style scoped lang="scss">
.el-aside {
margin: 0;
padding: 0;
width: 400px;
background-color: white;
}
.el-main {
background-color: #f1f1f1;
}
.custom-tree-node{
height: 30px;
}
</style>

View File

@ -0,0 +1,95 @@
<template>
<div>
<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>
</div>
</template>
<script>
export default {
name: 'OverallAssetStructure',
props: {
tableData: {
type: Array
}
},
data() {
return {
}
},
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,178 @@
<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="4" :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="96" :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="560" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
</el-row>
</template>
<script>
import CountTo from 'vue-count-to'
export default {
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>

View File

@ -0,0 +1,187 @@
<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">
<overall-asset-structure/>
</el-tab-pane>
<el-tab-pane label="sys_dept(部门表)" name="second">sys_dept(部门表)</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</template>
<script>
import CountTo from 'vue-count-to'
import OverallAssetStructure from './OverallAssetStructure.vue'
export default {
props: {
title: {
type: String,
default: "-"
}
},
data() {
return {
activeName: 'first',
}
},
components: {
OverallAssetStructure,
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>

View File

@ -0,0 +1,171 @@
<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 v-if="data.type === 'dataSource'">{{ data.name + '('+data.dataSourceDatabaseName + '-' + data.fromSystem+')' }}</div>
<div @click="getTableStructure(data)" v-if="data.type === 'dataTable'">{{ data.tableName + '-'+data.dataAnnotation + '(' + data.dataCount+')' }}</div>
</div>
</el-tree>
</el-aside>
<el-container>
<el-main>
<OverallAssets v-if="showAssets == null"/>
<overall-specific-assets v-if="showAssets === 'dataSource'" :title="title"/>
<overall-asset-structure :tableData="tableData" 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 {queryBigStructure, queryTableStructure} from "@/api/data";
export default {
name: 'assetStructure',
components: { OverallAssetStructure, OverallSpecificAssets, OverallAssets },
data() {
return {
dataBaseConnectObj: {},
tableData: [
{
id: 1,
name: "id",
comment: "主键",
isPrimaryKey: "Y",
type: "bigint",
mappingType: "Long",
length: "-",
decimalPlaces: "-",
isNull: "N",
defaultValue: "-",
isDict: "N",
dictKey: "-",
}, {
id: 2,
name: "name",
comment: "姓名",
isPrimaryKey: "N",
type: "varchar",
mappingType: "String",
length: "64",
decimalPlaces: "-",
isNull: "N",
defaultValue: "-",
isDict: "N",
dictKey: "-",
}, {
id: 3,
name: "sex",
comment: "性别",
isPrimaryKey: "N",
type: "char",
mappingType: "String",
length: "1",
decimalPlaces: "-",
isNull: "N",
defaultValue: "-",
isDict: "Y",
dictKey: "system_sex",
}, {
id: 4,
name: "price",
comment: "金额",
isPrimaryKey: "N",
type: "double",
mappingType: "BigDecimal",
length: "10",
decimalPlaces: "2",
isNull: "N",
defaultValue: "0.00",
isDict: "N",
dictKey: "-",
}, {
id: 5,
name: "create_time",
comment: "创建时间",
isPrimaryKey: "N",
type: "datetime",
mappingType: "Date",
length: "-",
decimalPlaces: "-",
isNull: "Y",
defaultValue: "-",
isDict: "N",
dictKey: "-",
}, ],
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'childrenList',
label: 'name'
},
assetStructureList: [],
childrenList: [],
showAssets: null,
title: null
}
},
methods: {
getTableStructure(data) {
this.assetStructureList.forEach(asset => {
asset.tableInfoList.forEach(tableInfo => {
if (tableInfo == data){
this.dataBaseConnectObj = asset
}
})
})
this.dataBaseConnectObj.tableName = data.tableName
console.log("数据库连接对象:",this.dataBaseConnectObj)
queryTableStructure(this.dataBaseConnectObj).then(
res => {
console.log(res)
}
)
},
getBigStructure() {
queryBigStructure().then(
res => {
this.assetStructureList = res.data
console.log("BigStructure",res.data)
}
)
},
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.dataSourceDatabaseName + '-' + data.fromSystem+')'
}
if (data.type === 'dataTable') {
this.title = data.tableName + '('+data.dataAnnotation + '-' + data.dataCount+')'
}
setTimeout(() => {
resolve(data.tableInfoList)
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>

View File

@ -0,0 +1,554 @@
<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/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>

View File

@ -0,0 +1,225 @@
<template>
<div>
{{goods}}
<el-table
:data="goodsList"
style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="商品编号"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.goodsId }}</span>
</template>
</el-table-column>
<el-table-column
label="商品名称"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.goodsName }}</span>
</template>
</el-table-column>
<el-table-column
label="商品图片"
width="180">
<template slot-scope="scope">
<img v-if="scope.row.goodsPic" :src="scope.row.goodsPic" class="avatar">
</template>
</el-table-column>
<el-table-column
label="商品价格"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.goodsPrice }}</span>
</template>
</el-table-column>
<el-table-column
label="创建时间"
width="180">
<template slot-scope="scope">
<i class="el-icon-time"></i>
<span style="margin-left: 10px">{{ scope.row.createTime }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:goods:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleEdit(scope.$index, scope.row)"
>编辑
</el-button>
<el-button
v-hasPermi="['system:goods:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.$index, scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-button
icon="el-icon-delete"
size="mini"
type="text"
@click="handleAdd()"
>新增
</el-button>
<!-- 添加弹出框-->
<el-dialog title="商品信息表单" :visible.sync="dialogFormVisible">
{{imgUrl}}
<el-form :model="goods">
<el-form-item label="商品名称" :label-width="formLabelWidth">
<el-input v-model="goods.goodsName" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="商品价格" :label-width="formLabelWidth">
<el-input v-model="goods.goodsPrice" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="商品图片" :label-width="formLabelWidth" :label-height="200">
<el-upload
style="height: 100%"
class="avatar-uploader"
action="http://localhost:9207/goods/uploadPicFile"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imgUrl" :src="imgUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addGoods()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
//jsjsjson,
//import from ',
import {addGoods, deleteGoodsById, getGoodsList} from "@/api/system/goods";
export default {
name: "index",
//import使"
components: {},
props: {},
data() {
//"
return {
goods: {},
dialogFormVisible: false,
single: false,
goodsList:[],
queryParam: {
pageNum: 1,
pageSize: 10,
goodsName: "",
beginTime: null,
endTime: null
},
ids: [],
formLabelWidth: '120px',
multipleSelection: [],
imgUrl: ""
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
getGoodsList() {
getGoodsList(this.queryParam).then(
res => {
this.goodsList = res.data.rows
console.log(res)
}
)
},
handleAdd(){
this.dialogFormVisible = true
},
handleEdit(index, row) {
console.log(index, row);
},
handleDelete(index, row) {
console.log(row)
this.ids.push(row.goodsId);
deleteGoodsById(this.ids).then(
res => {
console.log(res)
this.getGoodsList();
}
)
},
handleSelectionChange(val) {
this.ids = val.map(item => item.goodsId);
console.log(this.ids)
this.multipleSelection = val;
},
addGoods() {
this.goods.goodsPic = this.imgUrl;
addGoods(this.goods).then(
res => {
this.goods = {}
console.log(res);
this.dialogFormVisible = false
}
)
},
handleAvatarSuccess(res, file) {
this.imgUrl = res.data;
},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
}
return isLt2M;
}
},
// - 访this",
created() {
this.getGoodsList()
},
// - 访DOM",
mounted() {
},
beforeCreate() {
}, // - ",
beforeMount() {
}, // - ",
beforeUpdate() {
}, // - ",
updated() {
}, // - ",
beforeDestroy() {
}, // - ",
destroyed() {
}, // - ",
activated() {
} //keep-alive",
};
</script>
<style scoped>
</style>

View File

@ -136,6 +136,7 @@ export default {
let formData = new FormData(); let formData = new FormData();
formData.append("avatarfile", data); formData.append("avatarfile", data);
uploadAvatar(formData).then(response => { uploadAvatar(formData).then(response => {
console.log("上传头像",response)
this.open = false; this.open = false;
this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl; this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl;
store.commit('SET_AVATAR', this.options.img); store.commit('SET_AVATAR', this.options.img);