Merge branch 'master' of http://113.200.75.45:82/monitor_v3/hg-monitor-web into master-v32-xwx
Showing
5 changed files
with
101 additions
and
54 deletions
1 | //通知查询 | 1 | //通知查询 |
2 | -layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect', 'echarts'], function (exports) { | 2 | +layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect', 'echarts','laydate'], function (exports) { |
3 | var $ = layui.$; | 3 | var $ = layui.$; |
4 | var form = layui.form; | 4 | var form = layui.form; |
5 | var layer = layui.layer; | 5 | var layer = layui.layer; |
@@ -9,6 +9,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -9,6 +9,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
9 | var domainName = common.domainName; | 9 | var domainName = common.domainName; |
10 | var xmSelect = layui.xmSelect; | 10 | var xmSelect = layui.xmSelect; |
11 | var echarts = layui.echarts; | 11 | var echarts = layui.echarts; |
12 | + var laydate = layui.laydate; | ||
12 | 13 | ||
13 | //对外暴露的接口 | 14 | //对外暴露的接口 |
14 | exports('noticeIndex', function (data) { | 15 | exports('noticeIndex', function (data) { |
@@ -44,6 +45,44 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -44,6 +45,44 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
44 | $('#queryMore').on('click',function(){ | 45 | $('#queryMore').on('click',function(){ |
45 | queryData(); | 46 | queryData(); |
46 | }); | 47 | }); |
48 | + | ||
49 | + $('button[data-period]').on('click',function(){ | ||
50 | + var that = $(this); | ||
51 | + that.addClass('active'); | ||
52 | + that.removeClass('layui-btn-primary'); | ||
53 | + var currentVal = that.attr('data-period'); | ||
54 | + $.each($('button[data-period]'), function(index , el){ | ||
55 | + var itemEl = $(el); | ||
56 | + var val = itemEl.attr('data-period'); | ||
57 | + if(currentVal != val){ | ||
58 | + itemEl.addClass('layui-btn-primary'); | ||
59 | + itemEl.removeClass('active'); | ||
60 | + } | ||
61 | + }); | ||
62 | + | ||
63 | + // yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ss | ||
64 | + if(currentVal == 'custom'){ | ||
65 | + laydate.render({ | ||
66 | + elem: '#dataPeriodCustom', //指定元素 | ||
67 | + range: true, | ||
68 | + type: 'datetime', | ||
69 | + isInitValue: false, | ||
70 | + isPreview: false, | ||
71 | + value : new Date(), | ||
72 | + format:'yyyy-MM-dd HH:mm:ss', | ||
73 | + show: true, //直接显示 | ||
74 | + done: function(value, date, endDate){ | ||
75 | + that.attr('data-val',value); | ||
76 | + reloadData(); | ||
77 | + } | ||
78 | + }); | ||
79 | + return; | ||
80 | + } | ||
81 | + reloadData(); | ||
82 | + }); | ||
83 | + | ||
84 | + | ||
85 | + | ||
47 | form.render(); | 86 | form.render(); |
48 | 87 | ||
49 | getChartData(); | 88 | getChartData(); |
@@ -59,7 +98,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -59,7 +98,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
59 | usernames:userNames, | 98 | usernames:userNames, |
60 | isSend: $('#notice_search_isSend').val(), | 99 | isSend: $('#notice_search_isSend').val(), |
61 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), | 100 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), |
62 | - way:$('#noticeWaySearchBox').val() | 101 | + way:$('#noticeWaySearchBox').val(), |
102 | + dataPeriod: $('button[data-period].active').attr('data-period'), | ||
103 | + timeRange: $('button[data-period].active').attr('data-val') | ||
63 | } | 104 | } |
64 | , height: 'full-380' | 105 | , height: 'full-380' |
65 | , page: { | 106 | , page: { |
@@ -317,24 +358,13 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -317,24 +358,13 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
317 | form.render(); | 358 | form.render(); |
318 | } | 359 | } |
319 | }) | 360 | }) |
320 | - //lsq 快速检查字典数据 2022-07-05 | ||
321 | - $.ajax({ | ||
322 | - url: domainName + '/api-web/manage/ddic/findSucDdics/quick_search?access_token='+accessToken, | ||
323 | - type: "POST", | ||
324 | - success:function (res) { | ||
325 | - var quickSearchs = res.data; | ||
326 | - var html = '' | ||
327 | - $.each(quickSearchs,function (i,e) { | ||
328 | - html+=' <span data-code="'+e.ddicCode+'">'+e.ddicName+'</span>' | ||
329 | - }) | ||
330 | - $("#quick_search").html(''); | ||
331 | - $("#quick_search").append(html); | ||
332 | - form.render(); | ||
333 | - } | ||
334 | - }) | 361 | + |
335 | //刷新表格 | 362 | //刷新表格 |
336 | function reloadTable() { | 363 | function reloadTable() { |
337 | noticeTable.reload({ | 364 | noticeTable.reload({ |
365 | + page: { | ||
366 | + curr: 1 | ||
367 | + }, | ||
338 | where:{ | 368 | where:{ |
339 | access_token:accessToken, | 369 | access_token:accessToken, |
340 | keyword: $('#notice_search_keyword').val(), | 370 | keyword: $('#notice_search_keyword').val(), |
@@ -344,7 +374,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -344,7 +374,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
344 | usernames:userNames, | 374 | usernames:userNames, |
345 | page: 1, | 375 | page: 1, |
346 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), | 376 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), |
347 | - way:$('#noticeWaySearchBox').val() | 377 | + way:$('#noticeWaySearchBox').val(), |
378 | + dataPeriod: $('button[data-period].active').attr('data-period'), | ||
379 | + timeRange: $('button[data-period].active').attr('data-val') | ||
348 | } | 380 | } |
349 | }); | 381 | }); |
350 | } | 382 | } |
@@ -580,7 +612,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -580,7 +612,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
580 | resType: resType, | 612 | resType: resType, |
581 | isSend: $('#notice_search_isSend').val(), | 613 | isSend: $('#notice_search_isSend').val(), |
582 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), | 614 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), |
583 | - way:$('#noticeWaySearchBox').val() | 615 | + way:$('#noticeWaySearchBox').val(), |
616 | + dataPeriod: $('button[data-period].active').attr('data-period'), | ||
617 | + timeRange: $('button[data-period].active').attr('data-val') | ||
584 | }; | 618 | }; |
585 | 619 | ||
586 | $.ajax({ | 620 | $.ajax({ |
@@ -609,7 +643,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -609,7 +643,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
609 | var yData = res.map.countList; | 643 | var yData = res.map.countList; |
610 | var xData = res.map.userList; | 644 | var xData = res.map.userList; |
611 | //展示前20条数据 @Editor LH | 645 | //展示前20条数据 @Editor LH |
612 | - loadNoticeChart(noticeUserChart,xData.slice(0, 20), yData.slice(0, 20)); | 646 | + loadNoticeChart(noticeUserChart,xData.slice(0, 15), yData.slice(0, 15)); |
613 | } | 647 | } |
614 | } | 648 | } |
615 | }) | 649 | }) |
@@ -636,7 +670,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | @@ -636,7 +670,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions', 'xmSelect' | ||
636 | resType: resType, | 670 | resType: resType, |
637 | isSend: $('#notice_search_isSend').val(), | 671 | isSend: $('#notice_search_isSend').val(), |
638 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), | 672 | alarmKpi: $("#noticeAlarmKpiSearchBox").val(), |
639 | - way:$('#noticeWaySearchBox').val() | 673 | + way:$('#noticeWaySearchBox').val(), |
674 | + dataPeriod: $('button[data-period].active').attr('data-period'), | ||
675 | + timeRange: $('button[data-period].active').attr('data-val') | ||
640 | }; | 676 | }; |
641 | var noticeTypeChartNew = echarts.init(document.getElementById('notice_chart_type_new')); | 677 | var noticeTypeChartNew = echarts.init(document.getElementById('notice_chart_type_new')); |
642 | $.ajax({ | 678 | $.ajax({ |
@@ -96,6 +96,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | @@ -96,6 +96,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | ||
96 | conditions.startTime = $('#condition-template-startTime').val().trim(); | 96 | conditions.startTime = $('#condition-template-startTime').val().trim(); |
97 | conditions.endTime = $('#condition-template-endTime').val().trim(); | 97 | conditions.endTime = $('#condition-template-endTime').val().trim(); |
98 | noticeTable = table.render({ | 98 | noticeTable = table.render({ |
99 | + id:'systemNoticeNoticeTable', | ||
99 | elem: '#notice-table', | 100 | elem: '#notice-table', |
100 | url: domainName + '/api-web/manage/noticetemp/page?access_token=' + accessToken, | 101 | url: domainName + '/api-web/manage/noticetemp/page?access_token=' + accessToken, |
101 | where: conditions, | 102 | where: conditions, |
@@ -142,19 +143,17 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | @@ -142,19 +143,17 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | ||
142 | // } | 143 | // } |
143 | // } | 144 | // } |
144 | , { | 145 | , { |
145 | - field: 'subPersonSum', title: '订阅人数', align: 'center', sort: true, | 146 | + field: 'subPersonSum', title: '订阅用户', align: 'center', |
146 | templet: function (d) { | 147 | templet: function (d) { |
147 | if (!d.noticeTempUserList) { | 148 | if (!d.noticeTempUserList) { |
148 | return ''; | 149 | return ''; |
149 | } else { | 150 | } else { |
150 | var userList = []; | 151 | var userList = []; |
151 | - var userName = '' | ||
152 | $.each(d.noticeTempUserList,function (i,v) { | 152 | $.each(d.noticeTempUserList,function (i,v) { |
153 | userList.push(v.nickname); | 153 | userList.push(v.nickname); |
154 | }) | 154 | }) |
155 | - userName = userList.toString(); | ||
156 | // return '<span data-subid="' + d.subId + '" class="layui-table-link link-notice-temp-view-user" style="width: 100%;">' + userName + '</span>'; | 155 | // return '<span data-subid="' + d.subId + '" class="layui-table-link link-notice-temp-view-user" style="width: 100%;">' + userName + '</span>'; |
157 | - return '<span>' + userName + '</span>'; | 156 | + return userList.join(","); |
158 | } | 157 | } |
159 | } | 158 | } |
160 | }, /*{ | 159 | }, /*{ |
@@ -166,9 +165,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | @@ -166,9 +165,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | ||
166 | } | 165 | } |
167 | } | 166 | } |
168 | },*/ { | 167 | },*/ { |
169 | - field: 'frequency', title: '通知频率', align: 'center' | 168 | + field: 'frequency', title: '通知频率', align: 'center',sort:true |
170 | }, { | 169 | }, { |
171 | - field: 'tempStatus', title: '状态', align: 'center', | 170 | + field: 'tempStatus', title: '状态', align: 'center',sort: true, |
172 | templet: function (d) { | 171 | templet: function (d) { |
173 | var checked = ''; | 172 | var checked = ''; |
174 | if(d.enable == '1'){ //默认 | 173 | if(d.enable == '1'){ //默认 |
@@ -410,6 +409,22 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | @@ -410,6 +409,22 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laydate' | ||
410 | // }); | 409 | // }); |
411 | } | 410 | } |
412 | }); | 411 | }); |
412 | + | ||
413 | + | ||
414 | + //触发排序事件 | ||
415 | + table.on('sort(notice-table)', function(obj){ | ||
416 | + var type = !obj.type ? 'desc' : obj.type; | ||
417 | + | ||
418 | + conditions.orderKey = ` ${obj.field} ${type}` | ||
419 | + //尽管我们的 table 自带排序功能,但并没有请求服务端。 | ||
420 | + //有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如: | ||
421 | + table.reload('systemNoticeNoticeTable', { | ||
422 | + initSort: obj //记录初始排序,如果不设的话,将无法标记表头的排序状态。 | ||
423 | + ,where: conditions | ||
424 | + }); | ||
425 | + | ||
426 | + //layer.msg('服务端排序。order by '+ obj.field + ' ' + obj.type); | ||
427 | + }); | ||
413 | } | 428 | } |
414 | 429 | ||
415 | //发送通知弹窗 | 430 | //发送通知弹窗 |
@@ -68,30 +68,23 @@ | @@ -68,30 +68,23 @@ | ||
68 | </div> | 68 | </div> |
69 | </div> | 69 | </div> |
70 | <div class="layui-inline"> | 70 | <div class="layui-inline"> |
71 | - <!-- <button id="noticeSearchQueryBtn" type="button" class="layui-btn layui-btn-normal" ><i | 71 | + <div class="layui-btn-group"> |
72 | + <button type="button" class="layui-btn layui-btn-primary" data-period="all">全部</button> | ||
73 | + <button type="button" class="layui-btn active" data-period="today">今天</button> | ||
74 | + <button type="button" class="layui-btn layui-btn-primary" data-period="week">本周</button> | ||
75 | + <button type="button" class="layui-btn layui-btn-primary" data-period="month">本月</button> | ||
76 | + <button type="button" class="layui-btn layui-btn-primary" data-period="custom" id="dataPeriodCustom">自定义</button> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | + <div class="layui-inline"> | ||
80 | + <button id="noticeSearchQueryBtn" type="button" class="layui-btn layui-btn-normal" ><i | ||
72 | class="layui-icon layui-icon-search"></i>查询 | 81 | class="layui-icon layui-icon-search"></i>查询 |
73 | - </button>--> | 82 | + </button> |
74 | </div> | 83 | </div> |
75 | </div> | 84 | </div> |
76 | </form> | 85 | </form> |
77 | 86 | ||
78 | </div> | 87 | </div> |
79 | - <div class="search_button_group"> | ||
80 | - <div class="quick_search" id="quick_search"> | ||
81 | - <span>ip</span> | ||
82 | - <span>ip1</span> | ||
83 | - </div> | ||
84 | - | ||
85 | - <div class="layui-card-header card_header_search_button" > | ||
86 | - <div class="layui-btn-group time-group" id="noticeCount_time_button_id" style="float: right;"> | ||
87 | - <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" data-period="all">全部</button> | ||
88 | - <button type="button" class="layui-btn layui-btn-primary layui-btn-sm active" data-period="today">今天</button> | ||
89 | - <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" data-period="week">本周</button> | ||
90 | - <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" data-period="month">本月</button> | ||
91 | - <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" data-period="custom">自定义</button> | ||
92 | - </div> | ||
93 | - </div> | ||
94 | - </div> | ||
95 | </div> | 88 | </div> |
96 | <div style="display: flex" class="layui-card-echart"> | 89 | <div style="display: flex" class="layui-card-echart"> |
97 | <div style="flex-grow: 3;width: 66%!important;" > | 90 | <div style="flex-grow: 3;width: 66%!important;" > |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <div class="layui-card-header"> | 6 | <div class="layui-card-header"> |
7 | <div class="layui-status"> | 7 | <div class="layui-status"> |
8 | <form class="layui-form layui-card-header layuiadmin-card-header-auto"> | 8 | <form class="layui-form layui-card-header layuiadmin-card-header-auto"> |
9 | - <div class="layui-form-item"> | 9 | + <div class="layui-form-item" style="display: inline-flex;"> |
10 | <div class="layui-inline"> | 10 | <div class="layui-inline"> |
11 | <div class="layui-input-inline layui-input-inline--long" style="width: 180px;"> | 11 | <div class="layui-input-inline layui-input-inline--long" style="width: 180px;"> |
12 | <input type="text" id="condition-heartbeat-name" | 12 | <input type="text" id="condition-heartbeat-name" |
@@ -14,12 +14,11 @@ | @@ -14,12 +14,11 @@ | ||
14 | placeholder="输入关键字,回车搜索" autocomplete="off" class="layui-input"> | 14 | placeholder="输入关键字,回车搜索" autocomplete="off" class="layui-input"> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |
17 | - <div class="layui-inline"> | ||
18 | - <div class="layui-input-inline"> | ||
19 | - <input type="number" name="durationVal" | ||
20 | - lay-tips="最近心跳时间(单位:分钟)" placeholder="最近心跳时间" value="10" class="layui-input"> | ||
21 | - <!-- <span>分钟</span>--> | ||
22 | - </div> | 17 | + <div class="layui-inline" style="display: flex;flex-wrap: nowrap;width: 250px"> |
18 | + <div>超过最近心跳范围:</div> | ||
19 | + <input type="number" name="durationVal" style="width: 80px" | ||
20 | + lay-tips="超过最近心跳时间(单位:分钟)的心跳,<br/>在表格最近心跳列中文字颜色使用<span style='color:red'>红色</span>字体标识" placeholder="最近心跳时间" value="10" class="layui-input"> | ||
21 | + <div>分钟</div> | ||
23 | </div> | 22 | </div> |
24 | <div class="layui-inline"> | 23 | <div class="layui-inline"> |
25 | <button id="heartbeatQueryBtn" type="button" class="layui-btn layui-btn-normal">查询</button> | 24 | <button id="heartbeatQueryBtn" type="button" class="layui-btn layui-btn-normal">查询</button> |
@@ -383,6 +383,7 @@ | @@ -383,6 +383,7 @@ | ||
383 | ,trigger: 'focus' //呼出控件的事件 | 383 | ,trigger: 'focus' //呼出控件的事件 |
384 | ,show: false //是否直接显示,如果设置true,则默认直接显示控件 | 384 | ,show: false //是否直接显示,如果设置true,则默认直接显示控件 |
385 | ,showBottom: true //是否显示底部栏 | 385 | ,showBottom: true //是否显示底部栏 |
386 | + ,isPreview: true //是否显示值预览 | ||
386 | ,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列 | 387 | ,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列 |
387 | ,lang: 'cn' //语言,只支持cn/en,即中文和英文 | 388 | ,lang: 'cn' //语言,只支持cn/en,即中文和英文 |
388 | ,theme: 'default' //主题 | 389 | ,theme: 'default' //主题 |
@@ -843,7 +844,7 @@ | @@ -843,7 +844,7 @@ | ||
843 | 844 | ||
844 | ,elem = that.bindElem || options.elem[0] | 845 | ,elem = that.bindElem || options.elem[0] |
845 | ,valType = that.isInput(elem) ? 'val' : 'html' | 846 | ,valType = that.isInput(elem) ? 'val' : 'html' |
846 | - ,value = that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : elem.innerHTML) | 847 | + ,value = that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : '') |
847 | 848 | ||
848 | //校验日期有效数字 | 849 | //校验日期有效数字 |
849 | ,checkValid = function(dateTime){ | 850 | ,checkValid = function(dateTime){ |
@@ -1411,6 +1412,9 @@ | @@ -1411,6 +1412,9 @@ | ||
1411 | ,elem = that.bindElem || options.elem[0] | 1412 | ,elem = that.bindElem || options.elem[0] |
1412 | ,valType = that.isInput(elem) ? 'val' : 'html' | 1413 | ,valType = that.isInput(elem) ? 'val' : 'html' |
1413 | 1414 | ||
1415 | + if(!options.isPreview){ | ||
1416 | + return this; | ||
1417 | + } | ||
1414 | options.position === 'static' || lay(elem)[valType](value || ''); | 1418 | options.position === 'static' || lay(elem)[valType](value || ''); |
1415 | return this; | 1419 | return this; |
1416 | }; | 1420 | }; |
@@ -1867,4 +1871,4 @@ | @@ -1867,4 +1871,4 @@ | ||
1867 | }() | 1871 | }() |
1868 | ); | 1872 | ); |
1869 | 1873 | ||
1870 | -}(); | ||
1874 | +}(); |
-
Please register or login to post a comment