| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>华力机电SIMANC</title>
- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <!--标准mui.css-->
- <link rel="stylesheet" type="text/css" href="css/mui.min.css">
- <!--App自定义的css-->
- <link rel="stylesheet" type="text/css" href="css/app.css" />
- <style>
- .mui-col {
- display: inline-block;
- padding: 2px;
- }
- /*滚动条样式*/
- ::-webkit-scrollbar {
- width: 0;
- background-color: #F5F5F5;
- }
- /*定义滚动条轨道 内阴影+圆角*/
- ::-webkit-scrollbar-track {
- background-color: #2e3342;
- }
- /*定义滑块 内阴影+圆角*/
- ::-webkit-scrollbar-thumb {
- background-color: #2e3342;
- }
- .mui-btn-royal {
- background-color: rgba(141, 157, 199, 0.5);
- border: 1px solid rgba(141, 157, 199, 0.5)
- }
- span.mui-icon {
- font-size: 14px;
- color: #007aff;
- margin-left: -15px;
- padding-right: 10px;
- }
- .mui-content {
- padding: 2px;
- }
- .mui-content-padded {
- margin: 2px;
- }
- .grid-task>div {
- display: grid;
- grid-template-columns: 60px 1fr 1fr 100px;
- grid-gap: 1px;
- }
- .grid-task>div>span {
- height: 30px;
- line-height: 30px;
- color: #fff;
- font-size: 15px;
- background-color: rgba(141, 157, 199, 0.5);
- border: 1px solid rgba(14, 48, 61, 0.5);
- padding: 0px 5px 2px 15px;
- }
- .mui-content a {
- color: #8F8F94;
- }
- .mui-content a.active {
- color: #007aff;
- }
- .mui-content-padded a {
- margin: 3px;
- width: 50px;
- height: 50px;
- display: inline-block;
- text-align: center;
- background-color: #103543;
- border: 1px solid #FFF;
- border-radius: 25px;
- background-clip: padding-box;
- }
- .mui-content-padded a .mui-icon {
- margin-top: 8px;
- margin-left: 5px;
- }
- </style>
- </head>
- <body style="background: url(img/bg.png) no-repeat 0px 0px">
- <div class="mui-content" style="background: #2e3342;background-color: rgba(255,255,255,0)">
- <div class="mui-content-padded">
- <div class="mui-row">
- <div class="mui-col mui-col-xs-12">
- <div id="title" style="text-align: center;padding-bottom: 5px;background: url(img/title_bg.png) no-repeat 0 7px;background-size:100%;">
- <span style="color: #FFFFFF;font-size: 20px;">华力西曼克</a>
- </div>
- </div>
- <div class="mui-col mui-col-xs-12">
- <div class="row-row">
- <div class="cell">
- <div class="grid-task" style="color: #fff">
- <div><span>编号</span><span>源站点</span><span>目的站点</span><span>任务状态</span></div>
- </div>
- <div class="grid-task" id="grid-task" style="min-height:455px;max-height:455px;overflow-y:auto;">
- </div>
- </div>
- </div>
- </div>
- <div class="mui-col mui-col-xs-12" style="text-align:center;">
- <a href="index.html">
- <span class="mui-icon mui-icon-arrowleft" style="font-size: 30px;color: #9fb3b4;"></span>
- </a>
- </div>
- </div>
- </div>
- </div>
- </body>
- <script src="js/jquery.min.js"></script>
- <script src="js/mui.min.js"></script>
- <script src="js/msg.js"></script>
- <script type="text/javascript">
- var $btlist = $('#btlist');
- $(function() {
- //获取保存的ip、agvid等
- ip = localStorage.getItem("ip") + ":8888";
- url = "http://" + localStorage.getItem("ip") + ":8888";
- agvid = parseInt(localStorage.getItem("agvid"))
- //获取状态
- startLog();
- setInterval(function() {
- if (ws.readyState === 3) {
- startLog();
- }
- }, 1000);
- /*
- //设置页面可以左滑右滑跳转页面
- var windowHeight = $(window).height(),
- $body = $("body");
- $("body").on("touchstart", function(e) {
- e.preventDefault();
- startX = e.originalEvent.changedTouches[0].pageX,
- startY = e.originalEvent.changedTouches[0].pageY;
- });
- $("body").on("touchmove", function(e) {
- e.preventDefault();
- moveEndX = e.originalEvent.changedTouches[0].pageX,
- moveEndY = e.originalEvent.changedTouches[0].pageY,
- X = moveEndX - startX,
- Y = moveEndY - startY;
- if (Math.abs(X) > Math.abs(Y) && X > 100) {
- window.location.href = "index.html"; //right
- } else {
- return
- }
- })
- */
- })
- $(function() {
- GetTransTask(agvid, function (d) {
- console.log("GetTransTask: ", d)
- });
- })
- function GetTransTask(agvid, callback) {
- $.post(url + "/task/get", {
- id: agvid,
- }, callback);
- }
-
- //新建ws连接,获取agv的状态
- let ws;
- function startLog() {
- ws = new WebSocket("ws://" + ip + "/ws/msg/" + agvid);
- ws.onmessage = function(e) {
- let result;
- let msg = JSON.parse(e.data);
- switch (msg.type) {
- case msgTypeGetTaskInfo:
- if (agvid == msg.id) {
- showTaskGrid("#grid-task", msg.data);
- }
- break;
- default:
- }
- };
- }
- function showTaskGrid(select, vList) {
- let lines = "";
- for (let i in vList) {
- let task = vList[i];
- if (i === "0") {
- lines += '<div><span>' + task.id + '</span><span>' + task.src + '</span><span>' + task.dst +
- '</span><span>执行中</span></div>'
- } else {
- lines += '<div><span>' + task.id + '</span><span>' + task.src + '</span><span>' + task.dst +
- '</span><span>等待</span></div>'
- }
- }
- $(select).html(lines);
- }
- </script>
- </html>
|