Authored by wangtao

即时消息功能增加对于es、influxdb、tdengine的支撑(支持监控数据库的查询操作/文本,es、influxdb、tdengine暂时不支持)

@@ -37,6 +37,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -37,6 +37,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
37 noticeTimely.sendState = noticeTimely.sendState == 1 ? 1 : 0; 37 noticeTimely.sendState = noticeTimely.sendState == 1 ? 1 : 0;
38 noticeTimely.state = noticeTimely.state == 2 ? 1 : 0; 38 noticeTimely.state = noticeTimely.state == 2 ? 1 : 0;
39 form.val('form-noticeTimely-add', noticeTimely); 39 form.val('form-noticeTimely-add', noticeTimely);
  40 + $('[name="templates"]').val(noticeTimely.templates);
40 bloatedSite(noticeTimely.site); 41 bloatedSite(noticeTimely.site);
41 bloatedParameter(noticeTimely); 42 bloatedParameter(noticeTimely);
42 if (response.data) { 43 if (response.data) {
@@ -72,11 +73,11 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -72,11 +73,11 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
72 }, 73 },
73 }); 74 });
74 //响应声音事件 75 //响应声音事件
75 - form.on('select(noticeTimely_voice)', function(data){  
76 - var url='../src/style/mp3/'+data.value+'.mp3';  
77 - var audio=common.audioPlayer(url);  
78 - audio.playclip();  
79 - }); 76 + // form.on('select(noticeTimely_voice)', function(data){
  77 + // var url='../src/style/mp3/'+data.value+'.mp3';
  78 + // var audio=common.audioPlayer(url);
  79 + // audio.playclip();
  80 + // });
80 //选择用户 81 //选择用户
81 $("#noticeTimely-form-select-users").on("click",function (){ 82 $("#noticeTimely-form-select-users").on("click",function (){
82 //获取 83 //获取
@@ -100,8 +101,24 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -100,8 +101,24 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
100 } 101 }
101 }); 102 });
102 }); 103 });
  104 +
  105 + // 播放mp3
  106 + $("#playMp3").on("click",function () {
  107 + var name = $('#noticeTimely_voice').val();
  108 + var mp3Url = `/src/style/mp3/${name}.mp3`;
  109 + var player = new Audio(mp3Url);
  110 + player.play();
  111 + });
  112 +
