carmap.cshtml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. 
  2. @{
  3. ViewBag.Title = "岗位管理";
  4. Layout = "~/Views/Shared/_Layout.cshtml";
  5. }
  6. @using MES.Production.Service;
  7. @using Central.Control.Domain;
  8. @using Ant.Service.Common;
  9. @using Ant.Service.Common.Enums;
  10. @using MES.Production.Entity;
  11. @using CommonToolHelper;
  12. @model UserCarMapModel
  13. <!-- 重点参数:infoTitle, infoBody -->
  14. <!doctype html>
  15. <html lang="zh-CN">
  16. <head>
  17. <!-- 原始地址://webapi.amap.com/ui/1.0/ui/overlay/SimpleInfoWindow/examples/index.html -->
  18. <base href="http://webapi.amap.com/ui/1.0/ui/overlay/SimpleInfoWindow/examples/" />
  19. <meta charset="utf-8">
  20. <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  21. <script src="~/Content/js/jquery/jquery-1.8.2.min.js"></script>
  22. <title>地图</title>
  23. <style>
  24. html,
  25. body,
  26. #container {
  27. width: 100%;
  28. height: 600px;
  29. margin: 0px;
  30. }
  31. p.my-desc {
  32. margin: 5px 0;
  33. line-height: 150%;
  34. }
  35. body {
  36. background-color: white;
  37. }
  38. .changeicon {
  39. float: right;
  40. margin-right: -15px;
  41. position: absolute;
  42. right: -7px;
  43. top: 0px;
  44. border: none;
  45. background-color: #18a689;
  46. color: #FFFFFF;
  47. line-height: 33px;
  48. height: 33px;
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <div id="container"></div>
  54. <div class="row white-bg animated fadeInRight">
  55. <div class="wrapper-content">
  56. <div class="panel-body">
  57. <div class="tab-content">
  58. <div id="tab-1" class="tab-pane active">
  59. <div class="clearfix f-hafl">
  60. <div class="col-hafl">
  61. <div class="form-group">
  62. <label class="col-lg-3 control-label">农机名称:</label>
  63. <div class="col-lg-8" style="width:45% !important">
  64. <label style="margin-top:7px;">@Model.carName</label>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="col-hafl">
  69. <div class="form-group">
  70. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">农机状态:</label>
  71. <div class="col-lg-8">
  72. <label style="margin-top:7px;">@Model.carState</label>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="clearfix f-hafl">
  78. <div class="col-hafl">
  79. <div class="form-group">
  80. <label class="col-lg-3 control-label">IMEI号:</label>
  81. <div class="col-lg-8" style="width:45% !important">
  82. <label style="margin-top:7px;">@Model.carId</label>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="col-hafl">
  87. <div class="form-group">
  88. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">是否在线:</label>
  89. <div class="col-lg-8">
  90. <label style="margin-top:7px;">@(Model.isOnLine == 1 ? "在线" : "不在线")</label>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="clearfix f-hafl">
  96. <div class="col-hafl">
  97. <div class="form-group">
  98. <label class="col-lg-3 control-label">车锁状态:</label>
  99. <div class="col-lg-8">
  100. <label class="radio-inline">
  101. <input type="radio" name="sexcode" id="a1" onchange="SendLockCarCmd()" @(Model.LockState == true ? "checked" : "") value="1">锁车
  102. </label>
  103. <label class="radio-inline">
  104. <input type="radio" name="sexcode" id="a2" onchange="SendUnLockCarCmd()" @(Model.LockState == false ? "checked" : "") value="2">解锁
  105. </label>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. @*<div class="hr-line-dashed">
  111. <div class="form-group m20">
  112. <div class="col-sm-2 col-sm-offset-2">
  113. <button class="btn btn-primary btn-save" onclick="checkradio()" type="submit"><i class="fa fa-check"></i> <span>确定保存</span></button>
  114. <button class="btn btn-warning" id="btn-dig-close" onclick="checkradio()" type="button"><i class="im-undo2"></i> 取消返回</button>
  115. </div>
  116. </div>
  117. </div>*@
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <script type="text/javascript" src='http://webapi.amap.com/maps?v=1.4.2&key=fa36ec6323075f37020083ceffe8eb24'></script>
  124. <!-- UI组件库 1.0 -->
  125. <script src="http://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
  126. <script type="text/javascript">
  127. //创建地图
  128. function SendLockCarCmd() {
  129. var item = $(":radio:checked");
  130. var urlstr = "http://"+window.location.host + "/";
  131. //alert(urlstr);
  132. var len = item.length;
  133. if (len > 0) {
  134. if ($(":radio:checked").val() == 1)
  135. {
  136. $.ajax({
  137. url: urlstr + 'Sys/Car/SendLockCarCmd?carid='+@Model.carId,
  138. data: null,
  139. type: 'get',
  140. dataType: 'json',
  141. async: false,
  142. cache: false,
  143. success: function (res) {
  144. if (res.Status == 'y') {
  145. //var data = eval(res.Data);
  146. //for (var i = 0; i < data.length; i++) {
  147. // var jsonH = data[i];
  148. // option += '<option value="' + jsonH.ID + '">' + jsonH.NAME + '</option>';
  149. //}
  150. //alert("锁车发送成功!");
  151. }
  152. }
  153. });
  154. }
  155. else
  156. {
  157. }
  158. }
  159. }
  160. //解锁
  161. function SendUnLockCarCmd() {
  162. var item = $(":radio:checked");
  163. var urlstr = "http://"+window.location.host + "/";
  164. //alert(urlstr);
  165. var len = item.length;
  166. if (len > 0) {
  167. if ($(":radio:checked").val() == 2)
  168. {
  169. $.ajax({
  170. url: urlstr + 'Sys/Car/SendUnLockCarCmd?carid='+@Model.carId,
  171. data: null,
  172. type: 'get',
  173. dataType: 'json',
  174. async: false,
  175. cache: false,
  176. success: function (res) {
  177. if (res.Status == 'y') {
  178. //var data = eval(res.Data);
  179. //for (var i = 0; i < data.length; i++) {
  180. // var jsonH = data[i];
  181. // option += '<option value="' + jsonH.ID + '">' + jsonH.NAME + '</option>';
  182. //}
  183. // alert("解锁发送成功!");
  184. }
  185. }
  186. });
  187. }
  188. else
  189. {
  190. }
  191. }
  192. }
  193. var map = new AMap.Map('container', {
  194. resizeEnable: true,
  195. zoom: 16,
  196. center: [@Model.lng, @Model.lat]
  197. });
  198. AMapUI.loadUI(['overlay/SimpleInfoWindow'], function (SimpleInfoWindow) {
  199. var marker = new AMap.Marker({
  200. map: map,
  201. zIndex: 99999,
  202. offset: new AMap.Pixel(-14, -34),//相对于基点的位置
  203. icon: new AMap.Icon({ //复杂图标
  204. size: new AMap.Size(34, 49),//图标大小
  205. image: "@Model.imageUrl", //大图地址
  206. })
  207. });
  208. var infoWindow = new SimpleInfoWindow({
  209. infoTitle: '<strong>@Model.carName</strong>',
  210. infoBody: '<p class="my-desc"><strong>@Model.Note<br/>@Model.address</strong></p>',
  211. //基点指向marker的头部位置
  212. offset: new AMap.Pixel(0, -31)
  213. });
  214. function openInfoWin() {
  215. infoWindow.open(map, marker.getPosition());
  216. }
  217. //marker 点击时打开
  218. AMap.event.addListener(marker, 'click', function () {
  219. openInfoWin();
  220. });
  221. });
  222. </script>
  223. </body>
  224. </html>