作者 小范

Merge remote-tracking branch 'origin/message_bus' into message_bus

# Conflicts:
#	src/routes.js
#	src/views/bus/Configure.vue
@@ -49,7 +49,12 @@ export const updateRoutingKey = params =>{return http.put(`${baseUrl}/routing/up @@ -49,7 +49,12 @@ export const updateRoutingKey = params =>{return http.put(`${baseUrl}/routing/up
49 export const deleteRoutingKey = params =>{return http.del(`${baseUrl}/routing/delete`, params);}; 49 export const deleteRoutingKey = params =>{return http.del(`${baseUrl}/routing/delete`, params);};
50 // MQ路由键,批量删除 50 // MQ路由键,批量删除
51 export const batchRemoveRoutingKey = params =>{return http.get(`${baseUrl}/routing/batchRemove`, params);}; 51 export const batchRemoveRoutingKey = params =>{return http.get(`${baseUrl}/routing/batchRemove`, params);};
52 - 52 +//路由管理查询
  53 +export const queRouter=params=>{return http.get(`${baseUrl}/router/queRouter`, params);};
  54 +// 路由管理,删除
  55 +export const deleteRouter = params =>{return http.get(`${baseUrl}/router/delRouter`, params);};
  56 +// 路由管理,添加
  57 +export const addRouter = params =>{return http.post(`${baseUrl}/router/addRouter`, params);};
53 58
54 // MQ消息队列,分页查询列表 59 // MQ消息队列,分页查询列表
55 export const selectBusQueueList = params =>{return http.get(`${baseUrl}/queue/list`, params);}; 60 export const selectBusQueueList = params =>{return http.get(`${baseUrl}/queue/list`, params);};
@@ -133,3 +138,8 @@ export const updateMessage = params =>{return http.put(`${baseUrl}/message/type/ @@ -133,3 +138,8 @@ export const updateMessage = params =>{return http.put(`${baseUrl}/message/type/
133 export const deleteMessage = params =>{return http.del(`${baseUrl}/message/type/delete`, params);}; 138 export const deleteMessage = params =>{return http.del(`${baseUrl}/message/type/delete`, params);};
134 export const batchDelete = params =>{return http.del(`${baseUrl}/message/type/batchDelete`, params);}; 139 export const batchDelete = params =>{return http.del(`${baseUrl}/message/type/batchDelete`, params);};
135 140
  141 +
  142 +//路由添加
  143 + //批量添加路由
  144 +export const api_batchAddRouter = params =>{return http.post(`${baseUrl}/router/batchAdd`, params);};
  145 +export const loadRouterBySndr = params =>{return http.get(`${baseUrl}/router/searchBysndr`, params);};
@@ -87,10 +87,12 @@ import UserInfo from "./views/bus/UserInfo.vue" @@ -87,10 +87,12 @@ import UserInfo from "./views/bus/UserInfo.vue"
87 import QueueView from "./views/bus/view/QueueView.vue" 87 import QueueView from "./views/bus/view/QueueView.vue"
88 import ExchangeView from "./views/bus/view/ExchangeView.vue" 88 import ExchangeView from "./views/bus/view/ExchangeView.vue"
89 import ElasticSearchInfo from "./views/bus/ElasticSearchInfo.vue" 89 import ElasticSearchInfo from "./views/bus/ElasticSearchInfo.vue"
90 -import ConfigureS from "./views/bus/Configure.vue" 90 +import RouterBatch from "./views/bus/RouterBatch.vue"
91 import MessageManagement from "./views/bus/MessageManagement.vue" 91 import MessageManagement from "./views/bus/MessageManagement.vue"
  92 +import RouterManage from "./views/bus/RouterManage"
92 93
93 - 94 +//组件练习
  95 +//import Page7 from "./views/nav3/Page7.vue"
94 96
95 97
96 98
@@ -162,10 +164,11 @@ let routes = [ @@ -162,10 +164,11 @@ let routes = [
162 // {path: '/exchange', component: Exchange, name: '交换机管理'}, 164 // {path: '/exchange', component: Exchange, name: '交换机管理'},
163 // {path: '/routing', component: RoutingKey, name: '路由键管理'}, 165 // {path: '/routing', component: RoutingKey, name: '路由键管理'},
164 {path: '/umb', component: UserMessageBinding, name: '路由配置管理'}, 166 {path: '/umb', component: UserMessageBinding, name: '路由配置管理'},
  167 + {path: '/routermanage', component: RouterManage, name: '路由配置'},
165 {path: '/note', component: MessageNote, name: '消息记录管理'}, 168 {path: '/note', component: MessageNote, name: '消息记录管理'},
166 {path: '/note_search', component: MessageNoteSearch, name: '消息记录搜索'}, 169 {path: '/note_search', component: MessageNoteSearch, name: '消息记录搜索'},
167 {path: '/es', component: ElasticSearchInfo, name: 'ES信息管理'}, 170 {path: '/es', component: ElasticSearchInfo, name: 'ES信息管理'},
168 - {path: '/configures', component: ConfigureS, name: '消息路由批量配置'}, 171 + {path: '/configures', component: RouterBatch, name: '消息路由批量配置'},
169 {path: '/ms', component: MessageManagement, name: '消息分类管理'} 172 {path: '/ms', component: MessageManagement, name: '消息分类管理'}
170 173
171 ] 174 ]
@@ -180,7 +183,15 @@ let routes = [ @@ -180,7 +183,15 @@ let routes = [
180 // {path: '/exchangeView', component: ExchangeView, name: '交换机监控'}, 183 // {path: '/exchangeView', component: ExchangeView, name: '交换机监控'},
181 ] 184 ]
182 }, 185 },
183 - 186 + {
  187 + path: '/nav3',
  188 + component: Home,
  189 + name: '组件练习',
  190 + iconCls: 'el-icon-view',
  191 + children: [
  192 + {path: '/page7', component: Page7, name: '组件'},
  193 + ]
  194 + },
184 195
185 196
186 // { 197 // {
1 -<template>  
2 - <el-container>  
3 - <el-main>  
4 - <div style="border: 6px solid #6F8294;" class="tr">  
5 - <el-row style="margin: -2px">  
6 - <el-col :span="6">  
7 - <el-row class="bt">  
8 - <span>选择消息发送者</span>  
9 - </el-row>  
10 - <el-row>  
11 - <el-tree  
12 - :data="sndr"  
13 - show-checkbox  
14 - node-key="id"  
15 - :props="userProps">  
16 - </el-tree>  
17 - </el-row>  
18 - </el-col>  
19 - <el-col :span="6" align="center">  
20 - <el-row class="bt">  
21 - <span>选择要发送的消息</span>  
22 - </el-row>  
23 - <el-row>  
24 - <el-tree  
25 - :data="message_type"  
26 - show-checkbox  
27 - node-key="id"  
28 - :props="defaultProps">  
29 - </el-tree>  
30 - </el-row>  
31 - </el-col>  
32 - <el-col :span="6">  
33 - <el-row class="bt">  
34 - <span>选择消息接收者</span>  
35 - </el-row>  
36 - <el-row>  
37 - <el-tree  
38 - :data="rcvr"  
39 - show-checkbox  
40 - node-key="id"  
41 - :props="userProps">  
42 - </el-tree>  
43 - </el-row>  
44 - </el-col>  
45 - <el-col :span="6">  
46 - <el-row class="bt">  
47 - <span>消息路由配置其他属性</span>  
48 - </el-row>  
49 - <el-row>  
50 - <el-form :inline="true" :model="formInline" class="demo-form-inline" align="center" style="border:3px solid #6F8294;height: 800px;padding-top: 15px">  
51 - <el-form-item label="路由状态:">  
52 - <el-select v-model="formInline.state" placeholder="请选择" style="width: 150px" size="mini">  
53 - <el-option label="启用" value="01"></el-option>  
54 - <el-option label="关闭" value="02"></el-option>  
55 - </el-select>  
56 - </el-form-item>  
57 - <el-form-item label="路由用途:">  
58 - <el-select v-model="formInline.purpose" placeholder="请选择" style="width: 150px" size="mini">  
59 - <el-option label="生产用" value="03"></el-option>  
60 - </el-select>  
61 - </el-form-item>  
62 - <el-form-item label="路由描述:">  
63 - <el-input type="textarea" v-model="formInline.describe" style="width: 150px" size="mini"></el-input>  
64 - </el-form-item>  
65 - </el-form>  
66 - </el-row>  
67 - </el-col>  
68 - </el-row>  
69 -  
70 - </div>  
71 - </el-main>  
72 - </el-container>  
73 -</template>  
74 -  
75 -<script>  
76 - import {getAlltype} from "../../api/message_bus";  
77 - export default {  
78 - name: 'Configure',  
79 -  
80 - data() {  
81 - return {  
82 - formInline: {  
83 - state: '',  
84 - purpose: '',  
85 - describe: ''  
86 - },  
87 - sndr: [{  
88 - id: 1,  
89 - label: '代理人系统接收账号(AGTR)',  
90 - }, {  
91 - id: 2,  
92 - label: '代理人接收中外运预配(AGTZ)',  
93 - }, {  
94 - id: 3,  
95 - label: '【测试】舱单自动化解析系统(AMDB)',  
96 - }],  
97 - rcvr: [{  
98 - id: 1,  
99 - label: '代理人系统接收账号(AGTR)',  
100 - }, {  
101 - id: 2,  
102 - label: '代理人接收中外运预配(AGTZ)',  
103 - }, {  
104 - id: 3,  
105 - label: '【测试】舱单自动化解析系统(AMDB)',  
106 - }],  
107 - queryInfo:{  
108 - pageNum:1,  
109 - pageSize:10,  
110 - name:"",  
111 - type:"",  
112 - },  
113 - message_type: [{  
114 - id: 1,  
115 - nameAndDes: '航班动态(1)',  
116 - children: [{  
117 - id: 7,  
118 - nameAndDes: '',  
119 - children: [{  
120 - id: 8,  
121 - nameAndDes: ''  
122 - }, {  
123 - id: 9,  
124 - nameAndDes: ''  
125 - }]  
126 - }]  
127 - }, {  
128 - id: 2,  
129 - nameAndDes: '航班历史(2)',  
130 - children: [{  
131 - id: 7,  
132 - nameAndDes: '',  
133 - children: [{  
134 - id: 8,  
135 - nameAndDes: ''  
136 - }, {  
137 - id: 9,  
138 - nameAndDes: ''  
139 - }]  
140 - }]  
141 - }, {  
142 - id: 3,  
143 - nameAndDes: '卡口业务交换信息(80)',  
144 - children: [{  
145 - id: 4,  
146 - nameAndDes: '卡口业务数据(KAKO)',  
147 - children: [{  
148 - id: 5,  
149 - nameAndDes: 'ALL'  
150 - }, {  
151 - id: 6,  
152 - nameAndDes: '卡口车单绑定关系数据(CARB)'  
153 - }]  
154 - }]  
155 - }],  
156 - defaultProps: {  
157 - children: 'children',  
158 - label: 'nameAndDes'  
159 - },  
160 - userProps: {  
161 - children: 'children',  
162 - label: 'label'  
163 - }  
164 - }  
165 - },  
166 - methods: {  
167 - onSubmit() {  
168 - console.log('submit!');  
169 - },  
170 - getAllType() {  
171 - let _this =this;  
172 - getAlltype().then((response) => {  
173 - let res = response.data;  
174 - if (res.code !== '200') {  
175 - return _this.$message.error('获取消息记录,失败!');  
176 - }  
177 - // 获取列表数据  
178 - _this.message_type = res.data;  
179 - // 关闭加载  
180 - _this.$message.success('获取消息收发记录,成功!');  
181 - }).catch(error => {  
182 - // 关闭加载  
183 - _this.$message.error(error.toString());  
184 - });  
185 - }  
186 - },  
187 - mounted() {  
188 - this.getAllType();  
189 - },  
190 -  
191 - }  
192 -</script>  
193 -  
194 -<style>  
195 - .bt {  
196 - font-weight: bold;  
197 - background-color: #6F8294;  
198 - color: #ffffff;  
199 - text-align: center  
200 - }  
201 - .el-col {  
202 - margin-right: 0px;  
203 - }  
204 - .tr .el-tree {  
205 - padding-top: 15px;  
206 - border:3px solid #6F8294;  
207 - height: 800px  
208 - }  
209 - .el-row .el-col .el-row {  
210 - margin-top: 0px;  
211 - }  
212 -</style>  
  1 +<template>
  2 + <el-container>
  3 + <el-main>
  4 + <el-card style="background-color: #F5F7FA">
  5 + <!-- 搜素区域 -->
  6 + <el-row>
  7 + <el-col :span="24" align="left">
  8 + <el-button type="warning" size="medium" icon="el-icon-search" @click="loadRouter" :loading="loadingStatus">
  9 + 加载已配置消息
  10 + </el-button>
  11 + <el-button type="primary" size="medium" icon="el-icon-plus" @click="batchAddRouter" :loading="loadingStatus">
  12 + 生成路由
  13 + </el-button>
  14 + </el-col>
  15 + </el-row>
  16 + <el-divider></el-divider>
  17 + <el-row>
  18 + <div style="border: 6px solid #6F8294;">
  19 + <el-row style="margin: -2px">
  20 + <el-col :span="6">
  21 + <el-row class="bt">
  22 + <span>选择消息发送者</span>
  23 + </el-row>
  24 + <el-row>
  25 + <el-tree
  26 + :data="sndr"
  27 + show-checkbox
  28 + node-key="username"
  29 + :props="userProps"
  30 + ref="sndrTree"
  31 + @check-change="treeSndrCheckChange"
  32 +
  33 + >
  34 + </el-tree>
  35 + </el-row>
  36 + </el-col>
  37 + <el-col :span="6" align="center">
  38 + <el-row class="bt">
  39 + <span>选择要发送的消息类型</span>
  40 + </el-row>
  41 + <el-row>
  42 + <el-tree
  43 + :data="message_type"
  44 + show-checkbox
  45 + node-key="name"
  46 + default-expand-all
  47 + check-strictly
  48 + :props="defaultProps"
  49 + highlight-current
  50 + ref="typeTree"
  51 + @check-change="treeTypeCheckChange"
  52 + >
  53 + </el-tree>
  54 + </el-row>
  55 + </el-col>
  56 + <el-col :span="6">
  57 + <el-row class="bt">
  58 + <span>选择消息接收者</span>
  59 + </el-row>
  60 + <el-row>
  61 + <el-tree
  62 + :data="rcvr"
  63 + show-checkbox
  64 + node-key="id"
  65 + :props="userProps"
  66 + ref="rcvrTree"
  67 + @check-change="treeRcvrCheckChange"
  68 + >
  69 + </el-tree>
  70 + </el-row>
  71 + </el-col>
  72 + <el-col :span="6">
  73 + <el-row class="bt">
  74 + <span>消息路由配置其他属性</span>
  75 + </el-row>
  76 + <el-row>
  77 + <el-form :inline="true" :model="params" class="demo-form-inline" align="center" style="border:3px solid #6F8294;height: 800px;padding-top: 15px">
  78 + <el-form-item label="路由状态:">
  79 + <el-select v-model="params.status" placeholder="请选择" style="width: 150px" size="mini">
  80 + <el-option
  81 + v-for="item in status_options"
  82 + :key="item.value"
  83 + :label="item.label"
  84 + :value="item.value">
  85 + <span style="float: left">{{ item.label }}</span>
  86 + <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  87 + </el-option>
  88 + </el-select>
  89 + </el-form-item>
  90 + <el-form-item label="路由用途:">
  91 + <el-select v-model="params.usage" placeholder="请选择" style="width: 150px" size="mini">
  92 + <el-option
  93 + v-for="item in usage_options"
  94 + :key="item.value"
  95 + :label="item.label"
  96 + :value="item.value">
  97 + <span style="float: left">{{ item.label }}</span>
  98 + <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
  99 + </el-option>
  100 + </el-select>
  101 + </el-form-item>
  102 + <el-form-item label="路由描述:">
  103 + <el-input type="textarea" v-model="params.des" style="width: 150px" size="mini"></el-input>
  104 + </el-form-item>
  105 + </el-form>
  106 + </el-row>
  107 + </el-col>
  108 + </el-row>
  109 +
  110 + </div>
  111 + </el-row>
  112 + </el-card>
  113 + </el-main>
  114 + </el-container>
  115 +</template>
  116 +
  117 +<script>
  118 + import { getAlltype,api_batchAddRouter,loadRouterBySndr } from "../../api/message_bus";
  119 + export default {
  120 + name: "Configure",
  121 +
  122 + data() {
  123 + return {
  124 + loadingStatus: false,
  125 + sndr: [],
  126 + rcvr: [],
  127 + api_back: [],
  128 + params:{
  129 + sndr: '',
  130 + sndrs: [],
  131 + types: [],
  132 + rcvrs: [],
  133 + status: 1,
  134 + usage: 2,
  135 + des: "",
  136 + ver: "1.0"
  137 + },
  138 + status_options:[
  139 + {
  140 + label: "启用",
  141 + value: 1
  142 + },
  143 + {
  144 + label:"关闭",
  145 + value: 0
  146 + }
  147 + ],
  148 + usage_options:[
  149 + {
  150 + label: "生产用",
  151 + value: 1
  152 + },
  153 + {
  154 + label:"测试用",
  155 + value: 2
  156 + }
  157 + ],
  158 + message_type: [{
  159 + id: 1,
  160 + name: '航班动态(1)',
  161 + children: [{
  162 + id: 7,
  163 + name: '',
  164 + children: [{
  165 + id: 8,
  166 + name: ''
  167 + }, {
  168 + id: 9,
  169 + name: ''
  170 + }]
  171 + }]
  172 + }, {
  173 + id: 2,
  174 + name: '航班历史(2)',
  175 + children: [{
  176 + id: 7,
  177 + name: '',
  178 + children: [{
  179 + id: 8,
  180 + name: ''
  181 + }, {
  182 + id: 9,
  183 + name: ''
  184 + }]
  185 + }]
  186 + }, {
  187 + id: 3,
  188 + name: '卡口业务交换信息(80)',
  189 + children: [{
  190 + id: 4,
  191 + name: '卡口业务数据(KAKO)',
  192 + children: [{
  193 + id: 5,
  194 + name: 'ALL'
  195 + }, {
  196 + id: 6,
  197 + name: '卡口车单绑定关系数据(CARB)'
  198 + }]
  199 + }]
  200 + }],
  201 + defaultProps: {
  202 + children: 'children',
  203 + label: function (data,node) {
  204 + return '[' + data.name+ ']' + data.des;
  205 + },
  206 + disabled: 'disabled'
  207 + },
  208 + userProps: {
  209 + children: 'children',
  210 + label: function (data, node) {
  211 + return '('+data.username + ')' + data.des;
  212 + }
  213 + }
  214 + }
  215 + },
  216 + methods: {
  217 + typeFilterNode(treeList) {
  218 + let _this = this;
  219 + if (Array.isArray(treeList)){
  220 + treeList.forEach(function(item,index){
  221 + if (item.type == 1 || item.type==2){
  222 + item.disabled = true;
  223 + }
  224 + if (item.children !== undefined){
  225 + _this.typeFilterNode(item.children);
  226 + }
  227 + })
  228 + }
  229 +
  230 + },
  231 + getAllType() {
  232 + let _this =this;
  233 + _this.loadingStatus = true;
  234 + getAlltype().then((response) => {
  235 + let res = response.data;
  236 + if (res.code !== '200') {
  237 + _this.loadingStatus = false;
  238 + return _this.$message.error('获取消息类型失败!');
  239 + }
  240 + // 获取列表数据
  241 + _this.message_type = res.data;
  242 + // _this.typeFilterNode(_this.message_type);
  243 + // 关闭加载
  244 + _this.$message.success('获取消息类型成功!');
  245 + _this.loadingStatus = false;
  246 + }).catch(error => {
  247 + // 关闭加载
  248 + _this.$message.error(error.toString());
  249 + _this.loadingStatus = false;
  250 + });
  251 + },
  252 + /**
  253 + * 访问用户服务,绑定用户列表,按组搜索
  254 + */
  255 + getUserInfo(){
  256 + let userResponse = [{
  257 + id: 1,
  258 + username: "zp260",
  259 + des: "测试用户1"
  260 + }, {
  261 + id: 2,
  262 + username: "test04",
  263 + des: "测试用户2"
  264 + },
  265 + {
  266 + id: 3,
  267 + username: "zp2505",
  268 + des: "测试用户3"
  269 + }
  270 + ];
  271 + this.sndr = userResponse;
  272 + this.rcvr = userResponse;
  273 + },
  274 + treeSndrCheckChange(data, checked, indeterminate) {
  275 + if (checked) {
  276 + this.params.sndrs.push(data.username);
  277 + } else {
  278 + this.params.sndrs.splice(this.params.sndrs.contains(data.username), 1);
  279 + }
  280 + },
  281 + treeRcvrCheckChange(data, checked, indeterminate) {
  282 + if (checked) {
  283 + this.params.rcvrs.push(data.username);
  284 + } else {
  285 + this.params.rcvrs.splice(this.params.rcvrs.contains(data.username), 1);
  286 + }
  287 + },
  288 + treeTypeCheckChange(data, checked, indeterminate) {
  289 + let mt = {
  290 + name:'',
  291 + type:0
  292 + };
  293 + mt.name = data.name;
  294 + mt.type = data.type;
  295 + if (checked) {
  296 + this.params.types.push(mt);
  297 + } else {
  298 + this.params.types.splice(this.params.types.contains(mt), 1);
  299 + }
  300 + console.log(this.params.types);
  301 + },
  302 + loadRouter(){
  303 + let _this = this;
  304 + this.loadingStatus = true;
  305 + if(this.params.sndrs.length !== 1){
  306 + this.$confirm('请选择单个发送者', '错误', {
  307 + confirmButtonText: '确定',
  308 + type: 'error',
  309 + center: true
  310 + }).then(() => {
  311 + _this.loadingStatus = false;
  312 + }).catch(() => {
  313 +
  314 + });
  315 + }else{
  316 + let pam = {
  317 + sndr: _this.params.sndrs[0]
  318 + };
  319 + loadRouterBySndr(pam).then(response => {
  320 + let res = response.data;
  321 + if (res.code !== '200') {
  322 + return _this.$message.error('读取用户路由,失败!');
  323 + }
  324 + _this.api_back = res.data;
  325 + _this.loadRouterHandle();
  326 + // 关闭加载
  327 + _this.$message.success('读取用户路由,成功!');
  328 + _this.loadingStatus = false;
  329 + }).catch(
  330 + error => {
  331 + // 关闭加载
  332 + _this.$message.error(error.toString());
  333 + _this.loadingStatus = false;
  334 + }
  335 + )
  336 + }
  337 + },
  338 + loadRouterHandle(){
  339 + if (Array.isArray(this.api_back) && this.api_back.length>0){
  340 + let typeList = [];
  341 + this.api_back.forEach(function(routerItem,index){
  342 + typeList.push({name:routerItem.stype});
  343 + });
  344 + this.typeTreeSet(typeList);
  345 + }
  346 + },
  347 + typeTreeSet(typeList){
  348 + this.$refs.typeTree.setCheckedNodes(typeList);
  349 + },
  350 + batchAddRouter() {
  351 + let _this = this;
  352 + _this.loadingStatus = true;
  353 + api_batchAddRouter(this.params).then(response => {
  354 + let res = response.data;
  355 + if (res.code !== '200') {
  356 + return _this.$message.error('批量添加路由,失败!');
  357 + }
  358 + // 关闭加载
  359 + _this.$message.success('批量添加路由,成功!');
  360 + _this.loadingStatus = false;
  361 + _this.resetPage();
  362 + }).catch(
  363 + error => {
  364 + // 关闭加载
  365 + _this.$message.error(error.toString());
  366 + _this.loadingStatus = false;
  367 + }
  368 + )
  369 + },
  370 + resetPage() {
  371 + this.$refs.sndrTree.setCheckedKeys([]);
  372 + this.$refs.typeTree.setCheckedKeys([]);
  373 + this.$refs.rcvrTree.setCheckedKeys([]);
  374 + }
  375 + },
  376 + mounted() {
  377 + this.getAllType();
  378 + this.getUserInfo();
  379 + }
  380 +
  381 + }
  382 +</script>
  383 +
  384 +<style scoped>
  385 + .bt {
  386 + font-weight: bold;
  387 + background-color: #6F8294;
  388 + color: #ffffff;
  389 + text-align: center
  390 + }
  391 + .el-col {
  392 + margin-right: 0px;
  393 + }
  394 + .el-tree {
  395 + padding-top: 15px;
  396 + border:3px solid #6F8294;
  397 + height: 800px
  398 + }
  399 + .el-row .el-col .el-row {
  400 + margin-top: 0px;
  401 + }
  402 +</style>
  1 +<template>
  2 + <el-container>
  3 + <el-main>
  4 + <el-card style="background-color: #F5F7FA">
  5 + <!-- 搜素区域 -->
  6 + <el-row>
  7 + <el-col :span="6">
  8 + <el-input v-model="umb_queryInfo.sndr"
  9 + size="medium"
  10 + placeholder="帐户名称" clearable>
  11 + <template slot="prepend" ><i class="el-icon-user"></i>帐户名称</template>
  12 + </el-input>
  13 + </el-col>
  14 + <el-col :span="6">
  15 + <el-input v-model="umb_queryInfo.btype"
  16 + size="medium"
  17 + placeholder="消息大类" clearable>
  18 + <template slot="prepend"><i class="el-icon-s-platform"></i>消息大类</template>
  19 + </el-input>
  20 + </el-col>
  21 + <el-col :span="6">
  22 + <el-input v-model="umb_queryInfo.stype"
  23 + size="medium"
  24 + placeholder="消息子类" clearable>
  25 + <template slot="prepend"><i class="el-icon-s-operation"></i>消息子类</template>
  26 + </el-input>
  27 + </el-col>
  28 + <el-col :span="6">
  29 + <el-button type="warning" size="medium" icon="el-icon-search" @click="queryRouterList">
  30 + 查询
  31 + </el-button>
  32 + <el-button type="primary" size="medium" icon="el-icon-plus" @click="dialogFormVisible = true">
  33 + 添加
  34 + </el-button>
  35 + </el-col>
  36 + </el-row>
  37 + <el-row>
  38 + <el-table
  39 + :data="umb_queryData.tableData"
  40 + border
  41 + :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}"
  42 + style="width: 100%">
  43 + <el-table-column
  44 + prop="sndr"
  45 + label="帐户名称"
  46 + >
  47 + </el-table-column>
  48 + <el-table-column
  49 + prop="btype"
  50 + label="消息大类"
  51 + >
  52 + </el-table-column>
  53 + <el-table-column
  54 + prop="stype"
  55 + label="消息子类"
  56 + >
  57 + </el-table-column>
  58 + <el-table-column
  59 + prop="rcvr_topic"
  60 + label="订阅主题"
  61 + >
  62 + <template slot-scope="scope">
  63 + <div v-for="reciver in scope.row.rcvrList">
  64 + {{reciver.rcvrTopic}}<!--,{{reciver.filterList.filter}}-->
  65 + <!-- <div v-for="filters in reciver.filterList">{{filters.filter}}</div>-->
  66 + </div>
  67 + </template>
  68 + </el-table-column>
  69 + <el-table-column
  70 + prop="filter"
  71 + label="过滤规则"
  72 + >
  73 + <template slot-scope="scope">
  74 + <div v-for="reciver in scope.row.rcvrList">
  75 + <!-- {{reciver.rcvrTopic}},{{reciver.filterList.filter}}-->
  76 + <div v-for="filters in reciver.filterList">{{reciver.rcvrTopic}}:[{{filters.filter}}]</div>
  77 + </div>
  78 + </template>
  79 + </el-table-column>
  80 + <el-table-column label="操作" width="145px" align="center" fixed="right">
  81 + <template slot-scope="scope">
  82 + <el-button type="danger" size="mini" @click="delRouter(scope.$index,scope.row)">删除</el-button>
  83 + </template>
  84 + </el-table-column>
  85 + </el-table>
  86 + </el-row>
  87 + <el-row>
  88 + <div class="block">
  89 + <el-pagination
  90 + @size-change="handleSizeChange"
  91 + @current-change="handleCurrentChange"
  92 + :current-page="umb_queryInfo.pageNum"
  93 + :page-sizes="[100, 200, 300, 400]"
  94 + :page-size="umb_queryInfo.pageSize"
  95 + layout="total, sizes, prev, pager, next, jumper"
  96 + :total="umb_queryData.total">
  97 + </el-pagination>
  98 + </div>
  99 + </el-row>
  100 + <el-row>
  101 + <el-dialog title="路由消息添加" :visible.sync="dialogFormVisible">
  102 + <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  103 + <el-form-item label="账户名称" prop="sndr">
  104 + <el-input v-model="ruleForm.sndr"></el-input>
  105 + </el-form-item>
  106 + <el-form-item label="消息大类" prop="btype">
  107 + <el-input v-model="ruleForm.btype"></el-input>
  108 + </el-form-item>
  109 + <el-form-item label="消息子类" prop="stype">
  110 + <el-input v-model="ruleForm.stype"></el-input>
  111 + </el-form-item>
  112 + <el-form-item label="订阅主题">
  113 + <el-input v-model="ruleForm.reciver.rcvrTopic"></el-input>
  114 + </el-form-item>
  115 + <el-form-item label="过滤规则">
  116 + <el-input v-model="ruleForm.reciver.reciverFilter.filter"></el-input>
  117 + </el-form-item>
  118 + </el-form>
  119 + <div slot="footer" class="dialog-footer">
  120 + <el-button @click="dialogFormVisible = false">取 消</el-button>
  121 + <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
  122 + </div>
  123 + </el-dialog>
  124 + </el-row>
  125 + </el-card>
  126 + </el-main>
  127 + </el-container>
  128 +</template>
  129 +<script>
  130 + import {queRouter, deleteRouter, addRouter} from "../../api/message_bus";
  131 + export default {
  132 + data(){
  133 + return{
  134 + dialogFormVisible:false,
  135 + ruleForm:{
  136 + sndr:undefined,
  137 + btype:undefined,
  138 + stype:undefined,
  139 + reciver:{
  140 + rcvrTopic:undefined,
  141 + reciverFilter:{
  142 + filter:undefined
  143 + }
  144 + },
  145 +
  146 +
  147 + },
  148 + rules: {
  149 + sndr: [
  150 + { required: true, message: '请输入账户名称', trigger: 'blur' },
  151 + { min: 3, max: 10, message: '长度在 3 到 10 个字符', trigger: 'blur' }
  152 + ],
  153 + btype: [
  154 + { required: true, message: '请输入消息大类', trigger: 'blur' }
  155 + ],
  156 + stype: [
  157 + { required: true, message: '请输入消息子类', trigger: 'blur' }
  158 + ]
  159 + },
  160 + user_cloud: {
  161 + cloudUserList: [],
  162 + queryInfo: {
  163 + pageNum: 1,
  164 + pageSize: 10000,
  165 + }
  166 + },
  167 + umb_queryInfo: {
  168 + // 用户名称
  169 + sndr: undefined,
  170 + // 消息大类
  171 + btype: undefined,
  172 + // 消息子类
  173 + stype: undefined,
  174 + // 当前页数
  175 + pageNum: 1,
  176 + // 每页条数
  177 + pageSize: 10
  178 +
  179 + },
  180 + umb_queryData: {
  181 + tableData: [],
  182 + total:0
  183 + }
  184 +
  185 + }
  186 + },
  187 + methods: {
  188 + handleSizeChange(val) {
  189 + this.umb_queryInfo.pageSize=val;
  190 + this.queryRouterList();
  191 + },
  192 + handleCurrentChange(val) {
  193 + this.umb_queryInfo.pageNum=val;
  194 + this.queryRouterList();
  195 + },
  196 + queryRouterList(){
  197 + queRouter(this.umb_queryInfo).then((response) => {
  198 + let res = response.data;
  199 + this.umb_queryData.tableData=res.data.list;
  200 + this.umb_queryData.total=res.data.total;
  201 + }).catch(error => {
  202 +
  203 + });
  204 + },
  205 + delRouter(index,row){
  206 + // 弹框询问是否删除?
  207 + this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
  208 + confirmButtonText: '确定删除',
  209 + cancelButtonText: '取消',
  210 + type: 'warning'
  211 + }
  212 + ).then(() => {
  213 + deleteRouter({id:row.id}).then((response) => {
  214 + let res = response.data;
  215 + this.$message.success(res.msg);
  216 + this.queryRouterList();
  217 + }).catch(error => {
  218 + this.$message.error(res.msg);
  219 + });
  220 + }).catch(() => {
  221 + });
  222 + },
  223 + submitForm(formName){
  224 + this.$refs[formName].validate((valid) => {
  225 + if (valid) {
  226 + addRouter(this.ruleForm).then((response) => {
  227 + let res = response.data;
  228 + this.dialogFormVisible=false;
  229 + this.$message.success(res.msg);
  230 + this.queryRouterList();
  231 + }).catch(error => {
  232 + this.$message.error(res.msg);
  233 + });
  234 + } else {
  235 + console.log('error submit!!');
  236 + return false;
  237 + }
  238 + });
  239 + }
  240 + }
  241 + }
  242 +</script>
