Compare commits

...

No commits in common. "main" and "master" have entirely different histories.
main ... master

28 changed files with 3704 additions and 386 deletions

View File

@ -37,8 +37,11 @@
}, },
"dependencies": { "dependencies": {
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"@vue/compiler-core": "^3.4.26",
"@vue/compiler-ssr": "^3.4.26",
"axios": "0.24.0", "axios": "0.24.0",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"codemirror": "^5.65.16",
"core-js": "3.25.3", "core-js": "3.25.3",
"echarts": "5.4.0", "echarts": "5.4.0",
"element-ui": "2.15.13", "element-ui": "2.15.13",
@ -53,6 +56,7 @@
"screenfull": "5.0.2", "screenfull": "5.0.2",
"sortablejs": "1.10.2", "sortablejs": "1.10.2",
"vue": "2.6.12", "vue": "2.6.12",
"vue-codemirror": "^4.0.6",
"vue-count-to": "1.0.13", "vue-count-to": "1.0.13",
"vue-cropper": "0.5.5", "vue-cropper": "0.5.5",
"vue-meta": "2.4.0", "vue-meta": "2.4.0",

View File

@ -0,0 +1,37 @@
import request from '@/utils/request'
// 查询资产授权列表
export function listAuth(query) {
return request({
url: '/source/auth/list',
method: 'get',
params:query
})
}
// 新增资产授权
export function addAuth(data) {
return request({
url: '/source/auth',
method: 'post',
data: data
})
}
// 删除资产授权
export function delAuth(data) {
return request({
url: '/source/auth/remove' ,
method: 'post',
data
})
}
export function assetsList(data) {
return request({
url: '/source/assets/assetsList',
method: 'post',
data
})
}

View File

@ -0,0 +1,184 @@
import request from '@/utils/request'
import data from '@/views/system/dict/data.vue'
// 查询数据源列表
export function listSource(query) {
return request({
url: '/source/source/list',
method: 'post',
params: query
})
}
export function testConnection(data) {
return request({
url: '/source/source/testConnection',
method: 'post',
data
})
}
// 查询接入类型列表
export function listType() {
return request({
url: '/source/source/findAccessType',
method: 'get',
})
}
// 查询数据源详细
export function getSource(id) {
return request({
url: '/source/source/' + id,
method: 'get'
})
}
export function database(data) {
return request({
url: '/source/source/database?name='+data,
method: 'post',
data
})
}
export function table(table) {
return request({
url: '/source/source/table?databaseName='+table,
method: 'post',
table
})
}
// 新增数据源
export function addSource(data) {
return request({
url: '/source/source',
method: 'post',
data: data
})
}
// 修改数据源
export function updateSource(data) {
return request({
url: '/source/source/'+data.id,
method: 'put',
data: data
})
}
//同步数据库接入
export function Synchronization(data){
return request({
url:'/source/source/synchronization',
method:'post',
data:data
})
}
// 删除数据源
export function delSource(id) {
return request({
url: '/source/source/' + id,
method: 'delete'
})
}
//资产属性列表
export function findStructure(){
return request({
url:'/source/source/findStructure',
method:'get'
})
}
export function findDataBaseTable(data){
return request({
url:'/source/source/findDataBaseTable',
method:'post',
data
})
}
export function structureList(data){
return request({
url:'/source/source/structureList?id='+data,
method:'post',
data
})
}
export function quantity(){
return request({
url:'/source/source/quantity',
method:'get'
})
}
//添加字典数据
export function sysDictDataTableAdd(data){
return request({
url:'/source/data/sysDictDataTableAdd',
method:'post',
data
})
}
//删除字典数据
export function sysDictDataTableDelete(data){
return request({
url:'/source/data/sysDictDataTableDelete?id='+data,
method:'post',
data
})
}
//修改字典数据
export function sysDictDataTableUpdate(data){
return request({
url:'/source/data/sysDictDataTableUpdate',
method:'post',
data
})
}
//查询出所有数据
export function dictionaryList(data){
return request({
url:'/source/dictionary/dictionaryList?databaseName='+data,
method:'post',
data
})
}
//添加字典类型
export function dictionaryAdd(data){
return request({
url:'/source/dictionary/dictionaryAdd',
method:'post',
data
})
}
//删除类型 以及下面类型相同数据
export function dictionaryDelete(data){
return request({
url:'/source/dictionary/dictionaryDelete?dictType='+data,
method:'post',
data
})
}
//修改字典类型
export function dictionaryUpdate(data){
return request({
url:'/source/dictionary/dictionaryUpdate',
method:'post',
data
})
}
//修改字典类型
export function modification(data){
return request({
url:'/source/databaseTable/modification',
method:'post',
data
})
}
//获取数据结构
export function information(){
return request({
url:'/source/source/information',
method:'get'
})
}

View File

@ -0,0 +1,107 @@
import request from '@/utils/request'
// 查询规则引擎列表
export function listRuleengine(query) {
return request({
url: '/rule/rule/list',
method: 'get',
params: query
})
}
// 查询规则引擎详细
export function getRuleengine(id) {
return request({
url: '/rule/rule/' + id,
method: 'get'
})
}
export function ruleengine(content) {
return request({
url: `/rule/rule/compiler`,
method: 'post',
data:content
})
}
export function getRuleContent(ruleId) {
return request({
url: `/rule/rule/getRuleContent?ruleId=`+ruleId,
method: 'get'
})
}
export function loader(data) {
return request({
url: `/rule/rule/loader`,
method: 'post',
data
})
}
// 新增规则引擎
export function addRuleengine(data) {
return request({
url: '/rule/rule',
method: 'post',
data: data
})
}
// 修改规则引擎
export function updateRuleengine(data) {
return request({
url: '/rule/rule/'+data.id,
method: 'put',
data: data
})
}
// 删除规则引擎
export function delRuleengine(id) {
return request({
url: '/rule/rule/' + id,
method: 'delete'
})
}
export function details(data){
return request({
url: '/rule/rule/details?id='+data,
method: 'post',
data
})
}
export function versionsAdd(data){
return request({
url: '/rule/versions/versionsAdd',
method: 'post',
data
})
}
export function engineOnOff(data){
return request({
url: '/rule/rule/engineOnOff',
method: 'post',
data
})
}
export function statusOnOff(data){
return request({
url: '/rule/rule/statusOnOff',
method: 'post',
data
})
}
export function versionsUpd(data){
return request({
url: '/rule/versions/versionsUpd',
method: 'post',
data
})
}

View File

@ -1,66 +0,0 @@
import request from '@/utils/request'
// 查询数据接入基本信息列表
export function listSource(query) {
return request({
url: '/source/source/list',
method: 'get',
params: query
})
}
// 查询数据接入基本信息详细
export function getSource(id) {
return request({
url: '/source/source/' + id,
method: 'get'
})
}
export function typeList() {
return request({
url: '/source/type/typeList',
method: 'get'
})
}
// 新增数据接入基本信息
export function addSource(data) {
return request({
url: '/source/source/add',
method: 'post',
data: data
})
}
// 修改数据接入基本信息
export function updateSource(data) {
return request({
url: '/source/source/'+data.id,
method: 'put',
data: data
})
}
// 删除数据接入基本信息
export function delSource(id) {
return request({
url: '/source/source/' + id,
method: 'delete'
})
}
export function connectTest(id) {
return request({
url: '/source/source/connect?id=' + id,
method: 'post'
})
}
export function synchronization(data) {
return request({
url: '/source/structure/'+data.id,
method: 'post'
})
}

View File

@ -9,24 +9,24 @@ export function listNotice(query) {
}) })
} }
export function updateAsUserDept(id) { export function updateAsUserDept(id){
return request({ return request({
url: '/system/userDept/UpdateAsUserDept?id=' + id, url:'/system/userDept/UpdateAsUserDept?id='+id,
method: 'get' method:'get'
}) })
} }
export function getNum(id) { export function getNum(id){
return request({ return request({
url: '/system/userDept/GetNum?noticeId=' + id, url:'/system/userDept/GetNum?noticeId='+id,
method: 'get' method:'get'
}) })
} }
export function getNoticeList(data) { export function getNoticeList(data){
return request({ return request({
url: '/system/notice/GetNoticeList', url:'/system/notice/GetNoticeList',
method: 'post', method:'post',
data data
}) })
} }

View File

@ -0,0 +1,93 @@
<template>
<div style="height: 800px">
<codemirror ref="codeMirror" v-model="code" :value="code" :options="cmOptions" style="height: 800px"/>
</div>
</template>
<script>
import { codemirror } from 'vue-codemirror'
import 'codemirror/mode/clike/clike';
// cm-setting.js
//
import 'codemirror/lib/codemirror.css';
//
import 'codemirror/theme/eclipse.css';
// html
import 'codemirror/mode/htmlmixed/htmlmixed.js';
//
import 'codemirror/mode/javascript/javascript.js';
import 'codemirror/mode/css/css.js';
import 'codemirror/mode/xml/xml.js';
//
import 'codemirror/addon/fold/foldcode.js';
import 'codemirror/addon/fold/foldgutter.js';
import 'codemirror/addon/fold/foldgutter.css';
import 'codemirror/addon/fold/brace-fold.js';
export default {
components: {
codemirror,
},
props: {
value: {
default: "",
type: String
},
readOnly: {
default: false,
type: Boolean
}
},
watch:{
'code':{
handler(val){
if (val != null){
console.log(this.$emit('input',val))
}
}
}
},
name: "Encoding",
data() {
return {
codemirror: null,
code: this.value,
cmOptions: {
autoRefresh: true, // true
value: '', //
mode: 'text/x-java', //Java
tabSize: 4, // tab
styleActiveLine: true, // true/false
lineNumbers: true, //
theme: 'eclipse', //cobalt/monokai
// json: true,
readOnly: this.readOnly, // true/false;"nocursor"
lineWrapping: false,
foldGutter: true,
gutters: [
'CodeMirror-lint-markers', //
'CodeMirror-linenumbers',
'CodeMirror-foldgutter', //
],
},
}
},
created() {
},
methods: {}
}
</script>
<style>
.CodeMirror {
font-family: 'JetBrainsMono-Medium', monospace;
height: 500px;
}
.CodeMirror-lines {
line-height: 1.5; /* 这里的1.5是示例表示行间距是字体大小的1.5倍 */
}
</style>

View File

