init
This commit is contained in:
857
application/admin/view/yq/base_config/perimeter/config.html
Normal file
857
application/admin/view/yq/base_config/perimeter/config.html
Normal file
@@ -0,0 +1,857 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
|
||||
<link rel="stylesheet" href="__CDN__/caicai/css/index.css" type="text/css">
|
||||
<script src="__CDN__/caicai/data/jquery-1.10.1.min.js"></script>
|
||||
<script src="__CDN__/layer/layer_zh-cn.js"></script>
|
||||
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" type="text/css">
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#container {
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.input-item {
|
||||
height: 2.2rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 6rem;
|
||||
margin: 0 .5rem;
|
||||
}
|
||||
|
||||
.input-text {
|
||||
width: 4rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 6rem;
|
||||
margin: 0 .5rem 0 .5rem;
|
||||
}
|
||||
|
||||
.input-text {
|
||||
width: 4rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
#app {}
|
||||
|
||||
.ads-search {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#app button {
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #ff0000 !important;
|
||||
}
|
||||
|
||||
.info div {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.i-tit {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#app {
|
||||
/* position: fixed;
|
||||
z-index: 1;
|
||||
bottom: 0;
|
||||
right: 5px;
|
||||
width: 280px;
|
||||
height: auto;*/
|
||||
}
|
||||
|
||||
.lengend {
|
||||
width: 280px;
|
||||
height: auto;
|
||||
background-color: rgba(0, 0, 0, .4);
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
padding-bottom: 5px;
|
||||
position: fixed;
|
||||
bottom: 52px;
|
||||
right: -285px;
|
||||
z-index: 99;
|
||||
transition: right .3s;
|
||||
}
|
||||
|
||||
.l-show {
|
||||
right: 26%;
|
||||
}
|
||||
|
||||
.l-item {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.l-head {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.f-item {
|
||||
width: auto;
|
||||
height: 25px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.f-item label {
|
||||
width: auto;
|
||||
display: inline-block;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.l-cont {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.l-cont .f-item {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.f-item label:before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
display: inline-block;
|
||||
content: "";
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
top: 5px;
|
||||
border: 1px solid #BFBFBF;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.f-item input:checked+label:before {
|
||||
background-image: url('__CDN__/caicai/icon/check.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 100% 100%;
|
||||
border-color: #4679ff;
|
||||
}
|
||||
|
||||
.f-item label span {
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.f-item label i {
|
||||
display: inline-block;
|
||||
width: 22px;
|
||||
height: 14px;
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
.f-item label img {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
vertical-align: sub;
|
||||
}
|
||||
|
||||
.app-vis {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin: 10px 0;
|
||||
float: right;
|
||||
cursor: pointer;
|
||||
position: fixed;
|
||||
bottom: 40px;
|
||||
right: 24%;
|
||||
}
|
||||
|
||||
.app-vis label {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('__CDN__/caicai/icon/icon_tili_p@2x.png');
|
||||
background-size: 100% 100%;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.app-vis input:checked+label {
|
||||
background-image: url('__CDN__/caicai/icon/icon_tili_n@2x.png');
|
||||
}
|
||||
.amap-logo {
|
||||
display: none!important;
|
||||
visibility: hidden!important;
|
||||
}
|
||||
.amap-copyright {
|
||||
display: none!important;
|
||||
visibility: hidden!important;
|
||||
}
|
||||
.info_name{
|
||||
position: fixed;
|
||||
min-width: 200px;
|
||||
height: auto;
|
||||
/*background-color: rgba(0,0,0,.5);*/
|
||||
z-index: 99;
|
||||
padding: 10px;
|
||||
font-size: 26px;
|
||||
color:#fff;
|
||||
background: rgba(13,21,61,.7);
|
||||
border: 1px solid rgba(126,206,244,.8);
|
||||
}
|
||||
</style>
|
||||
<title>{$site.name}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id='container'></div>
|
||||
<div id="app">
|
||||
<!-- <div class="info_name" :style="infoPos" v-show="zjinforvis">-->
|
||||
<!-- <div class="i-tit" style="font-size:18px">{{zjinfor.name}}</div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class='info'>操作说明:点击鼠标左键开始绘制,右键结束绘制</div>
|
||||
<div class="input-card" style='width: auto;'>
|
||||
<div class="input-item">
|
||||
<!-- <input type="radio" name='func' checked="" value='marker'><span class="input-text">画点</span> -->
|
||||
<input type="radio" name='func' checked value='polyline'><span class="input-text">画区域</span>
|
||||
<!-- <input type="radio" name='func' value='polygon'><span class="input-text" style='width:5rem;'>画多边形</span> -->
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<!-- <input type="radio" name='func' value='rectangle'><span class="input-text">画矩形</span> -->
|
||||
<!-- <input type="radio" name='func' value='circle'><span class="input-text">画圆</span> -->
|
||||
</div>
|
||||
<div class="input-item">
|
||||
<input id="clear" type="button" class="btn" value="清除" />
|
||||
<!-- <input id="close" type="button" class="btn" value="关闭绘图" /> -->
|
||||
<input type="button" class="btn save" value="保存" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="lengend" :class="vis&&'l-show'">
|
||||
<div class="l-item" v-for="(i,k) of form" :key="k">
|
||||
<div class="l-head">
|
||||
<div class="f-item">
|
||||
<input type="checkbox" v-model="i.val" :id="k+'-tit'">
|
||||
<label :for="k+'-tit'">
|
||||
<span>{{i.tit}}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="l-cont">
|
||||
<div class="f-item" v-for="(j,z) of i.kids" :key="z">
|
||||
<input type="checkbox" v-model="i.model" :value="j.val" :id="k+'-item-'+z"
|
||||
@change="i.change(i)">
|
||||
<label :for="k+'-item-'+z">
|
||||
<img :src="j.icon" alt="" v-if="j.icon">
|
||||
<i v-if="j.bc" :style="{'background-color':j.bc}"></i>
|
||||
<span>{{j.label}}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-vis">
|
||||
<input type="checkbox" v-model="vis" id="vis">
|
||||
<label for="vis"></label>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: 'a5d6cb96a51ade716e6bb1f4f4c61bb5',
|
||||
}
|
||||
</script>
|
||||
<script src="https://webapi.amap.com/maps?v=1.4.15&key=f5cfbfccbea2ee815aa8600946be6c7a&plugin=AMap.MouseTool"></script>
|
||||
<!--<script type="text/javascript" src="__CDN__/caicai/data/map.js"></script>-->
|
||||
<script type="text/javascript" src="__CDN__/caicai/data/vue.js"></script>
|
||||
<script type="text/javascript" src="__CDN__/caicai/data/data.js"></script>
|
||||
<script type="text/javascript" src="__CDN__/caicai/data/axios.js"></script>
|
||||
<script type="text/javascript">
|
||||
var inf = {$data};
|
||||
var perimeter_id = {$perimeter_id};
|
||||
// console.log('data:',inf)
|
||||
const MAP_KEY = "f5cfbfccbea2ee815aa8600946be6c7a",
|
||||
{
|
||||
LngLat
|
||||
} = AMap;
|
||||
var map = new AMap.Map('container', {
|
||||
zoom: 13,
|
||||
center: new LngLat(107.001406, 29.831293),
|
||||
//mapStyle: 'amap://styles/d20072f4733f3c023ea36097cd4d9933'
|
||||
});
|
||||
|
||||
map.setDefaultCursor('default');
|
||||
var mouseTool = new AMap.MouseTool(map);
|
||||
//监听draw事件可获取画好的覆盖物
|
||||
var overlays = [];var setattr='';
|
||||
mouseTool.on('draw', function(e) {
|
||||
overlays.push(e.obj);
|
||||
var polygonItem = e.obj;
|
||||
var path = polygonItem.getPath();
|
||||
mouseTool.close();
|
||||
setattr=path;
|
||||
// console.log(path);
|
||||
})
|
||||
|
||||
function draw(type) {
|
||||
switch (type) {
|
||||
case 'marker': {
|
||||
mouseTool.marker({
|
||||
//同Marker的Option设置
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'polyline': {
|
||||
mouseTool.polyline({
|
||||
strokeColor: 'blue'
|
||||
//同Polyline的Option设置
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var radios = document.getElementsByName('func');
|
||||
for (var i = 0; i < radios.length; i += 1) {
|
||||
radios[i].onchange = function(e) {
|
||||
draw(e.target.value)
|
||||
}
|
||||
}
|
||||
draw('polyline')
|
||||
$(function() { //保存
|
||||
$('#clear').click(function() {
|
||||
map.remove(overlays);
|
||||
overlays = [];
|
||||
draw('polyline');
|
||||
setattr='';
|
||||
});
|
||||
$('.save').click(function() {
|
||||
var data={
|
||||
info:JSON.stringify(setattr),
|
||||
perimeter_id:perimeter_id
|
||||
};
|
||||
|
||||
$.post("{:url('/yq/base_config/perimeter/config')}",data,function(res){
|
||||
if(res.code == 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
setTimeout(function(){
|
||||
window.location.reload(1);
|
||||
}, 2000);
|
||||
// layer.alert(res.msg, {icon: 6}, function (index) {
|
||||
// layer.close(index);
|
||||
// });
|
||||
}else {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mouseTool.close(true);
|
||||
})
|
||||
});
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
stopcolor = '#ff0000',
|
||||
treecolor='#26c533',
|
||||
livcolor = '#e89393',
|
||||
lv1color = "#ff0000",
|
||||
lv2color = "#a08e8e",
|
||||
lv3color = '#d2db00',
|
||||
lv4color = '#f29b76',
|
||||
overlayGroups = {
|
||||
fac: [],
|
||||
car: [],
|
||||
enter: {},
|
||||
road: [],
|
||||
truth: [],
|
||||
},
|
||||
kk =
|
||||
`107.027841,29.759073;107.034279,29.762086;106.997726,29.824484;107.059954,29.820257;107.043592,29.83791;107.016477,29.871028;106.962953,29.790122`;
|
||||
// function kkRender(){
|
||||
// strToLL(kk).map(i=>{
|
||||
// new AMap.Marker({
|
||||
// position:i,
|
||||
// map:map,
|
||||
// icon:'./icon/tuli_kakou.png'
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// kkRender(); //标记显示
|
||||
// showMarkers();
|
||||
|
||||
var vm = new Vue({
|
||||
el: "#app",
|
||||
filters: {
|
||||
status(n) {
|
||||
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let fac = [
|
||||
|
||||
|
||||
],
|
||||
enter = [{
|
||||
label: "一级周界",
|
||||
bc: lv1color,
|
||||
val: 'lv1',
|
||||
},
|
||||
{
|
||||
label: "二级周界",
|
||||
bc: lv2color,
|
||||
val: 'lv2',
|
||||
},
|
||||
{
|
||||
label: "三级周界",
|
||||
bc: lv3color,
|
||||
val: 'lv3',
|
||||
},
|
||||
{
|
||||
label: "四级周界",
|
||||
bc: lv4color,
|
||||
val: 'lv4',
|
||||
}
|
||||
|
||||
],
|
||||
road = [{
|
||||
label: "正常周界",
|
||||
bc: '#448ACA',
|
||||
val: 'nor',
|
||||
},
|
||||
{
|
||||
label: "预警周界",
|
||||
bc: '#46A162',
|
||||
val: 'warn',
|
||||
},
|
||||
{
|
||||
label: "禁行周界",
|
||||
bc: '#6A005F',
|
||||
val: 'no',
|
||||
}
|
||||
];
|
||||
|
||||
return {
|
||||
infoPos: {
|
||||
left: '0px',
|
||||
top: '0px'
|
||||
},
|
||||
zjinfor: {},
|
||||
zjinforvis: false,
|
||||
carInfo: {},
|
||||
infoVis: false,
|
||||
vis: false,
|
||||
linKey: "",
|
||||
search: '',
|
||||
mingyu: '',
|
||||
count_car: '',
|
||||
incount_car: '',
|
||||
outcount_car: '',
|
||||
stop_vehicle: '',
|
||||
type: '',
|
||||
form: [
|
||||
|
||||
{
|
||||
tit: '周界',
|
||||
get val() {
|
||||
return this.model.length === this.kids.length;
|
||||
},
|
||||
set val(n) {
|
||||
if (n) {
|
||||
this.model = this.kids.map(i => i.val);
|
||||
} else {
|
||||
this.model = [];
|
||||
}
|
||||
this.change(this);
|
||||
|
||||
},
|
||||
change(_this) {
|
||||
vm.enterSec();
|
||||
|
||||
let enters = overlayGroups.enter,
|
||||
kids = _this.kids.map(i => i.val);
|
||||
|
||||
|
||||
for (var i in enters) {
|
||||
if (_this.model.includes(i)) {
|
||||
enters[i].forEach(j => j.show());
|
||||
} else {
|
||||
enters[i].forEach(j => j.hide());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
model: enter.map(i => i.val),
|
||||
kids: enter
|
||||
},
|
||||
{
|
||||
tit: '周界筛选禁行',
|
||||
$val: false,
|
||||
|
||||
get val() {
|
||||
return this.$val;
|
||||
},
|
||||
set val(n) {
|
||||
this.$val = n;
|
||||
this.change(this);
|
||||
|
||||
},
|
||||
change(_this) {
|
||||
vm.enterSec();
|
||||
|
||||
|
||||
},
|
||||
model: [1, 2],
|
||||
kids: [{
|
||||
label: "非禁行",
|
||||
val: 2,
|
||||
},
|
||||
{
|
||||
label: "禁行",
|
||||
val: 1,
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
tit: '道路周界',
|
||||
model: true,
|
||||
change(_this) {
|
||||
let truth = overlayGroups.truth,
|
||||
kids = _this.kids.map(i => i.val);
|
||||
|
||||
for (var i in truth) {
|
||||
if (_this.model.includes(i)) {
|
||||
truth[i].forEach(j => j.show());
|
||||
} else {
|
||||
truth[i].forEach(j => j.hide());
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
get val() {
|
||||
return this.model;
|
||||
},
|
||||
set val(n) {
|
||||
this.model = n;
|
||||
let truth = overlayGroups.truth;
|
||||
for (var i in truth) {
|
||||
if (n) {
|
||||
truth[i].forEach(j => j.show());
|
||||
} else {
|
||||
truth[i].forEach(j => j.hide());
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
kids: [],
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
enterModel() {
|
||||
var ef = this.form.filter(i => i.tit === '周界')[0],
|
||||
sf = this.form.filter(i => i.tit === '周界筛选禁行')[0];
|
||||
|
||||
return {
|
||||
lv: ef.model,
|
||||
isSec: sf.val,
|
||||
sec: sf.model
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
enterSec() {
|
||||
let enters = overlayGroups.enter;
|
||||
for (var i in enters) {
|
||||
if (this.enterModel.lv.includes(i)) {
|
||||
if (this.enterModel.isSec) {
|
||||
enters[i].forEach(j => {
|
||||
if ([0, ...this.enterModel.sec].includes(j.getExtData().is_ban)) {
|
||||
j.show()
|
||||
} else {
|
||||
j.hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
enters[i].forEach(j => j.show());
|
||||
}
|
||||
|
||||
} else {
|
||||
enters[i].forEach(j => j.hide());
|
||||
}
|
||||
}
|
||||
},
|
||||
dataHandle(
|
||||
data
|
||||
) {
|
||||
// console.log('aaa',data)
|
||||
let lv1 = [],
|
||||
lv2 = [],
|
||||
lv3 = [],
|
||||
lv4 = [];
|
||||
data.filter(function(i) {
|
||||
var res;
|
||||
if (i.region_lv === 3&&i.region_type === 8) { //停车场
|
||||
//res = false;
|
||||
overlayGroups.fac.push(lvOverRender(i, {
|
||||
fillColor: stopcolor,
|
||||
fillOpacity: .3,
|
||||
strokeColor: stopcolor,
|
||||
// extData: {
|
||||
// type: 'stop'
|
||||
// }
|
||||
}))
|
||||
} else if (i.region_lv === 2&&i.region_type === 3) { //居住区
|
||||
//res = false;
|
||||
overlayGroups.fac.push(lvOverRender(i, {
|
||||
fillColor: livcolor,
|
||||
fillOpacity: .5,
|
||||
strokeColor: livcolor,
|
||||
// extData: {
|
||||
// type: 'live'
|
||||
// }
|
||||
}))
|
||||
}else if(i.region_lv === 2&&i.region_type === 4){ //森林防护区
|
||||
overlayGroups.fac.push(lvOverRender(i, {
|
||||
fillColor: treecolor,
|
||||
strokeColor: treecolor,
|
||||
}))
|
||||
}else if(i.region_type === 5){ //道路
|
||||
overlayGroups.fac.push(lvOverRender(i, {
|
||||
fillColor: '',
|
||||
strokeColor:'#00000',
|
||||
}))
|
||||
} else {
|
||||
res = true;
|
||||
}
|
||||
return res;
|
||||
|
||||
}).forEach(i => {
|
||||
if (i.info) {
|
||||
let stys = {
|
||||
// 87: {
|
||||
// fillColor: "#26c533",
|
||||
// strokeColor: '#26c533',
|
||||
// },
|
||||
// 85: {
|
||||
// fillColor: "#26c533",
|
||||
// strokeColor: '#26c533',
|
||||
// },
|
||||
// 99: {
|
||||
// fillColor: "#26c533",
|
||||
// strokeColor: '#26c533',
|
||||
// },
|
||||
|
||||
}
|
||||
var over = lvOverRender(i, stys[i.id] || {});
|
||||
switch (i.region_lv) {
|
||||
case 1:
|
||||
lv1.push(over);
|
||||
break;
|
||||
case 2:
|
||||
lv2.push(over);
|
||||
break;
|
||||
case 3:
|
||||
lv3.push(over);
|
||||
break;
|
||||
case 4:
|
||||
lv4.push(over);
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
overlayGroups.enter = {
|
||||
lv1,
|
||||
lv2,
|
||||
lv3,
|
||||
lv4
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
getData(this.dataHandle)
|
||||
}
|
||||
|
||||
});
|
||||
function strToLL(str) {
|
||||
return str.split(';').map(i => new LngLat(...i.split(',').map(j => +j)))
|
||||
}
|
||||
|
||||
function xlsxToPath(str) {
|
||||
str = str.replace(/\)\n$|\n|^\(/g, '').replace(/\)\(/g, ';');
|
||||
return strToLL(str);
|
||||
}
|
||||
function baiduToAMap(lls) {
|
||||
AMap.convertFrom(lls, 'baidu', (r, e) => {
|
||||
window.a = e.locations;
|
||||
})
|
||||
}
|
||||
function lvOverRender(i, sty) {
|
||||
var style = {
|
||||
fillOpacity: {
|
||||
1: 0,
|
||||
2: .5,
|
||||
3: .5,
|
||||
4: 1,
|
||||
},
|
||||
fillColor: {
|
||||
1: lv1color,
|
||||
2: lv2color,
|
||||
3: lv3color,
|
||||
4: lv4color
|
||||
},
|
||||
strokeOpacity: {
|
||||
1: 1,
|
||||
2: 1,
|
||||
3: 1,
|
||||
4: 1
|
||||
},
|
||||
strokeColor: {
|
||||
1: lv1color,
|
||||
2: lv2color,
|
||||
3: lv3color,
|
||||
4: lv4color
|
||||
},
|
||||
strokeWeight: {
|
||||
1: 3,
|
||||
2: 2,
|
||||
3: 0,
|
||||
4: 0,
|
||||
},
|
||||
zIndex: {
|
||||
1: 21,
|
||||
2: 22,
|
||||
3: 23,
|
||||
4: 24
|
||||
},
|
||||
strokeStyle: {
|
||||
1: 'dashed',
|
||||
2: 'solid',
|
||||
3: 'solid',
|
||||
4: 'solid',
|
||||
}
|
||||
}
|
||||
var poy = new AMap.Polygon({
|
||||
map: map,
|
||||
path:i.info?strToLL(i.info):'',
|
||||
extData: i,
|
||||
...(function() {
|
||||
var obj = {};
|
||||
for (var j in style) {
|
||||
obj[j] = style[j][i.region_lv]
|
||||
}
|
||||
return obj
|
||||
})(),
|
||||
...(sty || {})
|
||||
})
|
||||
|
||||
poy.on('mouseover',function(e){ //显示名称
|
||||
|
||||
if(e.target.getExtData().id==1){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
vm.zjinfor=e.target.getExtData();
|
||||
// console.log(e.target.getExtData())
|
||||
|
||||
// console.log(vm.zjinfor);
|
||||
vm.zjinforvis=true;
|
||||
vm.infoVis=false;
|
||||
let pos=e.pixel;
|
||||
vm.infoPos={
|
||||
left:`${pos.x+10}px`,
|
||||
top:`${pos.y-120}px`
|
||||
}
|
||||
var timer;
|
||||
timer&&clearTimeout(timer);
|
||||
|
||||
timer=setTimeout(e=>{
|
||||
vm.zjinforvis = false
|
||||
},5e3);
|
||||
})
|
||||
|
||||
let _this = this;
|
||||
|
||||
return poy;
|
||||
}
|
||||
|
||||
// var ws = new WebSocket("ws://47.108.64.59:2346"),
|
||||
function CarMarkers() {
|
||||
this.list = [];
|
||||
this.data = [];
|
||||
Object.defineProperty(this, 'ids', {
|
||||
get() {
|
||||
return this.data.map(i => i.id);
|
||||
}
|
||||
})
|
||||
}
|
||||
CarMarkers.prototype.getMarker = function(id) {
|
||||
return this.list.filter(i => {
|
||||
return i.getExtData().id === id
|
||||
})[0];
|
||||
}
|
||||
let car_markers = new CarMarkers();
|
||||
let _this = this;
|
||||
overlayGroups.truth = {
|
||||
nor: [],
|
||||
no: [],
|
||||
warn: []
|
||||
};
|
||||
var truthColor = {
|
||||
nor: '#1b2538',
|
||||
warn: '#46A162',
|
||||
no: '#6A005F'
|
||||
}
|
||||
ploygens.forEach(i => {
|
||||
|
||||
// if (i.type === 'Polyline') {
|
||||
// overlayGroups.truth[i.status] && overlayGroups.truth[i.status].push(new AMap[i.type]({
|
||||
// map: map,
|
||||
// path: strToLL(i.path),
|
||||
// strokeColor: truthColor[i.status],
|
||||
// strokeOpacity: 1,
|
||||
// zIndex: 25,
|
||||
// extData: i,
|
||||
// }))
|
||||
// }
|
||||
})
|
||||
|
||||
function getData(call) { //获取周界
|
||||
call(inf);
|
||||
return false;
|
||||
$.post('http://zhyq.toommi.com/api/Index/apppost', {
|
||||
action: 'Perimeter/perimeter_list'
|
||||
}).then(r => {
|
||||
console.log(r)
|
||||
call(
|
||||
JSON.parse(r)
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user