Merge branch 'master' of http://192.168.1.136:82/monitor_v3/hg-monitor-web into …
…master-v32-lushangqing
Showing
8 changed files
with
244 additions
and
82 deletions
@@ -108,25 +108,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -108,25 +108,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
108 | 108 | ||
109 | }); | 109 | }); |
110 | 110 | ||
111 | - //配置资源 | ||
112 | - $("#alarmtemplate_configres").on("click", function () { | ||
113 | - if ($.inArray('back:alarmtemp:resource', checkList) == -1) { | ||
114 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
115 | - return; | ||
116 | - } | ||
117 | - var tempIds = []; | ||
118 | - var data = table.checkStatus('alarmtemplateTable').data; | ||
119 | - if (data && data.length > 0) { | ||
120 | - $.each(data, function (i, obj) { | ||
121 | - tempIds.push(obj.alarmTempId); | ||
122 | - }); | ||
123 | - } | ||
124 | - if (tempIds.length != 1) { | ||
125 | - layer.msg('请选择一条要配置的数据', {icon: 7, time: 2000}); | ||
126 | - return; | ||
127 | - } | 111 | + function getOldResIdList(tempIds){ |
128 | var oldResIdList = []; | 112 | var oldResIdList = []; |
129 | - if (tempIds.length <= 1) { | ||
130 | admin.req({ | 113 | admin.req({ |
131 | url: common.domainName + '/api-web/alarmtemplate/getResIdByTempId', | 114 | url: common.domainName + '/api-web/alarmtemplate/getResIdByTempId', |
132 | async: false, | 115 | async: false, |
@@ -141,7 +124,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -141,7 +124,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
141 | oldResIdList = response.data.map(item => item.resId) | 124 | oldResIdList = response.data.map(item => item.resId) |
142 | } | 125 | } |
143 | }); | 126 | }); |
144 | - } | ||
145 | common.openWin("template/res/reslist", "配置资源", {oldData: oldResIdList}, ["选择", "取消"], function () { | 127 | common.openWin("template/res/reslist", "配置资源", {oldData: oldResIdList}, ["选择", "取消"], function () { |
146 | var resObj = layui.reslist().getData(); | 128 | var resObj = layui.reslist().getData(); |
147 | if (resObj && resObj.length > 0) { | 129 | if (resObj && resObj.length > 0) { |
@@ -153,21 +135,42 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -153,21 +135,42 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
153 | url: domainName + '/api-web/manage/resource/alarmTemplate?resIds=' + resIds.toString() + '&alarmTempId=' + tempIds.toString() + '&access_token=' + accessToken, | 135 | url: domainName + '/api-web/manage/resource/alarmTemplate?resIds=' + resIds.toString() + '&alarmTempId=' + tempIds.toString() + '&access_token=' + accessToken, |
154 | done: function (res) { | 136 | done: function (res) { |
155 | if (res.success) { | 137 | if (res.success) { |
156 | - layer.msg("配置成功!", {offset: '15px', icon: 1, time: 1000}, function () { | 138 | + layer.msg("配置成功!", {offset: '15px', icon: 1, time: 2000}, function () { |
157 | layer.closeAll(); | 139 | layer.closeAll(); |
158 | reloadalarmtemplateTable(); | 140 | reloadalarmtemplateTable(); |
141 | + | ||
159 | }); | 142 | }); |
160 | } else { | 143 | } else { |
161 | - layer.msg("配置失败,请重试或者与管理员联系!", {offset: '15px', icon: 7, time: 1000}); | 144 | + layer.msg("配置失败,请重试或者与管理员联系!", {offset: '15px', icon: 7, time: 2000}); |
162 | } | 145 | } |
163 | } | 146 | } |
164 | }); | 147 | }); |
165 | } else { | 148 | } else { |
166 | - layer.msg("请至少选择一条资源", {offset: '15px', icon: 7, time: 1000}); | 149 | + layer.msg("请至少选择一条资源", {offset: '15px', icon: 7, time: 2000}); |
167 | return false; | 150 | return false; |
168 | } | 151 | } |
169 | return true; | 152 | return true; |
170 | }); | 153 | }); |
154 | + } | ||
155 | + | ||
156 | + //配置资源 | ||
157 | + $("#alarmtemplate_configres").on("click", function () { | ||
158 | + if ($.inArray('back:alarmtemp:resource', checkList) == -1) { | ||
159 | + layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
160 | + return; | ||
161 | + } | ||
162 | + var tempIds = []; | ||
163 | + var data = table.checkStatus('alarmtemplateTable').data; | ||
164 | + if (data && data.length > 0) { | ||
165 | + $.each(data, function (i, obj) { | ||
166 | + tempIds.push(obj.alarmTempId); | ||
167 | + }); | ||
168 | + } | ||
169 | + if (tempIds.length != 1) { | ||
170 | + layer.msg('请选择一条要配置的数据', {icon: 7, time: 2000}); | ||
171 | + return; | ||
172 | + } | ||
173 | + getOldResIdList(tempIds); | ||
171 | }); | 174 | }); |
172 | 175 | ||
173 | // 解除绑定 | 176 | // 解除绑定 |
@@ -226,7 +229,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -226,7 +229,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
226 | , url: domainName + '/api-web/alarmtemplate/page' | 229 | , url: domainName + '/api-web/alarmtemplate/page' |
227 | , where: { | 230 | , where: { |
228 | access_token: accessToken, | 231 | access_token: accessToken, |
229 | - alarmTempName: $("#alarmtemplatekw").val(), | 232 | + keyWord: $("#alarmtemplatekw").val(), |
230 | policyId: policyId, | 233 | policyId: policyId, |
231 | resIdList: resIdList | 234 | resIdList: resIdList |
232 | } | 235 | } |
@@ -355,9 +358,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -355,9 +358,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
355 | //查看告警模板的资源数量 | 358 | //查看告警模板的资源数量 |
356 | $(".view-alarmtemplate-res-total").on("click", function () { | 359 | $(".view-alarmtemplate-res-total").on("click", function () { |
357 | var alarmTempId = $(this).data("id"); | 360 | var alarmTempId = $(this).data("id"); |
358 | - common.openWin("template/res/reslist", "资源列表", {alarmTempId: alarmTempId}, ["关闭"], function () { | ||
359 | - return true; | ||
360 | - }, null, ['90%', '80%']) | 361 | + layer.open({ |
362 | + title: ['绑定资源', 'font-size:18px;'], | ||
363 | + type: 1, | ||
364 | + area: ['90%','80%'], | ||
365 | + resize:false, | ||
366 | + btn: ['确定','取消'], | ||
367 | + content: laytpl($('#tempResource').html()).render(JSON.stringify({})), | ||
368 | + success: function (index, layero) { | ||
369 | + renderResByTemp(alarmTempId) | ||
370 | + | ||
371 | + //新增资源权限 | ||
372 | + $('#addAuthResBtn').on('click', function () { | ||
373 | + openResByTemp(alarmTempId,index) | ||
374 | + }) | ||
375 | + | ||
376 | + //删除资源权限 | ||
377 | + $('#delAuthResBtn').on('click', function () { | ||
378 | + deleteResTemp(alarmTempId) | ||
379 | + }) | ||
380 | + }, | ||
381 | + yes: function(index, layero){ | ||
382 | + layer.close(index); //如果设定了yes回调,需进行手工关闭 | ||
383 | + } | ||
384 | + }); | ||
361 | }); | 385 | }); |
362 | 386 | ||
363 | //设置同步 | 387 | //设置同步 |
@@ -374,6 +398,120 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -374,6 +398,120 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
374 | } | 398 | } |
375 | }); | 399 | }); |
376 | 400 | ||
401 | + //渲染用户所有资源权限列表表格 | ||
402 | + function renderResByTemp(alarmTempId) { | ||
403 | + temResTable = table.render({ | ||
404 | + elem: '#res_temp_table', | ||
405 | + url: domainName + '/api-web/home/res-list/all', | ||
406 | + where: { | ||
407 | + access_token: accessToken, | ||
408 | + resName: '', | ||
409 | + busId: '', | ||
410 | + resHealth: '', | ||
411 | + provider:'', | ||
412 | + collectorId: '', | ||
413 | + trapCollectorId: '', | ||
414 | + alarmTempId: alarmTempId, | ||
415 | + cutoverId: '', | ||
416 | + targetType: '', | ||
417 | + protocolFlag:'', | ||
418 | + protocol:'', | ||
419 | + editMode: 'true', | ||
420 | + resCategory: 'resources' | ||
421 | + }, | ||
422 | + height: 'auto', | ||
423 | + cellMinWidth: 80, | ||
424 | + page: { | ||
425 | + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'] | ||
426 | + , theme: '#1E9FFF' | ||
427 | + }, | ||
428 | + even: true, | ||
429 | + cols: [[ | ||
430 | + {type:'checkbox'} | ||
431 | + ,{type: 'numbers', title: '序号', align: 'center'} | ||
432 | + , { | ||
433 | + field: 'resName', title: '资源名称', align: 'center',sort:true, | ||
434 | + templet: '<div><span resmanage-data-edit="{{d.resId}}" data-zymc="{{ d.resId }}" data-ip="{{ d.ip }}" data-resTypeName="{{ d.resTypeName }}" data-admin="{{ d.admin }}" data-restype="{{d.resType}}" data-name="{{d.resName}}" data-pingenable="{{d.pingEnable}}">{{ d.resName }}</span></div>' | ||
435 | + } | ||
436 | + , {field: 'ip', title: 'IP地址', align: 'center',sort:true} | ||
437 | + , {field: 'port', title: '端口号', align: 'center',sort:true} | ||
438 | + , {field: 'adminName', title: '负责人', align: 'center',sort:true} | ||
439 | + , {field: 'resTypeName', title: '资源类型', align: 'center',sort:true} | ||
440 | + , {field: 'state', title: '资源状态', align: 'center',sort:true, templet: function (d) { | ||
441 | + switch (d.state) { | ||
442 | + case "new" : | ||
443 | + return '<button type="button" class="layui-btn layui-btn-warm layui-bg-gray layui-btn-radius layui-btn-xs p-0-15">未监控</button>' | ||
444 | + case "monitor" : | ||
445 | + return '<button type="button" class="layui-btn layui-btn-radius layui-bg-green layui-btn-xs p-0-15" style="background-color: #0BAC33 !important;">监控中</button>' | ||
446 | + case "stop" : | ||
447 | + return '<button type="button" class="layui-btn layui-btn-warm layui-bg-red layui-btn-radius layui-btn-xs p-0-15">暂停</button>' | ||
448 | + default : | ||
449 | + return '<button type="button" class="layui-btn layui-btn-warm layui-bg-gray layui-btn-radius layui-btn-xs p-0-15">未监控</button>' | ||
450 | + } | ||
451 | + }} | ||
452 | + , { | ||
453 | + title: '操作', fixed: 'right', align: 'center', fixed: 'right', | ||
454 | + templet: '<div><span data-id="{{d.resId}}" class="layui-table-link tem_res_delete_btn">删除</span></div>' | ||
455 | + } | ||
456 | + ]], | ||
457 | + done: function (res, curr, count) { | ||
458 | + //删除 | ||
459 | + $('.tem_res_delete_btn').on('click', function () { | ||
460 | + var id = $(this).data('id') | ||
461 | + deleteResTemp(alarmTempId,id) | ||
462 | + }) | ||
463 | + }, | ||
464 | + }) | ||
465 | + } | ||
466 | + | ||
467 | + //为用户添加资源权限 | ||
468 | + function openResByTemp(alarmTempId,index) { | ||
469 | + getOldResIdList(alarmTempId); | ||
470 | + } | ||
471 | + | ||
472 | + //删除对应的资源权限 | ||
473 | + function deleteResTemp(alarmTempId,id) { | ||
474 | + debugger | ||
475 | + if (typeof (id) != "string") { | ||
476 | + var ids = []; | ||
477 | + var data = table.checkStatus('res_temp_table').data; | ||
478 | + if (data && data.length > 0) { | ||
479 | + $.each(data, function (i, obj) { | ||
480 | + ids.push(obj.resId); | ||
481 | + }); | ||
482 | + } | ||
483 | + if (ids.length == 0) { | ||
484 | + layer.msg('请选择要删除的数据', {icon: 7, time: 2000}); | ||
485 | + return; | ||
486 | + } | ||
487 | + id = ids.toString(); | ||
488 | + } | ||
489 | + //确认提示框 | ||
490 | + layer.confirm('您确定要删除绑定的该资源吗?', { | ||
491 | + btn: ['确定', '取消'] //按钮 | ||
492 | + }, function () { | ||
493 | + $.ajax({ | ||
494 | + url: common.domainName + '/api-web/alarmtemplate/deleteByResIdsAndTempIds?access_token=' + accessToken | ||
495 | + , data: { | ||
496 | + resIds: id, | ||
497 | + tempIds: alarmTempId.toString() | ||
498 | + } | ||
499 | + }).done(function (res) { | ||
500 | + layer.msg('删除成功', { | ||
501 | + offset: '15px' | ||
502 | + , icon: 1 | ||
503 | + , time: 2000 | ||
504 | + }, function () { | ||
505 | + layer.closeAll(); | ||
506 | + reloadalarmtemplateTable() | ||
507 | + }); | ||
508 | + }).error(function (error) { | ||
509 | + console.log(error); | ||
510 | + }); | ||
511 | + }); | ||
512 | + } | ||
513 | + | ||
514 | + | ||
377 | //刷新表格 | 515 | //刷新表格 |
378 | function reloadalarmtemplateTable() { | 516 | function reloadalarmtemplateTable() { |
379 | alarmtemplateTable.reload({ | 517 | alarmtemplateTable.reload({ |
@@ -381,7 +519,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | @@ -381,7 +519,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'reslist', 'sessions' | ||
381 | access_token: accessToken, | 519 | access_token: accessToken, |
382 | policyId: policyId, | 520 | policyId: policyId, |
383 | resIdList: resIdList, | 521 | resIdList: resIdList, |
384 | - alarmTempName: $("#alarmtemplatekw").val() | 522 | + keyWord: $("#alarmtemplatekw").val() |
385 | } | 523 | } |
386 | }); | 524 | }); |
387 | } | 525 | } |
@@ -27,7 +27,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions'], function | @@ -27,7 +27,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions'], function | ||
27 | , url: domainName + '/api-web/alarmtemplate/list' | 27 | , url: domainName + '/api-web/alarmtemplate/list' |
28 | , where:{ | 28 | , where:{ |
29 | access_token:accessToken, | 29 | access_token:accessToken, |
30 | - alarmTempName:$("#alarmtemplatekw").val(), | 30 | + keyWord:$("#alarmtemplatekw").val(), |
31 | policyId:policyId | 31 | policyId:policyId |
32 | } | 32 | } |
33 | , height: 'full-310' | 33 | , height: 'full-310' |
@@ -145,7 +145,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions'], function | @@ -145,7 +145,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common','sessions'], function | ||
145 | alarmtemplatelistTable.reload({ | 145 | alarmtemplatelistTable.reload({ |
146 | where:{ | 146 | where:{ |
147 | access_token:accessToken, | 147 | access_token:accessToken, |
148 | - alarmTempName:$("#alarmtemplatelistkw").val(), | 148 | + keyWord:$("#alarmtemplatelistkw").val(), |
149 | } | 149 | } |
150 | }); | 150 | }); |
151 | } | 151 | } |
@@ -253,33 +253,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -253,33 +253,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
253 | // 发送状态 1已发送,2未发送 | 253 | // 发送状态 1已发送,2未发送 |
254 | noticeTimely.sendState = 2;//statusChange(document.querySelector("#switch_noticeTimely_sendState").checked ? 0 : 1); | 254 | noticeTimely.sendState = 2;//statusChange(document.querySelector("#switch_noticeTimely_sendState").checked ? 0 : 1); |
255 | noticeTimely.noticeNames = userNames; | 255 | noticeTimely.noticeNames = userNames; |
256 | - var noticeStateList = []; | ||
257 | - //获取消息状态列表 | ||
258 | - $.each($('#editNoticeTimely_add_table').find('tbody tr'), function (i, v) { | ||
259 | - var noticeState = {}; | ||
260 | - noticeState.noticeName = $(this).find('input[name="noticeName"]').val(); | ||
261 | - noticeState.sendTime = $(this).find('input[name="sendTime"]').val(); | ||
262 | - noticeState.sendContent = $(this).find('input[name="sendContent"]').val(); | ||
263 | - noticeState.noticeState = $(this).find('select[name="noticeState"]').val(); | ||
264 | - noticeStateList.push(noticeState); | ||
265 | - }); | ||
266 | - noticeTimely.noticeStateList = noticeStateList; | 256 | + // var noticeStateList = []; |
257 | + // //获取消息状态列表 | ||
258 | + // $.each($('#editNoticeTimely_add_table').find('tbody tr'), function (i, v) { | ||
259 | + // var noticeState = {}; | ||
260 | + // noticeState.noticeName = $(this).find('input[name="noticeName"]').val(); | ||
261 | + // noticeState.sendTime = $(this).find('input[name="sendTime"]').val(); | ||
262 | + // noticeState.sendContent = $(this).find('input[name="sendContent"]').val(); | ||
263 | + // noticeState.noticeState = $(this).find('select[name="noticeState"]').val(); | ||
264 | + // noticeStateList.push(noticeState); | ||
265 | + // }); | ||
266 | + // noticeTimely.noticeStateList = noticeStateList; | ||
267 | if (!noticeTimely.noticeNames) { | 267 | if (!noticeTimely.noticeNames) { |
268 | layer.msg('请选择用户', {icon: 7, time: 3000}); | 268 | layer.msg('请选择用户', {icon: 7, time: 3000}); |
269 | return false; | 269 | return false; |
270 | } | 270 | } |
271 | - if (!noticeTimely.templates) { | ||
272 | - layer.msg('请配置自定义展示中的展示内容', {icon: 7, time: 3000}); | ||
273 | - return false; | ||
274 | - } | 271 | + |
275 | noticeTimely.site = $('#notice_timely_select').val() + $('#notice_timely_site').val(); | 272 | noticeTimely.site = $('#notice_timely_select').val() + $('#notice_timely_site').val(); |
276 | //获取配置参数 | 273 | //获取配置参数 |
277 | var map = getParam(); | 274 | var map = getParam(); |
278 | if(!map){ | 275 | if(!map){ |
279 | - return ; | 276 | + return false; |
280 | } | 277 | } |
278 | + if(map.msgSetting && map.msgSetting != '' && map.msgSetting != null){ | ||
281 | noticeTimely.msgSetting = JSON.stringify(map.msgSetting); | 279 | noticeTimely.msgSetting = JSON.stringify(map.msgSetting); |
280 | + } | ||
282 | noticeTimely.templates = map.templates; | 281 | noticeTimely.templates = map.templates; |
282 | + if (!noticeTimely.templates || map.msgSetting == '' || map.msgSetting == null) { | ||
283 | + layer.msg('请配置自定义展示中的展示内容', {icon: 7, time: 3000}); | ||
284 | + return false; | ||
285 | + } | ||
283 | layer.load(2); | 286 | layer.load(2); |
284 | admin.req({ | 287 | admin.req({ |
285 | url: domainName + '/api-web/noticeTimely/save?access_token=' + accessToken, | 288 | url: domainName + '/api-web/noticeTimely/save?access_token=' + accessToken, |
@@ -449,8 +452,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -449,8 +452,6 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
449 | $('#details_tags').append(details_tags); | 452 | $('#details_tags').append(details_tags); |
450 | $('#details_tags span').on('click',function (){ | 453 | $('#details_tags span').on('click',function (){ |
451 | $('[name="templates"]').val($('[name="templates"]').val() + '#{'+$(this).text() + '}'); | 454 | $('[name="templates"]').val($('[name="templates"]').val() + '#{'+$(this).text() + '}'); |
452 | - noticeTimely.templates += '#{'+$(this).text() + '}'; | ||
453 | - | ||
454 | }); | 455 | }); |
455 | } | 456 | } |
456 | 457 | ||
@@ -459,8 +460,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -459,8 +460,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
459 | 460 | ||
460 | //获取模板和等级 | 461 | //获取模板和等级 |
461 | var obj = { | 462 | var obj = { |
462 | - msgSetting: null, | ||
463 | - templates: null | 463 | + msgSetting: '', |
464 | + templates: '' | ||
464 | }; | 465 | }; |
465 | 466 | ||
466 | var errMsg = ''; | 467 | var errMsg = ''; |
@@ -186,41 +186,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -186,41 +186,36 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
186 | cols: [[{ | 186 | cols: [[{ |
187 | type: 'checkbox' | 187 | type: 'checkbox' |
188 | }, { | 188 | }, { |
189 | - field: 'name', title: '名称', align: 'center', width: '250', | 189 | + field: 'name', title: '名称', align: 'center', width: '15%', |
190 | templet: | 190 | templet: |
191 | '<div>' + | 191 | '<div>' + |
192 | ' <span data-id="{{d.id}}" class="link link-noticeTimely-edit">{{d.name}}</span>' + | 192 | ' <span data-id="{{d.id}}" class="link link-noticeTimely-edit">{{d.name}}</span>' + |
193 | '</div>' | 193 | '</div>' |
194 | }, { | 194 | }, { |
195 | - field: 'details', title: '内容', align: 'left', minWidth: '650', | 195 | + field: 'details', title: '内容', align: 'left', width: '25%', |
196 | templet: function (d) { | 196 | templet: function (d) { |
197 | // return '<input type="text" class="layui-input" style= "background-color:transparent;border:0;padding-bottom: 10px" readonly="readonly" name="details" value="' + d.details + '">' | 197 | // return '<input type="text" class="layui-input" style= "background-color:transparent;border:0;padding-bottom: 10px" readonly="readonly" name="details" value="' + d.details + '">' |
198 | return '<code>' + d.details + '</code>' | 198 | return '<code>' + d.details + '</code>' |
199 | } | 199 | } |
200 | }, { | 200 | }, { |
201 | - field: 'frequency', title: '频率', align: 'center', width: '130' | 201 | + field: 'frequency', title: '频率', align: 'center', minWidth: '130' |
202 | }, { | 202 | }, { |
203 | field: 'noticeNicknames', title: '用户', align: 'center', minWidth: '180' | 203 | field: 'noticeNicknames', title: '用户', align: 'center', minWidth: '180' |
204 | }, { | 204 | }, { |
205 | - field: 'state', title: '是否启用', align: 'center', width: '100', | 205 | + field: 'lastSendTime', title: '最后发送时间', align: 'center', minWidth: '170',templet: function (d) { |
206 | + if(d.noticeStateNew && d.noticeStateNew.sendTime){ | ||
207 | + return d.noticeStateNew.sendTime; | ||
208 | + } | ||
209 | + return ''; | ||
210 | + } | ||
211 | + },{ | ||
212 | + field: 'state', title: '是否启用', align: 'center', minWidth: '100', | ||
206 | templet: function (d) { | 213 | templet: function (d) { |
207 | var checked = d.state == 2 ? 'checked' : ''; | 214 | var checked = d.state == 2 ? 'checked' : ''; |
208 | return '<div><input type="checkbox" data-id="' + d.id + '" lay-filter="switch_noticeTimely_checkbox_state" name="state" lay-skin="switch" lay-text="启用|禁用" ' + checked + ' ></div>' | 215 | return '<div><input type="checkbox" data-id="' + d.id + '" lay-filter="switch_noticeTimely_checkbox_state" name="state" lay-skin="switch" lay-text="启用|禁用" ' + checked + ' ></div>' |
209 | } | 216 | } |
210 | - }, /*{ | ||
211 | - field: 'broadcast', title: '是否广播', align: 'center', width: '100', | ||
212 | - templet: function (d) { | ||
213 | - var checked = d.broadcast == 1 ? 'checked' : ''; | ||
214 | - return '<div><input type="checkbox" data-id="' + d.id + '" lay-filter="switch_noticeTimely_checkbox_broadcast" name="broadcast" lay-skin="switch" lay-text="是|否" ' + checked + ' ></div>' | ||
215 | - } | ||
216 | }, { | 217 | }, { |
217 | - field: 'retry', title: '是否轮循', align: 'center', width: '100', | ||
218 | - templet: function (d) { | ||
219 | - var checked = d.retry == 1 ? 'checked' : ''; | ||
220 | - return '<div><input type="checkbox" data-id="' + d.id + '" lay-filter="switch_noticeTimely_checkbox_retry" name="retry" lay-skin="switch" lay-text="重发|不重发" ' + checked + ' ></div>' | ||
221 | - } | ||
222 | - }, */{ | ||
223 | - title: '操作', align: 'center', minWidth: '150', fixed: 'right', | 218 | + title: '操作', align: 'center', minWidth: '120', fixed: 'right', |
224 | templet: | 219 | templet: |
225 | '<div>' + | 220 | '<div>' + |
226 | ' <button data-id="{{d.id}}" class="layui-btn layui-btn-xs layui-btn-normal link-noticeTimely-delete" lay-tips="删除"><i class="layui-icon"></i></button>' + | 221 | ' <button data-id="{{d.id}}" class="layui-btn layui-btn-xs layui-btn-normal link-noticeTimely-delete" lay-tips="删除"><i class="layui-icon"></i></button>' + |
@@ -27,10 +27,10 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin'], function | @@ -27,10 +27,10 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin'], function | ||
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | 29 | ||
30 | - // //按钮搜索 | ||
31 | - // $('#heartbeatQueryBtn').unbind().on('click',function (e) { | ||
32 | - // reloadTable(); | ||
33 | - // }) | 30 | + //按钮搜索 |
31 | + $('#heartbeatQueryBtn').unbind().on('click',function (e) { | ||
32 | + reloadTable(); | ||
33 | + }) | ||
34 | 34 | ||
35 | 35 | ||
36 | // 渲染表格 | 36 | // 渲染表格 |
@@ -63,10 +63,12 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin'], function | @@ -63,10 +63,12 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin'], function | ||
63 | }, { | 63 | }, { |
64 | field: 'currTime', title: '最近心跳时间', align: 'center',sort: true, | 64 | field: 'currTime', title: '最近心跳时间', align: 'center',sort: true, |
65 | templet: function (d) { | 65 | templet: function (d) { |
66 | + var durationVal = $('[name="durationVal"]').val(); | ||
67 | + if(!durationVal || durationVal == '' || durationVal == null){ | ||
68 | + durationVal = 10; | ||
69 | + } | ||
66 | var beatTime = new Date(d.currTime); | 70 | var beatTime = new Date(d.currTime); |
67 | - var time = new Date(); | ||
68 | - time.setMinutes(time.getMinutes() - 10); | ||
69 | - if (time > beatTime) { | 71 | + if (d.between > parseInt(durationVal)) { |
70 | return `<div class="red">${beatTime.format("yyyy-MM-dd HH:mm:ss")}</div>` | 72 | return `<div class="red">${beatTime.format("yyyy-MM-dd HH:mm:ss")}</div>` |
71 | } else { | 73 | } else { |
72 | return `<div>${beatTime.format("yyyy-MM-dd HH:mm:ss")}</div>` | 74 | return `<div>${beatTime.format("yyyy-MM-dd HH:mm:ss")}</div>` |
@@ -85,7 +87,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin'], function | @@ -85,7 +87,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin'], function | ||
85 | heartbeatTable.reload({ | 87 | heartbeatTable.reload({ |
86 | where: { | 88 | where: { |
87 | access_token: accessToken, | 89 | access_token: accessToken, |
88 | - keyword: $('#condition-heartbeat-name').val(), | 90 | + keyword: $('#condition-heartbeat-name').val() |
89 | }, | 91 | }, |
90 | page: { | 92 | page: { |
91 | curr: 1 | 93 | curr: 1 |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <div class="layui-form-item"> | 9 | <div class="layui-form-item"> |
10 | <div class="layui-inline"> | 10 | <div class="layui-inline"> |
11 | <div class="layui-input-inline layui-input-inline--long"> | 11 | <div class="layui-input-inline layui-input-inline--long"> |
12 | - <input type="text" id="alarmtemplatekw" lay-tips="关键字检索包含 </br>模板名称" name="alarmtemplatekw" placeholder="输入关键字,回车搜索" autocomplete="off" class="layui-input"> | 12 | + <input type="text" id="alarmtemplatekw" lay-tips="关键字检索包含 </br>模板名称</br>资源名称" name="alarmtemplatekw" placeholder="输入关键字,回车搜索" autocomplete="off" class="layui-input"> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <div class="layui-inline"> | 15 | <div class="layui-inline"> |
@@ -57,6 +57,28 @@ | @@ -57,6 +57,28 @@ | ||
57 | </div> | 57 | </div> |
58 | <textarea class="hide" id="alarmtemplate-params">{{d}}</textarea> | 58 | <textarea class="hide" id="alarmtemplate-params">{{d}}</textarea> |
59 | </article> | 59 | </article> |
60 | + | ||
61 | +<script id="tempResource" type="text/html"> | ||
62 | + <article class="page-container"> | ||
63 | + <div class="page-panel"> | ||
64 | + <div class="main"> | ||
65 | + <div class="layui-card"> | ||
66 | + <div class="layui-card-body"> | ||
67 | + <div class="warn-btns"> | ||
68 | + <button id="addAuthResBtn" type="button" class="layui-btn layui-btn-sm layui-btn-normal"><i | ||
69 | + class="layui-icon"></i>新增资源 | ||
70 | + </button> | ||
71 | + <button id="delAuthResBtn" type="button" class="layui-btn layui-btn-sm layui-btn-normal"><i | ||
72 | + class="layui-icon"></i>删除资源 | ||
73 | + </button> | ||
74 | + </div> | ||
75 | + <table id="res_temp_table"></table> | ||
76 | + </div> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | + </div> | ||
80 | + </article> | ||
81 | +</script> | ||
60 | <!--<script template lay-done="layui.data.sendParams(d.params)"></script>--> | 82 | <!--<script template lay-done="layui.data.sendParams(d.params)"></script>--> |
61 | <script> | 83 | <script> |
62 | var params = document.getElementById("alarmtemplate-params").value; | 84 | var params = document.getElementById("alarmtemplate-params").value; |
@@ -13,8 +13,7 @@ | @@ -13,8 +13,7 @@ | ||
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <div class="layui-inline"> | 15 | <div class="layui-inline"> |
16 | - <button id="noticeTimelyQueryBtn" type="button" class="layui-btn layui-btn-normal" ><i | ||
17 | - class="layui-icon layui-icon-search"></i>查询 | 16 | + <button id="noticeTimelyQueryBtn" type="button" class="layui-btn layui-btn-normal" >查询 |
18 | </button> | 17 | </button> |
19 | </div> | 18 | </div> |
20 | </div> | 19 | </div> |
@@ -14,11 +14,16 @@ | @@ -14,11 +14,16 @@ | ||
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 | -<!-- <button id="heartbeatQueryBtn" type="button" class="layui-btn layui-btn-normal" ><i--> | ||
19 | -<!-- class="layui-icon layui-icon-search"></i>查询--> | ||
20 | -<!-- </button>--> | ||
21 | -<!-- </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> | ||
23 | + </div> | ||
24 | + <div class="layui-inline"> | ||
25 | + <button id="heartbeatQueryBtn" type="button" class="layui-btn layui-btn-normal">查询</button> | ||
26 | + </div> | ||
22 | </div> | 27 | </div> |
23 | </form> | 28 | </form> |
24 | </div> | 29 | </div> |
-
Please register or login to post a comment