Authored by 鲁尚清

Merge branch 'master-500-dev' of http://192.168.1.136:82/monitor_v3/hg-monitor-w…

…eb into master-500-dev-lushangqing
... ... @@ -33,6 +33,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
// 获取合并通知开关是否开启
getNoticeMergeFlag();
let NoticeMergeFlag = 'off';
function getNoticeMergeFlag(){
admin.req({
url: common.domainName + '/api-web/manage/ddic/findSucDdics/noticeMergeFlag'
... ... @@ -41,6 +42,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
, success: function (res) {
$.each(res.data, function (i, v) {
if(v.ddicCode == 'on'){
NoticeMergeFlag= 'on';
$('#noticeMergeTab').show();
}
});
... ... @@ -231,14 +233,17 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
return false;
}
if(!data.alarmContentExpr || data.alarmContentExpr == ''){
layer.msg("请先填写告警内容描述表达式!", {
icon: 7
, time: 3000
});
return false;
if(NoticeMergeFlag && NoticeMergeFlag == 'on'){
if(!data.alarmContentExpr || data.alarmContentExpr == ''){
layer.msg("请先填写告警内容描述表达式!", {
icon: 7
, time: 3000
});
return false;
}
}
var importantPolicy = data.seriousPolicy;
var importantExpr = data.importantPolicy;
var commonlyPolicy = data.commonlyPolicy;
... ...
... ... @@ -12,7 +12,7 @@ layui.extend({
,admin: 'lib/admin' //核心模块
/*,sessions: 'controller/sessions'*/
,view: 'lib/view' //核心模块
}).define(['setter', 'admin'], function(exports){
}).define(['setter', 'admin','pageTips'], function(exports){
var setter = layui.setter
,element = layui.element
,admin = layui.admin
... ...
... ... @@ -242,6 +242,13 @@ layui.define(['laytpl', 'layer'], function(exports){
that.parse(html);
view.removeLoad();
// 弹框
try{
layui.pageTips.init();
}catch (e) {
console.log(e)
}
if(that.done){
that.done(res);
delete that.done;
... ...
//性能曲线图
layui.define(['element', 'admin'], function (exports) {
var $ = layui.$;
var admin = layui.admin;
var domainName = sessionStorage.getItem('domainName');
var obj = {
data: {
contextmenuTips: null,
contextmenus: [],
classNams: []
},
getCurrentHash: function () {
return window.location.hash;
},
init: function () {
var that = this;
if (that.data.contextmenus.length > 0) {
that.bindContextMenuEvent();
return that.data.contextmenus;
}
if('#/user/login/redirect=%2F' == that.getCurrentHash()){
return;
}
// 获取配置的信息
admin.req({
url: domainName + '/api-web/manage/ddic/findSucDdics/contextmenus'
, method: 'POST'
, async: false
, success: function (res) {
$.each(res.data, function (i, v) {
that.data.contextmenus.push(v.ddicCode);
});
that.bindContextMenuEvent();
}
})
},
/**
* 获取当前元素的提示信息
* @param elementName 文本内容
* @param currentEl 当前元素
*/
getTipsDetail(elementName, currentEl) {
var that = this;
admin.req({
url: domainName + '/api-web/bHalt'
, data: {
urlHash: that.getCurrentHash(),
elementName: elementName
}
, async: false
, done: function (res) {
var contextmenuEl = '<ul id="tipContextmenu" class="contextmenu-style" style="color:#fff;">';
if (res.data && res.data.length > 0) {
let tipData = res.data;
tipData.map(item => {
contextmenuEl += '<li>' + item.elementExplain + '</li>';
})
} else {
contextmenuEl += '<li>' + elementName + '</li>';
}
contextmenuEl += '</ul>';
that.data.contextmenuTips = layer.tips(contextmenuEl, currentEl, {
time: 0,
tips: [3, '#1e9fff'],
success() {
}
})
setTimeout(function (){
layer.closeAll('tips');
},5000)
}
})
},
bindContextMenuEvent() {
var that = this;
var contextmenus = that.data.contextmenus;
var bindContextEvent = function (selector, index) {
var el = $(selector);
// 超过30秒
if (index > 60) {
return;
}
if (el == null || el.length == 0) {
setTimeout(function () {
bindContextEvent(selector, ++index);
}, 500)
return;
}
el.attr('title', '点击鼠标右键查看功能点描述信息')
el.contextmenu(function (e) {
e.preventDefault();
let thatItem = $(this);
// 获取当前元素名称正则表达式
var reg = sessionStorage.getItem('regular');
let elementName = thatItem.text().replace(reg, "");
that.getTipsDetail(elementName, thatItem);
})
}
// 循环绑定事件
var bind = function (){
$(contextmenus).each(function (index) {
let val = contextmenus[index];
if (val.indexOf('el::') != -1) {
let elName = val.replace('el::', '');
bindContextEvent(elName, 0);
}
})
}
// 获取当前页面,是否在配置中
var page = that.getCurrentHash();
$(contextmenus).each(function (index) {
let val = contextmenus[index];
if (val.indexOf('page::') != -1 ) {
let elName = val.replace('page::', '');
if(elName == page){
bind();
return;
}
}
})
// 点击关闭所有tips
$(document).on('click', function (event) {
layer.closeAll('tips');
})
}
}
// 页面刷新默认初始化
setTimeout(function () {
obj.init();
}, 1000)
//对外暴露 的接口
exports('pageTips', obj);
});
... ...