ExchangeView.vue
9.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<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>