@ -7,13 +7,12 @@
<top-nav v-if="topNav" id="topmenu-container" class="topmenu-container"/> <top-nav v-if="topNav" id="topmenu-container" class="topmenu-container"/>
<div class="right-menu"> <div class="right-menu">
<!-- <el-badge :value="messageTotal" class="item" style="margin-bottom: 25px;margin-right: 10px">-->
<!-- <el-button size="small" @click="noticeTableList()"></el-button>-->
<!-- </el-badge>-->
<template v-if="device!=='mobile'"> <template v-if="device!=='mobile'">
<i class="el-icon-message-solid" @click="noticeTableList"></i> <i class="el-icon-message-solid" @click="noticeTableList"></i>
<search id="header-search" class="right-menu-item"/> <search id="header-search" class="right-menu-item"/>
<screenfull id="screenfull" class="right-menu-item hover-effect"/> <screenfull id="screenfull" class="right-menu-item hover-effect"/>
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect"/> <size-select id="size-select" class="right-menu-item hover-effect"/>
</el-tooltip> </el-tooltip>
@ -39,80 +38,80 @@
</el-dropdown> </el-dropdown>
</div> </div>
<el-dialog <el-dialog
title="公告" title="公告"
:visible.sync="noticeTableVisible" :visible.sync="noticeTableVisible"
width="50%"> width="50%">
<el-radio-group v-model="form.noticeType" @change="getNoticeList"> <el-radio-group v-model="form.noticeType" @change="getNoticeList">
<el-radio-button label="">全部</el-radio-button> <el-radio-button label="">全部</el-radio-button>
<el-radio-button label="1">通知</el-radio-button> <el-radio-button label="1">通知</el-radio-button>
<el-radio-button label="2">公告</el-radio-button> <el-radio-button label="2">公告</el-radio-button>
</el-radio-group> </el-radio-group>
<br> <br> <br> <br>
<el-radio-group v-model="form.isRead" @change="getNoticeList"> <el-radio-group v-model="form.isRead" @change="getNoticeList">
<el-radio-button label="">全部</el-radio-button> <el-radio-button label="">全部</el-radio-button>
<el-radio-button label="0">已读</el-radio-button> <el-radio-button label="0">已读</el-radio-button>
<el-radio-button label="1">未读</el-radio-button> <el-radio-button label="1">未读</el-radio-button>
</el-radio-group> </el-radio-group>
<br><br><br> <br><br><br>
<el-card class="box-card" v-for="notice in noticeAttr"> <el-card class="box-card" v-for="notice in noticeAttr">
<!-- <div slot="header" class="clearfix">--> <!-- <div slot="header" class="clearfix">-->
<!-- <span>卡片名称</span>--> <!-- <span>卡片名称</span>-->
<!-- <el-button style="float: right"> </el-button>--> <!-- <el-button style="float: right"> </el-button>-->
<!-- </div>--> <!-- </div>-->
<!-- <div v-for="o in 4" :key="o" class="text item">--> <!-- <div v-for="o in 4" :key="o" class="text item">-->
<!-- {{'列表内容 ' + o }}--> <!-- {{'列表内容 ' + o }}-->
<!-- </div>--> <!-- </div>-->
<el-descriptions class="margin-top" :title="notice.noticeTitle" :column="2" :size="size" border> <el-descriptions class="margin-top" :title="notice.noticeTitle" :column="2" size="size" border>
<template slot="extra"> <template slot="extra">
<el-button size="small" @click="readNotice(notice)"></el-button> <el-button size="small" @click="readNotice(notice)"></el-button>
</template>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
消息发布时间
</template> </template>
<el-descriptions-item> {{notice.createTime}}
<template slot="label"> </el-descriptions-item>
<i class="el-icon-user"></i> <el-descriptions-item>
消息发布时间 <template slot="label">
</template> <i class="el-icon-user"></i>
{{notice.createTime}} 消息发布人
</el-descriptions-item> </template>
<el-descriptions-item> {{notice.createBy}}
<template slot="label"> </el-descriptions-item>
<i class="el-icon-user"></i> <el-descriptions-item>
消息发布人 <template slot="label">
</template> <i class="el-icon-tickets"></i>
{{notice.createBy}} 消息类型
</el-descriptions-item> </template>
<el-descriptions-item> <dict-tag :options="dict.type.sys_notice_type" :value="notice.noticeType"/>
<template slot="label"> </el-descriptions-item>
<i class="el-icon-tickets"></i> <el-descriptions-item>
消息类型 <template slot="label">
</template> <i class="el-icon-office-building"></i>
<dict-tag :options="dict.type.sys_notice_type" :value="notice.noticeType"/> 消息当前状态
</el-descriptions-item> </template>
<el-descriptions-item> <dict-tag :options="dict.type.is_read" :value="notice.isRead"/>
<template slot="label"> </el-descriptions-item>
<i class="el-icon-office-building"></i> </el-descriptions>
消息当前状态 </el-card>
</template> <span slot="footer" class="dialog-footer">
<dict-tag :options="dict.type.is_read" :value="notice.isRead"/>
</el-descriptions-item>
</el-descriptions>
</el-card>
<span slot="footer" class="dialog-footer">
<el-button @click="noticeTableVisible = false"> </el-button> <el-button @click="noticeTableVisible = false"> </el-button>
<el-button type="primary" @click="noticeTableVisible = false"> </el-button> <el-button type="primary" @click="noticeTableVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
:title="noticeInfo.noticeTitle" :title="noticeInfo.noticeTitle"
:visible.sync="noticeVisble" :visible.sync="noticeVisble"
width="30%"> width="30%">
<editor v-model="noticeInfo.noticeContent" :min-height="192"/> <editor v-model="noticeInfo.noticeContent" :min-height="192"/>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="noticeVisble = false"> </el-button> <el-button @click="noticeVisble = false"> </el-button>
<el-button type="primary" @click="noticeVisble = false"> </el-button> <el-button type="primary" @click="noticeVisble = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -201,22 +200,24 @@ export default {
} }
}, },
methods: { methods: {
getNoticeList() { getNoticeList(){
getNoticeList(this.form).then(res => { getNoticeList(this.form).then(
console.log(res) res=>{
this.noticeAttr = res.data console.log(res)
}) this.noticeAttr=res.data;
}
)
}, },
readNotice(row) { readNotice(row){
this.noticeInfo = row this.noticeIngo=row;
this.noticeVisble = true this.noticeVisble=true;
updateAsUserDept(row.id).then(res => { updateAsUserDept(row.id).then(res=>{
this.getNoticeList() this.getNoticeList()
}) })
}, },
noticeTableList() { noticeTableList(){
this.getNoticeList() this.getNoticeList();
this.noticeTableVisible = true this.noticeTableVisible=true;
}, },
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')

View File

@ -3,7 +3,6 @@
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/> <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
<sidebar v-if="!sidebar.hide" class="sidebar-container"/> <sidebar v-if="!sidebar.hide" class="sidebar-container"/>
<div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container"> <div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container">
<div :class="{'fixed-header':fixedHeader}"> <div :class="{'fixed-header':fixedHeader}">
<navbar/> <navbar/>
<tags-view v-if="needTagsView"/> <tags-view v-if="needTagsView"/>

View File

@ -70,6 +70,12 @@ export const constantRoutes = [
component: () => import('@/views/index'), component: () => import('@/views/index'),
name: 'Index', name: 'Index',
meta: {title: '首页', icon: 'dashboard', affix: true} meta: {title: '首页', icon: 'dashboard', affix: true}
},
{
path: '/ruleengine/engineVersion/:id',
name: 'EngineVersion',
component: () => import('@/views/ruleengine/engineVersion'),
meta: {title: '规则维护', icon: 'dashboard', affix: true}
} }
] ]
}, },

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,232 @@
<template>
<div class="app-container">
<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.accessSourceName" disabled/>
</el-form-item>
</el-col>
<el-col :offset="2" :span="8">
<el-form-item label="系统名称" prop="userName">
<el-input v-model="baseInfo.dataSourceSystemName" 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="idType" style="margin-top: 20px">
<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"
@change="(val)=>authChange(val,scope.row,scope.row.deptId)"
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" width="200px" >
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
@change="(val)=>authChange(val,scope.row,scope.row.userId)"
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'
import {listDept} from "@/api/system/dept";
import {listUser} from "@/api/system/user";
import {addAuth, delAuth, listAuth} from "@/api/accredit/auth";
export default {
name: "AuthDataSource",
props:{
baseInfo:{
type:Object,
default:{}
}
},
data() {
return {
//
loading: true,
idType: "dept",
//
total: 0,
pageNum: 1,
pageSize: 1,
deptData: [],
//
deptList: [],
//
userList: [],
authType:'dataSource',
argumentsList:{
authId:"",
idType:"",
authData:"",
authType:"",
}
};
},
watch:{
baseInfo:{
handler(){
this.loading = true;
setTimeout(() => this.loading = false, 200)
this.init();
},
immediate:true,
deep:true
},
idType:{
handler(){
this.setAuthInfo();
},
immediate:true
}
},
methods: {
parseTime,
init() {
listDept(null).then(response => {
//
this.deptData = response.data;
//
this.deptList = this.handleTree(response.data, "deptId");
});
listUser(null).then(response => {
//
this.userList = response.data.rows;
}
);
setTimeout(() => {
this.setAuthInfo();
}, 600);
},
setAuthInfo() {
//
listAuth({idType: this.idType, authType: this.authType}).then(response => {
let data;
if (this.idType === 'dept') {
data = this.deptData
data.forEach(x => {
response.data.rows.forEach(y => {
console.log("y",y)
if (this.idType === 'dept' && x.deptId === y.authId && this.baseInfo.databaseName==y.authData) {
console.log("y1是等于什么=?",y)
this.$set(x, 'isAuth', true);
this.$set(x, 'assetAuthId', y.databaseName);
} else if (this.idType === 'user' && x.userId === y.authId && this.baseInfo.databaseName==y.authData) {
console.log("y2是等于什么=?",y)
this.$set(x, 'isAuth', true);
this.$set(x, 'assetAuthId', y.databaseName);
}
})
})
} else {
data = this.userList;
data.forEach(x => {
response.data.rows.forEach(y => {
if (this.idType === 'dept' && x.deptId === y.authId && this.baseInfo.databaseName==y.authData) {
console.log("y1是等于什么=?",y)
this.$set(x, 'isAuth', true);
this.$set(x, 'assetAuthId', y.databaseName);
} else if (this.idType === 'user' && x.userId === y.authId && this.baseInfo.databaseName==y.authData) {
console.log("y2是等于什么=?",y)
this.$set(x, 'isAuth', true);
this.$set(x, 'assetAuthId', y.databaseName);
}
})
})
}
if(this.idType === 'dept'){
this.deptList = this.handleTree(this.deptData, "deptId");
}
})
},
authChange(val, row, id) {
if (val) {
//
addAuth({
authId: id, idType: this.idType,
authData: this.baseInfo.databaseName
, authType: this.authType
}).then(response => {
this.$message.success("授权成功");
this.setAuthInfo();
});
} else {
//
console.log("val",val)
console.log("row",row)
console.log("id",id)
this.argumentsList={}
this.argumentsList.authId=id
this.argumentsList.authData=this.baseInfo.databaseName
this.argumentsList.authType=this.authType
this.argumentsList.idType=this.idType
delAuth(this.argumentsList).then(response => {
this.$message.success("取消授权成功");
this.setAuthInfo();
});
}
}
}
};
</script>

View File

