|
|
@ -24,6 +24,7 @@
|
|
|
|
<el-form-item label=" ">
|
|
|
|
<el-form-item label=" ">
|
|
|
|
<el-button icon="Search" type="primary" @click="handleQuery">{{ t('option.search') }}</el-button>
|
|
|
|
<el-button icon="Search" type="primary" @click="handleQuery">{{ t('option.search') }}</el-button>
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">{{ t('option.reset') }}</el-button>
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">{{ t('option.reset') }}</el-button>
|
|
|
|
|
|
|
|
<el-button icon="Refresh" @click="getLine">获取点位</el-button>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
@ -44,10 +45,9 @@ const queryParams = ref({})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let map = null
|
|
|
|
let map = null
|
|
|
|
let polyline = null
|
|
|
|
|
|
|
|
let passedPolyline = null
|
|
|
|
|
|
|
|
let mouseTool = null
|
|
|
|
|
|
|
|
let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]]
|
|
|
|
let path = [[116.390969, 39.911592], [116.391496, 39.909008], [116.389264, 39.909765], [116.38802, 39.911016]]
|
|
|
|
|
|
|
|
let path2 = [[116.400969, 39.921592], [116.401496, 39.919008], [116.399264, 39.919765], [116.39802, 39.921016]]
|
|
|
|
|
|
|
|
const areaPath = ref([path,path2])
|
|
|
|
let marketPath = [116.390669, 39.911147]
|
|
|
|
let marketPath = [116.390669, 39.911147]
|
|
|
|
AMapLoader.load({
|
|
|
|
AMapLoader.load({
|
|
|
|
key: "ba8fb8d8bae1b280b93406d5959d492f", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
|
key: "ba8fb8d8bae1b280b93406d5959d492f", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
@ -75,7 +75,7 @@ AMapLoader.load({
|
|
|
|
marker.setLabel({
|
|
|
|
marker.setLabel({
|
|
|
|
direction: 'top',
|
|
|
|
direction: 'top',
|
|
|
|
offset: new AMap.Pixel(0, -10), //设置文本标注偏移量
|
|
|
|
offset: new AMap.Pixel(0, -10), //设置文本标注偏移量
|
|
|
|
content: "" + AMap.GeometryUtil.isPointInRing(marketPath,path),
|
|
|
|
content: "" + AMap.GeometryUtil.isPointInRing(marketPath,path,path2),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
marker.setMap(map);
|
|
|
|
marker.setMap(map);
|
|
|
|
|
|
|
|
|
|
|
@ -91,32 +91,47 @@ AMapLoader.load({
|
|
|
|
// 在图面添加类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
|
|
|
|
// 在图面添加类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
|
|
|
|
map.addControl(new AMap.MapType());
|
|
|
|
map.addControl(new AMap.MapType());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
areaPath.value.forEach( (e,index)=> {
|
|
|
|
let polygon = new AMap.Polygon({path: path});
|
|
|
|
let polygon = new AMap.Polygon({path: e});
|
|
|
|
map.add([polygon]);
|
|
|
|
map.add([polygon]);
|
|
|
|
let polyEditor = new AMap.PolygonEditor(map);
|
|
|
|
let polyEditor = new AMap.PolygonEditor(map);
|
|
|
|
polyEditor.addAdsorbPolygons([polygon]);
|
|
|
|
polyEditor.addAdsorbPolygons([polygon]);
|
|
|
|
polyEditor.on('add', function (data) {
|
|
|
|
polyEditor.on('add', function (data) {
|
|
|
|
console.log(data);
|
|
|
|
console.log(data);
|
|
|
|
let polygon = data.target;
|
|
|
|
let polygon = data.target;
|
|
|
|
polyEditor.addAdsorbPolygons(polygon);
|
|
|
|
polyEditor.addAdsorbPolygons(polygon);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
polyEditor.on('addnode', function (data) {
|
|
|
|
polyEditor.on('addnode', function (data) {
|
|
|
|
// 获取区域坐标
|
|
|
|
// 获取区域坐标
|
|
|
|
console.log(polyEditor.getTarget()._opts.path)
|
|
|
|
areaPath.value[index] = polyEditor.getTarget()._opts.path
|
|
|
|
})
|
|
|
|
})
|
|
|
|
polyEditor.on('adjust', function (data) {
|
|
|
|
polyEditor.on('adjust', function (data) {
|
|
|
|
// 获取区域坐标
|
|
|
|
// 获取区域坐标
|
|
|
|
console.log(polyEditor.getTarget()._opts.path)
|
|
|
|
areaPath.value[index] = polyEditor.getTarget()._opts.path
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
polyEditor.setTarget(polygon);
|
|
|
|
|
|
|
|
polyEditor.open();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
polyEditor.setTarget(polygon);
|
|
|
|
|
|
|
|
polyEditor.open();
|
|
|
|
|
|
|
|
// map.setFitView();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch(e => {
|
|
|
|
}).catch(e => {
|
|
|
|
console.log(e);
|
|
|
|
console.log(e);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
const getLine = () => {
|
|
|
|
|
|
|
|
let list = areaPath.value
|
|
|
|
|
|
|
|
let params = []
|
|
|
|
|
|
|
|
list.forEach((e,index)=>{
|
|
|
|
|
|
|
|
e.forEach(val => {
|
|
|
|
|
|
|
|
params.push({
|
|
|
|
|
|
|
|
longitude:val[0],
|
|
|
|
|
|
|
|
latitude:val[1],
|
|
|
|
|
|
|
|
index:index
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
console.log(params)
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
#container4 {
|
|
|
|
#container4 {
|
|
|
@ -125,4 +140,4 @@ AMapLoader.load({
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
height: calc(100vh - 190px);
|
|
|
|
height: calc(100vh - 190px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|