Authored by wangtao

获取诊断项的正常/异常列表

import {get,post} from './BaseApi.js'
import {get, post} from './BaseApi.js'
/**
... ... @@ -33,7 +33,7 @@ let saveOrUpdateRuleAdvanced = (params) => {
* @returns {Promise<*>}
*/
let delRuleAdvanced = (idList) => {
return get('/api-web/fault/conf/rule/delRuleAdvanced', {idList:idList});
return get('/api-web/fault/conf/rule/delRuleAdvanced', {idList: idList});
}
... ... @@ -56,11 +56,27 @@ let getFaultKpiList = (params) => {
return get('/api-web/fault/result/kpiList', params);
}
/**
* 获取诊断项的正常/异常列表
* @param params {
* isAbnormal 是否异常0否1是
* resClass 基础资源传参
* targetType
* faultNo
* }
* @returns {Promise<*>}
*/
let getFaultDiagnosticItemList = (params) => {
return get('/api-web/fault/result/normal', params);
}
export default {
getRuleAdvanced,
getFaultList,
saveOrUpdateRuleAdvanced,
delRuleAdvanced,
getFaultBusinessList,
getFaultKpiList
getFaultKpiList,
getFaultDiagnosticItemList
}
... ...
... ... @@ -29,6 +29,9 @@ export default {
getFaultKpiList(context, params){
return faultDiagnosisApi.getFaultKpiList(params);
},
getFaultDiagnosticItemList(context, params){
return faultDiagnosisApi.getFaultDiagnosticItemList(params);
},
}
};
... ...
... ... @@ -64,7 +64,7 @@
<!-- 资源明细 -->
<cm-dialog top="3vh" title="更多" width="80%" :showDialogVisible="moreDialog"
<cm-dialog top="3vh" :title="moreDialogTitle" width="80%" :showDialogVisible="moreDialog"
@hidedialog="showMoreDialog" :showFooter="false">
<template v-slot>
<div>
... ...
... ... @@ -92,10 +92,12 @@ export default {
let moreDialog = Vue.ref(false);
let moreDialogTitle = Vue.ref('更多');
let moreObj = Vue.ref({
columns: [],
data: []
});
const showMoreDialog = (flg, obj) => {
moreDialog.value = flg;
... ... @@ -152,6 +154,7 @@ export default {
service.openLine(proxy, faultNo, targetType, resId, kpiId, flag);
} else if (type === 'more') {
// 展示更多
moreDialogTitle.value = obj.title;
showMoreDialog(true, obj);
}
}
... ... @@ -168,6 +171,7 @@ export default {
moreObj,
moreDialog,
showMoreDialog,
moreDialogTitle,
...service
}
}
... ...
... ... @@ -281,13 +281,18 @@ const faultEvent = () => {
* @param global
* @param arr [[{指标对象},{指标对象},....].[{指标对象},{指标对象},....]]
*/
const sendEventMoreDialog = (emit, global, arr, option) => {
const sendEventMoreDialog = (emit, global, arr, title) => {
if (!arr || arr.length == 0) {
global.showMsg("暂无数据!", "warning");
return;
}
if (!title) {
title = '更多';
}
var obj = {
title: title,
columns: [{
prop: 'taskName',
width: 220,
... ... @@ -295,8 +300,10 @@ const faultEvent = () => {
}],
data: []
}
if (arr.length == undefined) {
arr = [];
}
// TODO 数据需要适配
arr.forEach(function (list) {
var dataItem = {};
list.forEach(function (listItem) {
... ... @@ -326,6 +333,80 @@ const faultEvent = () => {
emit('openDialog', 'more', {}, obj);
}
/**
* 打开正常/异常诊断项
* @param emit
* @param global
* @param arr [[{指标对象},{指标对象},....].[{指标对象},{指标对象},....]]
*/
const sendEventNormalDialog = (emit, global, faultNo, targetType, resClass, type) => {
// if (!arr || arr.length == 0) {
// global.showMsg("暂无数据!", "warning");
// return;
// }
var title = type == 'normal' ? '诊断项(正常)' : '诊断项(异常)';
if (!title) {
title = '更多';
}
var obj = {
title: title,
columns: [{
prop: 'taskName',
width: 120,
label: '名称',
}, {
prop: 'kpiName',
width: 120,
label: '指标名称',
}, {
prop: 'diagnosisResult',
width: 80,
label: '诊断值',
}, {
prop: 'isAbnormal',
width: 80,
label: '诊断结果',
render: function (row) {
if (row) {
if (row.isAbnormal === 1) {
return `<span style="color: red;">异常</span>`
} else {
return `<span style="color: blue;">正常</span>`
}
}
return '';
}
}],
data: []
}
var isAbnormal = '';
// 正常
if (type == 'normal') {
isAbnormal = 0;
} else {
isAbnormal = 1;
}
store.dispatch('getFaultDiagnosticItemList', {
isAbnormal: isAbnormal,
resClass: resClass,
targetType: targetType,
faultNo: faultNo
}).then((res) => {
if (res && res.success) {
obj.data = res.data;
emit('openDialog', 'more', {}, obj);
} else {
global.showMsg(res.msg, "warning");
}
});
emit('openDialog', 'more', {}, obj);
}
/**
* 诊断业务场景
... ... @@ -406,7 +487,8 @@ const faultEvent = () => {
sendEventLineDialog,
sendEventMoreDialog,
sendEventDiagnoseBusinessScenarios,
sendEventDiagnoseKpiList
sendEventDiagnoseKpiList,
sendEventNormalDialog
}
... ...