@ -0,0 +1,200 @@
<template>
<div class="app-container">
<el-descriptions title="基本信息" direction="vertical" :column="4" border>
<el-descriptions-item label="数据接入名称">{{baseInfo.accessSourceName}}</el-descriptions-item>
<el-descriptions-item label="系统名称">{{baseInfo.dataSourceSystemName}}</el-descriptions-item>
<el-descriptions-item label="数据库名称" :span="2">{{baseInfo.databaseName}}</el-descriptions-item>
<el-descriptions-item label="表名称">{{asset2.name}}</el-descriptions-item>
<el-descriptions-item label="表中文名称">{{asset2.as}}</el-descriptions-item>
<el-descriptions-item label="数据量">{{asset2.dataTotal}}</el-descriptions-item>
</el-descriptions>
<el-tabs type="border-card" v-model="idType" style="margin-top: 20px">
<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"
@change="(val)=>authChange(val,scope.row,scope.row.deptId)"
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" width="200px" >
<template slot-scope="scope">
<el-switch
style="display: block"
v-model="scope.row.isAuth"
active-color="#13ce66"
inactive-color="#ff4949"
@change="(val)=>authChange(val,scope.row,scope.row.userId)"
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'
import {listDept} from "@/api/system/dept";
import {listUser} from "@/api/system/user";
import {addAuth, delAuth, listAuth} from "@/api/accredit/auth";
export default {
name: "AuthTable",
props:{
baseInfo:{
type:Object,
default:{}
},
asset2:{
type:Object,
default:{}
}
},
data() {
return {
//
loading: true,
idType: "dept",
//
total: 0,
pageNum: 1,
pageSize: 1,
deptData:[],
//
deptList: [],
//
userList: [],
authType:'table',
argumentsList:{
authId:"",
idType:"",
authData:"",
authType:"",
}
};
},
watch:{
baseInfo:{
handler(){
this.loading = true;
setTimeout(() => this.loading = false, 200)
this.init();
},
immediate:true,
deep:true
},
idType:{
handler(){
this.setAuthInfo();
},
immediate:true
},
},
methods: {
parseTime,
init(){
listDept(null).then(response => {
this.deptData = response.data;
this.deptList = this.handleTree(response.data, "deptId");
});
listUser(null).then(response => {
this.userList = response.data.rows;
}
);
setTimeout(()=>{
this.setAuthInfo();
},600);
},
setAuthInfo(){
listAuth({idType:this.idType,authType:this.authType}).then(response=>{
let data;
if(this.idType==='dept'){
data=this.deptData;
}else {
data=this.userList;
}
data.forEach(x=>{
response.data.rows.forEach(y=>{
let id=y.authData.split(",")[1];
if(this.idType==='dept'&&x.deptId===y.authId&&this.baseInfo.databaseName +","+this.asset2.name==y.authData){
console.log(this.baseInfo)
this.$set(x,'isAuth',true);
this.$set(x,'assetAuthId',y.id);
}else if(this.idType==='user'&&x.userId===y.authId&&this.baseInfo.databaseName +","+this.asset2.name==y.authData){
this.$set(x,'isAuth',true);
this.$set(x,'assetAuthId',y.id);
}
})
})
if(this.idType === 'dept'){
this.deptList = this.handleTree(this.deptData, "deptId");
}
})
},
authChange(val,row,id){
if(val){
//
addAuth({authId:id,idType:this.idType,
authData:this.baseInfo.databaseName+','+this.asset2.name
,authType:this.authType}).then(response=>{
this.$message.success("授权成功");
this.setAuthInfo();
});
}else {
this.argumentsList={}
this.argumentsList.authId=id
this.argumentsList.authData=this.baseInfo.databaseName +","+ this.asset2.name
this.argumentsList.authType=this.authType
this.argumentsList.idType=this.idType
//
delAuth(this.argumentsList).then(response=>{
this.$message.success("取消授权成功");
this.setAuthInfo();
});
}
}
},
};
</script>

View File

