machinerymap.cshtml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. 
  2. @{
  3. ViewBag.Title = "车辆信息管理";
  4. Layout = "~/Views/Shared/_Lymap.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="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/js/jquery/jquery-1.8.2.min.js"></script>
  22. <title>地图</title>
  23. <style>
  24. html,
  25. body,
  26. #container {
  27. width: 99%;
  28. height: 550px;
  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. #div1 {
  39. width: 100px;
  40. height: 30px;
  41. border-radius: 50px;
  42. position: relative;
  43. }
  44. #div2 {
  45. width: 30px;
  46. height: 28px;
  47. border-radius: 30px;
  48. position: absolute;
  49. background: white;
  50. box-shadow: 0px 2px 4px rgba(0,0,0,0.4);
  51. }
  52. .open1 {
  53. background: rgba(0,184,0,0.8);
  54. }
  55. .open2 {
  56. top: 2px;
  57. right: 1px;
  58. }
  59. .close1 {
  60. background: red;
  61. border: 3px solid rgba(136, 11, 11, 0);
  62. border-left: transparent;
  63. }
  64. .close2 {
  65. left: 0px;
  66. top: 0px;
  67. border: 2px solid rgba(0,0,0,0.1);
  68. }
  69. .changeicon {
  70. float: right;
  71. margin-right: -15px;
  72. position: absolute;
  73. right: -7px;
  74. top: 0px;
  75. border: none;
  76. background-color: #18a689;
  77. color: #FFFFFF;
  78. line-height: 33px;
  79. height: 33px;
  80. }
  81. </style>
  82. </head>
  83. <body>
  84. <div id="container"></div>
  85. <div class="row white-bg animated fadeInRight">
  86. <div class="wrapper-content">
  87. <div class="panel-body">
  88. <div class="tab-content">
  89. <div id="tab-1" class="tab-pane active">
  90. <div class="clearfix f-hafl">
  91. <div class="col-hafl">
  92. <div class="form-group">
  93. <label class="col-lg-3 control-label">农机名称:</label>
  94. <div class="col-lg-8" style="width:45% !important">
  95. <label style="margin-top:7px;">@Model.carName</label>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="col-hafl">
  100. <div class="form-group">
  101. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">农机状态:</label>
  102. <div class="col-lg-8">
  103. <label style="margin-top:7px;">@Model.carNote</label>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="clearfix f-hafl">
  109. <div class="col-hafl">
  110. <div class="form-group">
  111. <label class="col-lg-3 control-label">农机IMEI号:</label>
  112. <div class="col-lg-8" style="width:45% !important">
  113. <label style="margin-top:7px;">@Model.carId</label>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="col-hafl">
  118. <div class="form-group">
  119. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">车架号:</label>
  120. <div class="col-lg-8">
  121. <label style="margin-top:7px;">@Model.barCode</label>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="clearfix f-hafl">
  127. <div class="col-hafl">
  128. <div class="form-group">
  129. <label class="col-lg-3 control-label">农机型号:</label>
  130. <div class="col-lg-8" style="width:45% !important">
  131. <label style="margin-top:7px;">@Model.CarModel</label>
  132. </div>
  133. </div>
  134. </div>
  135. <div class="col-hafl">
  136. <div class="form-group">
  137. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">出厂编号:</label>
  138. <div class="col-lg-8">
  139. <label style="margin-top:7px;">@Model.FactoryNumber</label>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="clearfix f-hafl">
  145. <div class="col-hafl">
  146. <div class="form-group">
  147. <label class="col-lg-3 control-label">是否在线:</label>
  148. <div class="col-lg-8" style="width:45% !important">
  149. <label style="margin-top:7px;">@(Model.isOnLine == 0 ? "不在线" : "在线")</label>
  150. </div>
  151. </div>
  152. </div>
  153. <div class="col-hafl">
  154. <div class="form-group">
  155. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">所属经销商:</label>
  156. <div class="col-lg-8">
  157. <label style="margin-top:7px;">@Model.distributorsName</label>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. @{
  163. if (Model.carType.ToInt32() != 4)
  164. {
  165. <div class="clearfix f-hafl">
  166. <div class="col-hafl">
  167. <div class="form-group">
  168. <label class="col-lg-3 control-label">农机油压:</label>
  169. <div class="col-lg-8" style="width:45% !important">
  170. <label style="margin-top:7px;">@Model.hydraulic </label>
  171. </div>
  172. </div>
  173. </div>
  174. <div class="col-hafl">
  175. <div class="form-group">
  176. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">农机水温:</label>
  177. <div class="col-lg-8">
  178. <label style="margin-top:7px;">@Model.temperature </label>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. <div class="clearfix f-hafl">
  184. <div class="col-hafl">
  185. <div class="form-group">
  186. <label class="col-lg-3 control-label">农机转速:</label>
  187. <div class="col-lg-8" style="width:45% !important">
  188. <label style="margin-top:7px;">@Model.speed </label>
  189. </div>
  190. </div>
  191. </div>
  192. <div class="col-hafl">
  193. <div class="form-group">
  194. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">蓄电池电压:</label>
  195. <div class="col-lg-8">
  196. <label style="margin-top:7px;">@(Model.voltage) </label>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. }
  202. }
  203. @{
  204. if (Model.carState.ToInt32() == MES.Production.Entity.Enum.CarState.Sales.GetHashCode())
  205. {
  206. <div class="clearfix f-hafl">
  207. <div class="col-hafl">
  208. <div class="form-group">
  209. <label class="col-lg-3 control-label">购买人:</label>
  210. <div class="col-lg-8" style="width:45% !important">
  211. <label style="margin-top:7px;">@Model.purchaserName</label>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="col-hafl">
  216. <div class="form-group">
  217. <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">购买人电话:</label>
  218. <div class="col-lg-8">
  219. <label style="margin-top:7px;">@Model.purchaserTel</label>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. }
  225. }
  226. <div class="clearfix f-hafl">
  227. <div class="col-hafl">
  228. <div class="form-group">
  229. <label class="col-lg-3 control-label">地图切换:</label>
  230. <div class="col-lg-8">
  231. <label class="radio-inline">
  232. <div id="div1" class="open1">
  233. <div id="div2" class="close2" onclick="myrefresh('')"></div>
  234. </div>
  235. </label>
  236. </div>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. <script type="text/javascript" src='http://webapi.amap.com/maps?v=1.4.2&key=fa36ec6323075f37020083ceffe8eb24'></script>
  246. <!-- UI组件库 1.0 -->
  247. <script src="http://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
  248. <script type="text/javascript">
  249. //创建地图
  250. //window.onload = function () {
  251. // var div2 = document.getElementById("div2");
  252. // var div1 = document.getElementById("div1");
  253. // div2.onclick = function () {
  254. // div1.className = (div1.className == "close1") ? "open1" : "close1";
  255. // div2.className = (div2.className == "close2") ? "open2" : "close2";
  256. // }
  257. //}
  258. $(function () {
  259. var div2 = document.getElementById("div2");
  260. myrefresh(div2.className);
  261. var div2 = document.getElementById("div2");
  262. var div1 = document.getElementById("div1");
  263. var lock = "@Model.LockState.ToString()";
  264. if (lock=="True") {
  265. div1.className = "close1";
  266. div2.className = "close2";
  267. }
  268. else {
  269. div1.className = "open1";
  270. div2.className = "open2";
  271. }
  272. });
  273. function SendLockCarCmd() {
  274. var urlstr = "http://" + window.location.host + "/";
  275. var div2 = document.getElementById("div2");
  276. var div1 = document.getElementById("div1");
  277. if (div1.className == "close1") {
  278. div1.className = "open1";
  279. }
  280. else {
  281. div1.className = "close1";
  282. }
  283. if (div2.className == "close2") {
  284. div2.className = "open2";
  285. }
  286. else {
  287. div2.className = "close2";
  288. }
  289. if (div1.className == "close1") {
  290. $.ajax({
  291. url: urlstr + 'Sys/Car/SendLockCarCmd?carid='+@Model.carId,
  292. data: null,
  293. type: 'get',
  294. dataType: 'json',
  295. async: false,
  296. cache: false,
  297. success: function (res) {
  298. if (res.Status == 'y') {
  299. dig.msg("锁车发送成功!");
  300. //alert("锁车发送成功!");
  301. }
  302. }
  303. });
  304. } else {
  305. $.ajax({
  306. url: urlstr + 'Sys/Car/SendUnLockCarCmd?carid=' +@Model.carId,
  307. data: null,
  308. type: 'get',
  309. dataType: 'json',
  310. async: false,
  311. cache: false,
  312. success: function (res) {
  313. if (res.Status == 'y') {
  314. //alert("解锁发送成功!");
  315. dig.msg("解锁发送成功!");
  316. }
  317. }
  318. });
  319. }
  320. }
  321. //解锁
  322. function SendUnLockCarCmd() {
  323. var item = $(":radio:checked");
  324. var urlstr = "http://"+window.location.host + "/";
  325. //alert(urlstr);
  326. var len = item.length;
  327. if (len > 0) {
  328. if ($(":radio:checked").val() == 2)
  329. {
  330. $.ajax({
  331. url: urlstr + 'Sys/Car/SendUnLockCarCmd?carid='+@Model.carId,
  332. data: null,
  333. type: 'get',
  334. dataType: 'json',
  335. async: false,
  336. cache: false,
  337. success: function (res) {
  338. if (res.Status == 'y') {
  339. alert("解锁发送成功!");
  340. }
  341. }
  342. });
  343. }
  344. else
  345. {
  346. }
  347. }
  348. }
  349. function myrefresh(i) {
  350. var map;
  351. var div2 = document.getElementById("div2");
  352. var div1 = document.getElementById("div1");
  353. if (div1.className == "close1") {
  354. div1.className = "open1";
  355. }
  356. else {
  357. div1.className = "close1";
  358. }
  359. if (div2.className == "close2") {
  360. map = new AMap.Map('container', {
  361. resizeEnable: true,
  362. zoom: 16,
  363. center: [@Model.lng, @Model.lat]
  364. });
  365. div2.className = "open2";
  366. }
  367. else {
  368. map = new AMap.Map('container', {
  369. resizeEnable: true,
  370. layers: [new AMap.TileLayer.Satellite()],
  371. zoom: 16,
  372. center: [@Model.lng, @Model.lat]
  373. });
  374. div2.className = "close2";
  375. }
  376. AMapUI.loadUI(['overlay/SimpleInfoWindow'], function (SimpleInfoWindow) {
  377. var marker = new AMap.Marker({
  378. map: map,
  379. zIndex: 99999,
  380. offset: new AMap.Pixel(-14, -34),//相对于基点的位置
  381. icon: new AMap.Icon({ //复杂图标
  382. size: new AMap.Size(34, 49),//图标大小
  383. image: "@Model.imageUrl", //大图地址
  384. })
  385. });
  386. var infoWindow = new SimpleInfoWindow({
  387. infoTitle: '<strong>@Model.carName(@Model.FactoryNumber)</strong>',
  388. infoBody: '<p class="my-desc"><strong>@Model.Note<br/>@Model.onlineDate<br/>@Model.workHours<br/>@Model.address</strong></p>',
  389. //基点指向marker的头部位置
  390. offset: new AMap.Pixel(0, -31)
  391. });
  392. function openInfoWin() {
  393. infoWindow.open(map, marker.getPosition());
  394. }
  395. //marker 点击时打开
  396. AMap.event.addListener(marker, 'click', function () {
  397. openInfoWin();
  398. });
  399. });
  400. }
  401. </script>
  402. </body>
  403. </html>