@{ ViewBag.Title = "岗位管理"; Layout = "~/Views/Shared/_Lymap.cshtml"; } @using MES.Production.Service; @using Central.Control.Domain; @using Ant.Service.Common; @using Ant.Service.Common.Enums; @using MES.Production.Entity; @using CommonToolHelper; @model UserCarMapModel <!-- 重点参数:infoTitle, infoBody --> <!doctype html> <html lang="zh-CN"> <head> <!-- 原始地址://webapi.amap.com/ui/1.0/ui/overlay/SimpleInfoWindow/examples/index.html --> <base href="http://webapi.amap.com/ui/1.0/ui/overlay/SimpleInfoWindow/examples/" /> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> <link href="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/uploadone/CSS/webuploader.css" rel="stylesheet" /> <link href="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/uploadone/CSS/bootstrap.min.css" rel="stylesheet" /> <link href="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/uploadone/CSS/uploadstyle.css" rel="stylesheet" /> <link href="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/uploadone/CSS/font-awesome.css" rel="stylesheet" /> <script src="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/js/jquery/jquery-1.8.2.min.js"></script> <script src="http://@HttpContext.Current.Request.Url.Host:@Request.Url.Port/Content/uploadone/Script/webuploader.js"></script> <title>地图</title> <style> html, body, #container { width: 100%; height: 500px; margin: 0px; } p.my-desc { margin: 5px 0; line-height: 150%; } body { background-color: white; } #div1 { width: 100px; height: 30px; border-radius: 50px; position: relative; } #div2 { width: 30px; height: 28px; border-radius: 30px; position: absolute; background: white; box-shadow: 0px 2px 4px rgba(0,0,0,0.4); } .open1 { background: rgba(0,184,0,0.8); } .open2 { top: 2px; right: 1px; } .close1 { background: red; border: 3px solid rgba(136, 11, 11, 0); border-left: transparent; } .close2 { left: 0px; top: 0px; border: 2px solid rgba(0,0,0,0.1); } .changeicon { float: right; margin-right: -15px; position: absolute; right: -7px; top: 0px; border: none; background-color: #18a689; color: #FFFFFF; line-height: 33px; height: 33px; } </style> </head> <body> <div id="container"></div> @Html.Hidden("hidfilename", "") @Html.Hidden("hidfileid", "") <div class="row white-bg animated fadeInRight"> <div class="wrapper-content"> <div class="panel-body"> <div class="tab-content"> <div id="tab-1" class="tab-pane active"> <div class="clearfix f-hafl"> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label">农机名称:</label> <div class="col-lg-8" style="width:45% !important"> <label style="margin-top:7px;">@Model.carName</label> </div> </div> </div> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">农机状态:</label> <div class="col-lg-8"> <label style="margin-top:7px;">@Model.carNote</label> </div> </div> </div> </div> <div class="clearfix f-hafl"> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label">农机IMEI号:</label> <div class="col-lg-8" style="width:45% !important"> <label style="margin-top:7px;">@Model.carId</label> </div> </div> </div> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">车架号:</label> <div class="col-lg-8"> <label style="margin-top:7px;">@Model.barCode</label> </div> </div> </div> </div> <div class="clearfix f-hafl"> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label">是否在线:</label> <div class="col-lg-8" style="width:45% !important"> <label style="margin-top:7px;">@(Model.isOnLine == 0 ? "不在线" : "在线")</label> </div> </div> </div> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">所属经销商:</label> <div class="col-lg-8"> <label style="margin-top:7px;">@Model.distributorsName</label> </div> </div> </div> </div> @{ if (Model.carType.ToInt32() != 4) { <div class="clearfix f-hafl"> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label">农机油压:</label> <div class="col-lg-8" style="width:45% !important"> <label style="margin-top:7px;">@Model.hydraulic KPa</label> </div> </div> </div> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">农机水温:</label> <div class="col-lg-8"> <label style="margin-top:7px;">@Model.temperature ℃</label> </div> </div> </div> </div> <div class="clearfix f-hafl"> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label">农机转速:</label> <div class="col-lg-8" style="width:45% !important"> <label style="margin-top:7px;">@Model.speed 转</label> </div> </div> </div> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label" style="width:29% !important; padding-left:5px; padding-right:5px;">蓄电池电压:</label> <div class="col-lg-8"> <label style="margin-top:7px;">@(Model.voltage.ToDou()) V</label> </div> </div> </div> </div> } } <div class="form-group"> <label class="col-lg-3 control-label">申请人:</label> <div class="col-lg-8"> @Html.TextBoxFor(p => p.applyName, new { @class = "form-control", @placeholder = "请输入申请人", @datatype = "n15-20", @nullmsg = "请输入申请人", @errormsg = "农机条码必须是15-20位的数字!" }) </div> </div> <div class="clearfix f-hafl"> <div class="col-lg-3 col-sm-3 pl0"> <div class="form-group"> </div> </div> </div> <div class="form-group"> <label class="col-lg-3 control-label">申请原因:</label> <div class="col-lg-8"> @Html.TextAreaFor(p => p.applyReason, new { @class = "form-control", @placeholder = "请输入申请原因", @datatype = "n15-20", @nullmsg = "请输入申请原因", @errormsg = "农机条码必须是15-20位的数字!" }) </div> </div> <div class="clearfix f-hafl"> <div class="col-lg-3 col-sm-3 pl0"> <div class="form-group"> </div> </div> </div> <div class="form-group"> <label class="col-lg-3 control-label">申请附件图片:</label> <div class="col-lg-8"> <div id="fileNameList"> </div> <div class="cp_img_jia" id="fileNamePicker"></div> </div> </div> <div class="clearfix f-hafl"> <div class="col-lg-3 col-sm-3 pl0"> <div class="form-group"> </div> </div> </div> <div class="form-group"> <label class="col-lg-3 control-label">密码:</label> <div class="col-lg-8"> @Html.PasswordFor(p => p.applyPwd, new { @class = "form-control", @placeholder = "请输入密码", @datatype = "n15-20", @nullmsg = "请输入密码", @errormsg = "必须是15-20位的数字!" }) </div> </div> <div class="clearfix f-hafl"> <div class="col-lg-3 col-sm-3 pl0"> <div class="form-group"> </div> </div> </div> @{ if (Model.carState != MES.Production.Entity.Enum.CarState.Sales.GetHashCode()) { <div class="clearfix f-hafl"> <div class="col-hafl"> <div class="form-group"> <label class="col-lg-3 control-label">锁车解锁:</label> <div class="col-lg-8"> <label class="radio-inline"> <div id="div1" class="open1"> <div id="div2" class="open2" onclick="SendLockCarCmd()"></div> </div> </label> @*<label class="radio-inline"> <input type="radio" name="sexcode" id="a1" onchange="SendLockCarCmd()" @(Model.LockState == true ? "checked" : "") value="1">锁车 </label> <label class="radio-inline"> <input type="radio" name="sexcode" id="a2" onchange="SendUnLockCarCmd()" @(Model.LockState == false ? "checked" : "") value="2">解锁 </label>*@ </div> </div> </div> </div> } } </div> </div> </div> </div> </div> <script type="text/javascript" src='http://webapi.amap.com/maps?v=1.4.2&key=fa36ec6323075f37020083ceffe8eb24'></script> <!-- UI组件库 1.0 --> <script src="http://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script> <script type="text/javascript"> //创建地图 //window.onload = function () { // var div2 = document.getElementById("div2"); // var div1 = document.getElementById("div1"); // div2.onclick = function () { // div1.className = (div1.className == "close1") ? "open1" : "close1"; // div2.className = (div2.className == "close2") ? "open2" : "close2"; // } //} var applicationPath = "http://" + window.location.host; $(function () { var filename = document.getElementById("hidfilename").value; if (filename != null && filename != "") { //alert(filename); var headstr = "<div id=\"WU_FILE_0\" class=\"cpup_img upload-state-done\"><img src=\""; var footstr = "\"><div class=\"upcp_img_jian\"></div><p class=\"progress hide\"><span style=\"width: 100%;\"></span></p></div>"; document.getElementById("fileNameList").innerHTML = headstr + filename + footstr; } var $ = jQuery, fileId, $list = $('#fileNameList'), // 优化retina, 在retina下这个值是2 ratio = window.devicePixelRatio || 1, // 缩略图大小 thumbnailWidth = 90 * ratio, thumbnailHeight = 90 * ratio, // Web Uploader实例 uploader; uploader = WebUploader.create({ // 选完文件后,是否自动上传。 auto: true, disableGlobalDnd: true, // swf文件路径 swf: applicationPath + '/Script/Uploader.swf', // 文件接收服务端。 //server: applicationPath + '/Home/UpLoadProcess', server: applicationPath + '/Sys/Home/UpLoadProcess', // 选择文件的按钮。可选。 // 内部根据当前运行是创建,可能是input元素,也可能是flash. pick: '#fileNamePicker', //只允许选择图片 accept: { title: 'Images', extensions: 'gif,jpg,jpeg,bmp,png', mimeTypes: 'image/*' } }); // 当有文件添加进来的时候 uploader.on('fileQueued', function (file) { var $li = $( '<div id="' + file.id + '" class="cpup_img">' + '<img id="jjgimg">' + '<div class="upcp_img_jian"></div></div>' ), $img = $li.find('img'); $list.children().remove();//先清空元素内容 if (fileId != file.id && fileId != null) { //alert(fileId); uploader.removeFile(uploader.getFile(fileId, true)); } fileId = file.id; // $list为容器jQuery实例 $list.append($li); // 创建缩略图 // 如果为非图片文件,可以不用调用此方法。 // thumbnailWidth x thumbnailHeight 为 100 x 100 uploader.makeThumb(file, function (error, src) { if (error) { $img.replaceWith('<span>不能预览</span>'); return; } //alert(src); //alert(file); $img.attr('src', src); }, thumbnailWidth, thumbnailHeight); }); //上传压缩宽度 uploader.option('compress', { width: 700 }); // 文件上传过程中创建进度条实时显示。 uploader.on('uploadProgress', function (file, percentage) { var $li = $('#' + file.id), $percent = $li.find('.progress span'); // 避免重复创建 if (!$percent.length) { $percent = $('<p class="progress"><span></span></p>') .appendTo($li) .find('span'); } $percent.css('width', percentage * 100 + '%'); }); // 文件上传成功,给item添加成功class, 用样式标记上传成功。 uploader.on('uploadSuccess', function (file, response) { //alert(file.name);//原来文件名 //alert(response.id);//文件路径 var imgurl = response.filePath; //上传图片的路径 var fileid = response.fileid; //上传图片的路径 console.log(response.id); console.log(imgurl); $('#' + file.id).addClass('upload-state-done'); //alert(document.getElementById("fileNameList").innerHTML.replace('class="progress"', 'class="progress hide"')); $("#hidfilename").val(imgurl); $("#jjgimg").attr('src', imgurl);//季健国加为了解决保存一串字符串 $("#hidfileid").val(fileid); }); // 文件上传失败,显示上传出错。 uploader.on('uploadError', function (file) { var $li = $('#' + file.id), $error = $li.find('div.error'); // 避免重复创建 if (!$error.length) { $error = $('<div class="error"></div>').appendTo($li); } $error.text('上传失败'); }); // 完成上传完了,成功或者失败,先删除进度条。 uploader.on('uploadComplete', function (file) { $('#' + file.id).find('.progress').remove(); }); //所有文件上传完毕 uploader.on("uploadFinished", function () { //提交表单 }); //开始上传 $("#ctlUpBtn").click(function () { uploader.upload(); }); //显示删除按钮 $(".cpup_img").on("mouseover", function () { $(this).children(".upcp_img_jian").css('display', 'block'); }); //隐藏删除按钮 $(".cpup_img").on("mouseout", function () { $(this).children(".upcp_img_jian").css('display', 'none'); }); //执行删除方法 $list.on("click", ".upcp_img_jian", function () { var Id = $(this).parent().attr("id"); try { uploader.removeFile(uploader.getFile(Id, true)); } catch (ex) { } $(this).parent().remove(); }); $('.form-horizontal').initValidform(); $('.select2').select2(); //分配部门 var div2 = document.getElementById("div2"); var div1 = document.getElementById("div1"); var lock = "@Model.LockState.ToString()"; if (lock=="True") { div1.className = "close1"; div2.className = "close2"; } else { div1.className = "open1"; div2.className = "open2"; } }); function SendLockCarCmd() { var urlstr = "http://" + window.location.host + "/"; var apply1 = $('#applyName').val(); var apply2 = $('#applyReason').val(); var apply3 = $('#applyPwd').val(); if (apply1 == "") { dig.msg("申请人不能为空!"); $('#applyName').focus(); return; } if (apply2 == "") { dig.msg("申请原因不能为空!"); $('#applyReason').focus(); return; } if (apply3 == "") { dig.msg("申请密码不能为空!"); $('#applyPwd').focus(); return; } var div2 = document.getElementById("div2"); var div1 = document.getElementById("div1"); if (div1.className == "close1") { div1.className = "open1"; } else { div1.className = "close1"; } if (div2.className == "close2") { div2.className = "open2"; } else { div2.className = "close2"; } if (div1.className == "close1") { $.ajax({ url: urlstr + 'Sys/Car/SendLockCarCmd?carid=' +@Model.carId+'&applyName=' + apply1 + '&applyReason=' + apply2 + '&applyPwd=' + apply3, data: null, type: 'get', dataType: 'json', async: false, cache: false, success: function (res) { if (res.Status == 'y') { dig.msg("锁车发送成功!"); //alert("锁车发送成功!"); } else { dig.msg(res.Msg); } } }); } else { $.ajax({ url: urlstr + 'Sys/Car/SendUnlockCarCmd?carid=' +@Model.carId+'&applyName=' + apply1 + '&applyReason=' + apply2 + '&applyPwd=' + apply3, data: null, type: 'get', dataType: 'json', async: false, cache: false, success: function (res) { if (res.Status == 'y') { //alert("解锁发送成功!"); dig.msg("解锁发送成功!"); } else { dig.msg(res.Msg); } } }); } } //解锁 function SendUnLockCarCmd() { var item = $(":radio:checked"); var urlstr = "http://" + window.location.host + "/"; var apply1 = $('#applyName').val(); var apply2 = $('#applyReason').val(); var apply3 = $('#applyPwd').val(); if (apply1 == "") { dig.msg("申请人不能为空!"); $('#applyName').focus(); return; } if (apply2 == "") { dig.msg("申请原因不能为空!"); $('#applyReason').focus(); return; } if (apply3 == "") { dig.msg("申请密码不能为空!"); $('#applyPwd').focus(); return; } //alert(urlstr); var len = item.length; if (len > 0) { if ($(":radio:checked").val() == 2) { $.ajax({ url: urlstr + 'Sys/Car/SendUnlockCarCmd?carid=' +@Model.carId+'&applyName=' + apply1 + '&applyReason=' + apply2 + '&applyPwd=' + apply3, data: null, type: 'get', dataType: 'json', async: false, cache: false, success: function (res) { if (res.Status == 'y') { alert("解锁发送成功!"); } } }); } else { } } } var map = new AMap.Map('container', { resizeEnable: true, zoom: 16, center: [@Model.lng, @Model.lat] }); //加载缩放条事件 map.plugin(["AMap.ToolBar"], function () { toolBar = new AMap.ToolBar(); map.addControl(toolBar); }); AMapUI.loadUI(['overlay/SimpleInfoWindow'], function (SimpleInfoWindow) { var marker = new AMap.Marker({ map: map, zIndex: 99999, offset: new AMap.Pixel(-14, -34),//相对于基点的位置 icon: new AMap.Icon({ //复杂图标 size: new AMap.Size(34, 49),//图标大小 image: "@Model.imageUrl", //大图地址 }) }); var infoWindow = new SimpleInfoWindow({ infoTitle: '<strong>@Model.carName</strong>', infoBody: '<p class="my-desc"><strong>@Model.Note<br/>@Model.onlineDate<br/>@Model.workHours<br/>@Model.address</strong></p>', //基点指向marker的头部位置 offset: new AMap.Pixel(0, -31) }); function openInfoWin() { infoWindow.open(map, marker.getPosition()); } //marker 点击时打开 AMap.event.addListener(marker, 'click', function () { openInfoWin(); }); }); </script> </body> </html>