@ -0,0 +1,132 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
<el-tree :data="parentList"
:expand-on-click-node="false"
:load="expandTable"
lazy
@node-click="handleNodeClick"
:props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 0" @click="select(data.id)">{{ data.accessSourceName + '(' + data.databaseName + '-' + data.dataSourceSystemName + ')' }}</div>
<div v-if="data.type === 1">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
</el-tree>
</el-aside>
<el-main>
<el-container>
<el-main>
<el-empty v-if="showAssets === null" description="暂无数据" style="height: 100%;background-color: white"></el-empty>
<auth-data-source v-if="showAssets === 0" :baseInfo="asset" />
<auth-table v-else-if="showAssets === 1" :baseInfo="asset" :asset2="asset2"/>
</el-main>
</el-container>
</el-main>
</el-container>
</template>
<script>
import {
findStructure,
structureList,
} from '@/api/dataSource/source'
import AuthDataSource from '@/views/dataSource/assetAuthorization/auth/AuthDataSource.vue'
import AuthTable from '@/views/dataSource/assetAuthorization/auth/AuthTable.vue'
export default {
name: 'assetAuthorization',
components: { AuthTable, AuthDataSource},
data() {
return {
mainHeight: window.innerHeight - 85,
showAssets:null,
parentList:[],
defaultProps: {
children: 'childrenList',
label: 'name'
},
showAuth:null,
asset:{},
asset2:{},
}
},
created() {
this.getList();
},
methods: {
handleNodeClick(data,node) {
if (node.level==1){
this.asset ={}
console.log(data)
this.asset.accessSourceName=data.accessSourceName
this.asset.dataSourceSystemName=data.dataSourceSystemName
this.asset.databaseName=data.databaseName
console.log("asset",this.asset)
}
if(node.level === 2) {
this.asset2 ={}
console.log(data)
this.asset2.name=data.name
this.asset2.as=data.as
this.asset2.dataTotal=data.dataTotal
console.log("asset",this.asset)
}
},
expandTable(node, resolve) {
if (node.level === 0){
return resolve(this.parentList);
}
const { data } = node;
this.showAssets = data.type;
if (data.type === 1) {
return resolve([])
}
//
setTimeout(() => {
resolve(this.childrenList);
}, 500);
//
this.title = data.accessSourceName + '(' + data.databaseName + '-' + data.dataSourceSystemName + ')';
},
select(id){
structureList(id).then(
res=>{
this.childrenList=res.data.databaseTableInformationList
}
)
},
//
getList(){
this.loading =true;
findStructure().then(
res=>{
this.parentList=res.data.assetStructureList;
}
)
},
}
}
</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,308 @@
<template>
<div>
<el-card v-if="tableMessage!=null" >
<div slot="header" class="clearfix">
<span>资产模型基本信息</span>
</div>
<el-descriptions border :column="2">
<el-descriptions-item label="表名称">{{tableMessage.name}}</el-descriptions-item>
<el-descriptions-item label="表备注">{{ tableMessage.as }}</el-descriptions-item>
<el-descriptions-item label="数据量">{{ tableMessage.dataTotal }}</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="sendTest"
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 === '是' ? 'success' : ''">
{{scope.row.isPrimaryKey}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="detailType" label="类型" />
<el-table-column prop="type" 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 === '是' ? 'success' : 'danger'">
{{scope.row.isNull}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="默认值" width="180">
<template slot-scope="scope">
<span style="margin-left: 10px" v-if="scope.row.defaultValue==null">-</span>
<span style="margin-left: 10px" v-else>{{scope.row.defaultValue}}</span>
</template>
</el-table-column>
<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="dictMap[scope.row.dictKey]">
<el-table-column property="dictLabel" label="字典标签"/>
<el-table-column property="dictValue" 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" @click="updEssential(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
<el-form v-model="form" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="名称">
<el-input v-model="form.name" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="注释">
<el-input v-model="form.comment" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否主键">
<el-tag size="small" :type="form.isPrimaryKey === '是' ? 'success' : 'danger'">
{{ form.isPrimaryKey }}
</el-tag>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数据类型">
<el-input v-model="form.detailType" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="数据长度">
<el-input v-model="form.length" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="小数位">
<el-input v-model="form.decimalPlaces" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否为空">
<el-tag size="small" :type="form.isNull === 'YES' ? 'success' : 'danger'">
{{ form.isNull }}
</el-tag>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="默认值">
<el-input v-model="form.defaultValue" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="映射字段">
<el-input v-model="form.type" readonly autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否字典">
<el-switch
v-model="form.isDict"
active-value="Y"
inactive-value="N"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
</el-col>
</el-row>
{{this.dictMap}}
<el-row v-if="form.isDict === 'Y' ">
<el-col :span="24">
<el-form-item label="字典">
<el-select v-model="form.dictKey">
<el-option v-for="(value, dictKey) in dictMap" :key="dictKey" :label="dictKey" :value="dictKey"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="dictMap[form.dictKey]">
<el-form-item>
<el-table :data="dictMap[form.dictKey]" striped border>
<el-table-column property="dictLabel" label="字典标签"/>
<el-table-column property="dictValue" label="字典值"/>
</el-table>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="formStatus = false"> </el-button>
<el-button type="primary" @click="confirmButton"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import bus from '@/views/dataSource/assets/dashboard/bus'
import { database, findDataBaseTable, modification, table } from '@/api/dataSource/source'
export default {
name: 'OverallAssetStructure',
props:['itemTest','itemTable','dictDetail'],
data() {
return {
localEssential: null,
localTableMessage: null,
formStatus: false,
tableMessage:{},
form:{
comment:"",
databaseName:"",
decimalPlaces:"",
defaultValue:"",
detailType:"",
dictKey:"",
id:"",
isDict:"",
isNull:"",
isPrimaryKey:"",
length:"",
name:"",
tableName:"",
type:"",
},
dictMap: {},
sendTest:[],
databaseConnect:null,
tableList:[],
}
},
beforeDestroy() {
//
bus.$off('getEssential');
},
watch:{
"itemTest": {
handler(val){
if (val && val.databaseName && val.name) {
const obj = {
databaseName: val.databaseName,
name: val.name
};
findDataBaseTable(obj).then(res => {
this.sendTest = res.data
})
}
if (val && val.name) {
database(val.name).then(
res => {
this.sendTest=res.data
}
)
}
},
immediate:true,
},
"itemTable":{
handler(val){
if (val.databaseName && val.name && val.type==null) {
table(val.databaseName).then(res => {
res.data.forEach(res=>{
if (res.name == val.name) {
this.tableMessage=res
}
})
})
}
if (val.databaseName && val.name && val.type===1){
this.tableMessage=val
}
},
immediate:true
},
"dictDetail": {
handler(val) {
val.forEach(item => {
const dictKey = `system_${item.dictName.toLowerCase().replace(/ /g, '_')}`; // key
this.$set(this.dictMap, dictKey, item.sysDictDataTableList.map(
dataModel => ({
dictLabel: dataModel.dictLabel,
dictValue: dataModel.dictValue,
edit: dataModel.edit,
})
));
});
console.log('map',this.dictMap)
},
immediate: true,
},
},
created() {
},
methods: {
updEssential(row){
this.form={}
console.log("row",row)
this.form=row
this.formStatus=true
},
confirmButton(){
console.log("form",this.form)
modification(this.form).then(res=>{
if (res.code === 200) {
this.$message.success(res.msg)
this.formStatus = false
}else {
this.$message.success(res.msg)
this.formStatus = false
}
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,191 @@
<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="totalNum" :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="assetsNum" :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="totalTable" :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
},
props:{
totalNum: {},
assetsNum: {},
totalTable: {},
},
data() {
return {
num:null,
}
},
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,405 @@
<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="assetsNum" :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="totalTable" :start-val="0" class="card-panel-num"/>
</div>
</div>
</el-col>
<el-col :span="24">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>基础字典</span>
<el-popover
placement="top-start"
title="基础字典"
width="200"
trigger="hover"
content="这个字典是数据资产项目当中的字典内容,而不是本项目当中的字典内容。主要作用为数据清洗过程中数据字典映射作用">
<i class="el-icon-question" slot="reference"></i>
</el-popover>
<el-popover
placement="right"
width="400"
trigger="click">
<el-row :gutter="20">
<el-col :span="18">
<el-input v-model="dictAddName"></el-input>
</el-col>
<el-col :span="6">
<el-button @click="addDict()"></el-button>
</el-col>
</el-row>
<el-button style="float: right; padding: 3px 0" type="text" slot="reference">新增字典</el-button>
</el-popover>
</div>
<el-row :gutter="20">
<el-col v-for="item in dictDetail" :md="8" :sm="24" :xs="12">
<el-card class="box-card" style="height: 400px">
<div slot="header" class="clearfix">
<span>{{item.dictName+'('+item.dictType+')'}}</span>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="delDict(item.dictType)"
>---删除</el-button>
<el-button style="float: right; padding: 3px 0"
type="text"
@click="item.sysDictDataTableList.push({dictLabel: null, dictValue: null,edit:true });"
>新增</el-button>
</div>
<el-table :data="item.sysDictDataTableList" style="width: 100%" height="280px">
<el-table-column prop="label" label="标签">
<template slot-scope="scope">
<span v-if="!scope.row.edit">{{scope.row.dictLabel}}</span>
<el-input v-if="scope.row.edit" v-model="scope.row.dictLabel" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="值">
<template slot-scope="scope">
<span v-if="!scope.row.edit">{{scope.row.dictValue}}</span>
<el-input v-if="scope.row.edit" v-model="scope.row.dictValue" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="操作">
<template slot-scope="scope">
<el-button
v-if="!scope.row.edit"
size="mini"
type="text"
icon="el-icon-edit"
@click="scope.row.edit=true"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="delDictData(item,scope.row)"
>删除</el-button>
<el-button
v-if="scope.row.edit"
@click="editConfirm(item,scope.row)"
size="mini"
type="text"
icon="el-icon-finished"
>确定</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
</el-col>
<el-col :span="24" style="margin-top: 30px; margin-bottom: 20px;">
<el-tabs v-model="activeName" type="border-card" @tab-click="handleTabClick">
<el-tab-pane
v-for="item in childrenList"
:key="item.name"
:label="item.name+'('+item.as+')'"
:name="item.name">
<overall-asset-structure
:itemTest="item"
:itemTable="tableMessage"
:dictDetail="dictDetail"/>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</template>
<script>
import CountTo from 'vue-count-to'
import OverallAssetStructure from "@/views/dataSource/assets/dashboard/OverallAssetStructure";
import bus from '@/views/dataSource/assets/dashboard/bus'
import {
dictionaryAdd,
dictionaryDelete,
sysDictDataTableAdd,
sysDictDataTableDelete,
table,
sysDictDataTableUpdate
} from '@/api/dataSource/source'
export default {
props: {
childrenList: {
type: Array,
default: function () {
return []
},
},
dictDetail: {
type: Array,
default: function () {
return []
}
},
title: null,
assetsNum:0,
totalTable:0,
databaseName:null,
},
data() {
return {
activeName: 'first',
childrenListModel: [],
tableMessage: {},
dictionary: {},
dictAddName: "",
dict: {
dictName: "",
dictType: "",
remark: "",
tableName: "",
},
}
},
created() {
},
components: {
OverallAssetStructure,
CountTo
},
methods: {
//
delDict(data){
console.log("data",data)
dictionaryDelete(data).then(res=>{
this.information(res)
})
},
addDict(){
if (!this.dictAddName){
this.$message.error('数据字典,不可为空');
return;
}
let strings = this.dictAddName.split(',');
this.dict.dictName = strings[0];
this.dict.dictType = strings[1];
this.dict.remark = this.dict.dictName + "列表";
this.dict.tableName = this.databaseName;
dictionaryAdd(this.dict).then(res=>{
this.information(res)
})
},
delDictData(item,row){
let id = null
item.sysDictDataTableList.forEach(res=>{
if (res.dictLabel === row.dictLabel && res.dictType===row.dictType && res.dictValue === row.dictValue) {
id=res.id
}
})
sysDictDataTableDelete(id).then(res=>{
this.information(res)
})
row.edit = false;
},
editConfirm(item,row){
if (!row.dictLabel || !row.dictValue) {
this.$message.error('字典标签或字典值,不可为空');
return;
}
let obj ={}
obj.dictType=item.dictType
obj.dictLabel=row.dictLabel
obj.dictValue=row.dictValue
obj.remark=item.dictName+row.dictLabel
if (row.id) {
item.sysDictDataTableList.forEach(res=>{
if (res.dictLabel === row.dictLabel) {
obj.id=res.id
}
})
sysDictDataTableUpdate(obj).then(res=>{
this.information(res)
})
row.edit = false;
}else {
sysDictDataTableAdd(obj).then(res=>{
this.information(res)
})
row.edit = false;
}
},
handleTabClick(tab, node,event ) {
// name childrenList item
this.selectedItem = this.childrenList.find(item => item.name === tab.name);
table(this.selectedItem.databaseName).then(
res => {
this.childrenListModel = res.data
this.childrenListModel.forEach(res=>{
if (this.selectedItem.name == res.name) {
this.tableMessage=res
}
})
}
)
bus.$emit('getEssential',this.childrenListModel,this.tableMessage)
},
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
},
information(res){
if (res.code === 200) {
this.$message.success(res.msg)
}else {
this.$message.success(res.msg)
}
},
}
}
</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,2 @@
import Vue from 'vue'
export default new Vue

View File

@ -0,0 +1,190 @@
<template>
<el-container :style="{height: mainHeight + 'px'}">
<el-aside>
<el-tree :data="parentList"
:expand-on-click-node="false"
:load="expandTable"
lazy
@node-click="handleNodeClick"
:props="defaultProps">
<div class="custom-tree-node" slot-scope="{ node, data }">
<div v-if="data.type === 0" @click="select(data.id)">{{ data.accessSourceName + '(' + data.databaseName + '-' + data.dataSourceSystemName + ')' }}</div>
<div v-if="data.type === 1">{{ data.name + '-'+data.as + '(' + data.dataTotal+')' }}</div>
</div>
</el-tree>
</el-aside>
<el-main>
<OverallAssets v-if="showAssets === null"
:totalNum="totalNum"
:assetsNum="assetsNum"
:totalTable="totalTable"/>
<OverallSpecificAssets v-if="showAssets === 0"
:childrenList="childrenList"
:title="title"
:dictDetail="dictDetail"
:assetsNum="num"
:totalTable="tableNum"
:databaseName="databaseName"/>
<OverallAssetStructure v-if="showAssets === 1"
:itemTest="databaseConnect"
:itemTable="databaseConnect"/>
</el-main>
</el-container>
</template>
<script>
import OverallAssets from "@/views/dataSource/assets/dashboard/OverallAssets";
import OverallSpecificAssets from "@/views/dataSource/assets/dashboard/OverallSpecificAssets";
import OverallAssetStructure from "@/views/dataSource/assets/dashboard/OverallAssetStructure";
import {
quantity,
findStructure,
table,
findDataBaseTable,
structureList,
dictionaryList
} from '@/api/dataSource/source'
import item from '@/layout/components/Sidebar/Item.vue'
export default {
name: 'assets',
components: { OverallSpecificAssets, OverallAssets,OverallAssetStructure },
data() {
return {
mainHeight: window.innerHeight - 85,
defaultProps: {
children: 'childrenList',
label: 'name'
},
childrenList: [],
parentList: [],
typeList: [],
dictDetail: [],
tableList: [],
showAssets: null,
title: '',
totalTable: 0,
totalNum: 0,
databaseId: 0,
assetsNum: 0,
quantityList:[],
num:0,
tableNum:0,
databaseConnect:{
databaseName:null,
name:null,
},
databaseName:'',
}
},
created() {
this.getList();
this.statistical();
},
methods: {
handleNodeClick(data,node) {
if (node.level==1){
//
dictionaryList(data.databaseName).then(res=> {
this.dictDetail=res.data.map(item=>({
...item,
sysDictDataTableList: item.sysDictDataTableList.map(model => ({
...model,
edit: false
}))
}))
})
this.databaseName=data.databaseName
this.num=0
this.tableNum=0
this.quantityList.forEach(res=>{
if (res.databaseName==data.databaseName){
//
this.tableNum+=res.dataTotal;
this.num+=1
}
})
}
if(node.level === 2) {
this.databaseConnect={},
this.databaseConnect.databaseName=data.databaseName;
this.databaseConnect.name=data.name;
}
},
expandTable(node, resolve) {
if (node.level === 0){
return resolve(this.parentList);
}
const { data } = node;
this.showAssets = data.type;
if (data.type === 1) {
return resolve([])
}
//
setTimeout(() => {
resolve(this.childrenList);
}, 500);
//
this.title = data.accessSourceName + '(' + data.databaseName + '-' + data.dataSourceSystemName + ')';
},
select(id){
structureList(id).then(
res=>{
this.childrenList=res.data.databaseTableInformationList
}
)
},
getList(){
this.loading =true;
findStructure().then(
res=>{
this.parentList=res.data.assetStructureList;
//
this.totalNum=this.parentList.length
}
)
},
statistical(){
quantity().then(res=>{
//
this.quantityList=res.data
//
this.assetsNum=this.quantityList.length
this.quantityList.forEach(res=>{
//
this.totalTable+=res.dataTotal
})
})
}
}
}
</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

@ -1,22 +1,46 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="130px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="接入源名称" prop="sourceName"> <el-form-item label="接入源名称" prop="accessSourceName">
<el-input <el-input
v-model="queryParams.sourceName" v-model="queryParams.accessSourceName"
placeholder="请输入接入源名称" placeholder="请输入接入源名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="数据来源系统名称" prop="systemName"> <el-form-item label="数据来源系统名称" prop="dataSourceSystemName">
<el-input <el-input
v-model="queryParams.systemName" v-model="queryParams.dataSourceSystemName"
placeholder="请输入数据来源系统名称" placeholder="请输入数据来源系统名称"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="主机地址" prop="hostAddress">
<el-input
v-model="queryParams.hostAddress"
placeholder="请输入主机地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="主机端口" prop="hostPort">
<el-input
v-model="queryParams.hostPort"
placeholder="请输入主机端口"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数据连接类型ID" prop="dataAccessTypeId">
<el-input
v-model="queryParams.dataAccessTypeId"
placeholder="请输入数据连接类型ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="数据库名称" prop="databaseName"> <el-form-item label="数据库名称" prop="databaseName">
<el-input <el-input
v-model="queryParams.databaseName" v-model="queryParams.databaseName"
@ -25,6 +49,38 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="初始连接数量" prop="initialQuantity">
<el-input
v-model="queryParams.initialQuantity"
placeholder="请输入初始连接数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="最大连接数量" prop="maximumQuantity">
<el-input
v-model="queryParams.maximumQuantity"
placeholder="请输入最大连接数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="最大等待时间" prop="maximumTime">
<el-input
v-model="queryParams.maximumTime"
placeholder="请选择最大等待时间"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="最大等待次数" prop="maximumFrequency">
<el-input
v-model="queryParams.maximumFrequency"
placeholder="请输入最大等待次数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -77,29 +133,30 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="accessList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="sourceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="接入源名称" align="center" prop="sourceName" /> <el-table-column label="数据管理id" align="center" prop="id" />
<el-table-column label="数据来源系统名称" align="center" prop="systemName" /> <el-table-column label="接入源名称" align="center" prop="accessSourceName" />
<el-table-column label="数据来源系统名称" align="center" prop="dataSourceSystemName" />
<el-table-column label="主机地址" align="center" prop="hostAddress" /> <el-table-column label="主机地址" align="center" prop="hostAddress" />
<el-table-column label="主机端口" align="center" prop="hostNumber" /> <el-table-column label="主机端口" align="center" prop="hostPort" />
<el-table-column label="数据接入类型" align="center"> <el-table-column label="数据连接类型ID" align="center" prop="dataAccessTypeId" />
<template slot-scope="scope">
<template v-if="scope.row.accessId === 1">MySql</template>
<template v-else-if="scope.row.accessId === 2">Oracle</template>
</template>
</el-table-column>
<el-table-column label="数据库名称" align="center" prop="databaseName" /> <el-table-column label="数据库名称" align="center" prop="databaseName" />
<el-table-column label="数据连接参数" align="center" prop="dataConnectionParameter" />
<el-table-column label="初始连接数量" align="center" prop="initialQuantity" />
<el-table-column label="最大连接数量" align="center" prop="maximumQuantity" />
<el-table-column label="最大等待时间" align="center" prop="maximumTime" />
<el-table-column label="最大等待次数" align="center" prop="maximumFrequency" />
<el-table-column label="连接数据库用户名" align="center" prop="databaseUserName" />
<el-table-column label="连接数据库用户密码" align="center" prop="databaseUserPassword" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-connection" @click="testConnection(scope.row)"
@click="syncAssetsStructure(scope.row)" >测试连接</el-button>
v-hasPermi="['source:structure:synchronization']"
>同步资产结构</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -107,14 +164,6 @@
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['source:source:edit']" v-hasPermi="['source:source:edit']"
>修改</el-button> >修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="connect(scope.row)"
v-hasPermi="['source:source:connect']"
>测试连接</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -122,6 +171,11 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['source:source:remove']" v-hasPermi="['source:source:remove']"
>删除</el-button> >删除</el-button>
<el-button
size="mini"
type="text"
@click="Synchronization(scope.row)"
>同步数据库</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -134,6 +188,7 @@
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改数据接入对话框 --> <!-- 添加或修改数据接入对话框 -->
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body> <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="140px"> <el-form ref="form" :model="form" :rules="rules" label-width="140px">
@ -143,37 +198,38 @@
</div> </div>
<el-row> <el-row>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="接入源名称" prop="name"> <el-form-item label="接入源名称" prop="accessSourceName">
<el-input v-model="form.sourceName" placeholder="请输入接入源名称" /> <el-input v-model="form.accessSourceName" placeholder="请输入接入源名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="数据来源系统名称" prop="systemName"> <el-form-item label="数据来源系统名称" prop="dataSourceSystemName">
<el-input v-model="form.systemName" placeholder="请输入数据来源系统名称" /> <el-input v-model="form.dataSourceSystemName" placeholder="请输入数据来源系统名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="主机地址" prop="host"> <el-form-item label="主机地址" prop="hostAddress">
<el-input v-model="form.hostAddress" placeholder="请输入主机地址" /> <el-input v-model="form.hostAddress" placeholder="请输入主机地址" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="主机端口" prop="port"> <el-form-item label="主机端口" prop="port">
<el-input v-model="form.hostNumber" placeholder="请输入主机地址" /> <el-input v-model="form.hostPort" placeholder="请输入主机端口" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="数据接入类型" prop="type"> <el-form-item label="数据接入类型" prop="type">
<el-select style="width: 100%" v-model="form.accessId"> <el-select style="width: 100%" v-model="form.dataAccessTypeId">
<el-option <el-option
v-for="item in type" v-for="item in accessTypes"
:key="item.id" :key="item.id"
:label="item.accessName" :label="item.accessName"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -183,6 +239,20 @@
<el-input v-model="form.databaseName" placeholder="请输入数据库名称" /> <el-input v-model="form.databaseName" placeholder="请输入数据库名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="数据库用户名" prop="databaseUserName">
<el-input v-model="form.databaseUserName" placeholder="请输入数据库名称" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="数据库用户密码" prop="databaseUserPassword">
<el-input v-model="form.databaseUserPassword" placeholder="请输入数据库名称" />
</el-form-item>
</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-card> <el-card>
@ -190,8 +260,8 @@
<span>数据连接参数</span> <span>数据连接参数</span>
</div> </div>
<el-col :sm="24"> <el-col :sm="24">
<el-form-item label="数据连接参数" prop="connectionParam"> <el-form-item label="数据连接参数" prop="dataConnectionParameter">
<el-input v-model="form.connectionParameters" placeholder="请输入内容" /> <el-input v-model="form.dataConnectionParameter" placeholder="请输入内容" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-row :gutter="10" style="margin: 10px 0"> <el-row :gutter="10" style="margin: 10px 0">
@ -225,25 +295,25 @@
</div> </div>
<el-row> <el-row>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="初始连接数量" prop="initNum"> <el-form-item label="初始连接数量" prop="initialQuantity">
<el-input v-model="form.initialize" placeholder="请输入初始连接数量" /> <el-input v-model="form.initialQuantity" placeholder="请输入初始连接数量" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="最大连接数量" prop="maxNum"> <el-form-item label="最大连接数量" prop="maximumQuantity">
<el-input v-model="form.maxInitialize" placeholder="请输入最大连接数量" /> <el-input v-model="form.maximumQuantity" placeholder="请输入最大连接数量" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="最大等待时间" prop="maxWaitTime"> <el-form-item label="最大等待时间" prop="maximumTime">
<el-input v-model="form.maxWaitingTime" placeholder="请输入最大等待时间" /> <el-input v-model="form.maximumTime" placeholder="请输入最大等待时间" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="最大等待次数" prop="maxWaitSize"> <el-form-item label="最大等待次数" prop="maximumFrequency">
<el-input v-model="form.maxIsoFrequency" placeholder="请输入最大等待次数" /> <el-input v-model="form.maximumFrequency" placeholder="请输入最大等待次数" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -265,9 +335,16 @@
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {listSource, getSource, delSource, addSource, updateSource, typeList, connectTest, synchronization} from "@/api/source/source"; import {
listSource,
getSource,
delSource,
addSource,
updateSource,
listType,
testConnection, Synchronization
} from "@/api/dataSource/source";
export default { export default {
name: "Source", name: "Source",
@ -285,8 +362,8 @@ export default {
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
accessList: [], sourceList: [],
// //
title: "", title: "",
// //
@ -295,76 +372,63 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
sourceName: null, accessSourceName: null,
systemName: null, dataSourceSystemName: null,
databaseName: null hostAddress: null,
hostPort: null,
dataAccessTypeId: null,
databaseName: null,
dataConnectionParameter: null,
initialQuantity: null,
maximumQuantity: null,
maximumTime: null,
maximumFrequency: null,
databaseUserName: null,
databaseUserPassword: null,
}, },
type:[], accessTypes:[],
dataSourceParamList:[],
// //
form: {}, form: {},
// //
rules: { rules: {
sourceName: [ //
{required: true, message: "接入源名称不能为空", trigger: "blur"} dataSourceParamList: [
], {
systemName: [ name: null,
{required: true, message: "数据来源系统名称不能为空", trigger: "blur"} val: null
], }
accessId: [
{required: true, message: "数据接入类型不能为空", trigger: "blur"}
],
hostAddress: [
{required: true, message: "主机地址不能为空", trigger: "blur"}
],
hostNumber: [
{required: true, message: "主键端口号不能为空", trigger: "blur"}
],
databaseName: [
{required: true, message: "数据库名称不能为空", trigger: "blur"}
],
connectionParameters: [
{required: true, message: "数据连接参数不能为空", trigger: "blur"}
],
initialize: [
{required: true, message: "初始连接数量不能为空", trigger: "blur"}
],
maxInitialize: [
{required: true, message: "最大连接数量不能为空", trigger: "blur"}
],
maxWaitingTime: [
{required: true, message: "最大等待时间不能为空", trigger: "blur"}
],
maxIsoFrequency: [
{required: true, message: "最大等待次数不能为空", trigger: "blur"}
] ]
}, }
dataSourceParamList: [
{
name: null,
val: null
}
]
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.findAccessType();
}, },
methods: { methods: {
syncAssetsStructure(row){ Synchronization(dataSource){
console.log(row) Synchronization(dataSource).then(
synchronization(row).then(res=>{ res=>{
console.log(res)
})
},
//
connect(row){
connectTest(row.id).then(res=>{
if (res.code == 200) {
this.$message.success(res.data)
}else {
this.$message.success(res.msg) this.$message.success(res.msg)
} }
}) )
},
testConnection(source){
testConnection(source).then(
res=>{
this.$message.success(res.msg)
}
)
},
//
findAccessType(){
listType().then(
res=>{
this.accessTypes=res.data;
console.log("res",this.accessTypes)
}
)
}, },
// //
addParam(){ addParam(){
@ -382,26 +446,23 @@ export default {
} }
this.processParam(); this.processParam();
}, },
//
processParam(){ processParam(){
this.form.connectionParameters = this.dataSourceParamList this.form.dataConnectionParameter = this.dataSourceParamList
.filter(item => item.name != null || item.val != null) .filter(item => item.name != null || item.val != null)
.map(item => { .map(item => {
return item.name + "=" + item.val; return item.name + "=" + item.val;
}).join("&") }).join("&")
console.log(this.form.connectionParameters) console.log(this.form.dataConnectionParameter)
}, },
/** 查询数据接入基本信息列表 */ /** 查询数据列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listSource(this.queryParams).then(response => { listSource(this.queryParams).then(response => {
this.accessList = response.data.rows; this.sourceList = response.data.rows;
console.log(this.accessList)
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
typeList().then(res=>{
this.type=res.data
})
}, },
// //
cancel() { cancel() {
@ -412,17 +473,19 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: null, id: null,
sourceName: null, accessSourceName: null,
systemName: null, dataSourceSystemName: null,
hostAddress: null, hostAddress: null,
hostNumber: null, hostPort: null,
accessId: null, dataAccessTypeId: null,
connectionParameters: null,
initialize: 5,
maxInitialize: 20,
maxWaitingTime: 3000,
maxIsoFrequency: 3,
databaseName: null, databaseName: null,
dataConnectionParameter: null,
initialQuantity: null,
maximumQuantity: null,
maximumTime: null,
maximumFrequency: null,
databaseUserName: null,
databaseUserPassword: null,
remark: null, remark: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
@ -451,26 +514,22 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加数据接入基本信息"; this.title = "添加数据";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids
this.form = row; this.form = row;
this.dataSourceParamList = []; this.dataSourceParamList = [];
getSource(id).then(response => { this.form.dataConnectionParameter.split("&").forEach(param => {
this.form.connectionParameters.split("&").forEach(param => { let paramArr = param.split("=");
let paramArr = param.split("="); this.dataSourceParamList.push({
this.dataSourceParamList.push({ name: paramArr[0],
name: paramArr[0], val: paramArr[1]
val: paramArr[1]
})
}) })
this.form = response.data; })
this.open = true; this.open = true;
this.title = "修改数据接入基本信息"; this.title = "修改数据接入";
});
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
@ -483,7 +542,6 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
addSource(this.form).then(response => { addSource(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -496,7 +554,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除数据接入基本信息编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除数据编号为"' + ids + '"的数据项?').then(function() {
return delSource(ids); return delSource(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
@ -505,7 +563,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('source/source/export', { this.download('dataSource/source/export', {
...this.queryParams ...this.queryParams
}, `source_${new Date().getTime()}.xlsx`) }, `source_${new Date().getTime()}.xlsx`)
} }

View File

@ -0,0 +1,140 @@
<template>
<el-col :span="22" :offset="1">
<el-card>
<div slot="header" class="clearfix">
<span>公共配置</span>
</div>
<el-form ref="form" :model="ruleEngineCommonConfig" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="规则基础目录">
<el-input v-model="ruleEngineCommonConfig.packageName" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="自定义基础目录">
<el-input v-model="ruleEngineCommonConfig.customName" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="模板基础目录">
<el-input v-model="ruleEngineCommonConfig.templateName" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-col>
<el-card>
<div slot="header" class="clearfix">
<span>作用域</span>
</div>
<el-tabs type="border-card" v-model="codeCardStatus">
<el-tab-pane v-for="scope in scopeList" :label="scope.type" :name="scope.value">
<encoding v-if="codeCardStatus === scope.value" style="height: 600px" v-model="scope.code" :read-only="true"></encoding>
</el-tab-pane>
</el-tabs>
</el-card>
</el-col>
</el-col>
</template>
<script>
import Encoding from "@/components/Encoding/index.vue";
export default {
name: "EngineConfig",
components: {Encoding},
data() {
return {
codeCardStatus: "taskContext",
ruleEngineCommonConfig: {
packageName: "com.muyu.rule.engine",
customName: "custom",
templateName: "template",
},
scopeList: [
{ type: "任务", value: "taskContext", "code":
"package com.muyu.scope;\n" +
"\n" +
"/**\n" +
" * @Author: DongZeLiang\n" +
" * @date: 2024/4/29\n" +
" * @Description: 任务上下文\n" +
" * @Version: 1.0\n" +
" */\n" +
"public class TaskContext {\n" +
"\n" +
" public static TaskContext build(){\n" +
" return new TaskContext();\n" +
" }\n" +
"}\n"
},
{ type: "资产集", value: "recordContext", "code":
"package com.muyu.scope;\n" +
"\n" +
"/**\n" +
" * @Author: DongZeLiang\n" +
" * @date: 2024/4/29\n" +
" * @Description: 数据集\n" +
" * @Version: 1.0\n" +
" */\n" +
"public class DataSetContext {\n" +
"\n" +
" private final RecordContext recordContext;\n" +
"\n" +
" public DataSetContext (RecordContext recordContext) {\n" +
" this.recordContext = recordContext;\n" +
" }\n" +
"}\n" },
{ type: "资产记录", value: "dataSetContext", "code":
"package com.muyu.scope;\n" +
"\n" +
"/**\n" +
" * @Author: DongZeLiang\n" +
" * @date: 2024/4/29\n" +
" * @Description: 记录/资产模型\n" +
" * @Version: 1.0\n" +
" */\n" +
"public class RecordContext {\n" +
"\n" +
" private final TaskContext taskContext;\n" +
"\n" +
" public RecordContext (TaskContext taskContext) {\n" +
" this.taskContext = taskContext;\n" +
" }\n" +
"}\n" },
{ type: "资产模型", value: "dataModelContext", "code":
"package com.muyu.scope;\n" +
"\n" +
"/**\n" +
" * @Author: DongZeLiang\n" +
" * @date: 2024/4/29\n" +
" * @Description: 数据模型\n" +
" * @Version: 1.0\n" +
" */\n" +
"public class DataModelContext {\n" +
"\n" +
" private final DataSetContext dataSetContext;\n" +
"\n" +
" public DataModelContext (DataSetContext dataSetContext) {\n" +
" this.dataSetContext = dataSetContext;\n" +
" }\n" +
"}\n" }
]
}
},
created() {
},
methods: {}
}
</script>
<style>
.el-col {
margin-top: 20px;
}
</style>

View File

@ -0,0 +1,660 @@
<template>
<div class="app-container">
<el-descriptions class="margin-top" :title="ruleEngineInfo.name" :column="3" border>
<template slot="extra">
<el-dropdown split-button type="primary" @command="handleClick">
更多操作
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="add">版本添加</el-dropdown-item>
<el-dropdown-item command="activate">{{(ruleEngineInfo.ruleengine.isActivate === 'no-activate' ? "激活":"禁用")+'引擎'}}</el-dropdown-item>
<el-dropdown-item command="status">{{(ruleEngineInfo.ruleengine.status === '0' ? "关闭": "开启")+'引擎'}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
<el-descriptions-item label="规则名称">
{{ruleEngineInfo.ruleengine.name}}
</el-descriptions-item>
<el-descriptions-item label="规则类型">
<dict-tag :options="dict.type.rule_engine_type" :value="ruleEngineInfo.ruleengine.type"/>
</el-descriptions-item>
<el-descriptions-item label="规则作用域">
<dict-tag :options="dict.type.rule_engine_level" :value="ruleEngineInfo.ruleengine.level"/>
</el-descriptions-item>
<el-descriptions-item label="引擎编码"> {{ruleEngineInfo.ruleengine.code + " ("+ruleEngineInfo.ruleengine.engineCode+")"}} </el-descriptions-item>
<el-descriptions-item label="是否激活">
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineInfo.ruleengine.isActivate"/>
</el-descriptions-item>
<el-descriptions-item label="规则状态">
<dict-tag :options="dict.type.sys_normal_disable" :value="ruleEngineInfo.ruleengine.status"/>
</el-descriptions-item>
</el-descriptions>
<editor style="margin-top: 20px" :read-only="true" v-model="ruleEngineInfo.ruleengine.description"></editor>
<el-card class="box-card" v-if="ruleEngineInfo.engineVersionList.length>0">
<div slot="header" class="clearfix">
<span>规则引擎版本</span>
</div>
<el-row :gutter="20">
<el-col :span="12" v-for="ruleEngineVersion in ruleEngineInfo.engineVersionList">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>{{ruleEngineVersion.name + "-" + ruleEngineVersion.code}}</span>
<el-dropdown style="float: right; padding: 3px 0" @command="checkRuleEngineVersion">
<span class="el-dropdown-link">
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{event: 'info', ruleEngineVersion: ruleEngineVersion}">规则详情</el-dropdown-item>
<el-dropdown-item :command="{event: 'test', ruleEngineVersion: ruleEngineVersion}" :disabled="ruleEngineVersion.status === '0'">测试规则</el-dropdown-item>
<el-dropdown-item :command="{event: 'status', ruleEngineVersion: ruleEngineVersion}" :disabled="ruleEngineVersion.status !== '2'">
{{ruleEngineVersion.isActivate !== 'no-activate' ? "禁用" : "激活"}}规则
</el-dropdown-item>
<el-dropdown-item
:command="{event: 'publish', ruleEngineVersion: ruleEngineVersion}"
v-if="ruleEngineVersion.status === '1' && ruleEngineVersion.isTest === '1'">
发布规则
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item label="版本类" :span="2"> {{ruleEngineVersion.versionCode}} </el-descriptions-item>
<el-descriptions-item label="版本名称"> {{ruleEngineVersion.name}} </el-descriptions-item>
<el-descriptions-item label="版本CODE"> {{ruleEngineVersion.code}} </el-descriptions-item>
<el-descriptions-item label="是否激活">
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineVersion.isActivate"/>
</el-descriptions-item>
<el-descriptions-item label="版本状态">
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersion.status"/>
</el-descriptions-item>
<el-descriptions-item label="是否测试">
<dict-tag :options="dict.type.rule_engine_activate_is_test" :value="ruleEngineVersion.isTest"/>
</el-descriptions-item>
</el-descriptions>
<editor style="margin-top: 10px" :read-only="true" v-model="ruleEngineVersion.description"></editor>
</el-card>
</el-col>
</el-row>
</el-card>
<el-dialog
title="新增版本" :visible.sync="addVersionStatus"
width="75%">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>基本信息</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="genEngineVersion"></el-button>
</div>
<el-form :data="engineVersionForm" label-width="80px" :model="engineVersionForm">
<el-row>
<el-col :span="24">
<el-form-item label="版本类">
<el-input v-model="engineVersionForm.versionCode" disabled placeholder="点击类生成自动生成类名称"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="名称">
<el-input v-model="engineVersionForm.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="编码">
<el-input v-model="engineVersionForm.code"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="状态">
<dict-tag :options="dict.type.rule_engine_version_status" :value="engineVersionForm.status"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否激活">
<dict-tag :options="dict.type.rule_engine_activate_status" :value="engineVersionForm.isActivate"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<editor v-model="engineVersionForm.description" :min-height="150"/>
</el-card>
<el-card class="box-card" v-if="engineVersionForm.codeIng != null">
<div slot="header" class="clearfix">
<span>引擎编码</span>
</div>
<encoding style="height: 800px" v-model="engineVersionForm.codeIng"></encoding>
</el-card>
<span slot="footer" class="dialog-footer">
<el-button @click="addVersionCancel"> </el-button>
<el-button type="primary" @click="addVersionSubmission"> </el-button>
</span>
</el-dialog>
<el-drawer
title="规则版本详情" size="80%" :before-close="ruleEngineVersionInfoStatusClose"
:visible.sync="ruleEngineVersionInfoStatus"
:direction="'rtl'">
<div class="app-container">
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
<el-descriptions-item label="版本类" :span="2"> {{ruleEngineVersionInfoAndTest.versionCode}} </el-descriptions-item>
<el-descriptions-item label="版本名称"> {{ruleEngineVersionInfoAndTest.name}} </el-descriptions-item>
<el-descriptions-item label="版本CODE"> {{ruleEngineVersionInfoAndTest.code}} </el-descriptions-item>
<el-descriptions-item label="是否激活">
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineVersionInfoAndTest.isActivate"/>
</el-descriptions-item>
<el-descriptions-item label="版本状态">
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersionInfoAndTest.status"/>
</el-descriptions-item>
<el-descriptions-item label="是否测试">
<dict-tag :options="dict.type.rule_engine_activate_is_test" :value="ruleEngineVersionInfoAndTest.isTest"/>
</el-descriptions-item>
</el-descriptions>
<editor style="margin-top: 10px" :read-only="true" :min-height="100" v-model="ruleEngineVersionInfoAndTest.description"></editor>
<el-row style="margin-top: 10px">
<el-button @click="saveCoding"></el-button>
</el-row>
<encoding style="height: 800px; margin-top: 20px" v-model="ruleEngineVersionInfoAndTest.codeIng"/>
</div>
</el-drawer>
<el-drawer
title="规则版本测试" size="80%" :before-close="ruleEngineVersionTestStatusClose"
:visible.sync="ruleEngineVersionTestStatus"
:direction="'rtl'">
<el-row :gutter="20">
<el-col :span="12">
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
<el-descriptions-item label="版本类" :span="2"> {{ruleEngineVersionInfoAndTest.versionCode}} </el-descriptions-item>
<el-descriptions-item label="版本名称"> {{ruleEngineVersionInfoAndTest.name}} </el-descriptions-item>
<el-descriptions-item label="版本CODE"> {{ruleEngineVersionInfoAndTest.code}} </el-descriptions-item>
<el-descriptions-item label="是否激活">
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineVersionInfoAndTest.isActivate"/>
</el-descriptions-item>
<el-descriptions-item label="版本状态">
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersionInfoAndTest.status"/>
</el-descriptions-item>
<el-descriptions-item label="是否测试">
<dict-tag :options="dict.type.rule_engine_activate_is_test" :value="ruleEngineVersionInfoAndTest.isTest"/>
</el-descriptions-item>
</el-descriptions>
</el-col>
<el-col :span="12">
<editor style="margin-top: 10px" :read-only="true" :min-height="105" v-model="ruleEngineVersionInfoAndTest.description"></editor>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<encoding style="margin-top: 20px" v-model="ruleEngineVersionInfoAndTest.codeIng" :read-only="true"></encoding>
</el-col>
<el-col :span="12">
<el-col :span="assetStructure == null ? 24 : 12">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>选择数据接入</span>
</div>
<el-select v-model="assetStructure" style="width: 100%;">
<el-option v-for="_assetStructure in assetStructureList"
:key="_assetStructure.dataSource.accessSourceName"
:value="_assetStructure.dataSource.accessSourceName"
:label="_assetStructure.dataSource.accessSourceName+'('+_assetStructure.dataSource.dataSourceSystemName+')'"
></el-option>
</el-select>
</el-card>
</el-col>
<el-col :span="12" v-if="assetStructure != null">
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span>选择资产结构</span>
</div>
<el-select v-model="assets" style="width: 100%;">
<el-option v-for="_valueList in assetsList"
:key="_valueList.name"
:value="_valueList.name"
:label="_valueList.name+'('+_valueList.as+')'"
></el-option>
</el-select>
</el-card>
</el-col>
<el-col :span="24" v-if="assets != null">
<el-card class="box-card" v-if="this.ruleEngineInfo.ruleengine.level === 'dataSetContext'">
<div slot="header" class="clearfix">
<span>选择资产模型</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="dataModelRandom"></el-button>
</div>
<el-descriptions direction="vertical" :column="3" border>
<el-descriptions-item v-for="_dataModel in dataModelList"
:label='_dataModel.name + "("+_dataModel.comment+")"'>
<el-radio v-model="dataMode" :label="_dataModel.name" :value="_dataModel.id">{{dataModeMapList[dataModeMapIndex][_dataModel.name]}}</el-radio>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="box-card" v-if="this.ruleEngineInfo.ruleengine.level !== 'dataSetContext'">
<div slot="header" class="clearfix">
<span>{{this.ruleEngineInfo.ruleengine.level === "data-set" ? "选择资产集" : "选择资产记录"}}</span>
<el-table :data="dataModeMapList" max-height="200px"
@selection-change="changeDataRow">
<el-table-column type="selection" width="55" v-if="this.ruleEngineInfo.ruleengine.level === 'data-set'"/>
<el-table-column v-for="dataModel in dataModelList" :label="dataModel.comment" :prop="dataModel.name"/>
<el-table-column label="操作" v-if="this.ruleEngineInfo.ruleengine.level !== 'data-set'">
<template slot-scope="scope">
<el-button type="text" @click="dataRecordSelect(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<el-descriptions title="选择行数据" direction="vertical" :column="3" border style="margin-top: 20px" v-if="dataRecordSelectData != null">
<el-descriptions-item v-for="(val, key) in dataRecordSelectData"
:label='key'>
<el-checkbox v-model="dataRecordSelectKeyList" :label="key" :value="key">{{val}}</el-checkbox>
</el-descriptions-item>
</el-descriptions>
<el-descriptions title="选择模型" :column="3" border style="margin-top: 20px" v-if="dataModeMap.length !== 0">
<el-descriptions-item v-for="_dataModel in dataModelList"
:label='_dataModel.comment'>
<el-checkbox v-model="dataRecordSelectKeyList" :label="_dataModel.name" :value="_dataModel.id"></el-checkbox>
</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
</el-col>
<el-col :span="24" style="margin-top: 10px" v-if="dataMode != null || dataRecordSelectKeyList.length > 0">
<el-button @click="dataTest"></el-button>
<el-input style="margin-top: 10px" v-model="testResult" type="textarea" placeholder="请点击测试" disabled/>
</el-col>
</el-col>
</el-row>
</el-drawer>
</div>
</template>
<script>
import { details, versionsAdd, engineOnOff, statusOnOff, versionsUpd, ruleengine} from '@/api/rule/maintenance'
import Encoding from "@/components/Encoding/index.vue";
import { database, information } from '@/api/dataSource/source'
import { assetsList } from '@/api/accredit/auth'
export default {
name: "EngineVersion",
computed: {},
components: {Encoding},
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level', 'rule_engine_version_status','rule_engine_activate_is_test'],
data() {
return {
ruleEngineId:this.$route.params && this.$route.params.id,
ruleEngineInfo: {
ruleengine:{
id:null,
name:null,
code:null,
type:null,
level:null,
isActivate:null,
status:null,
description:null,
engineCode:null
},
engineVersionList:[],
},
dataModeMapIndex:0,
dataRecordSelectKeyList:[],
dataRecordSelectData:[],
//
addVersionStatus: false,
engineVersionForm: {
ruleId:0,
name:null,
code:null,
status: "0",
versionCode : null,
isActivate: "no-activate",
description: null,
codeIng: null,
isTest:"0"
},
assetStructure:null,
assets:null,
//
dataMode: null,
//
assetStructureList:[],
//
assetsList:[],
//
ruleEngineVersionInfoStatus: false,
//
ruleEngineVersionTestStatus: false,
//
ruleEngineVersionInfoAndTest:{},
//
ruleContentReq: {},
//
testResult: "",
//
dataSource:{},
//
databaseTableInformationList:[],
//
dataModelList:[],
dataModeMapList:[],
keyList:[],
dataList:[],
dataModeMap:[],
dataName:[],
dataVal:[],
newData:[],
}
},
created() {
this.initRuleEngine();
this.SourceList();
},
watch: {
"assetStructure": {
handler(val) {
this.assetsList = []
console.log("assetStructure监听", val)
this.assetStructureList.forEach(res => {
console.log("循环的值", res)
if (res.dataSource.accessSourceName === val) {
res.databaseTableInformationList.forEach(values => {
if (res.dataSource.databaseName === values.databaseName) {
this.assetsList.push(values);
console.log(this.assetsList)
}
})
}
})
}
},
"assets": {
handler(val) {
console.log("assets监听",val)
this.keyList=[]
this.assetsList.forEach(res=>{
if (res.name === val) {
this.dataModelList = res.databaseTables
this.dataName=[]
database(val).then(res=>{
for (let resKey in res.data){
this.dataName.push(res.data[resKey].name)
}
})
assetsList(val).then(res=>{
this.dataModeMap=res.data
this.dataVal=[]
for (let resKey in res.data){
this.dataVal.push({
key:res.data[resKey].assetKey.split("-")[2],
value:res.data[resKey].value,
type:res.data[resKey].type
})
console.log("res.data[resKey].assetKey",res.data[resKey].assetKey.split("-")[2])
console.log("res.data[resKey].value",res.data[resKey].value)
console.log("res.data[resKey].type",res.data[resKey].type)
if (this.dataVal != null) {
this.newData = []
let keys = this.dataName
console.log("keys",this.dataName)
let count = keys.length
const newData = this.dataVal.reduce((acc, curr, index) => {
if (index % count === 0 && index + count - 1 < this.dataVal.length) { //
//
const tempObj = {};
// 使 keys tempObj
for (let i = 0; i < keys.length; i++) {
// 访 kvt
tempObj[keys[i]] = (i === 0) ? parseInt(this.dataVal[index + i].value, 10) : this.dataVal[index + i].value;
}
// acc
acc.push(tempObj);
}
//
return acc;
}, []);
this.newData = newData
console.log("newData",newData)
console.log("this.newData====",this.newData)
}
this.dataModeMapList = this.newData
console.log("this.newData=============",this.newData)
console.log("dataModeMapList",this.dataModeMapList)
}
})
}
})
console.log("dataModeMapList===============",this.dataModeMapList)
}
},
},
methods: {
//
dataTest(){
let number = Math.floor(Math.random()*3);
if (number === 0){
this.testResult = "测试正常,无异常数据返回";
}else if (number === 1){
this.testResult = "测试失败:触发*****异常条例,数据发生动作【移除/忽略/记录】";
}else if (number === 2){
this.testResult = "程序异常:*******异常";
}
},
//
dataRecordSelect(row){
this.dataRecordSelectKeyList = [];
this.dataRecordSelectData = row;
},
//
changeDataRow(val){
this.changeDataList = val;
},
dataModelRandom(){
this.dataModeMapIndex = Math.floor(Math.random()*this.dataModeMapList.length);
},
//
saveCoding: function() {
this.ruleEngineVersionInfoAndTest.status = "1"
console.log(this.ruleEngineVersionInfoAndTest)
versionsUpd(this.ruleEngineVersionInfoAndTest).then(res=>{
if (res.code === 200) {
const codeName = this.ruleEngineVersionInfoAndTest.codeIng;
this.ruleContentReq.ruleContent=codeName
this.ruleContentReq.className= this.ruleEngineVersionInfoAndTest.versionCode
this.$message.success(res.msg)
ruleengine(this.ruleContentReq).then(
res=>{
this.ruleEngineVersionInfoStatus=false
this.initRuleEngine(this.ruleEngineId)
this.ruleEngineVersionInfoAndTest={}
}
)
}else {
this.initRuleEngine(this.ruleEngineId)
this.ruleEngineVersionInfoAndTest={}
this.ruleEngineVersionInfoStatus=false
}
})
},
//
ruleEngineVersionInfoStatusClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
this.ruleEngineVersionInfoAndTest = {};
done();
})
.catch(_ => {});
},
//
ruleEngineVersionTestStatusClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
this.ruleEngineVersionInfoAndTest = {};
done();
})
.catch(_ => {});
},
//
checkRuleEngineVersion(command) {
switch (command.event) {
case "info"://
this.ruleEngineVersionInfoStatus = true
this.ruleEngineVersionInfoAndTest = command.ruleEngineVersion;
break;
case "test"://
this.ruleEngineVersionTestStatus = true
this.ruleEngineVersionInfoAndTest = command.ruleEngineVersion;
break;
case "status"://
command.ruleEngineVersion.isActivate = 'no-activate' === command.ruleEngineVersion.isActivate ? 'activated' : 'no-activate'
break;
case "publish"://
command.ruleEngineVersion.status = '2'
break;
}
console.log(command.event);
console.log(command.ruleEngineVersion);
},
//
genEngineVersion(){
if (this.engineVersionForm.name == null || this.engineVersionForm.name === "") {
this.$message.error('规则名称不可为空');
return false;
}
if (this.engineVersionForm.code == null || this.engineVersionForm.code === "") {
this.$message.error('规则CODE不可为空');
return false;
}
this.engineVersionForm.versionCode = this.ruleEngineInfo.ruleengine.engineCode + "_" + this.engineVersionForm.code
this.engineVersionForm.codeIng= this.getCodeIng(this.ruleEngineInfo.ruleengine.level)
},
//
getCodeIng(value){
let parentClass=null
console.log("规则作用域",value)
//
if (value === 'taskContext') {
parentClass = "DataSetContext";
//
}else if (value === 'recordContext'){
parentClass = "RecordContext";
//
}else if (value === 'dataSetContext'){
parentClass = "DataModelContext";
}
let packageName = "com.muyu.engine";
let customName = "custom";
let templateName = "template";
let codeIng = `package ${packageName}.${customName};
import com.muyu.engine.action.ActionDiscard;
import com.muyu.engine.scope.${parentClass};
/**
* @Author: DongZeLiang
* @date: 2024/5/6
* @Description: ${this.engineVersionForm.name}-${this.engineVersionForm.code}
* @Version: 1.0
*/
public class ${this.engineVersionForm.versionCode} extends ${parentClass} {
public static void main(String[] args) {
return "zhangsan";
}
}`;
return codeIng;
},
//
addVersionSubmission(){
this.engineVersionForm.ruleId=this.$route.params.id
console.log("engineVersionForm",this.engineVersionForm)
versionsAdd(this.engineVersionForm).then(res=>{
if (res.code === 200) {
this.$message.success(res.msg)
this.addVersionStatus=false
this.initRuleEngine(this.ruleEngineId)
this.engineVersionForm={}
}else {
this.$message.error(res.msg)
this.addVersionStatus=false
this.initRuleEngine(this.ruleEngineId)
this.engineVersionForm={}
}
})
},
//
addVersionCancel(){
this.addVersionStatus = false
},
handleClick(clickType){
console.log("clickType",clickType)
if (clickType === "add"){
//
this.addVersionStatus = true;
}else if(clickType === "activate"){
//
this.ruleEngineInfo.ruleengine.isActivate = 'no-activate' === this.ruleEngineInfo.ruleengine.isActivate ? 'activated' : 'no-activate'
engineOnOff(this.ruleEngineInfo.ruleengine).then(res=>{
if (res.code === 200) {
this.$message.success(res.msg)
this.initRuleEngine(this.ruleEngineId)
}else {
this.$message.error(res.msg)
this.initRuleEngine(this.ruleEngineId)
}
})
}else if(clickType === "status"){
//
this.ruleEngineInfo.ruleengine.status = '0' === this.ruleEngineInfo.ruleengine.status ? '1' : '0'
statusOnOff(this.ruleEngineInfo.ruleengine).then(res=>{
if (res.code === 200) {
this.$message.success(res.msg)
this.initRuleEngine(this.ruleEngineId)
}else {
this.$message.error(res.msg)
this.initRuleEngine(this.ruleEngineId)
}
})
}
},
//
initRuleEngine(){
details(this.$route.params.id).then(res=>{
this.ruleEngineInfo=res.data
})
},
SourceList(){
information().then(res=>{
this.assetStructureList=res.data
console.log("数据结构",this.assetStructureList)
})
}
}
}
</script>
<style scoped>
.box-card{
margin-top: 20px;
}
.el-dropdown-link {
cursor: pointer;
color: #409EFF;
}
.el-icon-arrow-down {
font-size: 12px;
}
.CodeMirror {
height: 600px;
}
</style>

