Merge branch 'master' of http://113.200.75.45:82/monitor_v3/hg-monitor-web into master-v32-xwx
Showing
5 changed files
with
112 additions
and
7 deletions
1 | -import {get,post} from './BaseApi.js' | 1 | +import {get, post} from './BaseApi.js' |
2 | 2 | ||
3 | 3 | ||
4 | /** | 4 | /** |
@@ -33,7 +33,7 @@ let saveOrUpdateRuleAdvanced = (params) => { | @@ -33,7 +33,7 @@ let saveOrUpdateRuleAdvanced = (params) => { | ||
33 | * @returns {Promise<*>} | 33 | * @returns {Promise<*>} |
34 | */ | 34 | */ |
35 | let delRuleAdvanced = (idList) => { | 35 | let delRuleAdvanced = (idList) => { |
36 | - return get('/api-web/fault/conf/rule/delRuleAdvanced', {idList:idList}); | 36 | + return get('/api-web/fault/conf/rule/delRuleAdvanced', {idList: idList}); |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
@@ -56,11 +56,27 @@ let getFaultKpiList = (params) => { | @@ -56,11 +56,27 @@ let getFaultKpiList = (params) => { | ||
56 | return get('/api-web/fault/result/kpiList', params); | 56 | return get('/api-web/fault/result/kpiList', params); |
57 | } | 57 | } |
58 | 58 | ||
59 | + | ||
60 | +/** | ||
61 | + * 获取诊断项的正常/异常列表 | ||
62 | + * @param params { | ||
63 | + * isAbnormal 是否异常0否1是 | ||
64 | + * resClass 基础资源传参 | ||
65 | + * targetType | ||
66 | + * faultNo | ||
67 | + * } | ||
68 | + * @returns {Promise<*>} | ||
69 | + */ | ||
70 | +let getFaultDiagnosticItemList = (params) => { | ||
71 | + return get('/api-web/fault/result/normal', params); | ||
72 | +} | ||
73 | + | ||
59 | export default { | 74 | export default { |
60 | getRuleAdvanced, | 75 | getRuleAdvanced, |
61 | getFaultList, | 76 | getFaultList, |
62 | saveOrUpdateRuleAdvanced, | 77 | saveOrUpdateRuleAdvanced, |
63 | delRuleAdvanced, | 78 | delRuleAdvanced, |
64 | getFaultBusinessList, | 79 | getFaultBusinessList, |
65 | - getFaultKpiList | 80 | + getFaultKpiList, |
81 | + getFaultDiagnosticItemList | ||
66 | } | 82 | } |
@@ -29,6 +29,9 @@ export default { | @@ -29,6 +29,9 @@ export default { | ||
29 | getFaultKpiList(context, params){ | 29 | getFaultKpiList(context, params){ |
30 | return faultDiagnosisApi.getFaultKpiList(params); | 30 | return faultDiagnosisApi.getFaultKpiList(params); |
31 | }, | 31 | }, |
32 | + getFaultDiagnosticItemList(context, params){ | ||
33 | + return faultDiagnosisApi.getFaultDiagnosticItemList(params); | ||
34 | + }, | ||
32 | 35 | ||
33 | } | 36 | } |
34 | }; | 37 | }; |
@@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
64 | 64 | ||
65 | 65 | ||
66 | <!-- 资源明细 --> | 66 | <!-- 资源明细 --> |
67 | -<cm-dialog top="3vh" title="更多" width="80%" :showDialogVisible="moreDialog" | 67 | +<cm-dialog top="3vh" :title="moreDialogTitle" width="80%" :showDialogVisible="moreDialog" |
68 | @hidedialog="showMoreDialog" :showFooter="false"> | 68 | @hidedialog="showMoreDialog" :showFooter="false"> |
69 | <template v-slot> | 69 | <template v-slot> |
70 | <div> | 70 | <div> |
@@ -92,10 +92,12 @@ export default { | @@ -92,10 +92,12 @@ export default { | ||
92 | 92 | ||
93 | 93 | ||
94 | let moreDialog = Vue.ref(false); | 94 | let moreDialog = Vue.ref(false); |
95 | + let moreDialogTitle = Vue.ref('更多'); | ||
95 | let moreObj = Vue.ref({ | 96 | let moreObj = Vue.ref({ |
96 | columns: [], | 97 | columns: [], |
97 | data: [] | 98 | data: [] |
98 | }); | 99 | }); |
100 | + | ||
99 | const showMoreDialog = (flg, obj) => { | 101 | const showMoreDialog = (flg, obj) => { |
100 | moreDialog.value = flg; | 102 | moreDialog.value = flg; |
101 | 103 | ||
@@ -152,6 +154,7 @@ export default { | @@ -152,6 +154,7 @@ export default { | ||
152 | service.openLine(proxy, faultNo, targetType, resId, kpiId, flag); | 154 | service.openLine(proxy, faultNo, targetType, resId, kpiId, flag); |
153 | } else if (type === 'more') { | 155 | } else if (type === 'more') { |
154 | // 展示更多 | 156 | // 展示更多 |
157 | + moreDialogTitle.value = obj.title; | ||
155 | showMoreDialog(true, obj); | 158 | showMoreDialog(true, obj); |
156 | } | 159 | } |
157 | } | 160 | } |
@@ -168,6 +171,7 @@ export default { | @@ -168,6 +171,7 @@ export default { | ||
168 | moreObj, | 171 | moreObj, |
169 | moreDialog, | 172 | moreDialog, |
170 | showMoreDialog, | 173 | showMoreDialog, |
174 | + moreDialogTitle, | ||
171 | ...service | 175 | ...service |
172 | } | 176 | } |
173 | } | 177 | } |
@@ -282,13 +282,18 @@ const faultEvent = () => { | @@ -282,13 +282,18 @@ const faultEvent = () => { | ||
282 | * @param global | 282 | * @param global |
283 | * @param arr [[{指标对象},{指标对象},....].[{指标对象},{指标对象},....]] | 283 | * @param arr [[{指标对象},{指标对象},....].[{指标对象},{指标对象},....]] |
284 | */ | 284 | */ |
285 | - const sendEventMoreDialog = (emit, global, arr, option) => { | 285 | + const sendEventMoreDialog = (emit, global, arr, title) => { |
286 | if (!arr || arr.length == 0) { | 286 | if (!arr || arr.length == 0) { |
287 | global.showMsg("暂无数据!", "warning"); | 287 | global.showMsg("暂无数据!", "warning"); |
288 | return; | 288 | return; |
289 | } | 289 | } |
290 | 290 | ||
291 | + if (!title) { | ||
292 | + title = '更多'; | ||
293 | + } | ||
294 | + | ||
291 | var obj = { | 295 | var obj = { |
296 | + title: title, | ||
292 | columns: [{ | 297 | columns: [{ |
293 | prop: 'taskName', | 298 | prop: 'taskName', |
294 | width: 220, | 299 | width: 220, |
@@ -296,8 +301,10 @@ const faultEvent = () => { | @@ -296,8 +301,10 @@ const faultEvent = () => { | ||
296 | }], | 301 | }], |
297 | data: [] | 302 | data: [] |
298 | } | 303 | } |
304 | + if (arr.length == undefined) { | ||
305 | + arr = []; | ||
306 | + } | ||
299 | 307 | ||
300 | - // TODO 数据需要适配 | ||
301 | arr.forEach(function (list) { | 308 | arr.forEach(function (list) { |
302 | var dataItem = {}; | 309 | var dataItem = {}; |
303 | list.forEach(function (listItem) { | 310 | list.forEach(function (listItem) { |
@@ -327,6 +334,80 @@ const faultEvent = () => { | @@ -327,6 +334,80 @@ const faultEvent = () => { | ||
327 | emit('openDialog', 'more', {}, obj); | 334 | emit('openDialog', 'more', {}, obj); |
328 | } | 335 | } |
329 | 336 | ||
337 | + /** | ||
338 | + * 打开正常/异常诊断项 | ||
339 | + * @param emit | ||
340 | + * @param global | ||
341 | + * @param arr [[{指标对象},{指标对象},....].[{指标对象},{指标对象},....]] | ||
342 | + */ | ||
343 | + const sendEventNormalDialog = (emit, global, faultNo, targetType, resClass, type) => { | ||
344 | + // if (!arr || arr.length == 0) { | ||
345 | + // global.showMsg("暂无数据!", "warning"); | ||
346 | + // return; | ||
347 | + // } | ||
348 | + | ||
349 | + var title = type == 'normal' ? '诊断项(正常)' : '诊断项(异常)'; | ||
350 | + if (!title) { | ||
351 | + title = '更多'; | ||
352 | + } | ||
353 | + | ||
354 | + var obj = { | ||
355 | + title: title, | ||
356 | + columns: [{ | ||
357 | + prop: 'taskName', | ||
358 | + width: 120, | ||
359 | + label: '名称', | ||
360 | + }, { | ||
361 | + prop: 'kpiName', | ||
362 | + width: 120, | ||
363 | + label: '指标名称', | ||
364 | + }, { | ||
365 | + prop: 'diagnosisResult', | ||
366 | + width: 80, | ||
367 | + label: '诊断值', | ||
368 | + }, { | ||
369 | + prop: 'isAbnormal', | ||
370 | + width: 80, | ||
371 | + label: '诊断结果', | ||
372 | + render: function (row) { | ||
373 | + if (row) { | ||
374 | + if (row.isAbnormal === 1) { | ||
375 | + return `<span style="color: red;">异常</span>` | ||
376 | + } else { | ||
377 | + return `<span style="color: blue;">正常</span>` | ||
378 | + } | ||
379 | + } | ||
380 | + return ''; | ||
381 | + } | ||
382 | + | ||
383 | + }], | ||
384 | + data: [] | ||
385 | + } | ||
386 | + | ||
387 | + var isAbnormal = ''; | ||
388 | + // 正常 | ||
389 | + if (type == 'normal') { | ||
390 | + isAbnormal = 0; | ||
391 | + } else { | ||
392 | + isAbnormal = 1; | ||
393 | + } | ||
394 | + | ||
395 | + store.dispatch('getFaultDiagnosticItemList', { | ||
396 | + isAbnormal: isAbnormal, | ||
397 | + resClass: resClass, | ||
398 | + targetType: targetType, | ||
399 | + faultNo: faultNo | ||
400 | + }).then((res) => { | ||
401 | + if (res && res.success) { | ||
402 | + obj.data = res.data; | ||
403 | + emit('openDialog', 'more', {}, obj); | ||
404 | + } else { | ||
405 | + global.showMsg(res.msg, "warning"); | ||
406 | + } | ||
407 | + }); | ||
408 | + | ||
409 | + emit('openDialog', 'more', {}, obj); | ||
410 | + } | ||
330 | 411 | ||
331 | /** | 412 | /** |
332 | * 诊断业务场景 | 413 | * 诊断业务场景 |
@@ -407,7 +488,8 @@ const faultEvent = () => { | @@ -407,7 +488,8 @@ const faultEvent = () => { | ||
407 | sendEventLineDialog, | 488 | sendEventLineDialog, |
408 | sendEventMoreDialog, | 489 | sendEventMoreDialog, |
409 | sendEventDiagnoseBusinessScenarios, | 490 | sendEventDiagnoseBusinessScenarios, |
410 | - sendEventDiagnoseKpiList | 491 | + sendEventDiagnoseKpiList, |
492 | + sendEventNormalDialog | ||
411 | 493 | ||
412 | } | 494 | } |
413 | 495 |
-
Please register or login to post a comment