tasklist.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 12px 2px 12px;
  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. .quxiao{
  83. width:25px;
  84. height:25px;
  85. border:0px;
  86. color:#FFF;
  87. background-color: #dd524d;
  88. margin-left: 18px;
  89. margin-top:2px;
  90. padding: 5px;
  91. }
  92. </style>
  93. </head>
  94. <body style="background: url(img/bg.png) no-repeat 0px 0px">
  95. <div class="mui-content" style="background: #2e3342;background-color: rgba(255,255,255,0)">
  96. <div class="mui-content-padded">
  97. <div class="mui-row">
  98. <div class="mui-col mui-col-xs-12">
  99. <div id="title" style="text-align: center;padding-bottom: 5px;background: url(img/title_bg.png) no-repeat 0 7px;background-size:100%;">
  100. <span style="color: #FFFFFF;font-size: 20px;">华力西曼克</a>
  101. </div>
  102. </div>
  103. <div class="mui-col mui-col-xs-12">
  104. <div class="row-row">
  105. <div class="cell">
  106. <div class="grid-task" style="color: #fff">
  107. <div><span>编号</span><span>源站点</span><span>目的站点</span><span>任务状态</span></div>
  108. </div>
  109. <div class="grid-task" id="grid-task" style="min-height:455px;max-height:455px;overflow-y:auto;">
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="mui-col mui-col-xs-12" style="text-align:center;">
  115. <a href="index.html">
  116. <span class="mui-icon mui-icon-arrowleft" style="font-size: 30px;color: #9fb3b4;"></span>
  117. </a>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </body>
  123. <script src="js/jquery.min.js"></script>
  124. <script src="js/mui.min.js"></script>
  125. <script src="js/msg.js"></script>
  126. <script type="text/javascript">
  127. var $btlist = $('#btlist');
  128. $(function() {
  129. //获取保存的ip、agvid等
  130. ip = localStorage.getItem("ip") + ":8888";
  131. url = "http://" + localStorage.getItem("ip") + ":8888";
  132. agvid = parseInt(localStorage.getItem("agvid"))
  133. //获取状态
  134. workmode = localStorage.getItem("workmode");
  135. if (workmode == "service") {
  136. startLog();
  137. setInterval(function() {
  138. if (ws.readyState === 3) {
  139. startLog();
  140. }
  141. }, 1000);
  142. GetTransTask(agvid, function (d) {
  143. showTaskGrid("#grid-task", d.data, agvid);
  144. });
  145. }
  146. })
  147. function GetTransTask(agvid, callback) {
  148. $.post(url + "/task/get", {
  149. id: agvid,
  150. }, callback);
  151. }
  152. //新建ws连接,获取agv的状态
  153. let ws;
  154. function startLog() {
  155. ws = new WebSocket("ws://" + ip + "/ws/msg/" + agvid);
  156. ws.onmessage = function(e) {
  157. let result;
  158. let msg = JSON.parse(e.data);
  159. switch (msg.type) {
  160. case msgTypeStatus:
  161. if (agvid == msg.id) {
  162. GetTransTask(agvid, function (d) {
  163. showTaskGrid("#grid-task", d.data, agvid);
  164. });
  165. }
  166. break;
  167. default:
  168. }
  169. };
  170. }
  171. function showTaskGrid(select, vList,agvid) {
  172. let lines = "";
  173. for (let i in vList) {
  174. let task = vList[i];
  175. if(i === "0"){
  176. lines += '<div><span>'+ i + '</span><span>'+ task.src + '</span><span>'+ task.dst + '</span><span>执行中</span></div>'
  177. }else{
  178. lines += '<div>'+
  179. '<span>'+ i + '</span>'+
  180. '<span>'+ task.src + '</span>'+
  181. '<span>'+ task.dst + '</span>'+
  182. '<span>'+
  183. '等待<button class="quxiao"><lable onclick="deleteTask('+task.id+', '+agvid+')">&times;</lable></button></span>'+
  184. '</div>'
  185. }
  186. }
  187. $(select).html(lines);
  188. }
  189. function GetTransTask(agvid, callback) {
  190. $.post(url + "/task/get", {
  191. id: agvid,
  192. }, callback);
  193. }
  194. function deleteTask(taskid, agvid) {
  195. $.post(url + "/task/done", {"id": agvid, "taskid": taskid}, function (d) {
  196. history.go(0)
  197. })
  198. }
  199. </script>
  200. </html>