View File

@ -0,0 +1,424 @@
<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="type">
<el-select v-model="queryParams.type" placeholder="请选择规则类型" clearable>
<el-option
v-for="dict in dict.type.rule_engine_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否激活" prop="isActivate">
<el-select v-model="queryParams.isActivate" placeholder="请选择是否激活" clearable>
<el-option
v-for="dict in dict.type.rule_engine_activate_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="规则状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择规则状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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="['rule:rule:add']"
>新增
</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="['rule:rule: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="['rule:rule:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="engineList" @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="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.rule_engine_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="规则作用域" align="center" prop="level">
<template slot-scope="scope">
<dict-tag :options="dict.type.rule_engine_level" :value="scope.row.level"/>
</template>
</el-table-column>
<el-table-column label="引擎编码" align="center" prop="code"/>
<el-table-column label="是否激活" align="center" prop="isActivate">
<template slot-scope="scope">
<dict-tag :options="dict.type.rule_engine_activate_status" :value="scope.row.isActivate"/>
</template>
</el-table-column>
<el-table-column label="规则状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<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-takeaway-box"
@click="toEngineVersion(scope.row)"
v-hasPermi="['rule:engine:edit']"
>规则维护
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:rule:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['rule:rule: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="80px">
<el-row>
<el-col :span="12">
<el-form-item label="规则名称" prop="name">
<el-input v-model="form.name" placeholder="请输入规则名称"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规则编码" prop="code">
<el-input v-model="form.code" placeholder="请输入规则编码"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="规则类型" prop="type">
<el-select v-model="form.type" placeholder="请选择规则类型" style="width: 100%">
<el-option
v-for="dict in dict.type.rule_engine_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规则级别" prop="level">
<el-select v-model="form.level" placeholder="请选择规则级别" style="width: 100%">
<el-option
v-for="dict in dict.type.rule_engine_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否激活" prop="isActivate">
<el-radio-group v-model="form.isActivate">
<el-radio
v-for="dict in dict.type.rule_engine_activate_status"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规则状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="规则描述">
<editor v-model="form.description" :min-height="192"/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-col>
</el-row>
</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 'codemirror/lib/codemirror.css';
import 'codemirror/mode/javascript/javascript.js';
import {
addRuleengine, delRuleengine,
getRuleengine,
listRuleengine,
updateRuleengine
} from '@/api/rule/maintenance'
export default {
name: "EngineMaintenance",
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
engineList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
isActivate: null,
status: null,
description: null,
},
//
form: {},
//
rules: {
name: [
{required: true, message: "规则名称不能为空", trigger: "blur"}
],
type: [
{required: true, message: "规则类型不能为空", trigger: "change"}
],
code: [
{required: true, message: "规则编码不能为空", trigger: "blur"}
],
level: [
{required: true, message: "规则级别不能为空", trigger: "change"}
],
isActivate: [
{required: true, message: "是否激活不能为空", trigger: "change"}
],
status: [
{required: true, message: "规则状态不能为空", trigger: "change"}
],
createBy: [
{required: true, message: "创建者不能为空", trigger: "blur"}
],
createTime: [
{required: true, message: "创建时间不能为空", trigger: "blur"}
],
},
editor: null,
isEditorVisible:false,
dialogVisible:false,
ruleContentReq:{}
};
},
created() {
this.getList();
},
methods: {
toEngineVersion(row) {
console.log(row)
this.$router.push({ path: `/ruleengine/engineVersion/${row.id}`});
},
/** 查询规则引擎列表 */
getList() {
this.loading = true;
listRuleengine(this.queryParams).then(
response => {
this.engineList = response.data.rows;
this.total = response.data.total;
this.loading = false;
}
)
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
type: null,
isActivate: "no-activate",
status: "0",
description: 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
getRuleengine(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) {
updateRuleengine(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRuleengine(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 delRuleengine(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('ruleengine/ruleengine/export', {
...this.queryParams
}, `ruleengine_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -234,9 +234,9 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listDept(this.queryParams).then(response => { listDept(this.queryParams).then(response => {
console.log(response.data) console.log(response.data);
this.deptList = this.handleTree(response.data, "deptId"); this.deptList = this.handleTree(response.data, "deptId");
console.log(this.deptList) console.log(this.deptList);
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -105,8 +105,7 @@
size="mini" size="mini"
type="text" type="text"
@click="noticeDetails(scope.row.noticeId)" @click="noticeDetails(scope.row.noticeId)"
>通知详情 >通知详情</el-button>
</el-button>
<el-button <el-button
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
icon="el-icon-edit" icon="el-icon-edit"
@ -156,17 +155,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.noticeType == 2">
<span style="margin-right: 15px;margin-left: 10px"><b>公告时间</b></span>
<el-date-picker
v-model="form.time"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
@ -179,6 +167,16 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.noticeType==2">
<span style="margin-right: 15px;margin-left: 10px"><b>公告时间</b></span>
<el-date-picker
v-model="form.time"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="内容"> <el-form-item label="内容">
<editor v-model="form.noticeContent" :min-height="192"/> <editor v-model="form.noticeContent" :min-height="192"/>
@ -186,6 +184,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-cascader
:options="options"
:props="props"
clearable v-if="form.noticeType==1"></el-cascader>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
@ -263,12 +265,11 @@ export default {
dicts: ['sys_notice_status', 'sys_notice_type'], dicts: ['sys_notice_status', 'sys_notice_type'],
data() { data() {
return { return {
sectionList:[], sectionsList:[],
personnelList:[], personne1List:[],
props: { multiple: true }, props: { multiple: true },
options1: [], options:[],
options: [], options1:[],
activeName: '部门',
// //
loading: true, loading: true,
// //
@ -295,13 +296,14 @@ export default {
createBy: undefined, createBy: undefined,
status: undefined status: undefined
}, },
queryParam: { queryParam:{
pageNum: 1, pageNum:1,
pageSize: 10, pageSize:10,
noticeTitle: undefined, noticeType:undefined,
createBy: undefined, createBy:undefined,
status: undefined status:undefined,
}, },
depts:[],
// //
form: {}, form: {},
// //
@ -313,35 +315,44 @@ export default {
{required: true, message: "公告类型不能为空", trigger: "change"} {required: true, message: "公告类型不能为空", trigger: "change"}
] ]
}, },
asUserDeptNum: {}, asUserDeptNum:{},
numVisable: false numVisAble:false
}; };
}, },
created() { created() {
this.getDeptList();
this.getList(); this.getList();
}, },
methods: { methods: {
noticeDetails(noticeId) { noticeDetails(noticeId){
this.numVisable = true this.numVisAble=true;
getNum(noticeId).then(res => { getNum(noticeId).then(res=>{
this.asUserDeptNum = res.data this.asUserDeptNum=res.data;
}) })
}, },
// //
recursion(data) { recursion(data){
data.forEach(da => { data.forEach(res=>{
this.$set(da, 'value', da.deptId); this.$set(res,'value',res.deptId);
delete da.deptId; delete res.deptId;
this.$set(da, 'label', da.deptName); this.$set(res,'label',res.deptName);
delete da.deptName; delete res.deptName;
if (da.children){ if (res.children){
this.recursion(da.children) this.recursion(res.children)
} }
}) })
}, },
//tab //tab
handleClick(tab, event) { handleClick(tab,event){
},
getDeptList(){
listDept(null).then(
res=>{
console.log(res.data)
}
)
}, },
/** 查询公告列表 */ /** 查询公告列表 */
getList() { getList() {
@ -366,7 +377,7 @@ export default {
noticeContent: undefined, noticeContent: undefined,
status: "0", status: "0",
sectionList:[], sectionList:[],
personnelList:[] personne1List:[],
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -391,20 +402,23 @@ export default {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加公告"; this.title = "添加公告";
listDept(this.queryParam).then(response => { listDept(this.queryParam).then(
this.options1 = this.handleTree(response.data, "deptId"); res=>{
console.log(this.options1) this.options1=this.handleTree(res.data,"deptId");
this.options1.forEach(op => { console.log(this.options1);
this.$set(op, 'value', op.deptId); this.options1.forEach(res=>{
delete op.deptId; this.$set(res,'value',res.deptId);
this.$set(op, 'label', op.deptName); delete res.deptId;
delete op.deptName; this.$set(res,'label',res.deptName);
if (op.children){ delete res.deptName;
this.recursion(op.children) if (res.children){
} this.recursion(res.children)
}) }
this.loading = false;
}) })
this.loading = false;
})
listUser(this.addDateRange(this.queryParams, [])).then(response => { listUser(this.addDateRange(this.queryParams, [])).then(response => {
this.options = response.data.rows; this.options = response.data.rows;
console.log(this.options) console.log(this.options)

View File

@ -352,6 +352,7 @@
</el-link> </el-link>
</div> </div>
</el-upload> </el-upload>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button> <el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button> <el-button @click="upload.open = false"> </el-button>
@ -372,10 +373,9 @@ import {
updateUser updateUser
} from "@/api/system/user"; } from "@/api/system/user";
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import {forceLogout, list} from "@/api/monitor/online";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {forceLogout, list} from "@/api/monitor/online";
export default { export default {
name: "User", name: "User",
@ -383,10 +383,10 @@ export default {
components: {Treeselect}, components: {Treeselect},
data() { data() {
return { return {
queryParam:{ // queryParam: {
ipaddr: undefined, // ipaddr: undefined,
userName: undefined // userName: undefined
}, // },
// //
loading: true, loading: true,
// //
@ -630,15 +630,14 @@ export default {
}).then(({value}) => { }).then(({value}) => {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
this.$modal.msgSuccess("修改成功,新密码是:" + value); this.$modal.msgSuccess("修改成功,新密码是:" + value);
// list(this.queryParam).then(res => {
list(this.queryParam).then(res=>{ // const userList = res.data.rows
const userList = res.data.rows // userList.forEach(userInfo => {
userList.forEach(userInfo=>{ // if (userInfo.userName == row.userName){
if (userInfo.userName==row.userName){ // forceLogout(userInfo.tokenId);
forceLogout(userInfo.tokenId) // }
} // })
}) // })
})
}); });
}).catch(() => { }).catch(() => {
}); });

View File

@ -8,10 +8,10 @@
<el-table ref="dragTable" :data="columns" :max-height="tableHeight" row-key="columnId"> <el-table ref="dragTable" :data="columns" :max-height="tableHeight" row-key="columnId">
<el-table-column class-name="allowDrag" label="序号" min-width="5%" type="index"/> <el-table-column class-name="allowDrag" label="序号" min-width="5%" type="index"/>
<el-table-column <el-table-column
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
label="字段列名" label="字段列名"
min-width="10%" min-width="10%"
prop="columnName" prop="columnName"
/> />
<el-table-column label="字段描述" min-width="10%"> <el-table-column label="字段描述" min-width="10%">
<template slot-scope="scope"> <template slot-scope="scope">
@ -19,10 +19,10 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
label="物理类型" label="物理类型"
min-width="10%" min-width="10%"
prop="columnType" prop="columnType"
/> />
<el-table-column label="Java类型" min-width="11%"> <el-table-column label="Java类型" min-width="11%">
<template slot-scope="scope"> <template slot-scope="scope">
@ -101,10 +101,10 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择"> <el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
<el-option <el-option
v-for="dict in dictOptions" v-for="dict in dictOptions"
:key="dict.dictType" :key="dict.dictType"
:label="dict.dictName" :label="dict.dictName"
:value="dict.dictType"> :value="dict.dictType">
<span style="float: left">{{ dict.dictName }}</span> <span style="float: left">{{ dict.dictName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ dict.dictType }}</span> <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.dictType }}</span>
</el-option> </el-option>
@ -182,7 +182,6 @@ export default {
submitForm() { submitForm() {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm; const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
const genForm = this.$refs.genInfo.$refs.genInfoForm; const genForm = this.$refs.genInfo.$refs.genInfoForm;
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => { Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
const validateResult = res.data.every(item => !!item); const validateResult = res.data.every(item => !!item);
if (validateResult) { if (validateResult) {