综合指数地图点位

pull/143/head
lukeyan 1 year ago
parent bdad757922
commit d0244d6062

@ -26,26 +26,142 @@
<script> <script>
// import { Engine } from 'mapv-three'; // import { Engine } from 'mapv-three';
// 创建地图实例 // 创建地图实例
var map = new BMapGL.Map("container"); // 创建地图实例 var map = new BMapGL.Map("container"); // 创建地图实例
var point = new BMapGL.Point(121.619992, 30.025703); // 创建点坐标 var point = new BMapGL.Point(121.619992, 30.025703); // 创建点坐标
map.centerAndZoom(point, 14); // 初始化地图,设置中心点坐标和地图级别 window.addEventListener('message', function (event) {
let company_list = event.data
console.log('data01', company_list);
company_list.forEach((item) => {
let company_point = new BMapGL.Point(item.longitude, item.latitude);
let myIcon = {};
// 根据公司排名打点
if (item.areaRank == '1') {
myIcon = new BMapGL.Icon(
'./top01.png',
new BMapGL.Size(40, 60),
{
imageOffset: new BMapGL.Size(0, 0, 5)
}
)
var marker = new BMapGL.Marker(company_point, { icon: myIcon }); // 创建点位
marker.disableMassClear();
map.addOverlay(marker);
} else if (item.areaRank == '2') {
myIcon = new BMapGL.Icon(
'./top02.png',
new BMapGL.Size(40, 60),
{
imageOffset: new BMapGL.Size(0, 0, 5)
}
)
var marker = new BMapGL.Marker(company_point, { icon: myIcon }); // 创建点位
marker.disableMassClear();
map.addOverlay(marker);
} else if (item.areaRank == '3') {
myIcon = new BMapGL.Icon(
'./top03.png',
new BMapGL.Size(40, 60),
{
imageOffset: new BMapGL.Size(0, 0, 5)
}
)
var marker = new BMapGL.Marker(company_point, { icon: myIcon }); // 创建点位
marker.disableMassClear();
map.addOverlay(marker);
} else if (item.areaRank == '4') {
myIcon = new BMapGL.Icon(
'./top04.png',
new BMapGL.Size(40, 60),
{
imageOffset: new BMapGL.Size(0, 0, 5)
}
)
var marker = new BMapGL.Marker(company_point, { icon: myIcon }); // 创建点位
marker.disableMassClear();
map.addOverlay(marker);
} else if (item.areaRank == '5') {
myIcon = new BMapGL.Icon(
'./top05.png',
new BMapGL.Size(40, 60),
{
imageOffset: new BMapGL.Size(0, 0, 5)
}
)
var marker = new BMapGL.Marker(company_point, { icon: myIcon }); // 创建点位
marker.disableMassClear();
map.addOverlay(marker);
}
// 公司名
let content = item.companyName;
let label = new BMapGL.Label(content, {
position: company_point, // 设置标注的地理位置
offset: new BMapGL.Size(-20, -50), // 设置标注的偏移量
})
label.setStyle({
backgroundColor: "#f9d2e4",
border: "0",
color: "#01847f",
fontSize: "16px",
cursor: "pointer",
});
label.disableMassClear();
map.addOverlay(label);
// 文本点击
label.addEventListener('click', function () {
map.clearOverlays(); // 为保证始终只有一个文本覆盖物弹出,每次创造文本覆盖物时,先清楚所有的文本覆盖物
// 注意 clearOverlays会清除地图所有的覆盖物所以要给不想清除的覆盖物加上disableMassClear以做到禁止删除
var point_text = new BMapGL.Label(); // 创建公司详情文本覆盖物
point_text.setStyle({
color: "blue",
borderRadius: "5px",
borderColor: "#ccc",
padding: "10px",
fontSize: "16px",
fontFamily: "微软雅黑",
backgroundColor: "#b5ebff",
transform: "translateX(-50%) translateY(calc(-100% - 10px))",
});
// 点位点击转处置弹窗
point_text.setPosition(
new BMapGL.Point(item.longitude, item.latitude)
);
point_text.setOffset(new BMapGL.Size(130, -10));
point_text.setStyle({
width: "340px",
height: "238px",
background: "url(../pbImg/dialogback.png) no-repeat",
backgroundSize: "100% 100%",
border: "0",
color: "#fff",
zIndex: 2000000000,
});
point_text.setContent(`
<div style='width:100%;display:flex;justify-content: space-between;align-items: center;'>
<h4 style='margin:12px;font-size: 14px;color: #FFE6D9;overflow: hidden;text-overflow: ellipsis;white-space: nowrap; cursor: pointer;'>${item.companyName}</h4>
<div class='closeBtn' style='background: url(../pbImg/close.png) no-repeat;width:20px;height:20px;background-size: 100% 100%;margin-right:10px; cursor: pointer;"'></div></div>
<div style='margin:0 auto;font-size: 14px;width:316px;height:108px;padding:0 12px;background: rgba(108,128,151,0.20);border: 1px solid rgba(73,84,97,1);'>
<h4 style='height:33%;opacity: 0.8;margin:0;line-height:38px;font-weight:300;'><span style="color:#D0DEEE;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">单位地址:</span>${item.companyAddress}</h4>
<div title="${item.levelIndexThree}" style='height:33%;opacity: 0.8;margin:0;line-height:38px;font-weight:300;overflow:hidden; text-overflow: ellipsis;white-space: nowrap'><span style="color:#D0DEEE;">安全负责人:</span>${item.emergencyContact}</div>
<h4 style='height:33%;opacity: 0.8;margin:0;line-height:38px;font-weight:300;'><span style="color:#D0DEEE;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">综合得分:</span>${item.score}</h4>
`);
map.addOverlay(point_text);
let closebtn = document.querySelector(".closeBtn");
closebtn.addEventListener("click", () => {
map.removeOverlay(point_text);
});
})
})
})
map.centerAndZoom(point, 14); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(); map.enableScrollWheelZoom();
// 初始化 mapvthree 引擎(第一个参数为地图实例或DOM) map.setMapType(BMAP_SATELLITE_MAP); // 卫星地图模式
// const engine = new Engine(map, {
// rendering: {
// enableAnimationLoop: true,
// }
// });
// engine.map.setCenter(center);
// engine.map.setPitch(60);
map.setMapType(BMAP_SATELLITE_MAP);
// map.setHeading(64.5); // map.setHeading(64.5);
// map.setTilt(73); // map.setTilt(73);
// 禁止地图旋转和倾斜可以通过配置项进行设置 // 禁止地图旋转和倾斜可以通过配置项进行设置
var map = new BMapGL.Map("allmap", { // var map = new BMapGL.Map("allmap", {
enableRotate: false, // enableRotate: false,
enableTilt: false // enableTilt: false
}); // });
</script> </script>
</body> </body>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -4,12 +4,12 @@ import vm from "../main";
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
const request = axios.create({ const request = axios.create({
//baseURL: 'http://172.18.113.50:8080/zhapi', baseURL: 'http://172.18.113.50:8080/zhapi',
//baseURL: 'http://172.18.113.13:8080/zhapi', // 孙强 //baseURL: 'http://172.18.113.13:8080/zhapi', // 孙强
//baseURL: 'http://172.18.100.57:8080/zhapi', // 刘建 //baseURL: 'http://172.18.100.57:8080/zhapi', // 刘建
//baseURL: 'http://192.168.0.188:8888/zhapi', //baseURL: 'http://192.168.0.188:8888/zhapi',
//baseURL: 'http://121.41.91.94:12002/zhapi', //baseURL: 'http://121.41.91.94:12002/zhapi',
baseURL: `http://${window.location.host}/zhapi`, //baseURL: `http://${window.location.host}/zhapi`,
timeout: 50000, timeout: 50000,
headers: { 'content-type': 'application/json' }, headers: { 'content-type': 'application/json' },
}) })

