DeviceClass-.html 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. <!DOCTYPE html>
  2. <html class="x-admin-sm">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="renderer" content="webkit">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  8. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
  9. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
  10. <link rel="stylesheet" href="https://osscold.baozhida.cn/lib/layui/layui.css">
  11. <script type="text/javascript" src="https://osscold.baozhida.cn/lib/layui/layui.js" charset="utf-8"></script>
  12. <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
  13. <script src="https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js"></script>
  14. <script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
  15. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  16. <!--[if lt IE 9]>
  17. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  18. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  19. <![endif]--></head>
  20. <style>
  21. .no_select{
  22. -webkit-touch-callout: none;
  23. -moz-user-select: none; /*火狐*/
  24. -webkit-user-select: none; /*webkit浏览器*/
  25. -ms-user-select: none; /*IE10*/
  26. -khtml-user-select: none; /*早期浏览器*/
  27. user-select: none;
  28. }
  29. .box_x{
  30. border: 1px solid #1E9FFF;
  31. width: 42px;
  32. height: 16px;
  33. margin: 0;
  34. padding: 4px;
  35. float: left;
  36. text-align: center;
  37. }
  38. </style>
  39. <body>
  40. <div class="layui-fluid">
  41. <div class="layui-row">
  42. <div class="layui-form-item">
  43. <label for="T_name" class="layui-form-label" style="width: 140px">
  44. <span class="x-red">*</span>传感器 分类名称</label>
  45. <div class="layui-input-inline">
  46. <input {{if gt .id 0 }}
  47. value="{{.T.T_name}}"
  48. {{end}} type="text" id="T_name" name="T_name" required="" lay-verify="required" autocomplete="off" class="layui-input"></div>
  49. </div>
  50. {{if ne .id 0 }}
  51. <div class="layui-tab layui-tab-card">
  52. <ul class="layui-tab-title">
  53. <li class="layui-this">通知规则</li>
  54. <li class="">微信通知</li>
  55. {{if eq 0 $.Admin_r.Admin_master}}
  56. <li class="">微信通知(冷链)</li>
  57. {{end}}
  58. <li class="">短信通知</li>
  59. <li class="">电话通知</li>
  60. <li class="">邮箱通知</li>
  61. </ul>
  62. <div class="layui-tab-content" style="height: 340px;overflow-y: auto;">
  63. <div id="T_Notice_mechanism" class="layui-tab-item layui-show" style="" >
  64. </div>
  65. <div class="layui-tab-item " >
  66. <div class="layui-row" style="margin: 0px 10px">
  67. <div class="layui-col-xs6" >
  68. <div class="layui-row no_select" style="margin: 10px 0px;font-size: 15px;color: #1E9FFF">
  69. 方式一:二维码
  70. </div>
  71. <div class="layui-row no_select" style="margin: 0px 10px">
  72. <div style="float: left;margin-bottom: 8px">
  73. 让被通知者 通过微信扫描二维码,二维码有效期7天。
  74. </div>
  75. <img id="myimg" style="width: 150px;height: 150px;float: left" src="https://osscold.baozhida.cn/images/二维码.png">
  76. </div>
  77. <!-- <div class="layui-row no_select" style="margin: 10px 0px;font-size: 15px;color: #1E9FFF;margin-top: 18px">-->
  78. <!-- 方式二:回复内容-->
  79. <!-- </div>-->
  80. <!-- <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;">-->
  81. <!-- </div>-->
  82. </div>
  83. <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;">
  84. <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
  85. <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
  86. <!-- width="30"/>-->
  87. <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
  88. <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
  89. <!-- </div>-->
  90. <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
  91. <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
  92. <!-- onclick=""><i class="iconfont" style="margin-right: 2px">&#xe69d;</i>删除</span>-->
  93. <!-- </div>-->
  94. <!-- </div>-->
  95. </div>
  96. </div>
  97. </div>
  98. {{if eq 0 $.Admin_r.Admin_master}}
  99. <div class="layui-tab-item " >
  100. <div class="layui-row" style="margin: 0px 10px">
  101. <div class="layui-col-xs6" >
  102. <div class="layui-row no_select" style="margin: 10px 0px;font-size: 15px;color: #1E9FFF">
  103. 方式一:二维码
  104. </div>
  105. <div class="layui-row no_select" style="margin: 0px 10px">
  106. <div style="float: left;margin-bottom: 8px">
  107. 让被通知者 通过微信扫描二维码,二维码有效期7天。
  108. </div>
  109. <img id="myimg2" style="width: 150px;height: 150px;float: left" src="https://osscold.baozhida.cn/images/二维码.png">
  110. </div>
  111. <!-- <div class="layui-row no_select" style="margin: 10px 0px;font-size: 15px;color: #1E9FFF;margin-top: 18px">-->
  112. <!-- 方式二:回复内容-->
  113. <!-- </div>-->
  114. <!-- <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;">-->
  115. <!-- </div>-->
  116. </div>
  117. <div id="Notice_wx2_list" class="layui-col-xs6" style="padding-left: 6px;padding-right: 6px;height: 350px;border-left:1px solid #cbcbcb;overflow-y:auto;">
  118. <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
  119. <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
  120. <!-- width="30"/>-->
  121. <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
  122. <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
  123. <!-- </div>-->
  124. <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
  125. <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
  126. <!-- onclick=""><i class="iconfont" style="margin-right: 2px">&#xe69d;</i>删除</span>-->
  127. <!-- </div>-->
  128. <!-- </div>-->
  129. </div>
  130. </div>
  131. </div>
  132. {{end}}
  133. <div class="layui-tab-item">
  134. <div class="layui-row" style="margin: 0px 10px">
  135. <div class="layui-col-xs6" >
  136. <div class="layui-row" style="margin: 20px 0px">
  137. <label for="T_name" class="layui-form-label" style="margin-left: 6px;margin-top: 6px;padding:0px;padding-right: 10px">
  138. <span class="x-red">*</span>添加手机号码</label>
  139. <div class="layui-input-inline">
  140. <input type="text" id="E_message" name="E_message" required="" class="layui-input">
  141. </div>
  142. </div>
  143. <div class="layui-row" style="margin: 0px 10px">
  144. <div class="layui-form-item" style="text-align: center;margin-top: 30px">
  145. <button class="layui-btn layui-btn-normal" onclick="Add_Notice_message()">添加</button>
  146. </div>
  147. </div>
  148. </div>
  149. <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;">
  150. <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
  151. <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
  152. <!-- width="30"/>-->
  153. <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
  154. <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
  155. <!-- </div>-->
  156. <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
  157. <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
  158. <!-- onclick="Add_Notice_phone()"><i class="iconfont" style="margin-right: 2px">&#xe69d;</i>删除</span>-->
  159. <!-- </div>-->
  160. <!-- </div>-->
  161. </div>
  162. </div>
  163. </div>
  164. <div class="layui-tab-item">
  165. <div class="layui-row" style="margin: 0px 10px">
  166. <div class="layui-col-xs6" >
  167. <div class="layui-row" style="margin: 20px 0px">
  168. <label for="T_name" class="layui-form-label" style="margin-left: 6px;margin-top: 6px;padding:0px;padding-right: 10px">
  169. <span class="x-red">*</span>添加手机号码</label>
  170. <div class="layui-input-inline">
  171. <input type="text" id="E_phone" name="E_phone" required="" class="layui-input">
  172. </div>
  173. </div>
  174. <div class="layui-row" style="margin: 0px 10px">
  175. <div class="layui-form-item" style="text-align: center;margin-top: 30px">
  176. <button class="layui-btn layui-btn-normal" onclick="Add_Notice_phone()">添加</button>
  177. </div>
  178. </div>
  179. </div>
  180. <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;">
  181. <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
  182. <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
  183. <!-- width="30"/>-->
  184. <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
  185. <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
  186. <!-- </div>-->
  187. <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
  188. <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
  189. <!-- onclick="Add_Notice_phone()"><i class="iconfont" style="margin-right: 2px">&#xe69d;</i>删除</span>-->
  190. <!-- </div>-->
  191. <!-- </div>-->
  192. </div>
  193. </div>
  194. </div>
  195. <div class="layui-tab-item">
  196. <div class="layui-row" style="margin: 0px 10px">
  197. <div class="layui-col-xs6" >
  198. <div class="layui-row" style="margin: 20px 0px">
  199. <label for="T_name" class="layui-form-label" style="margin-left: 6px;margin-top: 6px;padding:0px;padding-right: 10px">
  200. <span class="x-red">*</span>添加邮箱</label>
  201. <div class="layui-input-inline">
  202. <input type="text" id="E_mailbox" name="E_phone" required=""class="layui-input">
  203. </div>
  204. </div>
  205. <div class="layui-row" style="margin: 0px 10px">
  206. <div class="layui-form-item" style="text-align: center;margin-top: 30px">
  207. <button class="layui-btn layui-btn-normal" onclick="Add_Notice_mailbox()">添加</button>
  208. </div>
  209. </div>
  210. </div>
  211. <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;">
  212. <!-- <div class="layui-col" style="height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;">-->
  213. <!-- <img style="float: left;width: 30px;margin: 0px 10px;margin-top: 2px;" src="https://osscold.baozhida.cn/images/微信.png" height="30"-->
  214. <!-- width="30"/>-->
  215. <!-- <div style="float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">-->
  216. <!-- <div style="margin-top: 8px;font-size: 15px">SN:KF20210510143443</div>-->
  217. <!-- </div>-->
  218. <!-- <div class="layui-card-header" style="float: right; padding: 0px;height: 0px;">-->
  219. <!-- <span style="float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;"-->
  220. <!-- onclick="Add_Notice_phone()"><i class="iconfont" style="margin-right: 2px">&#xe69d;</i>删除</span>-->
  221. <!-- </div>-->
  222. <!-- </div>-->
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. {{end}}
  229. <div class="layui-form-item" style="text-align: center;margin-top: 20px">
  230. <button class="layui-btn layui-btn-normal" onclick="DeviceClass_Post(true)">提交 {{if gt .id 0 }}(点击提交后生效){{end}}</button>
  231. </div>
  232. </div>
  233. </div>
  234. <script>
  235. //获取GET
  236. function getPar(par) {
  237. //获取当前URL
  238. var local_url = document.location.href;
  239. //获取要取得的get参数位置
  240. var get = local_url.indexOf(par + "=")
  241. ;
  242. if (get == -1) {
  243. return false;
  244. }
  245. //截取字符串
  246. //截取字符串
  247. var get_par = local_url.slice(par.length + get + 1);
  248. //判断截取后的字符串是否还有其他get参数
  249. var nextPar = get_par.indexOf("&")
  250. ;
  251. if (nextPar != -1) {
  252. get_par = get_par.slice(0, nextPar);
  253. }
  254. return get_par;
  255. }
  256. // xxxx = plusXing(strx,"o5EKB1buEEsyDP6u-6H3H326T4no2","c")
  257. function plusXing(str, wid, v) {
  258. a_x = str.indexOf(wid+"/")
  259. return str.substring(0, a_x+wid.length + 1) + v + str.substring(str.indexOf("|",a_x),str.length);
  260. };
  261. layui.use(['form', 'layer',"layedit"],
  262. function() {
  263. $ = layui.jquery;
  264. var form = layui.form,
  265. layer = layui.layer;
  266. });
  267. function hello_s5 (){
  268. //要执行的代码
  269. console.log("开启 循环")
  270. forNotice_wx = true
  271. }
  272. function ShowElement(element,tid) {
  273. forNotice_wx = false
  274. var oldhtml = element.innerHTML;
  275. //创建新的input元素
  276. var newobj = document.createElement('input');
  277. //为新增元素添加类型
  278. newobj.type = 'text';
  279. //为新增元素添加value值
  280. newobj.value = oldhtml;
  281. //为新增元素添加光标离开事件
  282. newobj.onblur = function() {
  283. console.log("离开。。",tid,this.value == oldhtml ? oldhtml : this.value)
  284. element.innerHTML = this.value == oldhtml ? oldhtml : this.value;
  285. T_Notice_wx = plusXing(T_Notice_wx,tid,this.value == oldhtml ? oldhtml : this.value)
  286. console.log("T_Notice_wx:",T_Notice_wx)
  287. DeviceClass_Post(false)
  288. setTimeout(hello_s5,5000);//5秒后执行
  289. //当触发时判断新增元素值是否为空,为空则不修改,并返回原有值
  290. }
  291. //设置该标签的子节点为空
  292. element.innerHTML = '';
  293. //添加该标签的子节点,input对象
  294. element.appendChild(newobj);
  295. //设置选择文本的内容或设置光标位置(两个参数:start,end;start为开始位置,end为结束位置;如果开始位置和结束位置相同则就是光标位置)
  296. newobj.setSelectionRange(0, oldhtml.length);
  297. //设置获得光标
  298. newobj.focus();
  299. }
  300. var T_name = "{{.T.T_name}}"
  301. var T_Notice_wx = "{{.T.T_Notice_wx}}"
  302. var T_Notice_wx2 = "{{.T.T_Notice_wx2}}"
  303. var T_Notice_phone = "{{.T.T_Notice_phone}}"
  304. var T_Notice_message = "{{.T.T_Notice_message}}"
  305. var T_Notice_mailbox = "{{.T.T_Notice_mailbox}}"
  306. var T_Notice_mechanism = "{{.T.T_Notice_mechanism}}"
  307. var Onload = true
  308. var forNotice_wx = true
  309. // 页面 加载完成后执行
  310. window.onload=function(){
  311. console.log("页面 加载完成后执行")
  312. if(Onload && parseInt(getPar("id")) > 0){
  313. Onload =false;
  314. Show_Notice_T_Notice_mechanism(); // 报警机制
  315. Show_Notice_phone_list();
  316. Show_Notice_message_list();
  317. Show_Notice_mailbox_list();
  318. Get_DeviceClassId_QRCode();
  319. setTimeout("Automaticupdate_Notice_wx()", 1000)
  320. setTimeout("Automaticupdate_Notice_wx2()", 1000)
  321. setInterval(function(){
  322. if(forNotice_wx){
  323. Automaticupdate_Notice_wx();
  324. }
  325. },2000);
  326. }
  327. }
  328. // 微信
  329. function Automaticupdate_Notice_wx() {
  330. Get_DeviceClassId();
  331. }
  332. function Del_Notice_wx_plusXing(str, wid) {
  333. a_x = str.indexOf(wid+"/")
  334. return str.substring(a_x, str.indexOf("|",a_x));
  335. };
  336. function Del_Notice_wx(x) {
  337. srt_r = Del_Notice_wx_plusXing(T_Notice_wx,x)
  338. if(T_Notice_wx.indexOf(srt_r) == -1){
  339. layer.msg('删除失败');
  340. return
  341. }
  342. T_Notice_wx = T_Notice_wx.replace(srt_r + "|", "")
  343. Show_Notice_wx_list()
  344. DeviceClass_Post(false)
  345. }
  346. function Del_Notice_wx2(x) {
  347. srt_r = Del_Notice_wx_plusXing(T_Notice_wx2,x)
  348. if(T_Notice_wx2.indexOf(srt_r) == -1){
  349. layer.msg('删除失败');
  350. return
  351. }
  352. T_Notice_wx2 = T_Notice_wx2.replace(srt_r + "|", "")
  353. Show_Notice_wx_list2()
  354. DeviceClass_Post(false)
  355. }
  356. function Show_Notice_wx_list() {
  357. var scores = T_Notice_wx.split("|");
  358. $('#Notice_wx_list').html("");
  359. for (let i = 0; i < scores.length; i++) {
  360. if(scores[i].length == 0){
  361. return
  362. }
  363. scores_l = scores[i].split("/")
  364. $('#Notice_wx_list').append("" +
  365. "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
  366. " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/微信.png\" height=\"30\"\n" +
  367. " width=\"30\"/>\n" +
  368. " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
  369. " <div style=\"margin-top: 8px;font-size: 15px\" ondblclick=\"ShowElement(this,'"+scores_l[0]+"')\" >"+scores_l[1]+"</div>\n" +
  370. " </div>\n" +
  371. " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
  372. " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
  373. " onclick=\"Del_Notice_wx('"+scores_l[0]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\">&#xe69d;</i>删除</span>\n" +
  374. " </div>\n" +
  375. "</div>")
  376. }
  377. if(scores.length == 0){
  378. $('#Notice_wx_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
  379. }
  380. }
  381. function Show_Notice_wx_list2() {
  382. var scores = T_Notice_wx2.split("|");
  383. $('#Notice_wx2_list').html("");
  384. for (let i = 0; i < scores.length; i++) {
  385. if(scores[i].length == 0){
  386. return
  387. }
  388. scores_l = scores[i].split("/")
  389. $('#Notice_wx2_list').append("" +
  390. "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
  391. " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/微信.png\" height=\"30\"\n" +
  392. " width=\"30\"/>\n" +
  393. " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
  394. " <div style=\"margin-top: 8px;font-size: 15px\" ondblclick=\"ShowElement(this,'"+scores_l[0]+"')\" >"+scores_l[1]+"</div>\n" +
  395. " </div>\n" +
  396. " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
  397. " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
  398. " onclick=\"Del_Notice_wx2('"+scores_l[0]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\">&#xe69d;</i>删除</span>\n" +
  399. " </div>\n" +
  400. "</div>")
  401. }
  402. if(scores.length == 0){
  403. $('#Notice_wx2_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
  404. }
  405. }
  406. // 手机
  407. function Add_Notice_phone() {
  408. x = $("#E_phone").val()
  409. if(T_Notice_phone.indexOf(x) != -1){
  410. layer.msg('不能重复添加');
  411. return
  412. }
  413. T_Notice_phone = T_Notice_phone + x + "|"
  414. Show_Notice_phone_list()
  415. }
  416. function Del_Notice_phone(x) {
  417. if(T_Notice_phone.indexOf(x) == -1){
  418. layer.msg('删除失败');
  419. return
  420. }
  421. T_Notice_phone = T_Notice_phone.replace(x + "|", "")
  422. Show_Notice_phone_list()
  423. }
  424. function Show_Notice_phone_list() {
  425. var scores = T_Notice_phone.split("|");
  426. $('#Notice_phone_list').html("");
  427. for (let i = 0; i < scores.length; i++) {
  428. if(scores[i].length == 0){
  429. return
  430. }
  431. $('#Notice_phone_list').append("" +
  432. "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
  433. " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/电话.png\" height=\"30\"\n" +
  434. " width=\"30\"/>\n" +
  435. " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
  436. " <div style=\"margin-top: 8px;font-size: 15px\">"+scores[i]+"</div>\n" +
  437. " </div>\n" +
  438. " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
  439. " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
  440. " onclick=\"Del_Notice_phone('"+scores[i]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\">&#xe69d;</i>删除</span>\n" +
  441. " </div>\n" +
  442. "</div>")
  443. }
  444. if(scores.length == 0){
  445. $('#Notice_phone_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
  446. }
  447. }
  448. // 短信
  449. function Add_Notice_message() {
  450. x = $("#E_message").val()
  451. if(T_Notice_message.indexOf(x) != -1){
  452. layer.msg('不能重复添加');
  453. return
  454. }
  455. T_Notice_message = T_Notice_message + x + "|"
  456. Show_Notice_message_list()
  457. }
  458. function Del_Notice_message(x) {
  459. if(T_Notice_message.indexOf(x) == -1){
  460. layer.msg('删除失败');
  461. return
  462. }
  463. T_Notice_message = T_Notice_message.replace(x + "|", "")
  464. Show_Notice_message_list()
  465. }
  466. function Show_Notice_message_list() {
  467. var scores = T_Notice_message.split("|");
  468. $('#Notice_message_list').html("");
  469. for (let i = 0; i < scores.length; i++) {
  470. if(scores[i].length == 0){
  471. return
  472. }
  473. $('#Notice_message_list').append("" +
  474. "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
  475. " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/短信.png\" height=\"30\"\n" +
  476. " width=\"30\"/>\n" +
  477. " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
  478. " <div style=\"margin-top: 8px;font-size: 15px\">"+scores[i]+"</div>\n" +
  479. " </div>\n" +
  480. " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
  481. " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
  482. " onclick=\"Del_Notice_message('"+scores[i]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\">&#xe69d;</i>删除</span>\n" +
  483. " </div>\n" +
  484. "</div>")
  485. }
  486. if(scores.length == 0){
  487. $('#Notice_message_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
  488. }
  489. }
  490. // 邮件
  491. function Add_Notice_mailbox() {
  492. x = $("#E_mailbox").val()
  493. if(T_Notice_mailbox.indexOf(x) != -1){
  494. layer.msg('不能重复添加');
  495. return
  496. }
  497. T_Notice_mailbox = T_Notice_mailbox + x + "|"
  498. Show_Notice_mailbox_list()
  499. }
  500. function Del_Notice_mailbox(x) {
  501. if(T_Notice_mailbox.indexOf(x) == -1){
  502. layer.msg('删除失败');
  503. return
  504. }
  505. T_Notice_mailbox = T_Notice_mailbox.replace(x + "|", "")
  506. Show_Notice_mailbox_list()
  507. }
  508. function Show_Notice_mailbox_list() {
  509. var scores = T_Notice_mailbox.split("|");
  510. $('#Notice_mailbox_list').html("");
  511. for (let i = 0; i < scores.length; i++) {
  512. if(scores[i].length == 0){
  513. return
  514. }
  515. $('#Notice_mailbox_list').append("" +
  516. "<div class=\"layui-col\" style=\"height: 32px;background-color: #fafafa;border-radius:5px;margin-bottom: 4px;\">\n" +
  517. " <img style=\"float: left;width: 30px;margin: 0px 10px;margin-top: 2px;\" src=\"https://osscold.baozhida.cn/images/邮箱.png\" height=\"30\"\n" +
  518. " width=\"30\"/>\n" +
  519. " <div style=\"float: left;width: 170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">\n" +
  520. " <div style=\"margin-top: 8px;font-size: 15px\">"+scores[i]+"</div>\n" +
  521. " </div>\n" +
  522. " <div class=\"layui-card-header\" style=\"float: right; padding: 0px;height: 0px;\">\n" +
  523. " <span style=\"float: right;margin-top: 0px;color: rgba(255,73,91,0.95);height: 20px;margin-right: 6px;margin-top: -4px;\"\n" +
  524. " onclick=\"Del_Notice_mailbox('"+scores[i]+"')\"><i class=\"iconfont\" style=\"margin-right: 2px\">&#xe69d;</i>删除</span>\n" +
  525. " </div>\n" +
  526. "</div>")
  527. }
  528. if(scores.length == 0){
  529. $('#Notice_mailbox_list').append("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\" > 没有数据 < /div>" )
  530. }
  531. }
  532. function Get_DeviceClassId_QRCode(){
  533. $.ajax({
  534. type: 'POST',
  535. url: 'Get_DeviceClassId_QRCode',//发送请求
  536. data: {
  537. User_tokey: $.cookie("User_tokey"),
  538. T_class_id: parseInt(getPar("id")),
  539. },
  540. success: function(result) {
  541. console.log(result)
  542. if (result.Code == 200 ){
  543. $("#myimg").attr('src',result.Data.QR);
  544. // $('#Code').html(result.Data.Code);
  545. }else {
  546. layer.msg('二维码生成失败!', {
  547. time: 2000
  548. });
  549. }
  550. }
  551. });
  552. $.ajax({
  553. type: 'POST',
  554. url: 'Get_DeviceClassId_QRCode2',//发送请求
  555. data: {
  556. User_tokey: $.cookie("User_tokey"),
  557. T_class_id: parseInt(getPar("id")),
  558. },
  559. success: function(result) {
  560. console.log(result)
  561. if (result.Code == 200 ){
  562. $("#myimg2").attr('src',result.Data.QR);
  563. // $('#Code').html(result.Data.Code);
  564. }else {
  565. layer.msg('二维码生成失败!', {
  566. time: 2000
  567. });
  568. }
  569. }
  570. });
  571. }
  572. function Get_DeviceClassId(){
  573. $.ajax({
  574. type: 'POST',
  575. url: 'Get_DeviceClassId',//发送请求
  576. data: {
  577. T_class_id: parseInt(getPar("id")),
  578. },
  579. success: function(result) {
  580. console.log(result)
  581. if (result.Code == 200 ){
  582. T_Notice_wx = result.Data.T_Notice_wx
  583. Show_Notice_wx_list()
  584. T_Notice_wx2 = result.Data.T_Notice_wx2
  585. Show_Notice_wx_list2()
  586. }else {
  587. layer.msg('获取数据失败!', {
  588. time: 2000
  589. });
  590. }
  591. }
  592. });
  593. }
  594. function DeviceClass_Post(is){
  595. var loading = layer.load(0, {
  596. shade: false,
  597. time: 99*1000
  598. });
  599. $.ajax({
  600. type: 'POST',
  601. url: 'DeviceClass_Post',//发送请求
  602. data: {
  603. Id:"{{.id}}",
  604. T_name:$("#T_name").val(),
  605. T_Notice_wx:T_Notice_wx,
  606. T_Notice_wx2:T_Notice_wx2,
  607. T_Notice_phone:T_Notice_phone,
  608. T_Notice_message:T_Notice_message,
  609. T_Notice_mailbox:T_Notice_mailbox,
  610. T_Notice_mechanism:Get_Notice_T_Notice_mechanism(),
  611. },
  612. success: function(result) {
  613. console.log(result)
  614. layer.close(loading)
  615. if(result.Code == 200){
  616. if(is){
  617. //关闭当前frame
  618. parent.layer.close();
  619. parent.location.reload();
  620. }
  621. }
  622. }
  623. });
  624. }
  625. </script>
  626. <script>
  627. // 初始化 报警规则机制
  628. function T_Notice_mechanism_initialization(){
  629. var loading = layer.load(0, {
  630. shade: false,
  631. time: 99*1000
  632. });
  633. $.ajax({
  634. type: 'POST',
  635. url: 'DeviceWarningListT_Tips',//发送请求
  636. success: function(result) {
  637. console.log(result)
  638. layer.close(loading)
  639. //关闭当前frame
  640. // parent.layer.close();
  641. // parent.location.reload();
  642. T_Notice_mechanism = result.Data
  643. Show_Notice_T_Notice_mechanism()
  644. }
  645. });
  646. }
  647. function Get_Notice_T_Notice_mechanism() {
  648. box = $(".box_x")
  649. if(box.length < 8){
  650. return ""
  651. }
  652. box_x = (box.length / 15) - 1
  653. console.log("box_x:",box_x)
  654. i_v = 15
  655. str_ = ""
  656. for (let i = 0; i < box_x; i++) {
  657. i_ = 15 + 15 * i
  658. str_ += box[i_+0].textContent + ","
  659. i_++
  660. if(box[i_].firstElementChild.checked == true){
  661. str_ += "1,"
  662. }else {
  663. str_ += "0,"
  664. }
  665. i_++
  666. if(box[i_].firstElementChild.checked == true){
  667. str_ += "1,"
  668. }else {
  669. str_ += "0,"
  670. }
  671. i_++
  672. if(box[i_].firstElementChild.checked == true){
  673. str_ += "1,"
  674. }else {
  675. str_ += "0,"
  676. }
  677. i_++
  678. str_ += box[i_].firstElementChild.value + ","
  679. i_++
  680. str_ += box[i_].firstElementChild.value + ","
  681. i_++
  682. if(box[i_].firstElementChild.checked == true){
  683. str_ += "1,"
  684. }else {
  685. str_ += "0,"
  686. }
  687. i_++
  688. str_ += box[i_].firstElementChild.value + ","
  689. i_++
  690. str_ += box[i_].firstElementChild.value + ","
  691. i_++
  692. if(box[i_].firstElementChild.checked == true){
  693. str_ += "1,"
  694. }else {
  695. str_ += "0,"
  696. }
  697. i_++
  698. str_ += box[i_].firstElementChild.value + ","
  699. i_++
  700. str_ += box[i_].firstElementChild.value + ","
  701. i_++
  702. if(box[i_].firstElementChild.checked == true){
  703. str_ += "1,"
  704. }else {
  705. str_ += "0,"
  706. }
  707. i_++
  708. str_ += box[i_].firstElementChild.value + ","
  709. i_++
  710. str_ += box[i_].firstElementChild.value + ""
  711. str_ += "|"
  712. }
  713. return str_
  714. }
  715. function Show_Notice_T_Notice_mechanism() {
  716. console.log("======")
  717. var scores = T_Notice_mechanism.split("|");
  718. $('#T_Notice_mechanism').html("<div class=\"layui-row\">\n" +
  719. " <span class=\"box_x\" style=\"margin-left: -1px;width: 120px;\">报警类型</span>\n" +
  720. " <span class=\"box_x\" style=\"margin-left: 1px;\">记录</span>\n" +
  721. " <span class=\"box_x\" style=\"margin-left: 1px;\">处理</span>\n" +
  722. " <span class=\"box_x\" style=\"margin-left: 1px;\">微信</span>\n" +
  723. " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
  724. " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
  725. " <span class=\"box_x\" style=\"margin-left: 1px;\">短信</span>\n" +
  726. " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
  727. " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
  728. " <span class=\"box_x\" style=\"margin-left: 1px;\">手机</span>\n" +
  729. " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
  730. " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
  731. " <span class=\"box_x\" style=\"margin-left: 1px;\">邮箱</span>\n" +
  732. " <span class=\"box_x\" style=\"margin-left: -1px;\">触发数</span>\n" +
  733. " <span class=\"box_x\" style=\"margin-left: -1px;\">上限数</span>\n" +
  734. " </div>");
  735. for (let i = 0; i < scores.length; i++) {
  736. if(scores[i].length == 0){
  737. break
  738. }
  739. row = scores[i].split(",");
  740. $('#T_Notice_mechanism').append("" +
  741. "\n" +
  742. " <div class=\"layui-row\">\n" +
  743. " <div class=\"box_x\" style=\"margin-left: -1px;width: 120px;\">"+row[0]+"</div>\n" +
  744. " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
  745. " <input type=\"checkbox\">\n" +
  746. " </div>\n" +
  747. " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
  748. " <input type=\"checkbox\">\n" +
  749. " </div>\n" +
  750. "\n" +
  751. " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
  752. " <input type=\"checkbox\">\n" +
  753. " </div>\n" +
  754. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  755. " <input type=\"text\" style=\"width: 40px;\" value='"+row[4]+"'>\n" +
  756. " </div>\n" +
  757. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  758. " <input type=\"text\" style=\"width: 40px;\" value='"+row[5]+"'>\n" +
  759. " </div>\n" +
  760. "\n" +
  761. " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
  762. " <input type=\"checkbox\">\n" +
  763. " </div>\n" +
  764. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  765. " <input type=\"text\" style=\"width: 40px;\" value='"+row[7]+"'>\n" +
  766. " </div>\n" +
  767. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  768. " <input type=\"text\" style=\"width: 40px;\" value='"+row[8]+"'>\n" +
  769. " </div>\n" +
  770. "\n" +
  771. " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
  772. " <input type=\"checkbox\">\n" +
  773. " </div>\n" +
  774. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  775. " <input type=\"text\" style=\"width: 40px;\" value='"+row[10]+"'>\n" +
  776. " </div>\n" +
  777. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  778. " <input type=\"text\" style=\"width: 40px;\" value='"+row[11]+"'>\n" +
  779. " </div>\n" +
  780. "\n" +
  781. " <div class=\"box_x\" style=\"margin-left: 1px;\">\n" +
  782. " <input type=\"checkbox\">\n" +
  783. " </div>\n" +
  784. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  785. " <input type=\"text\" style=\"width: 40px;\" value='"+row[13]+"'>\n" +
  786. " </div>\n" +
  787. " <div class=\"box_x\" style=\"margin-left: -1px;\">\n" +
  788. " <input type=\"text\" style=\"width: 40px;\" value='"+row[14]+"'>\n" +
  789. " </div>\n" +
  790. "\n" +
  791. "\n" +
  792. " </div>\n")
  793. box = $(".box_x")
  794. if(row[1] == 1){
  795. box[box.length-1-13].firstElementChild.checked = true
  796. }
  797. if(row[2] == 1){
  798. box[box.length-1-12].firstElementChild.checked = true
  799. }
  800. if(row[3] == 1){
  801. box[box.length-1-11].firstElementChild.checked = true
  802. }
  803. if(row[6] == 1){
  804. box[box.length-1-8].firstElementChild.checked = true
  805. }
  806. if(row[9] == 1){
  807. box[box.length-1-5].firstElementChild.checked = true
  808. }
  809. if(row[12] == 1){
  810. box[box.length-1-2].firstElementChild.checked = true
  811. }
  812. }
  813. $('#T_Notice_mechanism').append("<div class='layui-row' style='text-align: center;margin-top: 20px'> " +
  814. "<button class=\"layui-btn layui-btn-normal\" onclick=\"T_Notice_mechanism_initialization()\">重置数据</button><button class=\"layui-btn layui-btn-normal\" onclick=\"\">说明</button>" +
  815. " </div>" )
  816. }
  817. </script>
  818. </body>
  819. </html>