作者 王勇

监控队列与交换机,基本完善

... ... @@ -105,3 +105,12 @@ export const insertUserInfo = params =>{return http.post(`${baseUrl}/user/insert
export const selectUserInfoList = params =>{return http.get(`${baseUrl}/user/list`, params);};
export const deleteUserInfo = params =>{return http.del(`${baseUrl}/user/delete`, params);};
export const deleteUserRelation = params =>{return http.del(`${baseUrl}/user/deleteRelation`, params);};
export const updatePassword = params =>{return http.put(`${baseUrl}/user/updatePassword`, params);};
// 批量删除用户
export const batchDeleteUser = params =>{return http.del(`${baseUrl}/user/batch_delete`, params);};
// 批量删除用户关系
export const batchDeleteUserRelation = params =>{return http.del(`${baseUrl}/user/batch_deleteRelation`, params);};
// 监控队列
export const selectQueueViewList = params =>{return http.get(`${baseUrl}/view/queue/list`, params);};
export const selectExchangeViewList = params =>{return http.get(`${baseUrl}/view/exchange/list`, params);};
... ...
... ... @@ -83,8 +83,9 @@ import RoutingKey from './views/bus/RoutingKey.vue'
import Queue from './views/bus/Queue.vue'
import MessageNote from './views/bus/MessageNote.vue'
import UserMessageBinding from './views/bus/UserMessageBinding.vue'
import UserInfo from "./views/bus/UserInfo.vue";
import UserInfo from "./views/bus/UserInfo.vue"
import QueueView from "./views/bus/view/QueueView.vue"
import ExchangeView from "./views/bus/view/ExchangeView.vue"
let routes = [
... ... @@ -144,6 +145,17 @@ let routes = [
]
},
{
path: '/bus/view',
component: Home,
name: '消息监控中心',
iconCls: 'el-icon-view',
children: [
{path: '/queueView', component: QueueView, name: '队列监控'},
{path: '/exchangeView', component: ExchangeView, name: '交换机监控'},
]
},
// {
// path: '/guestService',
... ...
... ... @@ -14,15 +14,14 @@
placeholder="服务器名称" clearable></el-input>
</el-col>
<el-col :span="4">
<el-input v-model="user_queryInfo.virtualHostName" prefix-icon="el-icon-search"
size="medium"
<el-input v-model="user_queryInfo.virtualHostName" prefix-icon="el-icon-search" size="medium"
placeholder="虚拟主机名称" clearable></el-input>
</el-col>
<el-col :span="8">
<el-button type="success" style="width:150px" size="medium" @click="user_getList">
查询用户信息
</el-button>
<el-button type="primary" style="width:150px" size="medium" @click="user_toAddDialog">
<el-button type="primary" style="width:150px" :loading="user_loading.listLoading" size="medium" @click="user_toAddDialog">
添加用户信息
</el-button>
</el-col>
... ... @@ -35,10 +34,12 @@
element-loading-text="获取用户信息列表,拼命加载中">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="用户名称" prop="username" align="center" width="190"></el-table-column>
<el-table-column label="服务器名称" prop="serverName" align="center" width="190"></el-table-column>
<el-table-column label="用户名称" prop="username" align="center" width="170"></el-table-column>
<el-table-column label="真实姓名" prop="realName" align="center" width="170"></el-table-column>
<el-table-column label="服务器名称" prop="serverName" align="center" width="180"></el-table-column>
<el-table-column label="虚拟主机名称" prop="virtualHostName" align="center" width="300"></el-table-column>
<el-table-column label="操作" width="340px" align="center">
<el-table-column label="操作" width="340px" align="center" fixed="right">
<template slot-scope="scope">
<!-- 删除用户 -->
<el-tooltip effect="dark" content="删除用户" placement="top-start" :enterable="false">
<el-button type="danger" icon="el-icon-delete" size="small"
... ... @@ -47,11 +48,11 @@
</el-button>
</el-tooltip>
<!-- 编辑关系 -->
<el-tooltip effect="dark" content="编辑关系" placement="top-start" :enterable="false">
<el-button type="primary" icon="el-icon-edit" size="small"
@click="user_toEditDialog(scope.$index,scope.row)">编辑关系
</el-button>
</el-tooltip>
<!-- <el-tooltip effect="dark" content="编辑关系" placement="top-start" :enterable="false">-->
<!-- <el-button type="primary" icon="el-icon-edit" size="small"-->
<!-- @click="user_toEditDialog(scope.$index,scope.row)">编辑关系-->
<!-- </el-button>-->
<!-- </el-tooltip>-->
<!-- 删除关系 -->
<el-tooltip effect="dark" content="删除关系" placement="top-start" :enterable="false">
<el-button type="danger" icon="el-icon-edit" size="small"
... ... @@ -59,18 +60,23 @@
</el-button>
</el-tooltip>
<!-- 修改密码 -->
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页区域 -->
<div style="margin-top: 10px">
<el-row :gutter="24">
<el-col :span="5">
<el-col :span="8">
<el-button type="danger" icon="el-icon-delete"
:loading="user_loading.batchDelLoading"
:disabled="this.user_page.selectList.length===0"
@click="user_batchRemove">批量删除
@click="user_batchRemove">批量删除用户
</el-button>
<el-button type="danger" icon="el-icon-delete"
:loading="user_loading.batchDelLoading"
:disabled="this.user_page.selectList.length===0"
@click="user_batchRemoveRelation">批量删除用户关系
</el-button>
</el-col>
<el-col :span="10" style="margin-top: 5px">
... ... @@ -92,25 +98,33 @@
<div>
<el-dialog title="添加MQ用户信息"
:visible.sync="user_dialog.addDialog"
v-loading="user_loading.addLoading" element-loading-text="正在添加MQ用户,拼命加载中"
style="margin-top: -20px"
width="50%" text-align="center" @close="user_addDialogClosed">
<el-form :inline="true" label-width="145px" status-icon style="margin-top: -10px"
:model="user_addForm" :rules="user_addFormRules" ref="user_addFormRef" align="center">
<el-form-item label="用户名称:" prop="exchangeName">
<el-form-item label="用户名称:" prop="username">
<el-input v-model="user_addForm.username" style="width:270px" size="small" clearable
placeholder="请输入用户名称">
</el-input>
</el-form-item>
<el-form-item label="用户密码:" prop="firstPassword">
<el-input type="password" v-model="user_addForm.firstPassword" style="width:270px"
size="small" clearable show-password placeholder="请输入用户密码"></el-input>
</el-form-item>
<el-form-item label="重新输入密码:" prop="password">
<el-input type="password" v-model="user_addForm.password" style="width:270px"
size="small" clearable show-password placeholder="请重新输入密码"></el-input>
</el-form-item>
<el-form-item label="真实姓名:" prop="realName">
<el-input v-model="user_addForm.realName" style="width:270px" size="small" clearable
placeholder="请输入真实姓名">
</el-input>
</el-form-item>
<br/>
<el-form-item label="选择关系:">
<el-form-item label="选择用户关系:">
<br/>
<el-tree style="width:270px"
:data="user_config.tree.server_hostList"
... ... @@ -131,26 +145,113 @@
</div>
</el-dialog>
</div>
<!-- 编辑,对话框区域 -->
<div>
<el-dialog title="编辑MQ用户关系"
:visible.sync="user_dialog.editDialog"
style="margin-top: -20px"
width="50%" text-align="center" @close="user_editDialogClosed">
<el-form :inline="true" label-width="145px" status-icon style="margin-top: -10px"
:model="user_editForm" :rules="user_editFormRules" ref="user_editFormRef" align="center">
<el-form-item label="用户名称:" prop="username">
<el-input v-model="user_editForm.username" style="width:300px" size="small" clearable readonly
placeholder="请输入用户名称"></el-input>
</el-form-item>
<el-form-item label="服务器名称:" prop="serverName">
<el-input v-model="user_editForm.serverName" style="width:300px" size="small" clearable readonly
placeholder="请输入服务器名称"></el-input>
</el-form-item>
<br/>
<el-form-item label="现有用户关系:" prop="virtualHostIds">
<el-select v-model="user_editForm.virtualHostIds" prefix-icon="el-icon-search" clearable
style="width:300px" size="small" filterable multiple disabled
@change="user_editChange"
placeholder="选择用户关系">
<el-option
v-for="item in (user_config.virtualHostList)"
:key="item.id"
:label="item.virtualHostName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<br/>
<el-form-item label="选择用户关系:" prop="virtualHostId">
<el-select v-model="user_editForm.virtualHostId" prefix-icon="el-icon-search" clearable
style="width:300px" size="small" filterable multiple
@change="user_editChange"
placeholder="选择用户关系">
<el-option
v-for="item in (user_config.virtualHostList)"
:key="item.id"
:label="item.virtualHostName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<br/>
<el-form-item label="选择用户关系:">
<br/>
<el-tree style="width:270px"
@check-change="user_editTreeChange"
:data="user_config.tree.edit_serverHostList"
:props="user_config.tree.defaultParams"
ref="tree_edit"
node-key="id"
:default-checked-keys='user_editForm.aliasName'
show-checkbox highlight-current default-expand-all>
</el-tree>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center;margin-top: -20px">
<el-button type="info" @click="user_dialog.editDialog = false" size="medium"
style="width: 100px">取消
</el-button>
<el-button type="primary" @click="user_edit" :loading="user_loading.editLoading"
size="medium" style="width: 100px">编辑关系
</el-button>
</div>
</el-dialog>
</div>
</el-container>
</template>
<script>
import {
getServerAndHostList,
selectUserInfoList
selectUserInfoList,
insertUserInfo,
deleteUserInfo,
deleteUserRelation,
getHostList,
batchDeleteUser,
batchDeleteUserRelation
} from "../../api/message_bus";
export default {
name: "UserInfo",
data() {
const validatePassword = (rule, value, callback) => {
if (value === '') {
callback(new Error('请重新输入密码'));
} else if (value !== this.user_addForm.firstPassword) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
/**
* user,配置与参数
*/
user_config: {
virtualHostList: [],
tree: {
treeList: [],
edit_serverHostList: [],
// 服务器及虚拟主机列表
server_hostList: [],
defaultParams: {
... ... @@ -191,7 +292,13 @@
/**
* user,新增表单
*/
user_addForm: {},
user_addForm: {
username: '',
realName: '',
firstPassword: '',
password: '',
virtualHostId: '',
},
/**
* user,编辑表单
... ... @@ -211,7 +318,21 @@
/**
* user,添加表单,验证规则
*/
user_addFormRules: {},
user_addFormRules: {
realName: [
{required: true, message: '请输入真实姓名', trigger: ['blur', 'change']},
],
username: [
{required: true, message: '请输入用户名称', trigger: ['blur', 'change']},
],
firstPassword: [
{required: true, message: '请输入用户密码', trigger: ['blur', 'change']},
],
password: [
{required: true, message: '请再次输入密码', trigger: ['blur', 'change']},
{validator: validatePassword, trigger: ['blur', 'change']}
],
},
/**
* user,编辑表单,验证规则
*/
... ... @@ -281,7 +402,7 @@
* user,添加对话框,打开事件
*/
user_toAddDialog() {
this.selectServerAndHostList();
// this.selectServerAndHostList();
this.user_dialog.addDialog = true;
},
/**
... ... @@ -296,15 +417,67 @@
* user,添加功能
*/
user_add() {
console.log(this.$refs.tree.getCheckedKeys());
this.user_addForm.virtualHostId = this.$refs.tree.getCheckedKeys().join();
if (this.user_addForm.virtualHostId === '') {
return this.$confirm('用户关系不能为空,请务必选择用户关系', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
}
this.$refs.user_addFormRef.validate(valid => {
// 未通过,表单预校验
if (!valid) return;
this.user_loading.addLoading = true;
insertUserInfo(this.user_addForm).then((response) => {
let res = response.data;
// 添加失败
if (res.code !== '200') {
if (res.code === '201') {
this.user_loading.addLoading = false;
return this.$confirm(res.msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
}
// 关闭加载
this.user_loading.addLoading = false;
this.$message.error(res.msg);
}
// 添加,成功
this.$message.success(res.msg);
// 关闭加载
this.user_loading.addLoading = false;
// 隐藏对话框
this.user_dialog.addDialog = false;
// 刷新列表
this.user_getList();
}).catch(error => {
this.user_loading.addLoading = false;
this.$message.error(error.toString());
});
})
},
/**
* user,编辑对话框,打开事件
*/
user_toEditDialog(index, row) {
this.user_dialog.editDialog = true;
this.selectHostList(row.serverId);
this.selectEditServerAndHostList(row.serverName)
this.user_editForm = Object.assign({}, row);
this.user_editForm.virtualHostIds = [];
if (this.user_editForm.virtualHostId.indexOf(",") === -1) {
// 队列id中不包含","
this.user_editForm.virtualHostIds[0] = this.user_editForm.virtualHostId;
} else {
this.user_editForm.virtualHostIds = this.user_editForm.virtualHostId.split(",")
}
this.user_dialog.editDialog = true;
},
/**
... ... @@ -316,24 +489,93 @@
},
/**
* user,编辑对话框,改变
*/
user_editChange(value) {
},
/**
* user,编辑对话框中的tree组件,改变
*/
user_editTreeChange(value) {
this.user_editForm.virtualHostId = this.$refs.tree_edit.getCheckedKeys().join();
console.log(this.user_editForm.virtualHostId)
},
/**
* user,编辑功能
*/
user_edit() {
this.user_addForm.virtualHostId = this.$refs.tree.getCheckedKeys().join();
},
/**
* user,删除功能
*/
user_remove(index, row) {
// 弹框询问是否删除?
this.$confirm('此操作永久删除该用户信息, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
// 开启加载
this.user_loading.delLoading = true;
deleteUserInfo(row).then((response) => {
let res = response.data;
if (res.code !== '200') {
// 关闭加载
this.user_loading.delLoading = false;
return this.$message.error(res.msg);
}
// 关闭加载
this.user_loading.delLoading = false;
this.$message.success(res.msg);
// 刷新列表
this.user_getList();
}).catch(error => {
// 关闭加载
this.user_loading.delLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
/**
* user,删除用户关系
*/
user_removeRelation(index, row) {
// 弹框询问是否删除?
this.$confirm('此操作永久删除该用户信息, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
// 开启加载
this.user_loading.delLoading = true;
deleteUserRelation(row).then((response) => {
let res = response.data;
if (res.code !== '200') {
// 关闭加载
this.user_loading.delLoading = false;
return this.$message.error(res.msg);
}
// 关闭加载
this.user_loading.delLoading = false;
this.$message.success(res.msg);
// 刷新列表
this.user_getList();
}).catch(error => {
// 关闭加载
this.user_loading.delLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
/**
... ... @@ -344,15 +586,94 @@
},
/**
* user,批量删除功能
* user,批量删除用户
*/
user_batchRemove() {
const usernames = this.user_page.selectList.map(item => item.username).toString().split(",");
const serverNames = this.user_page.selectList.map(item => item.serverName).toString().split(",");
const params = [];
if (usernames.length === serverNames.length) {
for (let i = 0; i < usernames.length; i++) {
let param = {
username: usernames[i],
serverName: serverNames[i],
}
console.log(param)
params.push(param)
}
} else {
return this.$message.error("批量删除用户失败,请仔细检查");
}
console.log(params)
this.$confirm('此操作永久删除该用户, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
// 开启加载
this.user_loading.listLoading = true;
batchDeleteUser(params).then((response) => {
let res = response.data;
if (res.code !== '200') {
// 关闭加载
this.user_loading.listLoading = false;
return this.$message.error(res.msg);
}
// 关闭加载
this.user_loading.listLoading = false;
this.$message.success(res.msg);
// 刷新列表
this.user_getList();
}).catch(error => {
// 关闭加载
this.user_loading.listLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
/**
* user,批量删除用户关系功能
*/
user_batchRemoveRelation() {
const ids = this.user_page.selectList.map(item => item.id).toString();
console.log(ids)
const param = {
id: ids,
}
this.$confirm('此操作永久删除该用户关系, 是否继续?', '警告', {
confirmButtonText: '确定删除',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
// 开启加载
this.user_loading.listLoading = true;
batchDeleteUserRelation(param).then((response) => {
let res = response.data;
if (res.code !== '200') {
// 关闭加载
this.user_loading.listLoading = false;
return this.$message.error(res.msg);
}
// 关闭加载
this.user_loading.listLoading = false;
this.$message.success(res.msg);
// 刷新列表
this.user_getList();
}).catch(error => {
// 关闭加载
this.user_loading.listLoading = false;
this.$message.error(error.toString());
});
}).catch(() => {
});
},
/**
* 服务器与虚拟主机 1:n
* 获取列表
* MQ服务器与虚拟主机(1:n)的列表
*/
selectServerAndHostList() {
getServerAndHostList().then((response) => {
... ... @@ -366,10 +687,44 @@
this.$message.error(error.toString());
});
},
/**
* 编辑列表的MQ服务器与虚拟主机(1:n)的列表
*/
selectEditServerAndHostList(serverName) {
const param = {serverName: serverName};
getServerAndHostList(param).then((response) => {
let res = response.data;
if (res.code !== '200') {
return this.$message.error('获取服务器与虚拟主机信息,失败!');
}
// 获取列表数据
this.user_config.tree.edit_serverHostList = res.data;
}).catch(error => {
this.$message.error(error.toString());
});
},
/**
* 获取虚拟主机列表
*/
selectHostList(serverId) {
let params = {serverId: serverId};
getHostList(params).then((response) => {
let res = response.data;
if (res.code !== '200') {
return this.$message.error('获取虚拟主机列表,失败!');
}
this.user_config.virtualHostList = res.data;
}).catch(error => {
this.$message.error(error.toString());
});
},
},
created() {
},
mounted() {
this.selectServerAndHostList();
},
computed: {},
}
... ...
<template>
<el-container>
<el-main>
<el-card style="background-color: #F5F7FA">
<!-- 搜素区域 -->
<div>
<el-row>
<el-col :span="4">
<el-input v-model="eView_queryInfo.serverName" prefix-icon="el-icon-search" size="medium"
placeholder="服务器名称" clearable></el-input>
</el-col>
<el-col :span="4">
<el-input v-model="eView_queryInfo.virtualHostName" prefix-icon="el-icon-search" size="medium"
placeholder="虚拟主机名称" clearable></el-input>
</el-col>
<el-col :span="8">
<el-button type="success" style="width:150px" size="medium" @click="getExchangeViewList">
交换机监控
</el-button>
</el-col>
</el-row>
</div>
<!-- 列表区域 -->
<div style="margin-top: 20px;">
<el-table :data="eView_page.exchangeViewList" border size="small"
v-loading="eView_loading.listLoading" element-loading-text="获取交换机监控信息,拼命加载中">
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="服务器名称" prop="serverName" align="center" width="150"></el-table-column>
<el-table-column label="虚拟主机名称" prop="tempExchangeInfo.vhost" align="center" width="150"></el-table-column>
<el-table-column label="交换机名称" prop="tempExchangeInfo.name" align="center" width="150"></el-table-column>
<el-table-column label="进入数量" prop="tempExchangeInfo.message_stats.publish_in" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.tempExchangeInfo.message_stats ===null">0</span>
<span v-if="scope.row.tempExchangeInfo.message_stats !==null" style="color: #eb2f06">
{{scope.row.tempExchangeInfo.message_stats.publish_in}}
</span>
</template>
</el-table-column>
<el-table-column label="进入速率" prop="tempExchangeInfo.message_stats.publish_in_details.rate" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.tempExchangeInfo.message_stats ===null">0</span>
<span v-if="scope.row.tempExchangeInfo.message_stats !==null &&
scope.row.tempExchangeInfo.message_stats.publish_in_details !==null" style="color: #0984e3">
{{scope.row.tempExchangeInfo.message_stats.publish_in_details.rate}}
</span>
</template>
</el-table-column>
<el-table-column label="交换数量" prop="tempExchangeInfo.message_stats.publish_out" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.tempExchangeInfo.message_stats ===null">0</span>
<span v-if="scope.row.tempExchangeInfo.message_stats !==null" style="color: #eb2f06">
{{scope.row.tempExchangeInfo.message_stats.publish_out}}
</span>
</template>
</el-table-column>
<el-table-column label="交换速率" prop="tempExchangeInfo.message_stats.publish_out_details.rate" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.tempExchangeInfo.message_stats ===null">0</span>
<span v-if="scope.row.tempExchangeInfo.message_stats !==null &&
scope.row.tempExchangeInfo.message_stats.publish_out_details !==null" style="color: #0984e3">
{{scope.row.tempExchangeInfo.message_stats.publish_out_details.rate}}
</span>
</template>
</el-table-column>
<el-table-column label="类型" prop="tempExchangeInfo.type" align="center" width="100"></el-table-column>
<el-table-column label="持久化" prop="tempExchangeInfo.durable" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.tempExchangeInfo.durable ===false">否</span>
<span v-if="scope.row.tempExchangeInfo.durable ===true">是</span>
</template>
</el-table-column>
<el-table-column label="自动删除" prop="tempExchangeInfo.auto_delete" align="center" width="100">
<template slot-scope="scope">
<span v-if="scope.row.tempExchangeInfo.auto_delete ===false">否</span>
<span v-if="scope.row.tempExchangeInfo.auto_delete ===true">是</span>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页区域 -->
<div style="margin-top: 10px">
<el-row :gutter="24">
<el-col :span="6" style="margin-top: 5px"></el-col>
<el-col :span="10" style="margin-top: 5px">
<el-pagination
@size-change="eView_handleSizeChange"
@current-change="eView_handleCurrentChange"
:current-page="eView_queryInfo.pageNum"
:page-sizes="[10,50,100,500]"
:page-size="eView_queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="eView_page.total">
</el-pagination>
</el-col>
</el-row>
</div>
</el-card>
</el-main>
</el-container>
</template>
<script>
import {selectExchangeViewList} from "../../../api/message_bus";
export default {
name: "ExchangeView",
data() {
return {
eView_queryInfo: {
serverName: '',
virtualHostName: '',
pageNum: 1,
pageSize: 10
},
eView_page: {
exchangeViewList: [],
total: 0,
},
eView_loading: {
listLoading: false,
},
/**
* Boolean属性,选择列表
*/
booleanList: [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
},
],
}
},
methods: {
/**
* 分页查询,监听 pageSize 改变的事件
*/
eView_handleSizeChange(newSize) {
this.eView_queryInfo.pageSize = newSize;
this.getExchangeViewList();
},
/**
* 分页查询,监听 pageNum 改变的事件
*/
eView_handleCurrentChange(newPage) {
this.eView_queryInfo.pageNum = newPage;
this.getExchangeViewList();
},
getExchangeViewList() {
this.eView_loading.listLoading = true;
selectExchangeViewList(this.eView_queryInfo).then((response) => {
let res = response.data;
if (res.code !== '200') {
this.eView_loading.listLoading = false;
return this.$message.error(res.msg);
}
this.eView_page.exchangeViewList = res.data;
console.log(this.eView_page.exchangeViewList)
this.eView_page.total = res.total;
this.eView_loading.listLoading = false;
}).catch(error => {
this.eView_loading.listLoading = false;
this.$message.error(error.toString());
});
}
},
created() {
},
mounted() {
this.timer = setInterval(this.getExchangeViewList, 5000);
},
beforeDestroy() {
clearInterval(this.timer);
},
computed: {},
}
</script>
<style scoped>
</style>
\ No newline at end of file
... ...
<template>
<el-container>
<el-main>
<el-card style="background-color: #F5F7FA">
<!-- 搜素区域 -->
<div>
<el-row>
<el-col :span="4">
<el-input v-model="queueView_queryInfo.serverName" prefix-icon="el-icon-search" size="medium"
placeholder="服务器名称" clearable></el-input>
</el-col>
<el-col :span="4">
<el-input v-model="queueView_queryInfo.virtualHostName" prefix-icon="el-icon-search" size="medium"
placeholder="虚拟主机名称" clearable></el-input>
</el-col>
<el-col :span="8">
<el-button type="success" style="width:150px" size="medium" @click="getQueueViewList">
队列监控
</el-button>
</el-col>
</el-row>
</div>
<!-- 列表区域 -->
<div style="margin-top: 20px;">
<el-table :data="queueView_page.queueViewList" border size="small"
v-loading="queueView_loading.listLoading" element-loading-text="获取队列监控信息,拼命加载中">
<el-table-column type="index" align="center"></el-table-column>
<el-table-column label="服务器名称" prop="serverName" align="center" width="150"></el-table-column>
<el-table-column label="虚拟主机名称" prop="queueInfo.vhost" align="center" width="150"></el-table-column>
<el-table-column label="队列名称" prop="queueInfo.name" align="center" width="230">
</el-table-column>
<el-table-column label="积压消息" prop="queueInfo.messages_ready" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.queueInfo.messages_ready !== null" style="color: #eb2f06">
{{scope.row.queueInfo.messages_ready}}
</span>
</template>
</el-table-column>
<el-table-column label="消息总数" prop="queueInfo.messages" align="center" width="120"></el-table-column>
<el-table-column label="持久化" prop="queueInfo.durable" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.queueInfo.durable ===false">否</span>
<span v-if="scope.row.queueInfo.durable ===true">是</span>
</template>
</el-table-column>
<el-table-column label="自动删除" prop="queueInfo.auto_delete" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.queueInfo.auto_delete ===false">否</span>
<span v-if="scope.row.queueInfo.auto_delete ===true">是</span>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页区域 -->
<div style="margin-top: 10px">
<el-row :gutter="24">
<el-col :span="6" style="margin-top: 5px"></el-col>
<el-col :span="10" style="margin-top: 5px">
<el-pagination
@size-change="queueView_handleSizeChange"
@current-change="queueView_handleCurrentChange"
:current-page="queueView_queryInfo.pageNum"
:page-sizes="[10,50,100,500]"
:page-size="queueView_queryInfo.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="queueView_page.total">
</el-pagination>
</el-col>
</el-row>
</div>
</el-card>
</el-main>
</el-container>
</template>
<script>
import {selectQueueViewList} from "../../../api/message_bus";
export default {
name: "QueueView",
data() {
return {
queueView_queryInfo: {
serverName: '',
virtualHostName: '',
pageNum: 1,
pageSize: 10
},
queueView_page: {
queueViewList: [],
total: 0,
},
queueView_loading: {
listLoading: false,
},
/**
* Boolean属性,选择列表
*/
booleanList: [
{
value: true,
label: '是'
},
{
value: false,
label: '否'
},
],
}
},
methods: {
/**
* 分页查询,监听 pageSize 改变的事件
*/
queueView_handleSizeChange(newSize) {
this.queueView_queryInfo.pageSize = newSize;
this.getQueueViewList();
},
/**
* 分页查询,监听 pageNum 改变的事件
*/
queueView_handleCurrentChange(newPage) {
this.queueView_queryInfo.pageNum = newPage;
this.getQueueViewList();
},
getQueueViewList() {
this.queueView_loading.listLoading = true;
selectQueueViewList(this.queueView_queryInfo).then((response) => {
let res = response.data;
if (res.code !== '200') {
this.queueView_loading.listLoading = false;
return this.$message.error(res.msg);
}
this.queueView_page.queueViewList = res.data;
this.queueView_page.total = res.total;
this.queueView_loading.listLoading = false;
}).catch(error => {
this.queueView_loading.listLoading = false;
this.$message.error(error.toString());
});
}
},
created() {
},
mounted() {
this.timer = setInterval(this.getQueueViewList, 5000);
},
beforeDestroy() {
clearInterval(this.timer);
},
computed: {},
}
</script>
<style scoped>
.demo-table-expand {
font-size: 0;
}
.demo-table-expand label {
width: 90px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 50%;
}
</style>
\ No newline at end of file
... ...