File diff suppressed because it is too large Load Diff

@ -206,7 +206,7 @@ export default {
init_right_chart() { init_right_chart() {
let data = [ let data = [
["业务咨询", 532], ["业务咨询", 532],
["法律服务", 231], ["法律办理", 231],
["证照办理", 234], ["证照办理", 234],
]; ];
this.right_option.series[0].data = data; this.right_option.series[0].data = data;

@ -38,7 +38,7 @@
<div class="person_type"> <div class="person_type">
<div class="person_type_item">普通岗位</div> <div class="person_type_item">普通岗位</div>
<div class="person_type_item">重点岗位</div> <div class="person_type_item">重点岗位</div>
<div class="person_type_item">专家岗位</div> <div class="person_type_item">专家人员</div>
<div class="person_type_item">重点人员</div> <div class="person_type_item">重点人员</div>
</div> </div>
<!-- 员工类型数量 --> <!-- 员工类型数量 -->

@ -51,7 +51,7 @@ export default {
paths.push(new build_map.Point(lng, lat)); paths.push(new build_map.Point(lng, lat));
} }
polygon = new build_map.Polygon(paths, { polygon = new build_map.Polygon(paths, {
fillColor: "#dcdfe6", fillColor: "#3b4c44",
strokeColor: "#0f1423", strokeColor: "#0f1423",
fillOpacity: 0.4, fillOpacity: 0.4,
strokeWeight: 1, strokeWeight: 1,
@ -66,7 +66,7 @@ export default {
paths.push(new build_map.Point(lng, lat)); paths.push(new build_map.Point(lng, lat));
} }
polygon = new build_map.Polygon(paths, { polygon = new build_map.Polygon(paths, {
fillColor: "#dcdfe6", fillColor: "#3b4c44",
strokeColor: "#0f1423", strokeColor: "#0f1423",
fillOpacity: 0.4, fillOpacity: 0.4,
strokeWeight: 1, strokeWeight: 1,

@ -0,0 +1,31 @@
<template>
<div class="map" id="container"></div>
</template>
<script>
export default {
name: "LineMap",
data() {
return {};
},
mounted() {
this.init_map()
},
methods: {
init_map() {
//
var map = new BMapGL.Map("container"); //
var point = new BMapGL.Point(121.619992, 30.025703); //
map.centerAndZoom(point, 14); //
map.enableScrollWheelZoom();
map.setMapType(BMAP_SATELLITE_MAP);
//
var map = new BMapGL.Map("allmap", {
enableRotate: false,
enableTilt: false,
});
},
},
};
</script>
<style lang="less" scoped>
</style>

@ -18,6 +18,9 @@
<!-- <div class="map_body"> <!-- <div class="map_body">
<HomeMap ref="homeMap"></HomeMap> <HomeMap ref="homeMap"></HomeMap>
</div> --> </div> -->
<!-- <div class="map_body">
<LineMap ref="lineMap"></LineMap>
</div> -->
<div class="left_box"> <div class="left_box">
<!-- 园区企业 --> <!-- 园区企业 -->
<CompanyNum ref="companyNum"></CompanyNum> <CompanyNum ref="companyNum"></CompanyNum>
@ -61,6 +64,8 @@ import CompanyService from "./components/companyService";
import Notification from "./components/notification"; import Notification from "./components/notification";
import Endanger from "./components/endanger"; import Endanger from "./components/endanger";
// import HomeMap from "./components/homeMap"; // import HomeMap from "./components/homeMap";
// import LineMap from "./components/lineMap"
import { topRanking } from '@/api/safetyIndex'
export default { export default {
name: "CompositeIndex", name: "CompositeIndex",
components: { components: {
@ -71,6 +76,7 @@ export default {
Notification, Notification,
Endanger, Endanger,
// HomeMap, // HomeMap,
// LineMap
}, },
data() { data() {
return { return {
@ -88,6 +94,9 @@ export default {
select_value: "地图", select_value: "地图",
}; };
}, },
mounted() {
this.get_rank()
},
methods: { methods: {
change_map(val) { change_map(val) {
if (val == "2") { if (val == "2") {
@ -97,6 +106,16 @@ export default {
}); });
} }
}, },
async get_rank() {
let params = {
scoreType: 'month'
}
let res = await topRanking(params)
console.log('restop',res);
let iframe_window = this.$refs.iframeDom.contentWindow
let data = res.data
iframe_window.postMessage(data,'*')
},
}, },
}; };
</script> </script>

@ -24,6 +24,11 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
//
new_line: {
type: Array,
default: () => [],
},
}, },
data() { data() {
return { return {
@ -206,7 +211,7 @@ export default {
}, },
}); });
//let that = this; // //let that = this; //
//let label = new BMap.Label(); let label = new BMap.Label();
setTimeout(() => { setTimeout(() => {
var point = new BMap.Point(item.longitude, item.latitude); var point = new BMap.Point(item.longitude, item.latitude);
// ; // ;
@ -220,34 +225,86 @@ export default {
); );
var marker = new BMap.Marker(point, { icon: myIcon }); // var marker = new BMap.Marker(point, { icon: myIcon }); //
map.addOverlay(marker); map.addOverlay(marker);
//
let line_point = []; //
var line_point = [];
for (let i = 0; i < new_line.length; i++) { for (let i = 0; i < new_line.length; i++) {
line_point.push( line_point.push(
new BMap.Point(new_line[i].longitude, new_line[i].latitude) new BMap.Point(new_line[i].longitude, new_line[i].latitude)
); );
} }
console.log("line_point", line_point); console.log("line_point", line_point);
let pl = new BMap.Polyline(line_point, { var polyline = new BMap.Polyline(line_point, {
strokeColor: "blue", strokeColor: "red",
strokeWeight: 6, strokeWeight: 6,
strokeOpacity: 0.5, strokeOpacity: 1,
}); });
console.log("pl", pl); console.log("pl", polyline);
map.addOverlay(pl); map.addOverlay(polyline);
}, 500); }, 500);
map.centerAndZoom(new BMap.Point(item.longitude, item.latitude), 16); // map.centerAndZoom(new BMap.Point(item.longitude, item.latitude), 16); //
map.setMinZoom(12); // map.setMinZoom(12); //
map.setMaxZoom(19); map.setMaxZoom(19);
map.enableScrollWheelZoom(true); map.enableScrollWheelZoom(true);
showBoundaryx(MapLine.features[5]);
function showBoundaryx(city) {
var paths = [];
var list = city.geometry.coordinates;
var polygon = {};
if (list.length > 1) {
for (let a = 0; a < list.length; a++) {
paths = [];
for (let i = 0; i < list[a][0].length; i++) {
let lat = list[a][0][i][1],
lng = list[a][0][i][0];
paths.push(new BMap.Point(lng, lat));
}
console.log('paths',paths);
polygon = new BMap.Polygon(paths, {
fillColor: "#3b4c44",
strokeColor: "#0f1423",
fillOpacity: 0.6,
strokeWeight: 1,
}); //
polygon.disableMassClear();
map.addOverlay(polygon); //
}
} else {
for (let i = 0; i < list[0].length; i++) {
let lat = list[0][i][1],
lng = list[0][i][0];
paths.push(new BMap.Point(lng, lat));
}
console.log('paths',paths);
polygon = new BMap.Polygon(paths, {
fillColor: "#3b4c44",
strokeColor: "#0f1423",
fillOpacity: 0.6,
strokeWeight: 1,
}); //
polygon.disableMassClear();
map.addOverlay(polygon); //
}
polygon.infowindow = new BMap.InfoWindow();
polygon.infowindow.name = city.properties.name;
polygon.addEventListener("mouseover", function () {
polygon.setFillColor("#ffa500");
});
polygon.addEventListener("mouseout", function () {
map.removeOverlay(label);
polygon.setFillColor("#3b4c44");
});
}
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
/* 去除百度地图logo */ /* 去除百度地图logo */
.anchorBL { .anchorBL {
display: none; display: none;
} }
.map { .map {

@ -333,7 +333,7 @@ export default {
console.log("res", res); console.log("res", res);
let arr = [ let arr = [
{ longitude: 121.597849, latitude: 29.904037 }, { longitude: 121.597849, latitude: 29.904037 },
{ longitude: 121.597864, latitude: 29.904234 }, { longitude: 121.593864, latitude: 29.903234 },
]; ];
const new_line = arr.map((item) => ({ const new_line = arr.map((item) => ({
longitude: item.longitude, longitude: item.longitude,

@ -199,6 +199,7 @@ export default {
function showBoundaryEx(city) { function showBoundaryEx(city) {
var paths = []; var paths = [];
var list = city.geometry.coordinates; var list = city.geometry.coordinates;
console.log('city.geometry.coordinates',list[0]);
var polygon = {}; var polygon = {};
if (list.length > 1) { if (list.length > 1) {
for (let a = 0; a < list.length; a++) { for (let a = 0; a < list.length; a++) {
@ -219,9 +220,7 @@ export default {
} }
} else { } else {
for (let i = 0; i < list[0].length; i++) { for (let i = 0; i < list[0].length; i++) {
let lat = list[0][i][1], paths.push(new BMap.Point(list[0][i][0], list[0][i][1]));
lng = list[0][i][0];
paths.push(new BMap.Point(lng, lat));
} }
polygon = new BMap.Polygon(paths, { polygon = new BMap.Polygon(paths, {
fillColor: "#3b4c44", fillColor: "#3b4c44",

Loading…
Cancel
Save