From 543e029484196a8aabf729979fbea4927f5fa261 Mon Sep 17 00:00:00 2001 From: wkl505997900 <505997900@qq.com> Date: Fri, 9 Dec 2022 19:41:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E7=AC=AC=E5=9B=9B=E6=AC=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/check.js | 2 +- src/views/diagnosis/AbnormalAlert.vue | 2 +- src/views/diagnosis/AppTemplateInfo.vue | 89 +++++++++++++++---------- src/views/diagnosis/WorkflowDetail.vue | 16 +++-- 4 files changed, 67 insertions(+), 42 deletions(-) diff --git a/src/api/check.js b/src/api/check.js index 9ad3b1f..dce135c 100644 --- a/src/api/check.js +++ b/src/api/check.js @@ -341,7 +341,7 @@ export function getAlertRecordResult(parameter) { per_page: parameter.per_page || 10, domain: parameter.domain || [], sort: 'time', - direction: directionMap[parameter.direction] || 'asc' + direction: directionMap[parameter.direction] || 'desc' }, /** diff --git a/src/views/diagnosis/AbnormalAlert.vue b/src/views/diagnosis/AbnormalAlert.vue index 06e865b..5db86e0 100644 --- a/src/views/diagnosis/AbnormalAlert.vue +++ b/src/views/diagnosis/AbnormalAlert.vue @@ -98,7 +98,7 @@ export default { align: 'center', filters: this.domainFilters, filteredValue: filters.domain || null, - filterMultiple: false + filterMultiple: true }, { title: '异常主机数', diff --git a/src/views/diagnosis/AppTemplateInfo.vue b/src/views/diagnosis/AppTemplateInfo.vue index 0a6b559..7961e30 100644 --- a/src/views/diagnosis/AppTemplateInfo.vue +++ b/src/views/diagnosis/AppTemplateInfo.vue @@ -40,38 +40,38 @@ import G6 from '@antv/g6'; import {getWorkflowAppExtraInfo} from '@/api/check'; import DrawerView from '@/views/utils/DrawerView'; // g6画图数据,自行编写的 -const NodeData = { - nodes: [ - { - id: 'node1', - label: '单指标检测', - x: 150, - y: 200 - }, - { - id: 'node2', - label: '多指标检测', - x: 450, - y: 200 - }, - { - id: 'node3', - label: '集群故障诊断', - x: 750, - y: 200 - } - ], - edges: [ - { - source: 'node1', - target: 'node2' - }, - { - source: 'node2', - target: 'node3' - } - ] -}; +// const NodeData = { +// nodes: [ +// { +// id: 'node1', +// label: '单指标检测', +// x: 150, +// y: 200 +// }, +// { +// id: 'node2', +// label: '多指标检测', +// x: 450, +// y: 200 +// }, +// { +// id: 'node3', +// label: '集群故障诊断', +// x: 750, +// y: 200 +// } +// ], +// edges: [ +// { +// source: 'node1', +// target: 'node2' +// }, +// { +// source: 'node2', +// target: 'node3' +// } +// ] +// }; const singleItemCheckColum = [ { title: '指标名', @@ -110,18 +110,25 @@ export default { }, data() { return { + NodeData: {}, + abb: [], + add: [], appInfo: '', singleItemCheckColum, multiItemCheckColum, label: '', - detail: [] + detail: [], + detailMap: { + diag: '单指标检测', + multicheck: '多指标检测', + singlecheck: '集群故障诊断' + } }; }, created() { this.app_id = this.$route.params.appId; }, mounted: function() { - this.drawMap(); this.getAppInformation(); }, methods: { @@ -130,6 +137,18 @@ export default { getWorkflowAppExtraInfo(this.app_id) .then(function(res) { _this.appInfo = res.result; + _this.abb = Object.keys(res.result.detail).map((key, index) => ({ + id: index + '', + label: _this.detailMap[key], + x: 150 + index * 300, + y: 200 + })) + _this.add = Object.keys(res.result.detail).map((key, index) => ({ + source: index + '', + target: index + 1 + '' + })).slice(0, -1) + _this.NodeData = {nodes: _this.abb, edges: _this.add}; + _this.drawMap(); }) .catch(function(err) { _this.$message.error(err.response.data.msg); @@ -166,7 +185,7 @@ export default { } } }); - graph.data(NodeData); + graph.data(this.NodeData); graph.render(); } } diff --git a/src/views/diagnosis/WorkflowDetail.vue b/src/views/diagnosis/WorkflowDetail.vue index 30e148b..26b1d4f 100644 --- a/src/views/diagnosis/WorkflowDetail.vue +++ b/src/views/diagnosis/WorkflowDetail.vue @@ -51,10 +51,8 @@ - - - - + + @@ -178,6 +176,12 @@ export default { }, data() { return { + detailStatusMap: { + diag: '单指标检测', + multicheck: '多指标检测', + singlecheck: '集群故障诊断' + }, + detailMap: [], workflow: {}, statusMap, hostcheckColums, @@ -187,7 +191,7 @@ export default { multicheckColumns, pagination: defaultPagination, tableIsLoading: false, - key: 'singlecheck', + key: 'multicheck', singlecheckModel: [], singlecheck: [], multicheck: [], @@ -257,6 +261,8 @@ export default { getWorkflowDatail(this.workflow_id) .then(function(res) { _this.workflow = res.result; + _this.key = Object.keys(res.result.detail)[0]; + _this.detailMap = Object.keys(res.result.detail); const tempArr = []; for (const modelId in _this.workflow.model_info) { if (modelId === _this.workflow.detail.diag) { -- 2.33.0