tasklist.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>华力机电SIMANC</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <!--标准mui.css-->
  10. <link rel="stylesheet" type="text/css" href="css/mui.min.css">
  11. <!--App自定义的css-->
  12. <link rel="stylesheet" type="text/css" href="css/app.css" />
  13. <style>
  14. .mui-col {
  15. display: inline-block;
  16. padding: 2px;
  17. }
  18. /*滚动条样式*/
  19. ::-webkit-scrollbar {
  20. width: 0;
  21. background-color: #F5F5F5;
  22. }
  23. /*定义滚动条轨道 内阴影+圆角*/
  24. ::-webkit-scrollbar-track {
  25. background-color: #2e3342;
  26. }
  27. /*定义滑块 内阴影+圆角*/
  28. ::-webkit-scrollbar-thumb {
  29. background-color: #2e3342;
  30. }
  31. .mui-btn-royal {
  32. background-color: rgba(141, 157, 199, 0.5);
  33. border: 1px solid rgba(141, 157, 199, 0.5)
  34. }
  35. span.mui-icon {
  36. font-size: 14px;
  37. color: #007aff;
  38. margin-left: -15px;
  39. padding-right: 10px;
  40. }
  41. .mui-content {
  42. padding: 2px;
  43. }
  44. .mui-content-padded {
  45. margin: 2px;
  46. }
  47. .grid-task>div {
  48. display: grid;
  49. grid-template-columns: 60px 1fr 1fr 100px;
  50. grid-gap: 1px;
  51. }
  52. .grid-task>div>span {
  53. height: 30px;
  54. line-height: 30px;
  55. color: #fff;
  56. font-size: 15px;
  57. background-color: rgba(141, 157, 199, 0.5);
  58. border: 1px solid rgba(14, 48, 61, 0.5);
  59. padding: 0px 5px 2px 15px;
  60. }
  61. .mui-content a {
  62. color: #8F8F94;
  63. }
  64. .mui-content a.active {
  65. color: #007aff;
  66. }
  67. .mui-content-padded a {
  68. margin: 3px;
  69. width: 50px;
  70. height: 50px;
  71. display: inline-block;
  72. text-align: center;
  73. background-color: #103543;
  74. border: 1px solid #FFF;
  75. border-radius: 25px;
  76. background-clip: padding-box;
  77. }
  78. .mui-content-padded a .mui-icon {
  79. margin-top: 8px;
  80. margin-left: 5px;
  81. }
  82. </style>
  83. </head>
  84. <body style="background: url(img/bg.png) no-repeat 0px 0px">
  85. <div class="mui-content" style="background: #2e3342;background-color: rgba(255,255,255,0)">
  86. <div class="mui-content-padded">
  87. <div class="mui-row">
  88. <div class="mui-col mui-col-xs-12">
  89. <div id="title" style="text-align: center;padding-bottom: 5px;background: url(img/title_bg.png) no-repeat 0 7px;background-size:100%;">
  90. <span style="color: #FFFFFF;font-size: 20px;">华力西曼克</a>
  91. </div>
  92. </div>
  93. <div class="mui-col mui-col-xs-12">
  94. <div class="row-row">
  95. <div class="cell">
  96. <div class="grid-task" style="color: #fff">
  97. <div><span>编号</span><span>源站点</span><span>目的站点</span><span>任务状态</span></div>
  98. </div>
  99. <div class="grid-task" id="grid-task" style="min-height:455px;max-height:455px;overflow-y:auto;">
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="mui-col mui-col-xs-12" style="text-align:center;">
  105. <a href="index.html">
  106. <span class="mui-icon mui-icon-arrowleft" style="font-size: 30px;color: #9fb3b4;"></span>
  107. </a>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </body>
  113. <script src="js/jquery.min.js"></script>
  114. <script src="js/mui.min.js"></script>
  115. <script src="js/msg.js"></script>
  116. <script type="text/javascript">
  117. var $btlist = $('#btlist');
  118. $(function() {
  119. //获取保存的ip、agvid等
  120. ip = localStorage.getItem("ip") + ":8888";
  121. url = "http://" + localStorage.getItem("ip") + ":8888";
  122. agvid = parseInt(localStorage.getItem("agvid"))
  123. //获取状态
  124. startLog();
  125. setInterval(function() {
  126. if (ws.readyState === 3) {
  127. startLog();
  128. }
  129. }, 1000);
  130. /*
  131. //设置页面可以左滑右滑跳转页面
  132. var windowHeight = $(window).height(),
  133. $body = $("body");
  134. $("body").on("touchstart", function(e) {
  135. e.preventDefault();
  136. startX = e.originalEvent.changedTouches[0].pageX,
  137. startY = e.originalEvent.changedTouches[0].pageY;
  138. });
  139. $("body").on("touchmove", function(e) {
  140. e.preventDefault();
  141. moveEndX = e.originalEvent.changedTouches[0].pageX,
  142. moveEndY = e.originalEvent.changedTouches[0].pageY,
  143. X = moveEndX - startX,
  144. Y = moveEndY - startY;
  145. if (Math.abs(X) > Math.abs(Y) && X > 100) {
  146. window.location.href = "index.html"; //right
  147. } else {
  148. return
  149. }
  150. })
  151. */
  152. })
  153. $(function() {
  154. GetTransTask(agvid, function (d) {
  155. console.log("GetTransTask: ", d)
  156. });
  157. })
  158. function GetTransTask(agvid, callback) {
  159. $.post(url + "/task/get", {
  160. id: agvid,
  161. }, callback);
  162. }
  163. //新建ws连接,获取agv的状态
  164. let ws;
  165. function startLog() {
  166. ws = new WebSocket("ws://" + ip + "/ws/msg/" + agvid);
  167. ws.onmessage = function(e) {
  168. let result;
  169. let msg = JSON.parse(e.data);
  170. switch (msg.type) {
  171. case msgTypeGetTaskInfo:
  172. if (agvid == msg.id) {
  173. showTaskGrid("#grid-task", msg.data);
  174. }
  175. break;
  176. default:
  177. }
  178. };
  179. }
  180. function showTaskGrid(select, vList) {
  181. let lines = "";
  182. for (let i in vList) {
  183. let task = vList[i];
  184. if (i === "0") {
  185. lines += '<div><span>' + task.id + '</span><span>' + task.src + '</span><span>' + task.dst +
  186. '</span><span>执行中</span></div>'
  187. } else {
  188. lines += '<div><span>' + task.id + '</span><span>' + task.src + '</span><span>' + task.dst +
  189. '</span><span>等待</span></div>'
  190. }
  191. }
  192. $(select).html(lines);
  193. }
  194. </script>
  195. </html>