@@ -49,11 +49,6 @@ @@ -49,11 +49,6 @@
49 <template slot="prepend" ><i class="el-icon-user"></i>路由键名称</template> 49 <template slot="prepend" ><i class="el-icon-user"></i>路由键名称</template>
50 </el-input> 50 </el-input>
51 </el-col> 51 </el-col>
52 - <!-- <el-col :span="4">-->  
53 - <!-- <el-input v-model="umb_queryInfo.subscriber" prefix-icon="el-icon-search"-->  
54 - <!-- size="medium"-->  
55 - <!-- placeholder="订阅者名称" clearable></el-input>-->  
56 - <!-- </el-col>-->  
57 <el-col :span="8"> 52 <el-col :span="8">
58 <el-button type="warning" style="width:150px" size="medium" icon="el-icon-search" @click="umb_getList"> 53 <el-button type="warning" style="width:150px" size="medium" icon="el-icon-search" @click="umb_getList">
59 查询配置信息 54 查询配置信息
@@ -140,20 +135,6 @@ @@ -140,20 +135,6 @@
140 <el-form :inline="true" label-width="120px" status-icon style="margin-top: -30px" align="center" 135 <el-form :inline="true" label-width="120px" status-icon style="margin-top: -30px" align="center"
141 :model="umb_addForm" :rules="umb_addFormRules" ref="umb_addFormRef"> 136 :model="umb_addForm" :rules="umb_addFormRules" ref="umb_addFormRef">
142 137
143 - <!-- <el-form-item label="用户名称:" prop="userIds">-->  
144 - <!-- <el-select v-model="umb_addForm.userIds" prefix-icon="el-icon-search" clearable-->  
145 - <!-- @change="umb_userInfo_addChange"-->  
146 - <!-- style="width:400px" size="medium" filterable multiple-->  
147 - <!-- placeholder="请选择用户">-->  
148 - <!-- <el-option-->  
149 - <!-- v-for="item in (umb_config.userInfoList)"-->  
150 - <!-- :key="item.id"-->  
151 - <!-- :label="item.username"-->  
152 - <!-- :value="item.id">-->  
153 - <!-- </el-option>-->  
154 - <!-- </el-select>-->  
155 - <!-- </el-form-item>-->  
156 -  
157 <el-form-item label="" prop="usernames"> 138 <el-form-item label="" prop="usernames">
158 <el-select v-model="umb_addForm.usernames" prefix-icon="el-icon-search" clearable 139 <el-select v-model="umb_addForm.usernames" prefix-icon="el-icon-search" clearable
159 @change="umb_userInfo_addChange" 140 @change="umb_userInfo_addChange"
@@ -169,12 +150,6 @@ @@ -169,12 +150,6 @@
169 </el-option> 150 </el-option>
170 </el-select> 151 </el-select>
171 </el-form-item> 152 </el-form-item>
172 -  
173 - <!-- <el-form-item label="订阅者名称:" prop="subscriber">-->  
174 - <!-- <el-input v-model="umb_addForm.subscriber" style="width:240px" size="small" clearable-->  
175 - <!-- placeholder="请输入订阅者名称">-->  
176 - <!-- </el-input>-->  
177 - <!-- </el-form-item>-->  
178 <el-form-item label="" prop="serverId"> 153 <el-form-item label="" prop="serverId">
179 <el-select v-model="umb_addForm.serverId" prefix-icon="el-icon-search" clearable 154 <el-select v-model="umb_addForm.serverId" prefix-icon="el-icon-search" clearable
180 style="width:300px" size="medium" filterable 155 style="width:300px" size="medium" filterable