...
|
...
|
@@ -871,6 +871,52 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele |
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 资源状态 带告警信息
|
|
|
* @param targetId 资源状体区域ID
|
|
|
* @param resId
|
|
|
* 返回报文: {"code":"0","data":{"yz":"3","icon":"worst","yb":"0","state":"差","zy":"0"}}
|
|
|
*/
|
|
|
renderResHealthForH3cBmc: function (targetId, resId) {
|
|
|
var url = "/api-web/detail/resouce/health?resId=" + resId;
|
|
|
admin.req({
|
|
|
url: common.domainName + url
|
|
|
}).done(function (res) {
|
|
|
var data = res.data;
|
|
|
var clas = 'res-state-pie--good';
|
|
|
if (data.icon == 'worst') {
|
|
|
clas = 'res-state-pie--bad';
|
|
|
}
|
|
|
if (data.icon == 'worse') {
|
|
|
clas = 'res-state-pie--middle';
|
|
|
}
|
|
|
var reslt = "优", yz = '0', yb = '0', zy = '0';
|
|
|
if (data.state) {
|
|
|
reslt = data.state;
|
|
|
}
|
|
|
if (data.yz) {
|
|
|
yz = data.yz=='null'||''?0:data.yz;
|
|
|
}
|
|
|
if (data.zy) {
|
|
|
zy = data.zy=='null'||''?0:data.zy;
|
|
|
}
|
|
|
if (data.yb) {
|
|
|
yb = data.yb=='null'||''?0:data.yb;
|
|
|
}
|
|
|
var html = '<div class="res-state-pie ' + clas + '" style="margin: auto">' + reslt + '</div>' +
|
|
|
' <div>' +
|
|
|
' <ul style="margin: 135px 100px 20px 0px">' +
|
|
|
' <li>严重告警:' + yz + '</li>' +
|
|
|
' <li>重要告警:' + zy + '</li>' +
|
|
|
' <li>一般告警:' + yb + '</li>' +
|
|
|
' </ul>' +
|
|
|
' </div>';
|
|
|
|
|
|
$("#" + targetId).html(html);
|
|
|
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 资源状态
|
|
|
* @param targetId 资源状体区域ID
|
|
|
* @param resId
|
...
|
...
|
@@ -2460,6 +2506,253 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele |
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 动态渲染表格
|
|
|
* @param tableId 表格所在区域ID
|
|
|
* @param page 是否分页 true/false
|
|
|
* @param resId 资源Id
|
|
|
* @param kpiId 指标Id,多个id,以逗号隔开
|
|
|
* @param flagPrifix 二级标识(flag)共性部分(前缀)
|
|
|
* @param colWidth 各个列宽度设置,可以只设置前边的,设置百分比
|
|
|
*/
|
|
|
renderTableForH3cBmc: function (tableId, page, resId, kpiId, title, flagPrifix, sortBy, order, size,colWidth) {
|
|
|
var editFlag = localStorage.getItem("editFlag");//是否编辑状态
|
|
|
//start lsq 状态信息的状态也增加下探 202-06-08
|
|
|
let statusF=false;//是否为状态信息
|
|
|
//end lsq 2022-06-08
|
|
|
if (!size) {
|
|
|
size = 5;
|
|
|
}
|
|
|
var url = "/api-web/detail/table/page?resId=" + resId + "&kpiId=" + kpiId + "&page=1&size=" + size;
|
|
|
if(sortBy){
|
|
|
url += '&sortBy=' + sortBy;
|
|
|
}
|
|
|
if(order){
|
|
|
url += '&order=' + order;
|
|
|
}
|
|
|
//如果是编辑状态,则进行分页展示
|
|
|
if (editFlag && editFlag == "true") {
|
|
|
page = true;
|
|
|
}
|
|
|
if (page) {//分页获取
|
|
|
url = "/api-web/detail/table/notpage?resId=" + resId + "&kpiId=" + kpiId;
|
|
|
}
|
|
|
if (flagPrifix) {
|
|
|
url = url + "&flagPrifix="+flagPrifix;
|
|
|
}
|
|
|
admin.req({
|
|
|
url: common.domainName + url
|
|
|
}).done(function (res) {
|
|
|
var data = res.data[0];
|
|
|
var header = data.header;
|
|
|
var content = data.content;
|
|
|
// 如果有数据,展示
|
|
|
if(content.length) {
|
|
|
$('#' + tableId + 'Hide').removeClass('hide');
|
|
|
}
|
|
|
//如果是端口存活拨测,并且没有返回值时,隐藏该展示区域
|
|
|
if(tableId.indexOf("_port_detection_id") != -1 && content.length < 1){
|
|
|
$("#"+tableId).parent().hide();
|
|
|
}else if(tableId === 'mysql_primary_slave_id' && content.length <1){ // joke add 20210303 如果时mysql主从信息,并且没有返回值时,隐藏该展示区域
|
|
|
$("#"+tableId).parent().hide();
|
|
|
}else{
|
|
|
//如果数据在10个及以内则不进行分页展示
|
|
|
if(content.length < 11){
|
|
|
page = false;
|
|
|
}else{
|
|
|
page = true;
|
|
|
}
|
|
|
var datas = [];
|
|
|
var list = data.data;
|
|
|
if (list && list.length > 0) {
|
|
|
datas = list;
|
|
|
}
|
|
|
var resType="";
|
|
|
var provider = ""
|
|
|
//获取资源类型
|
|
|
admin.req({
|
|
|
url: common.domainName + "/api-web/manage/resource/findById?resId="+resId,
|
|
|
async: false
|
|
|
}).done(function (res) {
|
|
|
if(res && res.success && res.obj && res.obj.bean && res.obj.bean.resType){
|
|
|
resType=res.obj.bean.resType;
|
|
|
provider = res.obj.bean.provider;
|
|
|
}
|
|
|
});
|
|
|
layui.use(['admin', 'table', 'common'], function () {
|
|
|
var table = layui.table;
|
|
|
var $ = layui.$;
|
|
|
var cols = [];
|
|
|
var fisttd = "";
|
|
|
|
|
|
$.each(header, function (i, v) {
|
|
|
if (i == 0) {
|
|
|
fisttd = v.id;
|
|
|
}
|
|
|
var columnObj = {
|
|
|
field: v.id, title: v.name, templet: function (d) {
|
|
|
var kpiname = "";
|
|
|
if (d[fisttd] && d[fisttd].kpiName) {
|
|
|
kpiname = d[fisttd].kpiName;
|
|
|
}
|
|
|
if (d[v.id] && d[v.id].kpiId) {
|
|
|
var value = d[v.id];
|
|
|
var resStyle = obj.alarmEleMatchStyle(value.flag, v.id);
|
|
|
//start lsq 判断当前kpiId是否在状态指标数据列表中 2022-06-08
|
|
|
let status=statusKpiList.indexOf(d[v.id].kpiId);
|
|
|
if(status!=-1){
|
|
|
statusF=true;
|
|
|
}
|
|
|
//end lsq 2022-06-08
|
|
|
//拼接表空间名称、文件系统名称等等,如果是性能指标或者趋势指标,则可以下探 徐毫杰还原
|
|
|
if (value.kpiIdent == '1') {
|
|
|
var chbox = '';
|
|
|
if (editFlag && editFlag == "true" && value.kpiIdent == '1') {
|
|
|
chbox = '<input lay-filter="kpicheckboxfilter" type="checkbox" lay-skin="primary" name="identKpiCheckbox" ' +
|
|
|
'data-id="' + v.id + '" data-kpiname="' + v.name + '" data-flag="' + value.flag + '" data-name="' + kpiname + '" data-unit="' + v.unit + '">';
|
|
|
}
|
|
|
return chbox + '<a class="link showlinechart_' + tableId + '" style="padding-left:5px;' + resStyle + '" ' + 'data-isWarning="' + value.isWarning + '" data-ident="' + value.kpiIdent + '"' +
|
|
|
'data-trend="' + value.isTrend + '" data-id="' + v.id + '" data-kpiname="' + kpiname + '" data-name="' + v.name + '" data-flag="' + value.flag + '">' + value.kpiValue + '</a>' +
|
|
|
'<a class="detail_row_menu hide" data-statusf="'+statusF+'" data-isWarning="' + value.isWarning + '" data-ident="' + value.kpiIdent + '" data-trend="' + value.isTrend + '" ' +
|
|
|
'data-id="' + v.id + '" data-kpiname="' + kpiname + '" data-name="' + v.name + '" data-flag="' + value.flag + '"' +
|
|
|
'data-canca="' + value.canCA + '" data-incaing="' + value.inCAing + '" data-restype="' + resType + '"' +
|
|
|
'>' +
|
|
|
'<img style="width: 20px;height: 20px;" src="/src/style/img/icon_row_menu.png"></a>';
|
|
|
|
|
|
} else {
|
|
|
var $html = "";
|
|
|
if (resType == 'HOST_X86SERVER' && provider == 'H3C' ){
|
|
|
$html = addTableCellButton(value);
|
|
|
if ($html == ''){
|
|
|
$html = '<a data-id="' + v.id + '"data-flag="' + value.flag + '">' + $html + value.kpiValue + '</a>';
|
|
|
}
|
|
|
return $html;
|
|
|
}else{
|
|
|
$html = addIconByValue(value.kpiValue);
|
|
|
//根据资源类型判断 修改样式
|
|
|
if ($html != "" && resType != "" && resType == "HOST_X86SERVER" && $html == '<i class="iconfont icon-size serious">\ue668</i>') {
|
|
|
$html = '<i class="iconfont icon-size grayColor">\ue61e</i>';
|
|
|
}
|
|
|
return '<a data-id="' + v.id + '"data-flag="' + value.flag + '">' + $html + value.kpiValue + '</a>';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
return d[v.id];
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
if (colWidth && colWidth[i]){
|
|
|
columnObj.width = colWidth[i];
|
|
|
}
|
|
|
|
|
|
// <i class="iconfont good">\ue659</i>
|
|
|
if(tableId == 'databaseoracle_mcx'){
|
|
|
if(columnObj['field'] == 'KPI709D6F5A'){
|
|
|
columnObj['width'] = 1000;
|
|
|
columnObj['align'] = 'left';
|
|
|
}else{
|
|
|
columnObj['width'] = 200;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
cols.push(columnObj);
|
|
|
});
|
|
|
//添加排序
|
|
|
if(tableId == 'nethardware_portlist' && flagPrifix == 'port'){
|
|
|
$.each(cols,function (i,v) {
|
|
|
v['sort']=true;
|
|
|
});
|
|
|
}
|
|
|
//封装content数据
|
|
|
if (content && content.length > 0) {
|
|
|
$.each(content, function (indx, con) {
|
|
|
var kpi = {};
|
|
|
$.each(con, function (inx, item) {
|
|
|
if (item.kpiValue || item.kpiValue === 0) {
|
|
|
kpi[item.kpiId] = item;
|
|
|
} else {
|
|
|
kpi[item.kpiId] = {};
|
|
|
}
|
|
|
});
|
|
|
datas.push(kpi);
|
|
|
});
|
|
|
}
|
|
|
var pagePro = page;
|
|
|
if (page) {
|
|
|
pagePro = {
|
|
|
layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
|
|
|
, theme: '#1E9FFF'
|
|
|
}
|
|
|
}
|
|
|
if (cols.length > 0) {
|
|
|
table.render({
|
|
|
elem: '#' + tableId
|
|
|
, data: datas
|
|
|
, cols: [cols]
|
|
|
, even: true
|
|
|
, page: pagePro//是否显示分页
|
|
|
, limit: 10
|
|
|
, done: function () {
|
|
|
//性能指标下探
|
|
|
$("a.showlinechart_" + tableId).unbind("click").on("click", function () {
|
|
|
var id = $(this).data("id");
|
|
|
var flag = $(this).data("flag");
|
|
|
var name = $(this).data("name");
|
|
|
var kpiName = $(this).data("kpiname");
|
|
|
var isWarning = $(this).data("iswarning");
|
|
|
var ident = $(this).data("ident");
|
|
|
var trend = $(this).data("trend");
|
|
|
var unit = $(this).data("unit");
|
|
|
if (flag) {
|
|
|
flag = flag.replace(/^\s+|\s+$/g, "");
|
|
|
}
|
|
|
var params = {
|
|
|
resId: resId,
|
|
|
kpiId: id,
|
|
|
flag: flag,
|
|
|
warning:isWarning,
|
|
|
ident:ident,
|
|
|
trend:trend,
|
|
|
unit:unit,
|
|
|
// Start Wang 2022/2/8 14:28 BUG#273 【性能曲线】测试名称重复
|
|
|
name:kpiName,
|
|
|
|
|
|
};
|
|
|
// common.openLineChart(kpiName + " " + name, params);
|
|
|
common.openLineChart(kpiName, params);
|
|
|
// End Wang 2022/2/8 14:29
|
|
|
});
|
|
|
//更多点击事件
|
|
|
$("#" + tableId + "More").unbind("click").on("click", function () {
|
|
|
obj.openMoreTableList(title, resId, kpiId, flagPrifix, sortBy, order,colWidth,true);
|
|
|
});
|
|
|
//下载点击事件
|
|
|
$("#" + tableId + "Download").unbind("click").on("click", function () {
|
|
|
obj.downloadTableList(title, resId, kpiId, flagPrifix, sortBy, order);
|
|
|
});
|
|
|
$("[lay-id='"+tableId+"']").find(".layui-table-cell").hover(function () {
|
|
|
var $that = $(this)
|
|
|
var $btn = $that.find(".detail_row_menu");
|
|
|
if ($btn.length > 0) {
|
|
|
//$(".layui-table-view").find(".layui-table-cell .detail_row_menu:not(.hide)").addClass("hide")
|
|
|
$(".layui-card-body").find(".detail_row_menu:not(.hide)").addClass("hide")
|
|
|
$btn.removeClass("hide");
|
|
|
}
|
|
|
})
|
|
|
//监听过滤压制事件
|
|
|
filterSuppressMonitor(resId);
|
|
|
//监听编辑状态下的复选框事件
|
|
|
getCheckedBoxData();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 柱状图+折线图
|
|
|
* @params targetId 目标dom
|
|
|
* @return
|
...
|
...
|
@@ -3135,7 +3428,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele |
|
|
* @param title
|
|
|
* @param params
|
|
|
*/
|
|
|
openMoreTableList: function (title, resId, kpiId, flag, sortBy, order,colWidth) {
|
|
|
openMoreTableList: function (title, resId, kpiId, flag, sortBy, order,colWidth,isH3cbmc) {
|
|
|
if (!title) {
|
|
|
title = "更多";
|
|
|
}
|
...
|
...
|
@@ -3147,6 +3440,9 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele |
|
|
"order": order,
|
|
|
"colWidth": colWidth
|
|
|
};
|
|
|
if (isH3cbmc == true){
|
|
|
params.isH3cbmc = isH3cbmc;
|
|
|
}
|
|
|
view('commonViewModel').render("template/detail/detail_more").then(function (res) {
|
|
|
layer.open({
|
|
|
title: [title, 'font-size:18px;'],
|
...
|
...
|
@@ -3934,6 +4230,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele |
|
|
setKPIAlarmConfig: setKPIAlarmConfig,
|
|
|
setKpiFilter: setKpiFilter,
|
|
|
addIconByValue: addIconByValue,
|
|
|
addTableCellButton: addTableCellButton,
|
|
|
bindTips:function () {
|
|
|
// 基本信息悬浮提示
|
|
|
$(".detail_base_info").mouseenter(function () {
|
...
|
...
|
@@ -4269,6 +4566,35 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele |
|
|
return $html;
|
|
|
}
|
|
|
|
|
|
function addTableCellButton(kpi) {
|
|
|
var $html = '';
|
|
|
//h3c bmc指定转换状态指标id
|
|
|
var filterKpiIds = "KPIF4362E32,KPI8ED105CD,KPI32A0A858,KPIF5D53796";
|
|
|
var kpiId = kpi.kpiId;
|
|
|
if (filterKpiIds.indexOf(kpiId) == -1){
|
|
|
return $html;
|
|
|
}
|
|
|
var kpiValue = kpi.kpiValue;
|
|
|
var value = kpi.kpiValue;
|
|
|
if(value && typeof(value) == 'string'){
|
|
|
value = value.trim().toLowerCase();
|
|
|
}
|
|
|
var colorClass = 'buttonUnknown';
|
|
|
if (value === 'ok'){
|
|
|
colorClass = 'buttonOk';
|
|
|
}else if (value === 'mlnor'){
|
|
|
colorClass = 'buttonMlnor';
|
|
|
}else if (value === 'major'){
|
|
|
colorClass = 'buttonMajor';
|
|
|
}else if (value === 'critical'){
|
|
|
colorClass = 'buttonCritical';
|
|
|
}else if (value === 'absence'){
|
|
|
colorClass = 'buttonAbsence';
|
|
|
}
|
|
|
$html = '<button type="button" class="layui-btn layui-btn-radius '+colorClass+' layui-btn-xs p-0-15 cant-click" style="font-size: 14px">'+kpiValue+'</button>';
|
|
|
return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取消容量预测
|
|
|
* @param pararms
|
...
|
...
|
|