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 @@ -33,6 +33,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
33 33
34 // 获取合并通知开关是否开启 34 // 获取合并通知开关是否开启
35 getNoticeMergeFlag(); 35 getNoticeMergeFlag();
  36 + let NoticeMergeFlag = 'off';
36 function getNoticeMergeFlag(){ 37 function getNoticeMergeFlag(){
37 admin.req({ 38 admin.req({
38 url: common.domainName + '/api-web/manage/ddic/findSucDdics/noticeMergeFlag' 39 url: common.domainName + '/api-web/manage/ddic/findSucDdics/noticeMergeFlag'
@@ -41,6 +42,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun @@ -41,6 +42,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
41 , success: function (res) { 42 , success: function (res) {
42 $.each(res.data, function (i, v) { 43 $.each(res.data, function (i, v) {
43 if(v.ddicCode == 'on'){ 44 if(v.ddicCode == 'on'){
  45 + NoticeMergeFlag= 'on';
44 $('#noticeMergeTab').show(); 46 $('#noticeMergeTab').show();
45 } 47 }
46 }); 48 });
@@ -231,6 +233,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun @@ -231,6 +233,7 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
231 return false; 233 return false;
232 } 234 }
233 235
  236 + if(NoticeMergeFlag && NoticeMergeFlag == 'on'){
234 if(!data.alarmContentExpr || data.alarmContentExpr == ''){ 237 if(!data.alarmContentExpr || data.alarmContentExpr == ''){
235 layer.msg("请先填写告警内容描述表达式!", { 238 layer.msg("请先填写告警内容描述表达式!", {
236 icon: 7 239 icon: 7
@@ -238,6 +241,8 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun @@ -238,6 +241,8 @@ layui.define(['form', 'admin', 'laydate', 'common','sessions','reskpilist'], fun
238 }); 241 });
239 return false; 242 return false;
240 } 243 }
  244 + }
  245 +
241 246
242 var importantPolicy = data.seriousPolicy; 247 var importantPolicy = data.seriousPolicy;
243 var importantExpr = data.importantPolicy; 248 var importantExpr = data.importantPolicy;
@@ -12,7 +12,7 @@ layui.extend({ @@ -12,7 +12,7 @@ layui.extend({
12 ,admin: 'lib/admin' //核心模块 12 ,admin: 'lib/admin' //核心模块
13 /*,sessions: 'controller/sessions'*/ 13 /*,sessions: 'controller/sessions'*/
14 ,view: 'lib/view' //核心模块 14 ,view: 'lib/view' //核心模块
15 -}).define(['setter', 'admin'], function(exports){ 15 +}).define(['setter', 'admin','pageTips'], function(exports){
16 var setter = layui.setter 16 var setter = layui.setter
17 ,element = layui.element 17 ,element = layui.element
18 ,admin = layui.admin 18 ,admin = layui.admin
@@ -242,6 +242,13 @@ layui.define(['laytpl', 'layer'], function(exports){ @@ -242,6 +242,13 @@ layui.define(['laytpl', 'layer'], function(exports){
242 that.parse(html); 242 that.parse(html);
243 view.removeLoad(); 243 view.removeLoad();
244 244
  245 + // 弹框
  246 + try{
  247 + layui.pageTips.init();
  248 + }catch (e) {
  249 + console.log(e)
  250 + }
  251 +
245 if(that.done){ 252 if(that.done){
246 that.done(res); 253 that.done(res);
247 delete that.done; 254 delete that.done;
  1 +//性能曲线图
  2 +layui.define(['element', 'admin'], function (exports) {
  3 + var $ = layui.$;
  4 + var admin = layui.admin;
  5 + var domainName = sessionStorage.getItem('domainName');
  6 +
  7 + var obj = {
  8 + data: {
  9 + contextmenuTips: null,
  10 + contextmenus: [],
  11 + classNams: []
  12 + },
  13 + getCurrentHash: function () {
  14 + return window.location.hash;
  15 + },
  16 + init: function () {
  17 + var that = this;
  18 +
  19 + if (that.data.contextmenus.length > 0) {
  20 + that.bindContextMenuEvent();
  21 + return that.data.contextmenus;
  22 + }
  23 + if('#/user/login/redirect=%2F' == that.getCurrentHash()){
  24 + return;
  25 + }
  26 + // 获取配置的信息
  27 + admin.req({
  28 + url: domainName + '/api-web/manage/ddic/findSucDdics/contextmenus'
  29 + , method: 'POST'
  30 + , async: false
  31 + , success: function (res) {
  32 + $.each(res.data, function (i, v) {
  33 + that.data.contextmenus.push(v.ddicCode);
  34 + });
  35 + that.bindContextMenuEvent();
  36 + }
  37 + })
  38 + },
  39 + /**
  40 + * 获取当前元素的提示信息
  41 + * @param elementName 文本内容
  42 + * @param currentEl 当前元素
  43 + */
  44 + getTipsDetail(elementName, currentEl) {
  45 + var that = this;
  46 + admin.req({
  47 + url: domainName + '/api-web/bHalt'
  48 + , data: {
  49 + urlHash: that.getCurrentHash(),
  50 + elementName: elementName
  51 + }
  52 + , async: false
  53 + , done: function (res) {
  54 + var contextmenuEl = '<ul id="tipContextmenu" class="contextmenu-style" style="color:#fff;">';
  55 + if (res.data && res.data.length > 0) {
  56 + let tipData = res.data;
  57 + tipData.map(item => {
  58 + contextmenuEl += '<li>' + item.elementExplain + '</li>';
  59 + })
  60 + } else {
  61 + contextmenuEl += '<li>' + elementName + '</li>';
  62 + }
  63 + contextmenuEl += '</ul>';
  64 + that.data.contextmenuTips = layer.tips(contextmenuEl, currentEl, {
  65 + time: 0,
  66 + tips: [3, '#1e9fff'],
  67 + success() {
  68 + }
  69 + })
  70 +
  71 + setTimeout(function (){
  72 + layer.closeAll('tips');
  73 + },5000)
  74 + }
  75 + })
  76 + },
  77 + bindContextMenuEvent() {
  78 + var that = this;
  79 + var contextmenus = that.data.contextmenus;
  80 +
  81 + var bindContextEvent = function (selector, index) {
  82 + var el = $(selector);
  83 +
  84 + // 超过30秒
  85 + if (index > 60) {
  86 + return;
  87 + }
  88 +
  89 + if (el == null || el.length == 0) {
  90 + setTimeout(function () {
  91 + bindContextEvent(selector, ++index);
  92 + }, 500)
  93 + return;
  94 + }
  95 +
  96 + el.attr('title', '点击鼠标右键查看功能点描述信息')
  97 + el.contextmenu(function (e) {
  98 + e.preventDefault();
  99 + let thatItem = $(this);
  100 + // 获取当前元素名称正则表达式
  101 + var reg = sessionStorage.getItem('regular');
  102 + let elementName = thatItem.text().replace(reg, "");
  103 + that.getTipsDetail(elementName, thatItem);
  104 + })
  105 + }
  106 +
  107 + // 循环绑定事件
  108 + var bind = function (){
  109 + $(contextmenus).each(function (index) {
  110 + let val = contextmenus[index];
  111 +
  112 + if (val.indexOf('el::') != -1) {
  113 + let elName = val.replace('el::', '');
  114 + bindContextEvent(elName, 0);
  115 + }
  116 + })
  117 + }
  118 +
  119 + // 获取当前页面,是否在配置中
  120 + var page = that.getCurrentHash();
  121 + $(contextmenus).each(function (index) {
  122 + let val = contextmenus[index];
  123 + if (val.indexOf('page::') != -1 ) {
  124 + let elName = val.replace('page::', '');
  125 + if(elName == page){
  126 + bind();
  127 + return;
  128 + }
  129 + }
  130 + })
  131 +
  132 + // 点击关闭所有tips
  133 + $(document).on('click', function (event) {
  134 + layer.closeAll('tips');
  135 + })
  136 + }
  137 + }
  138 +
  139 + // 页面刷新默认初始化
  140 + setTimeout(function () {
  141 + obj.init();
  142 + }, 1000)
  143 +
  144 + //对外暴露 的接口
  145 + exports('pageTips', obj);
  146 +});