正在显示
3 个修改的文件
包含
618 行增加
和
1 行删除
@@ -114,3 +114,9 @@ export const batchDeleteUserRelation = params =>{return http.del(`${baseUrl}/use | @@ -114,3 +114,9 @@ export const batchDeleteUserRelation = params =>{return http.del(`${baseUrl}/use | ||
114 | // 监控队列 | 114 | // 监控队列 |
115 | export const selectQueueViewList = params =>{return http.get(`${baseUrl}/view/queue/list`, params);}; | 115 | export const selectQueueViewList = params =>{return http.get(`${baseUrl}/view/queue/list`, params);}; |
116 | export const selectExchangeViewList = params =>{return http.get(`${baseUrl}/view/exchange/list`, params);}; | 116 | export const selectExchangeViewList = params =>{return http.get(`${baseUrl}/view/exchange/list`, params);}; |
117 | + | ||
118 | +export const selectElasticSearchList = params =>{return http.get(`${baseUrl}/es/page`, params);}; | ||
119 | +export const insertElasticSearchInfo = params =>{return http.post(`${baseUrl}/es/insert`, params);}; | ||
120 | +export const updateElasticSearchInfo = params =>{return http.put(`${baseUrl}/es/update`, params);}; | ||
121 | +export const deleteElasticSearchInfo = params =>{return http.del(`${baseUrl}/es/delete`, params);}; | ||
122 | +export const batchRemoveElasticSearchInfo = params =>{return http.del(`${baseUrl}/es/batchRemove`, params);}; |
@@ -86,7 +86,7 @@ import UserMessageBinding from './views/bus/UserMessageBinding.vue' | @@ -86,7 +86,7 @@ import UserMessageBinding from './views/bus/UserMessageBinding.vue' | ||
86 | import UserInfo from "./views/bus/UserInfo.vue" | 86 | 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 | - | 89 | +import ElasticSearchInfo from "./views/bus/ElasticSearchInfo.vue" |
90 | 90 | ||
91 | let routes = [ | 91 | let routes = [ |
92 | { | 92 | { |
@@ -142,6 +142,7 @@ let routes = [ | @@ -142,6 +142,7 @@ let routes = [ | ||
142 | {path: '/routing', component: RoutingKey, name: '路由键管理'}, | 142 | {path: '/routing', component: RoutingKey, name: '路由键管理'}, |
143 | {path: '/umb', component: UserMessageBinding, name: '配置管理'}, | 143 | {path: '/umb', component: UserMessageBinding, name: '配置管理'}, |
144 | {path: '/note', component: MessageNote, name: '消息记录管理'}, | 144 | {path: '/note', component: MessageNote, name: '消息记录管理'}, |
145 | + {path: '/es', component: ElasticSearchInfo, name: 'ES信息管理'}, | ||
145 | ] | 146 | ] |
146 | }, | 147 | }, |
147 | 148 |
src/views/bus/ElasticSearchInfo.vue
0 → 100644
1 | +<template> | ||
2 | + <el-container> | ||
3 | + <el-main> | ||
4 | + <el-card style="background-color: #F5F7FA"> | ||
5 | + <!-- 搜素区域 --> | ||
6 | + <div> | ||
7 | + <el-row> | ||
8 | + <el-col :span="4"> | ||
9 | + <el-input v-model="es_queryInfo.clusterName" prefix-icon="el-icon-search" size="small" | ||
10 | + placeholder="集群名称" clearable></el-input> | ||
11 | + </el-col> | ||
12 | + <el-col :span="4"> | ||
13 | + <el-input v-model="es_queryInfo.elasticsearchName" prefix-icon="el-icon-search" size="small" | ||
14 | + placeholder="节点(ES)名称" clearable></el-input> | ||
15 | + </el-col> | ||
16 | + </el-row> | ||
17 | + <el-row> | ||
18 | + <el-col :span="8"> | ||
19 | + <el-button type="success" style="width:150px" size="medium" @click="es_getList"> | ||
20 | + 查询ES信息 | ||
21 | + </el-button> | ||
22 | + <el-button type="primary" style="width:150px" size="medium" @click="es_toAddDialog"> | ||
23 | + 添加ES信息 | ||
24 | + </el-button> | ||
25 | + </el-col> | ||
26 | + </el-row> | ||
27 | + </div> | ||
28 | + <!-- 列表区域 --> | ||
29 | + <div style="margin-top: 20px;"> | ||
30 | + <el-table :data="es_page.esList" border v-loading="es_loading.listLoading" | ||
31 | + @selection-change="es_selectChange" size="small" | ||
32 | + element-loading-text="获取信息,拼命加载中"> | ||
33 | + <el-table-column type="selection" width="55" align="center"></el-table-column> | ||
34 | + <el-table-column type="index" align="center"></el-table-column> | ||
35 | + <el-table-column label="集群名称" prop="clusterName" align="center" width="200"></el-table-column> | ||
36 | + <el-table-column label="节点名称" prop="elasticsearchName" align="center" width="150"></el-table-column> | ||
37 | + <el-table-column label="协议" prop="scheme" align="center" width="100"></el-table-column> | ||
38 | + <el-table-column label="IP地址" prop="hostname" align="center" width="140"></el-table-column> | ||
39 | + <el-table-column label="端口号" prop="port" align="center" width="100"></el-table-column> | ||
40 | + <el-table-column label="状态" prop="elasticsearchState" align="center" width="100"> | ||
41 | + <template slot-scope="scope"> | ||
42 | + <span v-if="scope.row.elasticsearchState ===true" style="color: #32ff7e"> | ||
43 | + 运行状态 | ||
44 | + </span> | ||
45 | + <span v-if="scope.row.elasticsearchState ===false" style="color: #eb2f06"> | ||
46 | + 宕机状态 | ||
47 | + </span> | ||
48 | + </template> | ||
49 | + </el-table-column> | ||
50 | + <el-table-column label="描述" prop="description" align="center" width="100"></el-table-column> | ||
51 | + <el-table-column label="操作" width="225px" align="center" fixed="right"> | ||
52 | + <template slot-scope="scope"> | ||
53 | + <!-- 编辑按钮--> | ||
54 | + <el-tooltip effect="dark" content="编辑" placement="top-start" :enterable="false"> | ||
55 | + <el-button type="primary" icon="el-icon-edit" size="mini" | ||
56 | + @click="es_toEditDialog(scope.$index,scope.row)">编辑 | ||
57 | + </el-button> | ||
58 | + </el-tooltip> | ||
59 | + | ||
60 | + <!-- 删除按钮--> | ||
61 | + <el-tooltip effect="dark" content="删除" placement="top-start" :enterable="false"> | ||
62 | + <el-button type="danger" icon="el-icon-delete" size="mini" | ||
63 | + :loading="es_loading.delLoading" | ||
64 | + @click="es_remove(scope.$index,scope.row)">删除 | ||
65 | + </el-button> | ||
66 | + </el-tooltip> | ||
67 | + </template> | ||
68 | + </el-table-column> | ||
69 | + </el-table> | ||
70 | + </div> | ||
71 | + <!--分页区域--> | ||
72 | + <div style="margin-top: 10px"> | ||
73 | + <el-row :gutter="24"> | ||
74 | + <el-col :span="5"> | ||
75 | + <el-button type="danger" icon="el-icon-delete" | ||
76 | + :loading="es_loading.listLoading" | ||
77 | + :disabled="this.es_page.selectList.length===0" | ||
78 | + @click="es_batchRemove">批量删除 | ||
79 | + </el-button> | ||
80 | + </el-col> | ||
81 | + <el-col :span="10" style="margin-top: 5px"> | ||
82 | + <el-pagination | ||
83 | + @size-change="es_handleSizeChange" | ||
84 | + @current-change="es_handleCurrentChange" | ||
85 | + :current-page="es_queryInfo.pageNum" | ||
86 | + :page-size="es_queryInfo.pageSize" | ||
87 | + :page-sizes="[10,20,30,50]" | ||
88 | + layout="total, sizes, prev, pager, next, jumper" | ||
89 | + :total="es_page.total"> | ||
90 | + </el-pagination> | ||
91 | + </el-col> | ||
92 | + </el-row> | ||
93 | + </div> | ||
94 | + </el-card> | ||
95 | + </el-main> | ||
96 | + | ||
97 | + <!-- 添加,对话框 --> | ||
98 | + <div> | ||
99 | + <el-dialog title="添加ES节点" | ||
100 | + :visible.sync="es_dialog.addDialog" element-loading-text="拼命添加配置中" | ||
101 | + style="margin-top: -50px" text-align="center" width="50%" | ||
102 | + @close="es_addDialogClosed"> | ||
103 | + <el-form :inline="true" label-width="130px" status-icon style="margin-top: -10px" align="center" | ||
104 | + :model="es_addForm" :rules="es_addFormRules" ref="es_addFormRef"> | ||
105 | + <el-form-item label="集群名称:" prop="clusterName"> | ||
106 | + <el-input v-model="es_addForm.clusterName" style="width:280px" size="small" clearable | ||
107 | + placeholder="请输入集群名称"> | ||
108 | + </el-input> | ||
109 | + </el-form-item> | ||
110 | + <el-form-item label="节点名称:" prop="elasticsearchName"> | ||
111 | + <el-input v-model="es_addForm.elasticsearchName" style="width:280px" size="small" clearable | ||
112 | + placeholder="请输入ES(节点)名称"> | ||
113 | + </el-input> | ||
114 | + </el-form-item> | ||
115 | + <el-form-item label="协议:" prop="scheme"> | ||
116 | + <el-input v-model="es_addForm.scheme" style="width:280px" size="small" clearable readonly | ||
117 | + placeholder="请输入协议名称:http"> | ||
118 | + </el-input> | ||
119 | + </el-form-item> | ||
120 | + <el-form-item label="IP地址:" prop="hostname"> | ||
121 | + <el-input v-model="es_addForm.hostname" style="width:280px" size="small" clearable | ||
122 | + placeholder="请输入IP地址"> | ||
123 | + </el-input> | ||
124 | + </el-form-item> | ||
125 | + <el-form-item label="端口号:" prop="port"> | ||
126 | + <el-input v-model="es_addForm.port" style="width:280px" size="small" clearable | ||
127 | + placeholder="请输入端口号"> | ||
128 | + </el-input> | ||
129 | + </el-form-item> | ||
130 | + <el-form-item label="默认节点类型:" prop="isMaster"> | ||
131 | + <el-select v-model="es_addForm.isMaster" style="width: 280px" clearable | ||
132 | + size="small" placeholder="请选择默认节点类型?"> | ||
133 | + <el-option | ||
134 | + v-for="item in isMasterList" | ||
135 | + :key="item.value" | ||
136 | + :label="item.label" | ||
137 | + :value="item.value"> | ||
138 | + </el-option> | ||
139 | + </el-select> | ||
140 | + </el-form-item> | ||
141 | + <el-form-item label="相关描述:" prop="description"> | ||
142 | + <el-input v-model="es_addForm.description" style="width:280px" size="small" clearable | ||
143 | + placeholder="请输入相关描述"> | ||
144 | + </el-input> | ||
145 | + </el-form-item> | ||
146 | + </el-form> | ||
147 | + <div slot="footer" class="dialog-footer" style="text-align: center;margin-top: -20px"> | ||
148 | + <el-button type="info" @click="es_dialog.addDialog = false" size="medium" style="width: 100px"> | ||
149 | + 取消 | ||
150 | + </el-button> | ||
151 | + <el-button type="success" @click="es_add_test" size="medium" style="width: 100px"> | ||
152 | + 测试连接 | ||
153 | + </el-button> | ||
154 | + <el-button type="primary" @click="es_add" :loading="es_loading.addLoading" size="medium" style="width: 100px"> | ||
155 | + 添加 | ||
156 | + </el-button> | ||
157 | + </div> | ||
158 | + </el-dialog> | ||
159 | + </div> | ||
160 | + <!-- 编辑,对话框 --> | ||
161 | + <div> | ||
162 | + <el-dialog title="编辑ES信息" | ||
163 | + :visible.sync="es_dialog.editDialog" element-loading-text="拼命添加配置中" | ||
164 | + style="margin-top: -50px" text-align="center" width="50%" | ||
165 | + @close="es_editDialogClosed"> | ||
166 | + <el-form :inline="true" label-width="130px" status-icon style="margin-top: -10px" align="center" | ||
167 | + :model="es_editForm" :rules="es_editFormRules" ref="es_editFormRef"> | ||
168 | + <el-form-item label="集群名称:" prop="clusterName"> | ||
169 | + <el-input v-model="es_editForm.clusterName" style="width:280px" size="small" clearable | ||
170 | + placeholder="请输入集群名称"> | ||
171 | + </el-input> | ||
172 | + </el-form-item> | ||
173 | + <el-form-item label="节点名称:" prop="elasticsearchName"> | ||
174 | + <el-input v-model="es_editForm.elasticsearchName" style="width:280px" size="small" clearable | ||
175 | + placeholder="请输入ES(节点)名称"> | ||
176 | + </el-input> | ||
177 | + </el-form-item> | ||
178 | + <el-form-item label="协议:" prop="scheme"> | ||
179 | + <el-input v-model="es_editForm.scheme" style="width:280px" size="small" clearable readonly | ||
180 | + placeholder="请输入协议名称:http"> | ||
181 | + </el-input> | ||
182 | + </el-form-item> | ||
183 | + <el-form-item label="IP地址:" prop="hostname"> | ||
184 | + <el-input v-model="es_editForm.hostname" style="width:280px" size="small" clearable | ||
185 | + placeholder="请输入IP地址"> | ||
186 | + </el-input> | ||
187 | + </el-form-item> | ||
188 | + <el-form-item label="端口号:" prop="port"> | ||
189 | + <el-input v-model="es_editForm.port" style="width:280px" size="small" clearable | ||
190 | + placeholder="请输入端口号"> | ||
191 | + </el-input> | ||
192 | + </el-form-item> | ||
193 | + <el-form-item label="默认节点类型:" prop="isMaster"> | ||
194 | + <el-select v-model="es_editForm.isMaster" style="width: 280px" clearable | ||
195 | + size="small" placeholder="请选择默认节点类型?"> | ||
196 | + <el-option | ||
197 | + v-for="item in isMasterList" | ||
198 | + :key="item.value" | ||
199 | + :label="item.label" | ||
200 | + :value="item.value"> | ||
201 | + </el-option> | ||
202 | + </el-select> | ||
203 | + </el-form-item> | ||
204 | + <el-form-item label="相关描述:" prop="description"> | ||
205 | + <el-input v-model="es_editForm.description" style="width:280px" size="small" clearable | ||
206 | + placeholder="请输入相关描述"> | ||
207 | + </el-input> | ||
208 | + </el-form-item> | ||
209 | + </el-form> | ||
210 | + <div slot="footer" class="dialog-footer" style="text-align: center;margin-top: -20px"> | ||
211 | + <el-button type="info" @click="es_dialog.editDialog = false" size="medium" style="width: 100px"> | ||
212 | + 取消 | ||
213 | + </el-button> | ||
214 | + <el-button type="primary" @click="es_edit" :loading="es_loading.editLoading" size="medium" style="width: 100px"> | ||
215 | + 编辑 | ||
216 | + </el-button> | ||
217 | + </div> | ||
218 | + </el-dialog> | ||
219 | + </div> | ||
220 | + </el-container> | ||
221 | +</template> | ||
222 | + | ||
223 | +<script> | ||
224 | + import { | ||
225 | + selectElasticSearchList, | ||
226 | + insertElasticSearchInfo, | ||
227 | + deleteElasticSearchInfo, | ||
228 | + batchRemoveElasticSearchInfo, | ||
229 | + updateElasticSearchInfo, | ||
230 | + } from | ||
231 | + "../../api/message_bus"; | ||
232 | + import http from '../../api/http.js'; | ||
233 | + import axios from "axios"; | ||
234 | + | ||
235 | + export default { | ||
236 | + name: "ElasticSearchInfo", | ||
237 | + data() { | ||
238 | + return { | ||
239 | + status: undefined, | ||
240 | + /** | ||
241 | + * 搜索参数 | ||
242 | + */ | ||
243 | + es_queryInfo: { | ||
244 | + clusterName: '', | ||
245 | + elasticsearchName: '', | ||
246 | + elasticsearchState: undefined, | ||
247 | + pageNum: 1, | ||
248 | + pageSize: 10 | ||
249 | + }, | ||
250 | + | ||
251 | + /** | ||
252 | + * queue,分页 | ||
253 | + */ | ||
254 | + es_page: { | ||
255 | + esList: [], | ||
256 | + total: 0, | ||
257 | + selectList: [], | ||
258 | + }, | ||
259 | + /** | ||
260 | + * 添加表单 | ||
261 | + */ | ||
262 | + es_addForm: { | ||
263 | + clusterName: '', | ||
264 | + elasticsearchName: '', | ||
265 | + scheme: 'http', | ||
266 | + hostname: '', | ||
267 | + port: 9200, | ||
268 | + // elasticsearchState: true, | ||
269 | + isMaster: false, | ||
270 | + description: '', | ||
271 | + }, | ||
272 | + | ||
273 | + /** | ||
274 | + * 编辑表单 | ||
275 | + */ | ||
276 | + es_editForm: {}, | ||
277 | + /** | ||
278 | + * Boolean属性,选择列表 | ||
279 | + */ | ||
280 | + booleanList: [ | ||
281 | + { | ||
282 | + value: true, | ||
283 | + label: '运行' | ||
284 | + }, | ||
285 | + { | ||
286 | + value: false, | ||
287 | + label: '宕机' | ||
288 | + }, | ||
289 | + ], | ||
290 | + isMasterList: [ | ||
291 | + { | ||
292 | + value: true, | ||
293 | + label: '主节点' | ||
294 | + }, | ||
295 | + { | ||
296 | + value: false, | ||
297 | + label: '子节点' | ||
298 | + }, | ||
299 | + ], | ||
300 | + /** | ||
301 | + * 对话框 | ||
302 | + */ | ||
303 | + es_dialog: { | ||
304 | + addDialog: false, | ||
305 | + editDialog: false, | ||
306 | + }, | ||
307 | + /** | ||
308 | + * 加载 | ||
309 | + */ | ||
310 | + es_loading: { | ||
311 | + listLoading: false, | ||
312 | + addLoading: false, | ||
313 | + editLoading: false, | ||
314 | + delLoading: false, | ||
315 | + batchDelLoading: false, | ||
316 | + }, | ||
317 | + /** | ||
318 | + * 新增表单规则 | ||
319 | + */ | ||
320 | + es_addFormRules: { | ||
321 | + // clusterName: [ | ||
322 | + // {required: true, message: '请输入集群名称', trigger: ['blur', 'change']}, | ||
323 | + // ], | ||
324 | + // elasticsearchName: [ | ||
325 | + // {required: true, message: '请输入节点名称', trigger: ['blur', 'change']}, | ||
326 | + // ], | ||
327 | + scheme: [ | ||
328 | + {required: true, message: '请输入协议名称', trigger: ['blur', 'change']}, | ||
329 | + ], | ||
330 | + hostname: [ | ||
331 | + {required: true, message: '请输入IP地址', trigger: ['blur', 'change']}, | ||
332 | + ], | ||
333 | + port: [ | ||
334 | + {required: true, message: '请输入端口号', trigger: ['blur', 'change']}, | ||
335 | + ], | ||
336 | + elasticsearchState: [ | ||
337 | + {required: true, message: '请选择节点状态', trigger: ['blur', 'change']}, | ||
338 | + ], | ||
339 | + isMaster: [ | ||
340 | + {required: true, message: '请选择节点类型', trigger: ['blur', 'change']}, | ||
341 | + ], | ||
342 | + }, | ||
343 | + es_editFormRules: { | ||
344 | + clusterName: [ | ||
345 | + {required: true, message: '请输入集群名称', trigger: ['blur', 'change']}, | ||
346 | + ], | ||
347 | + elasticsearchName: [ | ||
348 | + {required: true, message: '请输入节点名称', trigger: ['blur', 'change']}, | ||
349 | + ], | ||
350 | + scheme: [ | ||
351 | + {required: true, message: '请输入协议名称', trigger: ['blur', 'change']}, | ||
352 | + ], | ||
353 | + hostname: [ | ||
354 | + {required: true, message: '请输入IP地址', trigger: ['blur', 'change']}, | ||
355 | + ], | ||
356 | + port: [ | ||
357 | + {required: true, message: '请输入端口号', trigger: ['blur', 'change']}, | ||
358 | + ], | ||
359 | + elasticsearchState: [ | ||
360 | + {required: true, message: '请选择节点状态', trigger: ['blur', 'change']}, | ||
361 | + ], | ||
362 | + isMaster: [ | ||
363 | + {required: true, message: '请选择节点类型', trigger: ['blur', 'change']}, | ||
364 | + ], | ||
365 | + }, | ||
366 | + } | ||
367 | + }, | ||
368 | + methods: { | ||
369 | + /** | ||
370 | + * 分页查询,监听 pageSize 改变的事件 | ||
371 | + */ | ||
372 | + es_handleSizeChange(newSize) { | ||
373 | + this.es_queryInfo.pageSize = newSize; | ||
374 | + this.es_getList(); | ||
375 | + }, | ||
376 | + | ||
377 | + /** | ||
378 | + * 分页查询,监听 pageNum 改变的事件 | ||
379 | + */ | ||
380 | + es_handleCurrentChange(newPage) { | ||
381 | + this.es_queryInfo.pageNum = newPage; | ||
382 | + this.es_getList(); | ||
383 | + }, | ||
384 | + | ||
385 | + /** | ||
386 | + * 分页查询 | ||
387 | + */ | ||
388 | + es_getList() { | ||
389 | + this.es_loading.listLoading = true; | ||
390 | + selectElasticSearchList(this.es_queryInfo).then((response) => { | ||
391 | + let res = response.data; | ||
392 | + if (res.code !== '200') { | ||
393 | + this.es_loading.listLoading = false; | ||
394 | + return this.$message.error(res.msg); | ||
395 | + } | ||
396 | + this.es_page.esList = res.data.list; | ||
397 | + this.es_page.total = res.data.total; | ||
398 | + this.es_loading.listLoading = false; | ||
399 | + }).catch(error => { | ||
400 | + this.es_loading.listLoading = false; | ||
401 | + this.$message.error(error.toString()); | ||
402 | + }); | ||
403 | + }, | ||
404 | + /** | ||
405 | + * 批量删除,选中 | ||
406 | + */ | ||
407 | + es_selectChange: function (selectList) { | ||
408 | + this.es_page.selectList = selectList; | ||
409 | + }, | ||
410 | + /** | ||
411 | + * 批量删除方法 | ||
412 | + */ | ||
413 | + es_batchRemove() { | ||
414 | + const ids = this.es_page.selectList.map(item => item.id).toString(); | ||
415 | + this.$confirm('此操作将永久删除选中的ES信息, 是否继续?', '警告', { | ||
416 | + confirmButtonText: '确定删除', | ||
417 | + cancelButtonText: '取消', | ||
418 | + type: 'warning' | ||
419 | + } | ||
420 | + ).then(() => { | ||
421 | + // 开启加载 | ||
422 | + this.es_loading.editLoading = true; | ||
423 | + let params = {id: ids}; | ||
424 | + batchRemoveElasticSearchInfo(params).then(response => { | ||
425 | + let res = response.data; | ||
426 | + if (res.code !== '200') { | ||
427 | + this.es_loading.editLoading = false; | ||
428 | + return this.$message.error(res.msg); | ||
429 | + } | ||
430 | + this.$message.success(res.msg); | ||
431 | + this.es_loading.editLoading = false; | ||
432 | + // 刷新列表 | ||
433 | + this.es_getList(); | ||
434 | + }).catch(error => { | ||
435 | + // 关闭加载 | ||
436 | + this.es_loading.editLoading = false; | ||
437 | + this.$message.error(error.toString()); | ||
438 | + }); | ||
439 | + }).catch(() => { | ||
440 | + }); | ||
441 | + }, | ||
442 | + /** | ||
443 | + * es,添加对话框,打开事件 | ||
444 | + */ | ||
445 | + es_toAddDialog() { | ||
446 | + this.es_dialog.addDialog = true; | ||
447 | + }, | ||
448 | + /** | ||
449 | + * es,添加对话框,关闭事件 | ||
450 | + */ | ||
451 | + es_addDialogClosed() { | ||
452 | + this.$refs.es_addFormRef.resetFields(); | ||
453 | + }, | ||
454 | + /** | ||
455 | + * 添加事件之测试连接 | ||
456 | + */ | ||
457 | + es_add_test() { | ||
458 | + this.$refs.es_addFormRef.validate(valid => { | ||
459 | + if (!valid) return; | ||
460 | + let scheme = this.es_addForm.scheme; | ||
461 | + let hostname = this.es_addForm.hostname; | ||
462 | + let port = this.es_addForm.port; | ||
463 | + let url = scheme + "://" + hostname + ":" + port; | ||
464 | + | ||
465 | + this.$confirm('测试ES信息,是否可用?', '警告', { | ||
466 | + confirmButtonText: '继续', | ||
467 | + cancelButtonText: '取消', | ||
468 | + type: 'warning' | ||
469 | + } | ||
470 | + ).then(() => { | ||
471 | + window.open(url, '_blank') | ||
472 | + }); | ||
473 | + | ||
474 | + }); | ||
475 | + }, | ||
476 | + /** | ||
477 | + * 添加事件 | ||
478 | + */ | ||
479 | + es_add() { | ||
480 | + this.$refs.es_addFormRef.validate(valid => { | ||
481 | + if (!valid) return; | ||
482 | + this.es_loading.addLoading = true; | ||
483 | + | ||
484 | + let scheme = this.es_addForm.scheme; | ||
485 | + let hostname = this.es_addForm.hostname; | ||
486 | + let port = this.es_addForm.port; | ||
487 | + let url = scheme + "://" + hostname + ":" + port; | ||
488 | + | ||
489 | + // 'Access-Control-Allow-Headers': 'content-type,token,id', | ||
490 | + // 'Access-Control-Request-Headers': 'Origin, X-Requested-With, content-Type, Accept, Authorization', | ||
491 | + // 'Content-type': 'application/json;charset=UTF-8', | ||
492 | + // this.$axios.get(url, { | ||
493 | + // headers: { | ||
494 | + // 'Access-Control-Allow-Origin': '*' | ||
495 | + // } | ||
496 | + // }).then( | ||
497 | + // (response) => { | ||
498 | + // console.log(response); | ||
499 | + // } | ||
500 | + // ).catch(error => { | ||
501 | + // this.$message.error(error.toString()); | ||
502 | + // this.es_loading.addLoading = false; | ||
503 | + // } | ||
504 | + // ); | ||
505 | + | ||
506 | + | ||
507 | + http.get(url).then((response) => { | ||
508 | + console.log(response); | ||
509 | + }).catch(error => { | ||
510 | + this.$message.error(error.toString()); | ||
511 | + this.es_loading.addLoading = false; | ||
512 | + }); | ||
513 | + | ||
514 | + | ||
515 | + // insertElasticSearchInfo(this.es_addForm).then((response) => { | ||
516 | + // let res = response.data; | ||
517 | + // if (res.code !== '200') { | ||
518 | + // this.es_loading.addLoading = false; | ||
519 | + // return this.$message.error(res.msg); | ||
520 | + // } | ||
521 | + // this.es_loading.addLoading = false; | ||
522 | + // this.es_dialog.addDialog = false; | ||
523 | + // this.es_getList(); | ||
524 | + // }).catch(error => { | ||
525 | + // this.es_loading.addLoading = false; | ||
526 | + // this.$message.error(error.toString()); | ||
527 | + // }); | ||
528 | + } | ||
529 | + ) | ||
530 | + }, | ||
531 | + | ||
532 | + /** | ||
533 | + * 删除 | ||
534 | + * @param index | ||
535 | + * @param row | ||
536 | + */ | ||
537 | + es_remove(index, row) { | ||
538 | + this.$confirm('此操作永久删除该ES节点信息, 是否继续?', '警告', { | ||
539 | + confirmButtonText: '确定删除', | ||
540 | + cancelButtonText: '取消', | ||
541 | + type: 'warning' | ||
542 | + } | ||
543 | + ).then(() => { | ||
544 | + // 开启加载 | ||
545 | + this.es_loading.delLoading = true; | ||
546 | + deleteElasticSearchInfo(row).then((response) => { | ||
547 | + let res = response.data; | ||
548 | + if (res.code !== '200') { | ||
549 | + this.es_loading.delLoading = false; | ||
550 | + return this.$message.error(res.msg); | ||
551 | + } | ||
552 | + this.es_loading.delLoading = false; | ||
553 | + this.$message.success(res.msg); | ||
554 | + this.es_getList(); | ||
555 | + }).catch(error => { | ||
556 | + // 关闭加载 | ||
557 | + this.es_loading.delLoading = false; | ||
558 | + this.$message.error(error.toString()); | ||
559 | + }); | ||
560 | + }).catch(() => { | ||
561 | + }); | ||
562 | + }, | ||
563 | + /** | ||
564 | + * queue,编辑对话框,打开事件 | ||
565 | + */ | ||
566 | + es_toEditDialog(index, row) { | ||
567 | + this.es_editForm = Object.assign({}, row); | ||
568 | + this.es_dialog.editDialog = true; | ||
569 | + }, | ||
570 | + /** | ||
571 | + * queue,编辑对话框,关闭事件 | ||
572 | + */ | ||
573 | + es_editDialogClosed() { | ||
574 | + //重置对话框 | ||
575 | + this.$refs.es_editFormRef.resetFields(); | ||
576 | + }, | ||
577 | + | ||
578 | + es_edit() { | ||
579 | + this.$refs.es_editFormRef.validate(valid => { | ||
580 | + if (!valid) return; | ||
581 | + this.es_loading.editLoading = true; | ||
582 | + updateElasticSearchInfo(this.es_editForm).then((response) => { | ||
583 | + let res = response.data; | ||
584 | + if (res.code !== '200') { | ||
585 | + this.es_loading.editLoading = false; | ||
586 | + return this.$message.error(res.msg); | ||
587 | + } | ||
588 | + this.es_loading.editLoading = false; | ||
589 | + this.$message.success(res.msg); | ||
590 | + this.es_dialog.editDialog = false; | ||
591 | + this.es_getList(); | ||
592 | + }).catch(error => { | ||
593 | + this.es_loading.editLoading = false; | ||
594 | + this.$message.error(error.toString()); | ||
595 | + }); | ||
596 | + }) | ||
597 | + } | ||
598 | + }, | ||
599 | + created() { | ||
600 | + | ||
601 | + }, | ||
602 | + mounted() { | ||
603 | + | ||
604 | + } | ||
605 | + } | ||
606 | +</script> | ||
607 | + | ||
608 | +<style scoped> | ||
609 | + | ||
610 | +</style> |
-
请 注册 或 登录 后发表评论