|
|
@@ -345,6 +345,25 @@
|
|
|
margin-left: 5px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+ .jkedit {
|
|
|
+ background-image: url(../static/imgs/jkedit.png);
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ width: 120px;
|
|
|
+ height: 30px;
|
|
|
+ margin: auto;
|
|
|
+ margin-top: 15px;
|
|
|
+ /* margin-bottom: 15px; */
|
|
|
+ }
|
|
|
+
|
|
|
+ .jkedit span {
|
|
|
+ width: 54px;
|
|
|
+ height: 32px;
|
|
|
+ display: inline-block;
|
|
|
+ float: left;
|
|
|
+ margin-left: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
/* 监控列表 */
|
|
|
.gardenListBtn{
|
|
|
margin-top: 10px;
|
|
|
@@ -364,6 +383,19 @@
|
|
|
.gardenListBtn button.layui-btn-primary:hover{
|
|
|
box-shadow: 0 0 2px 0px #039c6b;
|
|
|
}
|
|
|
+ /* 气象站定位弹框 */
|
|
|
+ #addLocation{
|
|
|
+ display: none;
|
|
|
+ padding: 20px;
|
|
|
+ height: 450px;
|
|
|
+ }
|
|
|
+ .mapbox{
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ #allmap{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
</style>
|
|
|
</head>
|
|
|
<script>
|
|
|
@@ -470,6 +502,10 @@
|
|
|
<span onmousedown="configCamera(this,'move',8)" onmouseup="configCamera(this,'stop')"></span>
|
|
|
<span onmousedown="configCamera(this,'move',9)" onmouseup="configCamera(this,'stop')"></span>
|
|
|
</div>
|
|
|
+ <div class="jkedit">
|
|
|
+ <span onclick="addMapPosition()" ></span>
|
|
|
+ <span onclick="ChangeName()" ></span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -483,12 +519,22 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <input type="text" name="" id="currid" value="{{equip_id|default:''}}">
|
|
|
-
|
|
|
+ <input type="hidden" name="" id="currid" value="{{equip_id|default:''}}">
|
|
|
+ <div id="addLocation">
|
|
|
+ <div class="">
|
|
|
+ 经度:<input type="text" name="title" lay-verify="title" id="lng" placeholder="" class="layui-input" style="width: 200px;display: inline-block;">
|
|
|
+ 纬度:<input type="text" name="title" lay-verify="title" id="lat" placeholder="" class="layui-input" style="width: 200px;display: inline-block;">
|
|
|
+ <button type="button" id="shaixuan" onclick="sub_getMarker()" class="layui-btn layui-btn-normal">定位</button>
|
|
|
+ </div>
|
|
|
+ <div class="mapbox">
|
|
|
+ <div id="allmap"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
<script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
|
|
|
<script src="{% static '/lib/layui/layui.js'%}"></script>
|
|
|
<script src="{% static '/js/backstageNet/common.js'%}"></script>
|
|
|
+ <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=TcRPmrsiZUqdUBWoELrUArRkCRC36KMx"></script>
|
|
|
|
|
|
<script>
|
|
|
$.ajaxSetup({
|
|
|
@@ -541,7 +587,134 @@
|
|
|
|
|
|
$("#span_V" + n).addClass("active");
|
|
|
}
|
|
|
+ // 百度地图API功能
|
|
|
+ var map = new BMap.Map("allmap");
|
|
|
+ map.centerAndZoom(new BMap.Point(113.64964385, 34.75661006), 13);// 创建点坐标
|
|
|
+ map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用
|
|
|
+ map.enableContinuousZoom(); //启用地图惯性拖拽,默认禁用
|
|
|
+ map.addControl(new BMap.NavigationControl()); // 添加平移缩放控件
|
|
|
+ map.addControl(new BMap.ScaleControl()); // 添加比例尺控件
|
|
|
+ map.addControl(new BMap.OverviewMapControl()); //添加缩略地图控件
|
|
|
+ map.enableScrollWheelZoom(); //启用滚轮放大缩小
|
|
|
+ map.addControl(new BMap.MapTypeControl());
|
|
|
+ //单击获取点击的经纬度
|
|
|
+ map.addEventListener("click", function (e) {
|
|
|
+ map.clearOverlays();
|
|
|
+ $('#lng').val(e.point.lng);
|
|
|
+ $('#lat').val(e.point.lat);
|
|
|
+ var point = new BMap.Point(e.point.lng, e.point.lat);
|
|
|
+ var marker = new BMap.Marker(point);
|
|
|
+ map.addOverlay(marker);
|
|
|
+ // alert(e.point.lng + "," + e.point.lat);
|
|
|
+ });
|
|
|
|
|
|
+ function sub_getMarker() {
|
|
|
+ map.clearOverlays();
|
|
|
+ var points = []
|
|
|
+ var point = new BMap.Point($('#lng').val(), $('#lat').val());
|
|
|
+ var marker = new BMap.Marker(point);
|
|
|
+ map.addOverlay(marker);
|
|
|
+ points.push(point)
|
|
|
+ console.log(points)
|
|
|
+ map.setViewport(points);
|
|
|
+ }
|
|
|
+ // 添加地图定位
|
|
|
+ function addMapPosition(obj) {
|
|
|
+ id = $('#divMain a.aSelected').find('.equipname').html().trim();
|
|
|
+ layui.use('layer', function () { //独立版的layer无需执行这一句
|
|
|
+ var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
|
|
|
+ layer.open({
|
|
|
+ title: '手动添加位置',
|
|
|
+ type: 1,
|
|
|
+ area: ['900px', '600px'],
|
|
|
+ btn: ['确定', '取消'],
|
|
|
+ yes: function (index, layero) {
|
|
|
+ //按钮【按钮一】的回调
|
|
|
+ if($('#lng').val() && $('#lat').val()){
|
|
|
+ $.ajax({
|
|
|
+ url:'equip_location',
|
|
|
+ type:'post',
|
|
|
+ data:{
|
|
|
+ e_id:id,
|
|
|
+ lng:$('#lng').val(),
|
|
|
+ lat:$('#lat').val(),
|
|
|
+ },
|
|
|
+ success:function(data){
|
|
|
+ console.log(data)
|
|
|
+ if(data == 0){
|
|
|
+ layer.closeAll();
|
|
|
+ }else{
|
|
|
+ layer.msg('添加失败', {icon: 2});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error:function(type){
|
|
|
+ console.log(type)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ layer.msg('请先定位', {icon: 2});
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ , btn2: function (index, layero) {
|
|
|
+ //按钮【按钮二】的回调
|
|
|
+ //return false 开启该代码可禁止点击该按钮关闭
|
|
|
+ },
|
|
|
+ content: $('#addLocation')
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //点击修改名称,跳出弹框并显示所选设备的设备名称;
|
|
|
+ function ChangeName() {
|
|
|
+ id = $('#divMain a.aSelected').find('.equipname').html().trim();
|
|
|
+ layui.use('layer', function () { //独立版的layer无需执行这一句
|
|
|
+ var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
|
|
|
+ layer.prompt({ title: '修改名称', value: '', area: 400 }, function (val, index) {
|
|
|
+ layer.close(index);
|
|
|
+ ChangeNameSub(id, val);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function ChangeNameSub(deviceId, name, address) {
|
|
|
+ data = {
|
|
|
+ ename: name,
|
|
|
+ eid: deviceId
|
|
|
+ }
|
|
|
+ //校验重复校验重复
|
|
|
+ $.ajax({
|
|
|
+ type: "post",
|
|
|
+ url: "equip_location",
|
|
|
+ data: data,
|
|
|
+ dataType: "json",
|
|
|
+ success: function (data) {
|
|
|
+ if (data == 1) {
|
|
|
+ // layer.tips("设备名已存在!", '#ename');
|
|
|
+ layui.use('layer', function () {
|
|
|
+ var layer = layui.layer;
|
|
|
+ layer.msg('设备名已存在!');
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else if (data == 2) {
|
|
|
+ layui.use('layer', function () {
|
|
|
+ var layer = layui.layer;
|
|
|
+ layer.msg('设备位置添加成功!');
|
|
|
+ // window.location.href = window.location.href;
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (data == 0) {
|
|
|
+ layui.use('layer', function () {
|
|
|
+ var layer = layui.layer;
|
|
|
+ layer.msg('设备名称修改成功!');
|
|
|
+ // window.location.href = window.location.href;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
function setMouseOut(idx) {
|
|
|
if (curIndex != idx && $("#a_" + idx).length > 0)
|
|
|
$("#a_" + idx).removeClass("aSelected");
|