123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <!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 12px 2px 12px;
- }
- .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;
- }
- .quxiao{
- width:25px;
- height:25px;
- border:0px;
- color:#FFF;
- background-color: #dd524d;
- margin-left: 18px;
- margin-top:2px;
- padding: 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"))
- //获取状态
-
- workmode = localStorage.getItem("workmode");
- if (workmode == "service") {
- startLog();
- setInterval(function() {
- if (ws.readyState === 3) {
- startLog();
- }
- }, 1000);
- GetTransTask(agvid, function (d) {
- showTaskGrid("#grid-task", d.data, agvid);
- });
- }
- })
- 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 msgTypeStatus:
- if (agvid == msg.id) {
- GetTransTask(agvid, function (d) {
- showTaskGrid("#grid-task", d.data, agvid);
- });
- }
- break;
- default:
- }
- };
- }
- function showTaskGrid(select, vList,agvid) {
- let lines = "";
- for (let i in vList) {
- let task = vList[i];
- if(i === "0"){
- lines += '<div><span>'+ i + '</span><span>'+ task.src + '</span><span>'+ task.dst + '</span><span>执行中</span></div>'
- }else{
- lines += '<div>'+
- '<span>'+ i + '</span>'+
- '<span>'+ task.src + '</span>'+
- '<span>'+ task.dst + '</span>'+
- '<span>'+
- '等待<button class="quxiao"><lable onclick="deleteTask('+task.id+', '+agvid+')">×</lable></button></span>'+
- '</div>'
- }
- }
- $(select).html(lines);
- }
- function GetTransTask(agvid, callback) {
- $.post(url + "/task/get", {
- id: agvid,
- }, callback);
- }
- function deleteTask(taskid, agvid) {
- $.post(url + "/task/done", {"id": agvid, "taskid": taskid}, function (d) {
- history.go(0)
- })
- }
- </script>
- </html>
|