|
@@ -42,8 +42,10 @@ import {
|
|
|
getBuildingProjectDetails,
|
|
|
getChemicalWarehouseDetails,
|
|
|
getMiningOperationsDetails,
|
|
|
- getEmergencyTransportResourcesDetails, getEmergencyDisasterInfoOfficerDetails, getMidmapDzzhDetails
|
|
|
-} from "@/api/globalMap/spatialAnalysis";
|
|
|
+ getEmergencyTransportResourcesDetails,
|
|
|
+ getEmergencyDisasterInfoOfficerDetails,
|
|
|
+ getMidmapDzzhDetails
|
|
|
+} from '@/api/globalMap/spatialAnalysis';
|
|
|
import { pointDetailTemplate } from '@/views/globalMap/data/mapData';
|
|
|
import ElementResizeDetectorMaker from 'element-resize-detector';
|
|
|
import useAppStore from '@/store/modules/app';
|
|
@@ -59,7 +61,15 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { point_type } = toRefs<any>(proxy?.useDict('point_type'));
|
|
|
const appStore = useAppStore();
|
|
|
|
|
|
-const emits = defineEmits(['update:drawing', 'selectGraphics', 'unSelectGraphics', 'showTextEditBox', 'onDrawCompleted', 'handleShowVideo', 'handleShowWarehouse']);
|
|
|
+const emits = defineEmits([
|
|
|
+ 'update:drawing',
|
|
|
+ 'selectGraphics',
|
|
|
+ 'unSelectGraphics',
|
|
|
+ 'showTextEditBox',
|
|
|
+ 'onDrawCompleted',
|
|
|
+ 'handleShowVideo',
|
|
|
+ 'handleShowWarehouse'
|
|
|
+]);
|
|
|
const containerRef = ref();
|
|
|
const width = ref('100%');
|
|
|
const height = ref('100%');
|
|
@@ -79,83 +89,87 @@ let AMap, map, scale;
|
|
|
// 鼠标绘制工具
|
|
|
const drawTool = useDrawTool();
|
|
|
// 初始化地图
|
|
|
-const { getAMap, getMap, switchMap, addMarker, addSearchMarker, clearMarker, getMarkers, getScale, showInfo, hideInfo, handleHover } = useAMap({
|
|
|
- key: '30d3d8448efd68cb0b284549fd41adcf', // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
- version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
- pitch: mapState.isThreeDimensional ? 45 : 0,
|
|
|
- zoom: mapState.zoom,
|
|
|
- center: [mapState.center[0], mapState.center[1]],
|
|
|
- dragEnable: true,
|
|
|
- scrollWheel: true,
|
|
|
- showScale: true,
|
|
|
- enableMouseTool: true,
|
|
|
- // 加载完成事件
|
|
|
- onLoadCompleted: () => {
|
|
|
- AMap = getAMap();
|
|
|
- map = getMap();
|
|
|
- scale = getScale();
|
|
|
- if (!['logical', 'vectorgraph'].includes(props.activeMap)) {
|
|
|
- switchMap(props.activeMap);
|
|
|
- } else {
|
|
|
- map.removeLayer();
|
|
|
- }
|
|
|
- map.on('zoomchange', zoomChangeHandler);
|
|
|
- drawTool.initMouseTool({ container: 'aMap', map, AMap });
|
|
|
- handleResize();
|
|
|
- },
|
|
|
- onMarkerClick: (data) => {
|
|
|
- // 多点位
|
|
|
- if (data.type === '1') {
|
|
|
- let path = [];
|
|
|
- props.pointType.forEach((item) => {
|
|
|
- path.push(item.component);
|
|
|
- });
|
|
|
- getPointInfoList({
|
|
|
- option: path.toString(),
|
|
|
- longitude: data.longitude.toString(),
|
|
|
- latitude: data.latitude.toString()
|
|
|
- }).then((res) => {
|
|
|
- const data2 = res.data.list;
|
|
|
- let content = document.createElement('div');
|
|
|
- // content.style.cssText = 'transform: scale(' + containerScale().scaleX + ');';
|
|
|
- content.className = 'point-info';
|
|
|
- let content2 = '';
|
|
|
- content2 += '<div class="title-box"><div class="gradient-text">多点位信息</div></div>';
|
|
|
- content2 += '<div class="icon1"></div>';
|
|
|
- content2 += '<div class="icon2"></div>';
|
|
|
- content2 += '<div class="icon3"></div>';
|
|
|
- content2 += '<div class="icon4"></div>';
|
|
|
- content.innerHTML = content2;
|
|
|
- let tableBox = document.createElement('div');
|
|
|
- tableBox.className = 'table-box';
|
|
|
- let table = document.createElement('div');
|
|
|
- table.className = 'table';
|
|
|
- table.innerHTML = '<div class="point-item"><div class="td3">主题</div><div class="td3">名称</div></div>';
|
|
|
- data2.forEach((item) => {
|
|
|
- item.longitude = data.longitude;
|
|
|
- item.latitude = data.latitude;
|
|
|
- const div = document.createElement('div');
|
|
|
- div.className = 'point-item point-item-hover';
|
|
|
- div.innerHTML =
|
|
|
- '<div class="td4">' + getDictLabel(point_type.value, item.dataType.toString()) + '</div><div class="td4">' + item.name + '</div>';
|
|
|
- div.addEventListener('click', () => {
|
|
|
- handlePointDetails(item);
|
|
|
+const { getAMap, getMap, switchMap, addMarker, addSearchMarker, clearMarker, getMarkers, getScale, showInfo, hideInfo, handleHover, creatMask } =
|
|
|
+ useAMap({
|
|
|
+ key: '30d3d8448efd68cb0b284549fd41adcf', // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
+ version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
+ pitch: mapState.isThreeDimensional ? 45 : 0,
|
|
|
+ zoom: mapState.zoom,
|
|
|
+ center: [mapState.center[0], mapState.center[1]],
|
|
|
+ dragEnable: true,
|
|
|
+ scrollWheel: true,
|
|
|
+ showScale: true,
|
|
|
+ enableMouseTool: true,
|
|
|
+ // 加载完成事件
|
|
|
+ onLoadCompleted: () => {
|
|
|
+ AMap = getAMap();
|
|
|
+ map = getMap();
|
|
|
+ scale = getScale();
|
|
|
+ if (!['logical', 'vectorgraph'].includes(props.activeMap)) {
|
|
|
+ switchMap(props.activeMap);
|
|
|
+ } else {
|
|
|
+ map.removeLayer();
|
|
|
+ }
|
|
|
+ map.on('zoomchange', zoomChangeHandler);
|
|
|
+ // 添加遮罩
|
|
|
+ // , { strokeColor: '#ff0000',strokeWeight: 2, offset }
|
|
|
+ creatMask([{ strokeColor: '#2a8797', strokeOpacity: 0.6,strokeWeight: 6, fillOpacity: 0}, { strokeWeight: 2, fillColor: '#4f95ff', fillOpacity: 0.2 }]);
|
|
|
+ drawTool.initMouseTool({ container: 'aMap', map, AMap });
|
|
|
+ handleResize();
|
|
|
+ },
|
|
|
+ onMarkerClick: (data) => {
|
|
|
+ // 多点位
|
|
|
+ if (data.type === '1') {
|
|
|
+ let path = [];
|
|
|
+ props.pointType.forEach((item) => {
|
|
|
+ path.push(item.component);
|
|
|
+ });
|
|
|
+ getPointInfoList({
|
|
|
+ option: path.toString(),
|
|
|
+ longitude: data.longitude.toString(),
|
|
|
+ latitude: data.latitude.toString()
|
|
|
+ }).then((res) => {
|
|
|
+ const data2 = res.data.list;
|
|
|
+ let content = document.createElement('div');
|
|
|
+ // content.style.cssText = 'transform: scale(' + containerScale().scaleX + ');';
|
|
|
+ content.className = 'point-info';
|
|
|
+ let content2 = '';
|
|
|
+ content2 += '<div class="title-box"><div class="gradient-text">多点位信息</div></div>';
|
|
|
+ content2 += '<div class="icon1"></div>';
|
|
|
+ content2 += '<div class="icon2"></div>';
|
|
|
+ content2 += '<div class="icon3"></div>';
|
|
|
+ content2 += '<div class="icon4"></div>';
|
|
|
+ content.innerHTML = content2;
|
|
|
+ let tableBox = document.createElement('div');
|
|
|
+ tableBox.className = 'table-box';
|
|
|
+ let table = document.createElement('div');
|
|
|
+ table.className = 'table';
|
|
|
+ table.innerHTML = '<div class="point-item"><div class="td3">主题</div><div class="td3">名称</div></div>';
|
|
|
+ data2.forEach((item) => {
|
|
|
+ item.longitude = data.longitude;
|
|
|
+ item.latitude = data.latitude;
|
|
|
+ const div = document.createElement('div');
|
|
|
+ div.className = 'point-item point-item-hover';
|
|
|
+ div.innerHTML =
|
|
|
+ '<div class="td4">' + getDictLabel(point_type.value, item.dataType.toString()) + '</div><div class="td4">' + item.name + '</div>';
|
|
|
+ div.addEventListener('click', () => {
|
|
|
+ handlePointDetails(item);
|
|
|
+ });
|
|
|
+ table.appendChild(div);
|
|
|
});
|
|
|
- table.appendChild(div);
|
|
|
+ tableBox.appendChild(table);
|
|
|
+ content.appendChild(tableBox);
|
|
|
+ let closeBtn = document.createElement('div');
|
|
|
+ closeBtn.className = 'close';
|
|
|
+ closeBtn.onclick = hideInfo;
|
|
|
+ content.appendChild(closeBtn);
|
|
|
+ showInfo(content, [data.longitude, data.latitude], true);
|
|
|
});
|
|
|
- tableBox.appendChild(table);
|
|
|
- content.appendChild(tableBox);
|
|
|
- let closeBtn = document.createElement('div');
|
|
|
- closeBtn.className = 'close';
|
|
|
- closeBtn.onclick = hideInfo;
|
|
|
- content.appendChild(closeBtn);
|
|
|
- showInfo(content, [data.longitude, data.latitude], true);
|
|
|
- });
|
|
|
- } else {
|
|
|
- handlePointDetails(data);
|
|
|
+ } else {
|
|
|
+ handlePointDetails(data);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-});
|
|
|
+ });
|
|
|
const handlePointDetails = (data) => {
|
|
|
let methodList = {
|
|
|
'1': getEmergencyExpertDetails,
|
|
@@ -421,7 +435,7 @@ watch(
|
|
|
() => {
|
|
|
nextTick(() => {
|
|
|
handleResize();
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
);
|
|
|
onMounted(() => {
|