DataRealCalss-.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  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"
  8. content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
  9. <link rel="shortcut icon" href="https://osscold.baozhida.cn/favicon.ico">
  10. <link rel="bookmark" href="https://osscold.baozhida.cn/favicon.ico">
  11. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
  12. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
  13. <script src="https://osscold.baozhida.cn/js/jquery.min.js"></script>
  14. <script src="https://osscold.baozhida.cn/js/jquery.cookie.min.js"></script>
  15. <script src="https://osscold.baozhida.cn/lib/layui/layui.js" charset="utf-8"></script>
  16. <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
  17. </head>
  18. <body>
  19. <div class="x-nav">
  20. <span class="layui-breadcrumb">
  21. <a href="">首页</a>
  22. <a><cite>宝智达</cite></a>
  23. </span>
  24. <a class="layui-btn layui-btn-normal" style="line-height:1.6em;margin-top:3px;float:right"
  25. onclick="location.reload()" title="刷新">
  26. <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
  27. </a>
  28. </div>
  29. <div class="layui-fluid">
  30. <div class="layui-row">
  31. <!-- // 传感器 选择-->
  32. <div class="layui-col-md12">
  33. <div class="layui-card">
  34. <div class="layui-card-body ">
  35. <form class="layui-form layui-col-space5" οnsubmit="return false;">
  36. <div class="layui-input-inline layui-show-xs-block">
  37. <input value="" type="text" id="D_T_sn" name="D_T_sn" placeholder="请输入 SN"
  38. autocomplete="off"
  39. class="layui-input"></div>
  40. <div class="layui-input-inline layui-show-xs-block">
  41. <input value="" type="text" id="D_Name" name="D_Name" placeholder="请输入 传感器名称"
  42. autocomplete="off"
  43. class="layui-input"></div>
  44. <div class="layui-input-inline layui-show-xs-block">
  45. <select id="Class_1" name="Class_1">
  46. <option value=0>所有分类</option>
  47. {{range $index, $elem := .Class_List}}
  48. <option value={{$elem.Id}}>{{$elem.T_name}}
  49. </option>
  50. {{end}}
  51. </select>
  52. </div>
  53. <div class="layui-input-inline layui-show-xs-block">
  54. <div class="layui-btn layui-btn-normal"
  55. onclick="get_DeviceSensor_list(0)">
  56. <i class="layui-icon">&#xe615;</i></div>
  57. </div>
  58. </form>
  59. <hr>
  60. </div>
  61. <div class="layui-card-body " style="margin-top: -20px">
  62. <div id="DeviceSensor_list" style="width: 98%; overflow: hidden;">
  63. <div style="color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px">加载中...</div>
  64. <!-- <div class="layui-col"-->
  65. <!-- style="height: 52px;background-color: #fafafa;border-radius:5px;padding-top: 2px;">-->
  66. <!-- <img style="float: left;width: 50px;margin: 0px 10px" src="https://osscold.baozhida.cn/images/温湿度传感器-1.png"-->
  67. <!-- height="50"-->
  68. <!-- width="40"/>-->
  69. <!-- <div style="float: left;">-->
  70. <!-- <div style="margin-top: 4px;font-size: 14px">士大夫撒地方递四方速递</div>-->
  71. <!-- <div style="margin-top: -3px;font-size: 12px">SN:KF20210510143443 [1]</div>-->
  72. <!-- </div>-->
  73. <!-- <div class="layui-card-header"-->
  74. <!-- style="float: right;padding-left: 0px;padding-top: 6px;color: #1E9FFF">-->
  75. <!-- 》-->
  76. <!-- </div>-->
  77. <!-- </div>-->
  78. </div>
  79. </div>
  80. <div class="layui-card-body " >
  81. <div style="height: 100px">
  82. <div >
  83. <span id="T_time" style="font-size: 14px">更新时间:等待同步中.....</span><img style="margin-left: 2px"
  84. src="https://osscold.baozhida.cn/images/等待.gif" height="20"
  85. width="20"/>
  86. </div>
  87. <div class="layui-card-body ">
  88. <div class="page">
  89. <div id="DeviceSensor_list_Pages">
  90. <!-- <a class="prev" href="">&lt;&lt;</a>-->
  91. <!-- <a class="num" href="">1222</a>-->
  92. <!-- <span class="current">111</span>-->
  93. <!-- <a class="num" href="">444</a>-->
  94. <!-- <a class="next" href="">&gt;&gt;</a>-->
  95. </div>
  96. </div>
  97. <div style="color: #1E9FFF;text-align: center" id="DeviceSensor_list_Pages_x"></div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </body>
  107. <script>
  108. layui.use(['laydate', 'form'],
  109. function () {
  110. var laydate = layui.laydate;
  111. });
  112. var T_name = ""
  113. var T_sn = ""
  114. var T_class_id = 0
  115. var T_id = 0
  116. var T_sn_T_id = ""
  117. var Time_start = ""
  118. var Time_end = ""
  119. var T_sn_list = []
  120. var DeviceSensor_lite = []
  121. var DeviceSensor_data = []
  122. var timestamp_V = (new Date()) / 1000;
  123. var Out_time = 999;
  124. /// --------------- 传感器列表
  125. // 页面 加载完成后执行
  126. window.onload = function () {
  127. console.log("页面 加载完成后执行")
  128. setInterval(function(){
  129. //要执行的代码
  130. // console.log("setInterval===== 1S")
  131. xx = $("span[name='time_x']")
  132. for (let i = 0; i < xx.length; i++) {
  133. if(xx[i].innerHTML == "N"){
  134. continue;
  135. }
  136. if(xx[i].innerHTML > Out_time ){
  137. xx[i].innerHTML = "N"
  138. }
  139. xx[i].innerHTML = parseInt(xx[i].innerHTML) + 1
  140. }
  141. var now = new Date();
  142. $("#T_time").html("当期时间:"+now.getFullYear()+"-"+(now.getMonth()+1)+"-"+getNow(now.getDate())+" "+getNow(now.getHours())+":"+getNow(now.getMinutes())+":"+getNow(now.getSeconds())+"")
  143. },1000);
  144. //
  145. setInterval(function(){
  146. get_DeviceSensor_list(-1)
  147. },3000);
  148. }
  149. function getNow(s) {
  150. return s < 10 ? '0' + s : s;
  151. }
  152. T_page = 0
  153. function get_DeviceSensor_list(page) {
  154. if(page == -1){
  155. page = T_page
  156. }
  157. T_page = page
  158. T_sn = $("#D_T_sn").val();
  159. T_name = $("#D_Name").val();
  160. T_class_id = $("#Class_1").val();
  161. $.ajax({
  162. type: 'POST',
  163. url: 'Device_Sensor_List',//发送请求
  164. data: {
  165. User_tokey: $.cookie("User_tokey"),
  166. T_sn: T_sn,
  167. T_name: T_name,
  168. T_class_id: parseInt(T_class_id),
  169. page: page,
  170. page_z: 30,
  171. },
  172. success: function (result) {
  173. console.log(result)
  174. if (result.Code == 200) {
  175. $('#DeviceSensor_list').html("")
  176. $('#DeviceSensor_list_Pages').html("")
  177. $('#DeviceSensor_list_Pages_x').html("")
  178. DeviceSensor_lite = result.Data.DeviceSensor_lite
  179. if (DeviceSensor_lite.length == 0) {
  180. $('#DeviceSensor_list').html("<div style=\"color: #1E9FFF;text-align: center;font-size: 15px;margin-top: 150px\">没有设备</div>")
  181. return
  182. }
  183. Add_DeviceSensor_list(result.Data.DeviceSensor_lite) // 列表
  184. Add_DeviceSensor_list_Pages(result.Data.Pages) // 分页
  185. $('#DeviceSensor_list_Pages_x').append("页数:" + result.Data.Page + "/" + result.Data.Page_size + " 总数:" + result.Data.Num);
  186. } else {
  187. }
  188. }
  189. });
  190. return false
  191. }
  192. function Add_DeviceSensor_list(data) {
  193. $('#DeviceSensor_list').html("")
  194. for (let i = 0; i < data.length; i++) {
  195. // if(T_sn_list.indexOf(data[i].T_sn) == -1 ){
  196. // websocket.send("{\"Sn\":\"" + data[i].T_sn + "\"}");
  197. // T_sn_list.push(data[i].T_sn)
  198. // }
  199. src_img = "记录.png"
  200. Ds = data[i]
  201. x_ = dateChangeFormat_xiangcha(Ds.T_time)
  202. outtime = 60 * 60 * 1
  203. while (true){
  204. // 初始化状态
  205. src_img = "记录.png"
  206. // 传感器正常
  207. if(Ds.T_sn.indexOf("YD") != -1){
  208. if(Ds.T_monitor == 0 ){
  209. src_img = "停止.png"
  210. }
  211. }
  212. // 是否 超时
  213. if(x_ > outtime) {
  214. // 传感器超时
  215. src_img = "离线-线.png"
  216. if(Ds.T_sn.indexOf("YD") != -1){
  217. src_img = "离线.png"
  218. }
  219. break;
  220. }
  221. // 是否 超标
  222. if(!(( 0 == Ds.T_Tlower && 0 == Ds.T_RHlower) && ( 0 == Ds.T_Tupper && 0 == Ds.T_RHupper))){
  223. if(Ds.T_t < Ds.T_Tlower || Ds.T_rh < Ds.T_RHlower || Ds.T_t > Ds.T_Tupper || Ds.T_rh > Ds.T_RHupper ){
  224. // 传感器 超标
  225. src_img = "报警.png"
  226. }
  227. }
  228. break;
  229. }
  230. DeviceTask_on = ""
  231. if(Ds.T_sn.indexOf("YD") != -1){
  232. DeviceTask_on = "onclick='DeviceTask_Post("+i+")'"
  233. }
  234. $('#DeviceSensor_list').append("" +
  235. "<div name='"+data[i].T_sn+"' class=\"layui-col-xs5 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"height: 104px; \" >\n" +
  236. " <div name='"+data[i].T_id+"' style=\"margin: 4px;height: 96px; border-radius:5px;background-color:#f1f1f1;\"\n" +
  237. " >\n" +
  238. " <div class=\"layui-row\" style=\"text-align: center;font-size: 15px;background-color: #8ecbff;border-radius:5px;\">\n" +
  239. " <span style=\"float: left;background-color: #69d1ff;padding: 0px 2px;border-radius:5px;\" >"+data[i].T_id+"</span>"+
  240. " <span style=\"float: right;background-color: #AFFF005E;padding: 0px 2px;border-radius:5px;\" name='time_x' >"+To_time(data[i].T_time)+"</span>"+To_str(data[i].T_name)+"\n" +
  241. " </div>\n" +
  242. " <div class=\"layui-row\" >\n" +
  243. " <div class=\" layui-col-md4 \" style='padding-top: 3px;padding-left: 6px;' "+DeviceTask_on+">\n" +
  244. " <img name='T_img' src=\"https://osscold.baozhida.cn/img/"+src_img+"\" height=\"35\" width=\"35\"/>\n" +
  245. " </div>\n" +
  246. " <div class=\"layui-col-md8\" style=\"margin-top: 3px;white-space:nowrap\">\n" +
  247. " <div style=\"width: 98%;height:20px;float: left;font-size: 15px;text-overflow:ellipsis; overflow:hidden;\">\n" +
  248. " <span name='T_t' style=\"width: 48px;float: left\">"+To_unm(data[i].T_t)+"℃</span>\n" +
  249. " <span name='T_T' style=\"font-size: 10px;float: left;margin-top: 1px;\">"+data[i].T_Tlower+"~"+data[i].T_Tupper+"</span>\n" +
  250. " </div>\n" +
  251. " <div style=\"width: 98%;height:20px;float: left;font-size: 15px;text-overflow:ellipsis; overflow:hidden;\">\n" +
  252. " <span name='T_rh' style=\"width: 48px;float: left\">"+To_unm(data[i].T_rh)+"%</span>\n" +
  253. " <span name='T_RH' style=\"font-size: 10px;float: left;margin-top: 1px;\">"+data[i].T_RHlower+"~"+data[i].T_RHupper+"</span>\n" +
  254. " </div>\n" +
  255. " </div>\n" +
  256. " <div class=\" layui-col-md12 \" style=\"padding-top: -2px;font-size: 16px;text-align: center;margin-top: -2px;border-top:1px solid #000\">\n" +
  257. " <span name='T_time'>"+dateChangeFormat('YYYY-mm-dd HH:MM:SS', data[i].T_time)+"</span>\n" +
  258. " </div>\n" +
  259. " </div>\n" +
  260. " </div>\n" +
  261. "</div>")
  262. }
  263. }
  264. function Add_DeviceSensor_list_Pages(Pages) {
  265. for (let i = 0; i < Pages.length; i++) {
  266. elem = Pages[i]
  267. switch (elem.A) {
  268. case 1:
  269. $('#DeviceSensor_list_Pages').append("<a class=\"prev\" onclick='get_DeviceSensor_list(" + elem.V + ")' >&lt;&lt;</a>\n");
  270. break;
  271. case 2:
  272. $('#DeviceSensor_list_Pages').append("<a class=\"num\" onclick='get_DeviceSensor_list(" + elem.V + ")' >" + elem.V + "</a>\n");
  273. break;
  274. case 3:
  275. $('#DeviceSensor_list_Pages').append("<span class=\"current\">" + elem.V + "</span>\n");
  276. break;
  277. case 4:
  278. $('#DeviceSensor_list_Pages').append("<a class=\"num\" onclick='get_DeviceSensor_list(" + elem.V + ")' >" + elem.V + "</a>\n");
  279. break;
  280. case 5:
  281. $('#DeviceSensor_list_Pages').append("<a class=\"next\" onclick='get_DeviceSensor_list(" + elem.V + ")' >&gt;&gt;</a>\n");
  282. break;
  283. }
  284. }
  285. }
  286. function Pu_DeviceSensor_list_g(sn,data) {
  287. for (let i = 0; i < data.length; i++) {
  288. // console.log(i," "+data[i].name)
  289. sn_ = $("div[name='"+sn+"']")
  290. // console.log("sn_:",sn_.length)
  291. if(sn_.length > 0){
  292. id_ = sn_.find("div[name='"+data[i].id+"']")
  293. // console.log("id_:",sn_.length)
  294. if(id_.length > 0){
  295. src_img = "温湿度传感器-1.png"
  296. Ds = data[i]
  297. x_ = dateChangeFormat_xiangcha(dateChangeFormat_x('YYYY-mm-dd HH:MM:SS', data[i].UT))
  298. outtime = 60 * 5
  299. // id_.find("img")[0].src = "https://osscold.baozhida.cn/images/"+src_img
  300. //
  301. id_.find("span")[1].innerHTML = "0"
  302. id_.find("span")[2].innerHTML = To_unm(data[i].T)+"℃"
  303. id_.find("span")[3].innerHTML = data[i].Tlower+"~"+data[i].Tupper
  304. id_.find("span")[4].innerHTML = To_unm(data[i].RH)+"%"
  305. id_.find("span")[5].innerHTML = data[i].RHlower+"~"+data[i].RHupper
  306. id_.find("span")[6].innerHTML = dateChangeFormat_x('YYYY-mm-dd HH:MM:SS', data[i].UT)
  307. console.log("更新:"+sn+">"+data[i].id)
  308. }
  309. }
  310. }
  311. }
  312. </script>
  313. <script>
  314. function DeviceTask_Post(i) {
  315. console.log(DeviceSensor_lite[i])
  316. confirm_str = "停止"
  317. T_task = "stop"
  318. if(DeviceSensor_lite[i].T_monitor == 0){
  319. confirm_str = "开始"
  320. T_task = "start"
  321. }
  322. layer.confirm("确定"+confirm_str+"记录?", {
  323. btn: ['确定'] //可以无限个按钮
  324. ,btn1: function(index, layero){
  325. $.ajax({
  326. type: 'POST',
  327. url: '../../Device/DeviceTask_Post',//发送请求
  328. data: {
  329. T_sn: DeviceSensor_lite[i].T_sn,
  330. T_task: T_task,
  331. },
  332. success: function (result) {
  333. console.log(result)
  334. layer.msg('提示:'+confirm_str+"记录 发送成功!请 等待同步显示",{time: 3000});
  335. }
  336. });
  337. return false
  338. }
  339. });
  340. }
  341. </script>
  342. <script>
  343. var websocket = null;
  344. //判断当前浏览器是否支持WebSocket
  345. run_WebSocket()
  346. function run_WebSocket() {
  347. console.log("run_WebSocket");
  348. if ('WebSocket' in window) {
  349. url = window.location.host
  350. if(url.indexOf("127.0.0.1") != -1){
  351. websocket = new WebSocket("ws://"+window.location.host+"/ws/join?User_tokey="+$.cookie('User_tokey'));
  352. }else {
  353. websocket = new WebSocket("wss://"+window.location.host+"/ws/join?User_tokey="+$.cookie('User_tokey'));
  354. }
  355. } else {
  356. alert('Dont support websocket')
  357. }
  358. }
  359. //连接成功建立的回调方法
  360. websocket.onopen = function () {
  361. console.log("open");
  362. get_DeviceSensor_list(0)
  363. // send("{\"Sn\":\"" + getQueryString("Sn") + "\"}")
  364. };
  365. //接收到消息的回调方法
  366. websocket.onmessage = function (event) {
  367. console.log(event.data)
  368. var obj = JSON.parse(event.data);
  369. // console.log(obj.type)
  370. // if(obj.sn != Device_Sn){
  371. // console.log(obj.sn,"跳过。。 Device_Sn = ",Device_Sn)
  372. // return
  373. // }
  374. // console.log(obj.sn,"进入。。 Device_Sn = ",Device_Sn)
  375. if (obj.type == 0 ) {
  376. // console.log("data.length:",obj.sensor.length)
  377. // Pu_DeviceSensor_list_g(obj.sn,obj.sensor)
  378. if(obj.type == 0 ){
  379. // $("#T_time").html("刷新时间:" + dateChangeFormat_x('YYYY-mm-dd HH:MM:SS', obj.sensor[0].UT) + " 上传刷新间隔:" + Math.abs(timestamp_V - obj.sensor[0].UT).toFixed(0) + "s")
  380. // console.log(timestamp_V, obj.sensor[0].UT, " 刷新间隔:" + (timestamp_V - obj.sensor[0].UT) + "s")
  381. timestamp_V = obj.sensor[0].UT
  382. }
  383. }
  384. };
  385. //连接关闭的回调方法
  386. websocket.onclose = function () {
  387. console.log("close");
  388. setTimeout(function(){
  389. //要执行的代码
  390. run_WebSocket();
  391. },2000);
  392. };
  393. //连接发生错误的回调方法
  394. websocket.onerror = function () {
  395. console.log("error");
  396. setTimeout(function(){
  397. //要执行的代码
  398. run_WebSocket();
  399. },2000);
  400. };
  401. //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
  402. window.onbeforeunload = function () {
  403. websocket.close();
  404. console.log("窗口关闭事件");
  405. };
  406. //关闭连接
  407. function closeWebSocket() {
  408. websocket.close();
  409. console.log("onbeforeunload");
  410. window.clearInterval(intervalId);
  411. }
  412. //发送消息
  413. function send(message) {
  414. console.log(message)
  415. websocket.send(message);
  416. }
  417. </script>
  418. <script>
  419. //获取GET
  420. function getPar(par) {
  421. //获取当前URL
  422. var local_url = document.location.href;
  423. //获取要取得的get参数位置
  424. var get = local_url.indexOf(par + "=")
  425. ;
  426. if (get == -1) {
  427. return false;
  428. }
  429. //截取字符串
  430. //截取字符串
  431. var get_par = local_url.slice(par.length + get + 1);
  432. //判断截取后的字符串是否还有其他get参数
  433. var nextPar = get_par.indexOf("&")
  434. ;
  435. if (nextPar != -1) {
  436. get_par = get_par.slice(0, nextPar);
  437. }
  438. return get_par;
  439. }
  440. function timestampToTime(timestamp) {
  441. if(timestamp == undefined){
  442. return "<img src=\"https://osscold.baozhida.cn/images/等待.gif\" style='float: left' height=\"16\" width=\"16\"/>"
  443. }
  444. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  445. Y = date.getFullYear() + '-';
  446. M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  447. D = date.getDate() + ' ';
  448. h = date.getHours() + ':';
  449. m = date.getMinutes() + ':';
  450. s = date.getSeconds();
  451. return Y + M + D + h + m + s;
  452. }
  453. function dateChangeFormat(format, date) {
  454. date = new Date(date);
  455. const dataItem = {
  456. 'Y+': date.getFullYear().toString(),
  457. 'm+': (date.getMonth() + 1).toString(),
  458. 'd+': date.getDate().toString(),
  459. 'H+': date.getHours().toString(),
  460. 'M+': date.getMinutes().toString(),
  461. 'S+': date.getSeconds().toString(),
  462. };
  463. Object.keys(dataItem).forEach((item) => {
  464. const ret = new RegExp(`(${item})`).exec(format);
  465. if (ret) {
  466. format = format.replace(ret[1], ret[1].length === 1 ? dataItem[item] : dataItem[item].padStart(ret[1].length, '0'));
  467. }
  468. });
  469. return format;
  470. }
  471. function dateChangeFormat_x(format, date) {
  472. date = new Date(date*1000);
  473. const dataItem = {
  474. 'Y+': date.getFullYear().toString(),
  475. 'm+': (date.getMonth() + 1).toString(),
  476. 'd+': date.getDate().toString(),
  477. 'H+': date.getHours().toString(),
  478. 'M+': date.getMinutes().toString(),
  479. 'S+': date.getSeconds().toString(),
  480. };
  481. Object.keys(dataItem).forEach((item) => {
  482. const ret = new RegExp(`(${item})`).exec(format);
  483. if (ret) {
  484. format = format.replace(ret[1], ret[1].length === 1 ? dataItem[item] : dataItem[item].padStart(ret[1].length, '0'));
  485. }
  486. });
  487. return format;
  488. }
  489. // 时间比较
  490. function dateChangeFormat_xiangcha( date) {
  491. console.log("===========")
  492. a_t = (new Date(dateChangeFormat('YYYY-mm-dd HH:MM:SS', date)).getTime()/1000)
  493. b_t = ((new Date()) / 1000)
  494. console.log("a_t:",a_t,"b_t:",b_t,">",b_t - a_t)
  495. return parseInt(b_t - a_t) ;
  496. }
  497. function To_str(data) {
  498. if(data == undefined){
  499. return "<img src=\"https://osscold.baozhida.cn/images/等待.gif\" style='float: left' height=\"16\" width=\"16\"/>"
  500. }
  501. if(data+"".length > 5){
  502. return data+"".slice(0,5);
  503. }
  504. return data;
  505. }
  506. function To_unm(data) {
  507. if(data == undefined){
  508. return "<img src=\"https://osscold.baozhida.cn/images/等待.gif\" style='float: left' height=\"16\" width=\"16\"/>"
  509. }
  510. return data.toFixed(1);
  511. }
  512. function To_time(data) {
  513. xx = dateChangeFormat_xiangcha(data)
  514. if(xx > Out_time){
  515. return "N";
  516. }
  517. return xx;
  518. }
  519. </script>
  520. </html>