123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776 |
- <!DOCTYPE html>
- <html class="x-admin-sm">
-
- <head>
- <meta charset="UTF-8">
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
- <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
- <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
- <link rel="stylesheet" href="https://osscold.baozhida.cn/lib/layui/layui.css">
- <script type="text/javascript" src="https://osscold.baozhida.cn/lib/layui/layui.js" charset="utf-8"></script>
- <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
- <script src="https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js"></script>
- <script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
- <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
- <!--[if lt IE 9]>
- <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
- <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
- <![endif]--></head>
- <style>
- .no_select{
- -webkit-touch-callout: none;
- -moz-user-select: none; /*火狐*/
- -webkit-user-select: none; /*webkit浏览器*/
- -ms-user-select: none; /*IE10*/
- -khtml-user-select: none; /*早期浏览器*/
- user-select: none;
- }
- .box_x{
- border: 1px solid #1E9FFF;
- width: 42px;
- height: 16px;
- margin: 0;
- padding: 4px;
- float: left;
- text-align: center;
- }
- </style>
- <body>
- <div class="layui-fluid">
- <div class="layui-row">
- <div class="layui-form-item">
- <label for="T_name" class="layui-form-label" style="width: 140px">
- <span class="x-red">*</span>传感器 分类名称</label>
- <div class="layui-input-inline">
- <input {{if gt .id 0 }}
- value="{{.T.T_name}}"
- {{end}} type="text" id="T_name" name="T_name" required="" lay-verify="required" autocomplete="off" class="layui-input"></div>
- </div>
- {{if ne .id 0 }}
- <div class="layui-tab layui-tab-card">
- <ul class="layui-tab-title">
- <li class="layui-this">通知规则</li>
- <li class="">微信通知</li>
- <li class="">电话通知</li>
- <li class="">短信通知</li>
- <li class="">邮箱通知</li>
- </ul>
- <div class="layui-tab-content" style="height: 340px;overflow-y: auto;">
- <div id="T_Notice_mechanism" class="layui-tab-item layui-show" style="" >
- </div>
- <div class="layui-tab-item " >
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-col-xs6" >
- <div class="layui-row no_select" style="margin: 10px 0px;font-size: 15px;color: #1E9FFF">
- 方式一:二维码
- </div>
- <div class="layui-row no_select" style="margin: 0px 10px">
- <div style="float: left;margin-bottom: 8px">
- 让被通知者 通过微信扫描二维码,二维码有效期7天。
- </div>
- <img id="myimg" style="width: 150px;height: 150px;float: left" src="https://osscold.baozhida.cn/images/二维码.png">
- </div>
- <!-- <div class="layui-row no_select" style="margin: 10px 0px;font-size: 15px;color: #1E9FFF;margin-top: 18px">-->
- <!-- 方式二:回复内容-->
- <!-- </div>-->
- <!-- <div id="Code" class="layui-row" style="height: 50px;margin: 0px 10px;border:1px solid #cbcbcb;box-shadow: 0px 0px 8px #316fe7;padding: 6px;border-radius:5px;">-->
- <!-- </div>-->
- </div>
- <div id="Notice_wx_list" class="layui-col-xs6" style="padding-left: 6px;padding-right: 6px;height: 350px;border-left:1px solid #cbcbcb;overflow-y:auto;">
- <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
- <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
- <!-- width="30"/>-->
- <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
- <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
- <!-- </div>-->
- <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
- <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
- <!-- onclick=""><i class="iconfont" style="margin-right: 2px"></i>删除</span>-->
- <!-- </div>-->
- <!-- </div>-->
- </div>
- </div>
- </div>
- <div class="layui-tab-item">
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-col-xs6" >
- <div class="layui-row" style="margin: 20px 0px">
- <label for="T_name" class="layui-form-label" style="margin-left: 6px;margin-top: 6px;padding:0px;padding-right: 10px">
- <span class="x-red">*</span>添加手机号码</label>
- <div class="layui-input-inline">
- <input type="text" id="E_phone" name="E_phone" required="" class="layui-input">
- </div>
- </div>
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-form-item" style="text-align: center;margin-top: 30px">
- <button class="layui-btn layui-btn-normal" onclick="Add_Notice_phone()">添加</button>
- </div>
- </div>
- </div>
- <div id="Notice_phone_list" class="layui-col-xs6" style="padding-left: 6px;padding-right: 6px;height: 350px;border-left:1px solid #cbcbcb;overflow-y:auto;">
- <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
- <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
- <!-- width="30"/>-->
- <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
- <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
- <!-- </div>-->
- <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
- <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
- <!-- onclick="Add_Notice_phone()"><i class="iconfont" style="margin-right: 2px"></i>删除</span>-->
- <!-- </div>-->
- <!-- </div>-->
- </div>
- </div>
- </div>
- <div class="layui-tab-item">
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-col-xs6" >
- <div class="layui-row" style="margin: 20px 0px">
- <label for="T_name" class="layui-form-label" style="margin-left: 6px;margin-top: 6px;padding:0px;padding-right: 10px">
- <span class="x-red">*</span>添加手机号码</label>
- <div class="layui-input-inline">
- <input type="text" id="E_message" name="E_message" required="" class="layui-input">
- </div>
- </div>
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-form-item" style="text-align: center;margin-top: 30px">
- <button class="layui-btn layui-btn-normal" onclick="Add_Notice_message()">添加</button>
- </div>
- </div>
- </div>
- <div id="Notice_message_list" class="layui-col-xs6" style="padding-left: 6px;padding-right: 6px;height: 350px;border-left:1px solid #cbcbcb;overflow-y:auto;">
- <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
- <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
- <!-- width="30"/>-->
- <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
- <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
- <!-- </div>-->
- <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
- <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
- <!-- onclick="Add_Notice_phone()"><i class="iconfont" style="margin-right: 2px"></i>删除</span>-->
- <!-- </div>-->
- <!-- </div>-->
- </div>
- </div>
- </div>
- <div class="layui-tab-item">
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-col-xs6" >
- <div class="layui-row" style="margin: 20px 0px">
- <label for="T_name" class="layui-form-label" style="margin-left: 6px;margin-top: 6px;padding:0px;padding-right: 10px">
- <span class="x-red">*</span>添加邮箱</label>
- <div class="layui-input-inline">
- <input type="text" id="E_mailbox" name="E_phone" required=""class="layui-input">
- </div>
- </div>
- <div class="layui-row" style="margin: 0px 10px">
- <div class="layui-form-item" style="text-align: center;margin-top: 30px">
- <button class="layui-btn layui-btn-normal" onclick="Add_Notice_mailbox()">添加</button>
- </div>
- </div>
- </div>
- <div id="Notice_mailbox_list" class="layui-col-xs6" style="padding-left: 6px;padding-right: 6px;height: 350px;border-left:1px solid #cbcbcb;overflow-y:auto;">
- <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
- <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
- <!-- width="30"/>-->
- <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
- <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
- <!-- </div>-->
- <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
- <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
- <!-- onclick="Add_Notice_phone()"><i class="iconfont" style="margin-right: 2px"></i>删除</span>-->
- <!-- </div>-->
- <!-- </div>-->
- </div>
- </div>
- </div>
- </div>
- </div>
- {{end}}
- <div class="layui-form-item" style="text-align: center;margin-top: 20px">
- <button class="layui-btn layui-btn-normal" onclick="DeviceClass_Post()">提交 {{if gt .id 0 }}(点击提交后生效){{end}}</button>
- </div>
- </div>
- </div>
- <script>
- //获取GET
- function getPar(par) {
- //获取当前URL
- var local_url = document.location.href;
- //获取要取得的get参数位置
- var get = local_url.indexOf(par + "=")
- ;
- if (get == -1) {
- return false;
- }
- //截取字符串
- //截取字符串
- var get_par = local_url.slice(par.length + get + 1);
- //判断截取后的字符串是否还有其他get参数
- var nextPar = get_par.indexOf("&")
- ;
- if (nextPar != -1) {
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
- // xxxx = plusXing(strx,"o5EKB1buEEsyDP6u-6H3H326T4no2","c")
- function plusXing(str, wid, v) {
- a_x = str.indexOf(wid+"/")
- return str.substring(0, a_x+wid.length + 1) + v + str.substring(str.indexOf("|",a_x),str.length);
- };
- layui.use(['form', 'layer',"layedit"],
- function() {
- $ = layui.jquery;
- var form = layui.form,
- layer = layui.layer;
- });
- function hello_s5 (){
- //要执行的代码
- console.log("开启 循环")
- forNotice_wx = true
- }
- function ShowElement(element,tid) {
- forNotice_wx = false
- var oldhtml = element.innerHTML;
- //创建新的input元素
- var newobj = document.createElement('input');
- //为新增元素添加类型
- newobj.type = 'text';
- //为新增元素添加value值
- newobj.value = oldhtml;
- //为新增元素添加光标离开事件
- newobj.onblur = function() {
- console.log("离开。。",tid,this.value == oldhtml ? oldhtml : this.value)
- element.innerHTML = this.value == oldhtml ? oldhtml : this.value;
- T_Notice_wx = plusXing(T_Notice_wx,tid,this.value == oldhtml ? oldhtml : this.value)
- console.log("T_Notice_wx:",T_Notice_wx)
- DeviceClass_Post()
- setTimeout(hello_s5,5000);//5秒后执行
- //当触发时判断新增元素值是否为空,为空则不修改,并返回原有值
- }
- //设置该标签的子节点为空
- element.innerHTML = '';
- //添加该标签的子节点,input对象
- element.appendChild(newobj);
- //设置选择文本的内容或设置光标位置(两个参数:start,end;start为开始位置,end为结束位置;如果开始位置和结束位置相同则就是光标位置)
- newobj.setSelectionRange(0, oldhtml.length);
- //设置获得光标
- newobj.focus();
- }
- var T_name = "{{.T.T_name}}"
- var T_Notice_wx = "{{.T.T_Notice_wx}}"
- var T_Notice_phone = "{{.T.T_Notice_phone}}"
- var T_Notice_message = "{{.T.T_Notice_message}}"
- var T_Notice_mailbox = "{{.T.T_Notice_mailbox}}"
- var T_Notice_mechanism = "{{.T.T_Notice_mechanism}}"
- var Onload = true
- var forNotice_wx = true
- // 页面 加载完成后执行
- window.onload=function(){
- console.log("页面 加载完成后执行")
- if(Onload && parseInt(getPar("id")) > 0){
- Onload =false;
- Show_Notice_T_Notice_mechanism(); // 报警机制
- Show_Notice_phone_list();
- Show_Notice_message_list();
- Show_Notice_mailbox_list();
- Get_DeviceClassId_QRCode();
- setTimeout("Automaticupdate_Notice_wx()", 1000)
- setInterval(function(){
- if(forNotice_wx){
- // Automaticupdate_Notice_wx();
- }
- },2000);
- }
- }
- // 微信
- function Automaticupdate_Notice_wx() {
- Get_DeviceClassId();
- }
- function Del_Notice_wx_plusXing(str, wid) {
- a_x = str.indexOf(wid+"/")
- return str.substring(a_x, str.indexOf("|",a_x));
- };
- function Del_Notice_wx(x) {
- srt_r = Del_Notice_wx_plusXing(T_Notice_wx,x)
- if(T_Notice_wx.indexOf(srt_r) == -1){
- layer.msg('删除失败');
- return
- }
- T_Notice_wx = T_Notice_wx.replace(srt_r + "|", "")
- Show_Notice_wx_list()
- DeviceClass_Post()
- }
- function Show_Notice_wx_list() {
- var scores = T_Notice_wx.split("|");
- $('#Notice_wx_list').html("");
- for (let i = 0; i < scores.length; i++) {
- if(scores[i].length == 0){
- return
- }
- scores_l = scores[i].split("/")
- $('#Notice_wx_list').append("" +
- "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
- " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/微信.png\" height=\"30\"\n" +
- " width=\"30\"/>\n" +
- " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
- " <div style=\"margin-top: 8px;font-size: 15px\" ondblclick=\"ShowElement(this,'"+scores_l[0]+"')\" >"+scores_l[1]+"</div>\n" +
- " </div>\n" +
- " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
- " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
- " onclick=\"Del_Notice_wx('"+scores_l[0]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\"></i>删除</span>\n" +
- " </div>\n" +
- "</div>")
- }
- if(scores.length == 0){
- $('#Notice_wx_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
- }
- }
- // 手机
- function Add_Notice_phone() {
- x = $("#E_phone").val()
- if(T_Notice_phone.indexOf(x) != -1){
- layer.msg('不能重复添加');
- return
- }
- T_Notice_phone = T_Notice_phone + x + "|"
- Show_Notice_phone_list()
- }
- function Del_Notice_phone(x) {
- if(T_Notice_phone.indexOf(x) == -1){
- layer.msg('删除失败');
- return
- }
- T_Notice_phone = T_Notice_phone.replace(x + "|", "")
- Show_Notice_phone_list()
- }
- function Show_Notice_phone_list() {
- var scores = T_Notice_phone.split("|");
- $('#Notice_phone_list').html("");
- for (let i = 0; i < scores.length; i++) {
- if(scores[i].length == 0){
- return
- }
- $('#Notice_phone_list').append("" +
- "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
- " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/电话.png\" height=\"30\"\n" +
- " width=\"30\"/>\n" +
- " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
- " <div style=\"margin-top: 8px;font-size: 15px\">"+scores[i]+"</div>\n" +
- " </div>\n" +
- " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
- " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
- " onclick=\"Del_Notice_phone('"+scores[i]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\"></i>删除</span>\n" +
- " </div>\n" +
- "</div>")
- }
- if(scores.length == 0){
- $('#Notice_phone_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
- }
- }
- // 短信
- function Add_Notice_message() {
- x = $("#E_message").val()
- if(T_Notice_message.indexOf(x) != -1){
- layer.msg('不能重复添加');
- return
- }
- T_Notice_message = T_Notice_message + x + "|"
- Show_Notice_message_list()
- }
- function Del_Notice_message(x) {
- if(T_Notice_message.indexOf(x) == -1){
- layer.msg('删除失败');
- return
- }
- T_Notice_message = T_Notice_message.replace(x + "|", "")
- Show_Notice_message_list()
- }
- function Show_Notice_message_list() {
- var scores = T_Notice_message.split("|");
- $('#Notice_message_list').html("");
- for (let i = 0; i < scores.length; i++) {
- if(scores[i].length == 0){
- return
- }
- $('#Notice_message_list').append("" +
- "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
- " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/短信.png\" height=\"30\"\n" +
- " width=\"30\"/>\n" +
- " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
- " <div style=\"margin-top: 8px;font-size: 15px\">"+scores[i]+"</div>\n" +
- " </div>\n" +
- " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
- " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
- " onclick=\"Del_Notice_message('"+scores[i]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\"></i>删除</span>\n" +
- " </div>\n" +
- "</div>")
- }
- if(scores.length == 0){
- $('#Notice_message_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
- }
- }
- // 邮件
- function Add_Notice_mailbox() {
- x = $("#E_mailbox").val()
- if(T_Notice_mailbox.indexOf(x) != -1){
- layer.msg('不能重复添加');
- return
- }
- T_Notice_mailbox = T_Notice_mailbox + x + "|"
- Show_Notice_mailbox_list()
- }
- function Del_Notice_mailbox(x) {
- if(T_Notice_mailbox.indexOf(x) == -1){
- layer.msg('删除失败');
- return
- }
- T_Notice_mailbox = T_Notice_mailbox.replace(x + "|", "")
- Show_Notice_mailbox_list()
- }
- function Show_Notice_mailbox_list() {
- var scores = T_Notice_mailbox.split("|");
- $('#Notice_mailbox_list').html("");
- for (let i = 0; i < scores.length; i++) {
- if(scores[i].length == 0){
- return
- }
- $('#Notice_mailbox_list').append("" +
- "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
- " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/邮箱.png\" height=\"30\"\n" +
- " width=\"30\"/>\n" +
- " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
- " <div style=\"margin-top: 8px;font-size: 15px\">"+scores[i]+"</div>\n" +
- " </div>\n" +
- " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
- " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
- " onclick=\"Del_Notice_mailbox('"+scores[i]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\"></i>删除</span>\n" +
- " </div>\n" +
- "</div>")
- }
- if(scores.length == 0){
- $('#Notice_mailbox_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
- }
- }
- function Get_DeviceClassId_QRCode(){
- $.ajax({
- type: 'POST',
- url: 'Get_DeviceClassId_QRCode',//发送请求
- data: {
- User_tokey: $.cookie("User_tokey"),
- T_class_id: parseInt(getPar("id")),
- },
- success: function(result) {
- console.log(result)
- if (result.Code == 200 ){
- $("#myimg").attr('src',result.Data.QR);
- // $('#Code').html(result.Data.Code);
- }else {
- layer.msg('二维码生成失败!', {
- time: 2000
- });
- }
- }
- });
- }
- function Get_DeviceClassId(){
- $.ajax({
- type: 'POST',
- url: 'Get_DeviceClassId',//发送请求
- data: {
- User_tokey: $.cookie("User_tokey"),
- T_class_id: parseInt(getPar("id")),
- },
- success: function(result) {
- console.log(result)
- if (result.Code == 200 ){
- T_Notice_wx = result.Data.T_Notice_wx
- Show_Notice_wx_list()
- }else {
- layer.msg('二维码生成失败!', {
- time: 2000
- });
- }
- }
- });
- }
- function DeviceClass_Post(){
- var loading = layer.load(0, {
- shade: false,
- time: 99*1000
- });
- $.ajax({
- type: 'POST',
- url: 'DeviceClass_Post',//发送请求
- data: {
- Id:"{{.id}}",
- T_name:$("#T_name").val(),
- T_Notice_wx:T_Notice_wx,
- T_Notice_phone:T_Notice_phone,
- T_Notice_message:T_Notice_message,
- T_Notice_mailbox:T_Notice_mailbox,
- T_Notice_mechanism:Get_Notice_T_Notice_mechanism(),
- },
- success: function(result) {
- console.log(result)
- layer.close(loading)
- //关闭当前frame
- parent.layer.close();
- parent.location.reload();
- }
- });
- }
- </script>
- <script>
- // 初始化 报警规则机制
- function T_Notice_mechanism_initialization(){
- var loading = layer.load(0, {
- shade: false,
- time: 99*1000
- });
- $.ajax({
- type: 'POST',
- url: 'DeviceWarningListT_Tips',//发送请求
- success: function(result) {
- console.log(result)
- layer.close(loading)
- //关闭当前frame
- // parent.layer.close();
- // parent.location.reload();
- T_Notice_mechanism = result.Data
- Show_Notice_T_Notice_mechanism()
- }
- });
- }
- function Get_Notice_T_Notice_mechanism() {
- box = $(".box_x")
- if(box.length < 8){
- return ""
- }
- box_x = (box.length / 15) - 1
- console.log("box_x:",box_x)
- i_v = 15
- str_ = ""
- for (let i = 0; i < box_x; i++) {
- i_ = 15 + 15 * i
- str_ += box[i_+0].textContent + ","
- i_++
- if(box[i_].firstElementChild.checked == true){
- str_ += "1,"
- }else {
- str_ += "0,"
- }
- i_++
- if(box[i_].firstElementChild.checked == true){
- str_ += "1,"
- }else {
- str_ += "0,"
- }
- i_++
- if(box[i_].firstElementChild.checked == true){
- str_ += "1,"
- }else {
- str_ += "0,"
- }
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- if(box[i_].firstElementChild.checked == true){
- str_ += "1,"
- }else {
- str_ += "0,"
- }
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- if(box[i_].firstElementChild.checked == true){
- str_ += "1,"
- }else {
- str_ += "0,"
- }
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- if(box[i_].firstElementChild.checked == true){
- str_ += "1,"
- }else {
- str_ += "0,"
- }
- i_++
- str_ += box[i_].firstElementChild.value + ","
- i_++
- str_ += box[i_].firstElementChild.value + ""
- str_ += "|"
- }
- return str_
- }
- function Show_Notice_T_Notice_mechanism() {
- console.log("======")
- var scores = T_Notice_mechanism.split("|");
- $('#T_Notice_mechanism').html("<div class=\"layui-row\">\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;width: 120px;\">报警类型</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: 1px;\">记录</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: 1px;\">处理</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: 1px;\">微信</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: 1px;\">短信</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: 1px;\">手机</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: 1px;\">邮箱</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
- " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
- " </div>");
- for (let i = 0; i < scores.length; i++) {
- if(scores[i].length == 0){
- break
- }
- row = scores[i].split(",");
- $('#T_Notice_mechanism').append("" +
- "\n" +
- " <div class=\"layui-row\">\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;width: 120px;\">"+row[0]+"</div>\n" +
- " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
- " <input type=\"checkbox\">\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
- " <input type=\"checkbox\">\n" +
- " </div>\n" +
- "\n" +
- " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
- " <input type=\"checkbox\">\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[4]+"'>\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[5]+"'>\n" +
- " </div>\n" +
- "\n" +
- " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
- " <input type=\"checkbox\">\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[7]+"'>\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[8]+"'>\n" +
- " </div>\n" +
- "\n" +
- " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
- " <input type=\"checkbox\">\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[10]+"'>\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[11]+"'>\n" +
- " </div>\n" +
- "\n" +
- " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
- " <input type=\"checkbox\">\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[13]+"'>\n" +
- " </div>\n" +
- " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
- " <input type=\"text\" style=\"width: 40px;\" value='"+row[14]+"'>\n" +
- " </div>\n" +
- "\n" +
- "\n" +
- " </div>\n")
- box = $(".box_x")
- if(row[1] == 1){
- box[box.length-1-13].firstElementChild.checked = true
- }
- if(row[2] == 1){
- box[box.length-1-12].firstElementChild.checked = true
- }
- if(row[3] == 1){
- box[box.length-1-11].firstElementChild.checked = true
- }
- if(row[6] == 1){
- box[box.length-1-8].firstElementChild.checked = true
- }
- if(row[9] == 1){
- box[box.length-1-5].firstElementChild.checked = true
- }
- if(row[12] == 1){
- box[box.length-1-2].firstElementChild.checked = true
- }
- }
- $('#T_Notice_mechanism').append("<div class='layui-row' style='text-align: center;margin-top: 20px'> " +
- "<button class=\"layui-btn layui-btn-normal\" onclick=\"T_Notice_mechanism_initialization()\">重置数据</button><button class=\"layui-btn layui-btn-normal\" onclick=\"T_Notice_mechanism_initialization()\">说明</button>" +
- " </div>" )
- }
- </script>
- </body>
- </html>
|