103 //添加消息状态 113 //添加消息状态
104 $("#editNoticeTimelyParamBtn").on("click",function () { 114 $("#editNoticeTimelyParamBtn").on("click",function () {
  115 +
  116 + let testStatus = $('#layui-notice_timely_sql_test').attr('test-status');
  117 + if(!testStatus || testStatus != 'success'){
  118 + layer.msg('请先测试脚本!', {icon: 7,time:3000});
  119 + return;
  120 + }
  121 +
105 var html = $("#noticeTimelyParamAddRowHtml").html(); 122 var html = $("#noticeTimelyParamAddRowHtml").html();
106 $('#notice_timely_param_level').append(html); 123 $('#notice_timely_param_level').append(html);
107 $('#notice_timely_param_sql').removeClass('hide'); 124 $('#notice_timely_param_sql').removeClass('hide');
@@ -121,7 +138,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -121,7 +138,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
121 //写入标签内容 138 //写入标签内容
122 function writeTagsInfo(data) { 139 function writeTagsInfo(data) {
123 var tags = ` 140 var tags = `
124 - <span id="tags_span_${data.id}" data-id="${data.id}" data-username="${data.username}" 141 + <span id="tags_span_${data.id}" style="margin: 3px;" data-id="${data.id}" data-username="${data.username}"
125 data-nickname="${data.nickname}" data-phone="${data.phone}" ><em>${data.nickname}</em> 142 data-nickname="${data.nickname}" data-phone="${data.phone}" ><em>${data.nickname}</em>
126 <button type="button" value="${data.id}" class="tagsclose close">×</button> 143 <button type="button" value="${data.id}" class="tagsclose close">×</button>
127 </span> 144 </span>
@@ -179,9 +196,13 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -179,9 +196,13 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
179 Object.assign(noticeTimely, form.val('form-noticeTimely-add')); 196 Object.assign(noticeTimely, form.val('form-noticeTimely-add'));
180 //状态是否为开启 197 //状态是否为开启
181 noticeTimely.state = statusChange(document.querySelector("#switch_noticeTimely_state").checked ? 1 : 0); 198 noticeTimely.state = statusChange(document.querySelector("#switch_noticeTimely_state").checked ? 1 : 0);
182 - noticeTimely.broadcast = statusChange(document.querySelector("#switch_noticeTimely_broadcast").checked ? 0 : 1);  
183 - noticeTimely.retry = statusChange(document.querySelector("#switch_noticeTimely_retry").checked ? 0 : 1);  
184 - noticeTimely.sendState = statusChange(document.querySelector("#switch_noticeTimely_sendState").checked ? 0 : 1); 199 + // 是否广播消息 1是,2否
  200 + noticeTimely.broadcast = 2;//statusChange(document.querySelector("#switch_noticeTimely_broadcast").checked ? 0 : 1);
  201 + // 是否重发 1重发,2不重发
  202 + noticeTimely.retry = 2;//statusChange(document.querySelector("#switch_noticeTimely_retry").checked ? 0 : 1); //
  203 +
  204 + // 发送状态 1已发送,2未发送
  205 + noticeTimely.sendState = 2;//statusChange(document.querySelector("#switch_noticeTimely_sendState").checked ? 0 : 1);
185 noticeTimely.noticeNames = userNames; 206 noticeTimely.noticeNames = userNames;
186 var noticeStateList = []; 207 var noticeStateList = [];
187 //获取消息状态列表 208 //获取消息状态列表
@@ -201,7 +222,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -201,7 +222,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
201 noticeTimely.site = $('#notice_timely_select').val() + $('#notice_timely_site').val(); 222 noticeTimely.site = $('#notice_timely_select').val() + $('#notice_timely_site').val();
202 //获取配置参数 223 //获取配置参数
203 var map = getParam(); 224 var map = getParam();
204 - noticeTimely.grade = map.grade; 225 + if(!map){
  226 + return ;
  227 + }
  228 + noticeTimely.msgSetting = JSON.stringify(map.msgSetting);
205 noticeTimely.templates = map.templates; 229 noticeTimely.templates = map.templates;
206 layer.load(2); 230 layer.load(2);
207 admin.req({ 231 admin.req({
@@ -333,21 +357,32 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -333,21 +357,32 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
333 } 357 }
334 , success: function (res) { 358 , success: function (res) {
335 if (res && res.data && res.data.length > 0) { 359 if (res && res.data && res.data.length > 0) {
  360 + // 增加测试成功属性
  361 + $('#layui-notice_timely_sql_test').attr('test-status','success');
336 //更新行数 362 //更新行数
337 var list = res.data; 363 var list = res.data;
338 //默认取值第一个 364 //默认取值第一个
339 var keys = Object.keys(list[0]); 365 var keys = Object.keys(list[0]);
  366 + var details_tags = '';
340 var html = ''; 367 var html = '';
341 keys.forEach(item => { 368 keys.forEach(item => {
342 html += '<option value="' + item + '">' + item + '</option>' 369 html += '<option value="' + item + '">' + item + '</option>'
  370 +
  371 + //
  372 + details_tags += `<span id="tags_span_${item}" class="layui-badge layui-bg-blue" style="margin: 3px;" ><em>${item}</em></span>`;
343 }) 373 })
344 $.each($('.notice_time_select_sql_value'), function (i, v) { 374 $.each($('.notice_time_select_sql_value'), function (i, v) {
345 $(this).empty(); 375 $(this).empty();
346 $(this).append(html); 376 $(this).append(html);
347 }) 377 })
348 - layer.msg('验证SQL通过!', {icon: 1, time: 3000}); 378 +
  379 + $('#details_tags').append(details_tags);
  380 + $('#details_tags span').on('click',function (){
  381 + $('[name="templates"]').val($('[name="templates"]').val() + '#{'+$(this).text() + '}');
  382 + });
  383 + layer.msg('脚本验证通过!', {icon: 1, time: 3000});
349 } else { 384 } else {
350 - layer.msg('验证SQL失败!', {icon: 7, time: 3000}); 385 + layer.msg('脚本验证失败,请检查!', {icon: 7, time: 3000});
351 } 386 }
352 } 387 }
353 }); 388 });
@@ -355,6 +390,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -355,6 +390,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
355 390
356 //获取配置参数 391 //获取配置参数
357 function getParam() { 392 function getParam() {
  393 + debugger
358 var map = getRowName(); 394 var map = getRowName();
359 var pa = ''; 395 var pa = '';
360 map.rowNameList.forEach(item => { 396 map.rowNameList.forEach(item => {
@@ -364,38 +400,58 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -364,38 +400,58 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
364 pa = pa.substring(0, pa.length - 1); 400 pa = pa.substring(0, pa.length - 1);
365 } 401 }
366 //获取模板和等级 402 //获取模板和等级
367 - var str = {  
368 - grade: '1', 403 + var obj = {
  404 + msgSetting: '',
369 templates: pa 405 templates: pa
370 }; 406 };
  407 +
  408 + var errMsg = '';
  409 +
371 if (!$('#notice_timely_param_sql').hasClass('hide')) { 410 if (!$('#notice_timely_param_sql').hasClass('hide')) {
372 - //获取模板信息  
373 - var val = $('#notice_timely_param_sql').find('textarea[name="details"]').eq(0).val();  
374 - str.templates = val ? val : pa;  
375 - var btn= $('#notice_timely_param_level').find('.layui-notice-time-btn').eq(0).val();  
376 - if(btn){  
377 - //获取颜色  
378 - //行名  
379 - var row = $('#notice_timely_param_level').find('.notice_time_select_sql_value').eq(0).val();  
380 - //条件  
381 - var condition = $('#notice_timely_param_level').find('.notice_time_select_symbol').eq(0).val();  
382 - //值1  
383 - var value1 = btn;  
384 - //颜色  
385 - var colour = $('#notice_timely_param_level').find('.notice_time_select_colour').eq(0).val();  
386 - //值2  
387 - var value2 = map.dataList[0][row] ? map.dataList[0][row] : '';  
388 - var sign = compareSize(value2, condition, value1);  
389 - //判断类型  
390 - if (sign) {  
391 - str.grade = colour; 411 + // 获取模板信息
  412 + var val = $('#notice_timely_param_sql').find('textarea[name="templates"]').eq(0).val();
  413 + obj.templates = val ? val : pa;
  414 +
  415 + var arr = [];
  416 + // 获取条件行
  417 + var msgSettings = $('#notice_timely_param_level').find('.msgSetting');
  418 + if(msgSettings && msgSettings.length > 0){
  419 + $(msgSettings).each(function (i,v){
  420 + if(v){
  421 + var settingItem = $(v);
  422 + var fieldName = settingItem.find('.notice_time_select_sql_value').val();
  423 + var condition = settingItem.find('.notice_time_select_symbol').val();
  424 + var conditionVal = settingItem.find('.layui-notice-time-btn').val();
  425 + var msgLevel = settingItem.find('.notice_time_select_colour').val();
  426 +
  427 + if(fieldName == '' || condition =='' || conditionVal ==''|| msgLevel =='' ||
  428 + fieldName == null || condition == null || conditionVal == null|| msgLevel == null){
  429 + if(errMsg != ''){
  430 + errMsg = "请完善展示设置的条件!";
  431 + }
  432 + return;
  433 + }
  434 + arr.push({
  435 + fieldName:fieldName,
  436 + condition:condition,
  437 + conditionVal:conditionVal,
  438 + msgLevel:msgLevel,
  439 + })
392 } 440 }
393 - }else{  
394 - var colour = $('#notice_timely_param_level').find('.notice_time_select_colour').eq(0).val();  
395 - str.grade = colour; 441 + })
  442 + }
  443 +
  444 + if(arr.length > 0){
  445 + obj.msgSetting = arr;
396 } 446 }
397 } 447 }
398 - return str; 448 + if(errMsg != ''){
  449 + layer.msg(errMsg.join('<br/>'), {icon: 7, time: 3000});
  450 + return undefined;
  451 + }
  452 +
  453 + // 验证数据
  454 + return obj;
399 } 455 }
400 456
401 //比大小 457 //比大小
@@ -207,7 +207,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -207,7 +207,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
207 var checked = d.state == 2 ? 'checked' : ''; 207 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>' 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>'
209 } 209 }
210 - }, { 210 + }, /*{
211 field: 'broadcast', title: '是否广播', align: 'center', width: '100', 211 field: 'broadcast', title: '是否广播', align: 'center', width: '100',
212 templet: function (d) { 212 templet: function (d) {
213 var checked = d.broadcast == 1 ? 'checked' : ''; 213 var checked = d.broadcast == 1 ? 'checked' : '';
@@ -219,7 +219,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl @@ -219,7 +219,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl
219 var checked = d.retry == 1 ? 'checked' : ''; 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>' 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 } 221 }
222 - }, { 222 + }, */{
223 title: '操作', align: 'center', minWidth: '150', fixed: 'right', 223 title: '操作', align: 'center', minWidth: '150', fixed: 'right',
224 templet: 224 templet:
225 '<div>' + 225 '<div>' +
@@ -465,7 +465,7 @@ layui.extend({ @@ -465,7 +465,7 @@ layui.extend({
465 new msgTips({ 465 new msgTips({
466 dom: ".right-bottom-tips", 466 dom: ".right-bottom-tips",
467 title: "告警消息", 467 title: "告警消息",
468 - message: `<p style="line-height: 40px">${v.alarmContent}</p>`, 468 + message: `<p style="line-height: 20px">${v.alarmContent}</p>`,
469 duration: 10000, 469 duration: 10000,
470 space: 10, 470 space: 10,
471 firstSpace: 8, 471 firstSpace: 8,
@@ -539,7 +539,7 @@ layui.extend({ @@ -539,7 +539,7 @@ layui.extend({
539 new msgTips({ 539 new msgTips({
540 dom: ".right-bottom-tips", 540 dom: ".right-bottom-tips",
541 title: title, 541 title: title,
542 - message: `<p style="line-height: 40px">${content}</p>`, 542 + message: `<p style="line-height: 20px">${content}</p>`,
543 duration: 10000, 543 duration: 10000,
544 space: 10, 544 space: 10,
545 firstSpace: 8, 545 firstSpace: 8,
@@ -11,105 +11,103 @@ @@ -11,105 +11,103 @@
11 </div> 11 </div>
12 </div> 12 </div>
13 <div class="inline-half layui-inline"> 13 <div class="inline-half layui-inline">
14 - <label class="layui-form-label">频率</label>  
15 - <div class="layui-input-inline">  
16 - <input type="text" id="sentFrequency_input_noticeTimely" name="frequency" lay-verify="required"  
17 - placeholder="请输入频率" class="layui-input">  
18 - </div>  
19 - <div class="layui-form-mid layui-word-aux" id="show_corn_info_frequency"  
20 - style="padding: 0!important;position: relative;line-height: 38px;display: flex;justify-content: center;margin: 0px;margin-left: 5px;">  
21 - <i class="layui-icon form-btn-icon">&#xe702;</i>  
22 - </div>  
23 - </div>  
24 - </div>  
25 - <div class="layui-form-item" style="display: flex;justify-content: space-between;">  
26 - <div class="layui-inline" style="flex: 1;">  
27 <label class="layui-form-label">状态</label> 14 <label class="layui-form-label">状态</label>
28 - <div class="layui-input-inline" style="margin-left: 20px;;width: 100px">  
29 -<!-- <div class="layui-input-inline" style="width: calc(20vw - 142px);margin-right:65px;margin-left: 50px;">--> 15 + <div class="layui-input-inline" style="padding-left: 6px">
30 <input type="checkbox" id="switch_noticeTimely_state" name="state" lay-skin="switch" lay-text="启用|禁用" value="0" > 16 <input type="checkbox" id="switch_noticeTimely_state" name="state" lay-skin="switch" lay-text="启用|禁用" value="0" >
31 </div> 17 </div>
32 </div> 18 </div>
33 - <div class="layui-inline" style="flex: 1;">  
34 - <label class="layui-form-label" >是否广播</label>  
35 - <div class="layui-input-inline" style="margin-left: 20px;width: 100px">  
36 - <input type="checkbox" id="switch_noticeTimely_broadcast" name="broadcast" lay-skin="switch" lay-text="是|否" value="0" >  
37 - </div>  
38 - </div>  
39 - <div class="layui-inline" style="">  
40 - <label class="layui-form-label">是否轮循</label>  
41 - <div class="layui-input-inline" style="margin-left: 20px;width: 100px">  
42 - <input type="checkbox" id="switch_noticeTimely_retry" name="retry" lay-skin="switch" lay-text="轮循|不轮循" value="0" >  
43 - </div>  
44 - </div>  
45 - <div class="layui-inline" style="display: none !important;">  
46 - <label class="layui-form-label">发送状态</label>  
47 - <div class="layui-input-inline" style="width: calc(20vw - 142px);margin-right:0px;margin-left: 50px;">  
48 - <input type="checkbox" id="switch_noticeTimely_sendState" name="sendState" lay-skin="switch" lay-text="已发送|未发送" value="0" >  
49 </div> 19 </div>
  20 +
  21 + <div class="layui-form-item">
  22 + <div class="inline-half layui-inline" style="width: 100%">
  23 + <label class="layui-form-label">频率</label>
  24 + <div style="width: calc(100% - 110px)">
  25 + <div class="layui-input-inline" style="width: calc(100% - 10px);display: inline-flex;">
  26 + <input type="text" id="sentFrequency_input_noticeTimely" name="frequency" lay-verify="required"
  27 + placeholder="请输入频率" class="layui-input">
  28 + <i id="show_corn_info_frequency" class="layui-icon form-btn-icon" style="line-height: 32px;margin-left: 5px;">&#xe702;</i>
50 </div> 29 </div>
51 </div> 30 </div>
52 - <div class="layui-form-item">  
53 - <div class="inline-half layui-inline" style="display: none!important;">  
54 - <label class="layui-form-label" style="font-size: 12px">重发延迟时间</label>  
55 - <div class="layui-input-inline">  
56 - <input type="text" name="retryTime" placeholder="请输入重发延迟时间(秒)" class="layui-input">  
57 </div> 31 </div>
58 </div> 32 </div>
  33 +
  34 + <!--添砖地址功能待优化-->
  35 + <!--<div class="layui-form-item">
59 <div class="inline-half layui-inline" style="width: 100%"> 36 <div class="inline-half layui-inline" style="width: 100%">
60 <label class="layui-form-label">跳转地址</label> 37 <label class="layui-form-label">跳转地址</label>
61 - <div style="width: 95%">  
62 - <div class="layui-input-inline" style="width: 46%;"> 38 + <div style="width: calc(100% - 110px)">
  39 + <div class="layui-input-inline" style="width: 200px;">
63 <select id="notice_timely_select"> 40 <select id="notice_timely_select">
64 <option selected="selected" disabled="disabled" style='display: none' value=''></option> 41 <option selected="selected" disabled="disabled" style='display: none' value=''></option>
65 </select> 42 </select>
66 </div> 43 </div>
67 - <div class="layui-input-inline" style="margin-left: 1px;width: 52%;"> 44 + <div class="layui-input-inline" style="width: calc(100% - 210px);display: inline-flex;">
68 <input type="text" name="site" id="notice_timely_site" placeholder="请输入详情页地址" class="layui-input"> 45 <input type="text" name="site" id="notice_timely_site" placeholder="请输入详情页地址" class="layui-input">
  46 + <i id="show_corn_info_state" class="layui-icon form-btn-icon" style="line-height: 32px;margin-left: 5px;">&#xe702;</i>
69 </div> 47 </div>
70 - <div class="layui-form-mid layui-word-aux" id="show_corn_info_state"  
71 - style="padding: 0!important;position: relative;line-height: 38px;display: flex;justify-content: center;margin: 0px;margin-left: 5px;">  
72 - <i class="layui-icon form-btn-icon">&#xe702;</i> 48 + </div>
  49 + </div>
  50 + </div>-->
  51 +
  52 + <div class="layui-form-item">
  53 + <div class="inline-half layui-inline" style="width: 100%">
  54 + <label class="layui-form-label">发送用户</label>
  55 + <div style="width: calc(100% - 110px)">
  56 + <div class="layui-input-inline" style="width: calc(100% - 10px);display: inline-flex;">
  57 + <div class="tags" id="select_noticeTimely_id_user" style="width: calc(100% - 20px);border: solid 1px #D2D2D2;margin-top: 0px;height: 36px;"></div>
  58 + <i class="layui-icon form-btn-icon" id="noticeTimely-form-select-users" style="line-height: 36px;margin-left: 5px;">&#xe615;</i>
73 </div> 59 </div>
74 </div> 60 </div>
75 </div> 61 </div>
76 </div> 62 </div>
  63 +
77 <div class="layui-form-item"> 64 <div class="layui-form-item">
78 - <div class="inline-half layui-inline" style="display: none!important;"> 65 + <div class="inline-half layui-inline">
79 <label class="layui-form-label">响应声音</label> 66 <label class="layui-form-label">响应声音</label>
80 <div class="layui-input-inline"> 67 <div class="layui-input-inline">
81 - <select name="voice" id="noticeTimely_voice" lay-filter="noticeTimely_voice"> 68 + <div style="display: flex">
  69 + <div style=" width: calc(100% - 60px);">
  70 + <select name="voice" id="noticeTimely_voice" lay-filter="noticeTimely_voice" >
  71 + <option value="14039">叮咚</option>
82 <option value="咳咳">咳咳</option> 72 <option value="咳咳">咳咳</option>
83 <option value="微信提醒">微信提醒</option> 73 <option value="微信提醒">微信提醒</option>
84 <option value="滑稽">滑稽</option> 74 <option value="滑稽">滑稽</option>
85 </select> 75 </select>
86 </div> 76 </div>
  77 + <button type="button" class="layui-btn layui-btn-primary" id="playMp3" style="margin-left: 2px">
  78 + <i class="layui-icon">&#xe652;</i>
  79 + </button>
87 </div> 80 </div>
88 - <div class="inline-half layui-inline" style="display: none!important;">  
89 - <label class="layui-form-label">类型</label>  
90 - <div class="layui-input-inline">  
91 - <input type="text" name="type" placeholder="请输入类型" value="sql" readonly="readonly" class="layui-input">  
92 </div> 81 </div>
93 </div> 82 </div>
  83 + <div class="inline-half layui-inline">
  84 + <label class="layui-form-label">类型</label>
  85 + <div class="layui-input-inline">
  86 + <select name="type" id="noticeTimely_type" lay-filter="noticeTimely_type">
  87 + <option value="sql">监控数据库</option>
  88 + <option value="text">文本</option>
  89 + <!-- <option value="es">es</option>
  90 + <option value="influxdb">时序</option>
  91 + <option value="tdEngine">tdEngine</option>-->
  92 + </select>
  93 + <span>
  94 + 文本支持:#{now} 当前时间格式:yyyy-MM-dd HH:mm:ss
  95 + </span>
94 </div> 96 </div>
95 - <div class="layui-form-item">  
96 - <label class="layui-form-label">用户</label>  
97 - <div class="layui-input-block tags-input" style="height: auto;width: 90% !important;">  
98 - <div class="tags" id="select_noticeTimely_id_user"></div>  
99 </div> 97 </div>
100 - <div class="layui-form-mid layui-word-aux" style="padding: 0!important;position: relative;top: -28px;left: 98%;justify-content: center;margin-left: 10px; "><i class="layui-icon form-btn-icon" id="noticeTimely-form-select-users">&#xe615;</i></div>  
101 </div> 98 </div>
  99 +
102 <div class="layui-form-item"> 100 <div class="layui-form-item">
103 <label class="layui-form-label textarea-label">内容</label> 101 <label class="layui-form-label textarea-label">内容</label>
104 <div class="layui-input-block" style="display: flex;flex-direction: column;align-items: flex-end;"> 102 <div class="layui-input-block" style="display: flex;flex-direction: column;align-items: flex-end;">
105 - <textarea name="details" placeholder="请输入内容(SQL)" class="layui-textarea" id="layui-notice_timely_sql" style="width: 100%"></textarea>  
106 - <div style="width: 100px;height: auto;">  
107 - <div style="background-color: #1E9FFF;width: 90px;float: right;display: flex;justify-content: center;height: 40px;line-height: 40px;margin-top: 30px; color: #fff;"  
108 - id="layui-notice_timely_sql_test">测试  
109 - </div> 103 + <textarea name="details" placeholder="请输入脚本内容" class="layui-textarea" id="layui-notice_timely_sql" style="width: 100%"></textarea>
  104 + <div style="width: 100%;padding: 10px 0px;">
  105 + <button id="layui-notice_timely_sql_test" class="layui-btn layui-btn-normal">测试脚本</button>
  106 + <span style="color: red">* 脚本尽量添加条件,否则一次性查询内容过多导致发送消息失败!(建议发送内容不超过200个汉字)</span>
110 </div> 107 </div>
111 </div> 108 </div>
112 </div> 109 </div>
  110 +
113 <button id="btn-noticeTimely-submit" class="hide" lay-submit lay-filter="btn-noticeTimely-submit">提交</button> 111 <button id="btn-noticeTimely-submit" class="hide" lay-submit lay-filter="btn-noticeTimely-submit">提交</button>
114 </form> 112 </form>
115 <div class="layui-card-body layui-form-pane editNoticeTimelyParam-list" style="padding-top: 0px;"> 113 <div class="layui-card-body layui-form-pane editNoticeTimelyParam-list" style="padding-top: 0px;">
@@ -125,16 +123,18 @@ @@ -125,16 +123,18 @@
125 <div class="layui-form-item hide" id="notice_timely_param_sql"> 123 <div class="layui-form-item hide" id="notice_timely_param_sql">
126 <label class="layui-form-label textarea-label">展示内容</label> 124 <label class="layui-form-label textarea-label">展示内容</label>
127 <div class="layui-input-block" style="display: flex;"> 125 <div class="layui-input-block" style="display: flex;">
128 - <textarea name="details" placeholder="请输入展示内容" class="layui-textarea" style=""></textarea> 126 + <textarea name="templates" placeholder="请输入展示内容" class="layui-textarea" style=""></textarea>
129 </div> 127 </div>
  128 + <div id="details_tags" style="width: 100%;display: flex;flex-wrap: wrap;"></div>
130 </div> 129 </div>
131 <div class="layui-form-item hide" id="notice_timely_param_level"> 130 <div class="layui-form-item hide" id="notice_timely_param_level">
132 <label class="layui-form-label">展示设置</label> 131 <label class="layui-form-label">展示设置</label>
  132 + <span style="color: red">* 列表数据的状态设置办法:获取“第一条”数据的内容进行判断;多条件之间的关系为“且”。</span>
133 </div> 133 </div>
134 </div> 134 </div>
135 </article> 135 </article>
136 <script type="text/html" id="noticeTimelyParamAddRowHtml"> 136 <script type="text/html" id="noticeTimelyParamAddRowHtml">
137 - <div class="layui-form-item"> 137 + <div class="layui-form-item msgSetting">
138 <div class="layui-inline" style="margin-left: 110px"> 138 <div class="layui-inline" style="margin-left: 110px">
139 <div class="layui-notice-time-lable">当数据集中的</div> 139 <div class="layui-notice-time-lable">当数据集中的</div>
140 <select class="layui-notice-time-select notice_time_select_sql_value"> 140 <select class="layui-notice-time-select notice_time_select_sql_value">
@@ -142,8 +142,8 @@ @@ -142,8 +142,8 @@
142 </select> 142 </select>
143 <div class="layui-notice-time-lable" style="width: 40px;">的值</div> 143 <div class="layui-notice-time-lable" style="width: 40px;">的值</div>
144 <select class="layui-notice-time-select notice_time_select_symbol"> 144 <select class="layui-notice-time-select notice_time_select_symbol">
145 - <option value="0">大于</option>  
146 - <option value="1">小于</option> 145 + <option value="0">大于(适用于数字类型、日期类型)</option>
  146 + <option value="1">小于(适用于数字类型、日期类型)</option>
147 <option value="2">等于</option> 147 <option value="2">等于</option>
148 </select> 148 </select>
149 <input type="text" class="layui-notice-time-btn" value=""> 149 <input type="text" class="layui-notice-time-btn" value="">
@@ -153,7 +153,7 @@ @@ -153,7 +153,7 @@
153 <option value="2">重要(黄色)</option> 153 <option value="2">重要(黄色)</option>
154 <option value="3">严重(红色)</option> 154 <option value="3">严重(红色)</option>
155 </select> 155 </select>
156 - <div class="layui-notice-time-lable" style="width: 40px;">提示</div> 156 + <div class="layui-notice-time-lable" style="width: 40px;">测试</div>
157 </div> 157 </div>
158 </div> 158 </div>
159 </script> 159 </script>