|
@@ -40,6 +40,8 @@ import {
|
|
|
} from './dialog';
|
|
|
import { IncidentItemDetail } from '@/api/incident';
|
|
|
import { useIncidentStore } from '@/store';
|
|
|
+import Popup from '../Popup';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
|
|
|
const MARKER_MAP_TYPES = [
|
|
|
// '待派发事件',
|
|
@@ -99,6 +101,7 @@ export default defineComponent({
|
|
|
|
|
|
const store = useMarkerStore();
|
|
|
const incidentStore = useIncidentStore();
|
|
|
+ const markerStore = useMarkerStore();
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
|
|
@@ -147,7 +150,7 @@ export default defineComponent({
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
- const getMarkerPopupHTML = (type: MarkerMapType, marker?: MarkerType) => {
|
|
|
+ const getMarkerPopupHTML = (type: MarkerMapType, marker: MarkerType) => {
|
|
|
switch (type) {
|
|
|
case '应急事件':
|
|
|
// case '待派发事件':
|
|
@@ -160,13 +163,7 @@ export default defineComponent({
|
|
|
},
|
|
|
() => {
|
|
|
router.push(`/incidentDetail?id=${marker?.id}`);
|
|
|
- handleRemoveAllMarkers();
|
|
|
- handleAddMarkers(
|
|
|
- '应急事件',
|
|
|
- [{ location: marker?.location, name: '中心庄' }],
|
|
|
- icon_map_dpf,
|
|
|
- );
|
|
|
- state.markers[0].marker.togglePopup();
|
|
|
+ handleSetDetailMarker(marker);
|
|
|
},
|
|
|
);
|
|
|
case '应急仓库':
|
|
@@ -193,11 +190,25 @@ export default defineComponent({
|
|
|
});
|
|
|
|
|
|
case '视频监控':
|
|
|
- return GET_VIDEO_DIALOG_HTML({
|
|
|
- name: '12312313',
|
|
|
- addr: 'su qian',
|
|
|
- link: '',
|
|
|
- });
|
|
|
+ return GET_VIDEO_DIALOG_HTML(
|
|
|
+ {
|
|
|
+ name: '12312313',
|
|
|
+ addr: 'su qian',
|
|
|
+ link: '',
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ if (route.query.id) {
|
|
|
+ markerStore.livevideovisible = true;
|
|
|
+ if (
|
|
|
+ markerStore.livevideos.findIndex(
|
|
|
+ (item) => item.location === marker.location,
|
|
|
+ ) < 0
|
|
|
+ ) {
|
|
|
+ markerStore.livevideos.push(marker);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ );
|
|
|
}
|
|
|
};
|
|
|
const updateTrafficSource = () => {
|
|
@@ -249,7 +260,7 @@ export default defineComponent({
|
|
|
...markers.map((i) => {
|
|
|
const popup = new window.minemap.Popup({
|
|
|
anchor: 'left',
|
|
|
- closeOnClick: false,
|
|
|
+ closeOnClick: true,
|
|
|
closeButton: false,
|
|
|
offset: [10, 25],
|
|
|
maxWidth: 'max-content',
|
|
@@ -316,6 +327,8 @@ export default defineComponent({
|
|
|
type: MarkerMapType,
|
|
|
markers: State['markers'],
|
|
|
) => {
|
|
|
+ state.hasTypes = state.hasTypes.filter((t) => t !== type);
|
|
|
+
|
|
|
const locations = markers.map((i) => i.location);
|
|
|
state.markers.forEach((m) => {
|
|
|
if (locations.includes(m.location)) {
|
|
@@ -340,7 +353,54 @@ export default defineComponent({
|
|
|
state.markers = [];
|
|
|
state.positions = [];
|
|
|
};
|
|
|
- onMounted(() => {
|
|
|
+
|
|
|
+ const handleSetDetailMarker = (marker: MarkerType) => {
|
|
|
+ handleRemoveAllMarkers();
|
|
|
+ const location = marker.location?.split(',').map(Number);
|
|
|
+
|
|
|
+ if (!location) {
|
|
|
+ ElMessage.error({ message: '该点位无地址经纬度' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取事件周围的 5km 内的 监控点
|
|
|
+ const bounds: number[][] = new window.minemap.LngLat(...location)
|
|
|
+ .toBounds(10000)
|
|
|
+ .toArray();
|
|
|
+
|
|
|
+ const videos = markerStore.videoSurveillance.reduce((carry, next) => {
|
|
|
+ const [lng, lat] = next.location?.split(',') ?? [];
|
|
|
+ // bounds [right-bottom[lng, lat],left-top[lng, lat], ]
|
|
|
+ if (
|
|
|
+ Number(lng) > bounds[0][0] &&
|
|
|
+ Number(lng) < bounds[1][0] &&
|
|
|
+ Number(lat) > bounds[0][1] &&
|
|
|
+ Number(lat) < bounds[1][1]
|
|
|
+ ) {
|
|
|
+ carry.push(next);
|
|
|
+ }
|
|
|
+ return carry;
|
|
|
+ }, [] as MarkerType[]);
|
|
|
+
|
|
|
+ console.log(location, bounds, videos, markerStore.videoSurveillance);
|
|
|
+
|
|
|
+ // 开启路况信息
|
|
|
+ if (!state.types.includes('路况信息')) {
|
|
|
+ state.types.push('路况信息');
|
|
|
+ state.hasTypes.push('路况信息');
|
|
|
+ toggleControlTraffic();
|
|
|
+ }
|
|
|
+
|
|
|
+ handleAddMarkers(
|
|
|
+ '应急事件',
|
|
|
+ [{ location: marker?.location, name: '中心庄' }],
|
|
|
+ icon_map_dpf,
|
|
|
+ );
|
|
|
+ handleAddMarkers('视频监控', videos, icon_map_spjk);
|
|
|
+ // state.markers[0].marker.togglePopup();
|
|
|
+ };
|
|
|
+
|
|
|
+ onMounted(async () => {
|
|
|
window.minemap.util.getJSON(
|
|
|
'https://minedata.cn/service/solu/style/id/12878',
|
|
|
function (error, data) {
|
|
@@ -394,22 +454,20 @@ export default defineComponent({
|
|
|
state.trafficLayerIds.push('trafficlines');
|
|
|
state.trafficStatus = false;
|
|
|
updateTrafficLayerVisibility('none');
|
|
|
- });
|
|
|
|
|
|
- if (!route.query.id) return;
|
|
|
- // 如果存在id
|
|
|
- handleAddMarkers(
|
|
|
- '应急事件',
|
|
|
- [{ location: '118.752399,34.118339', name: '中心庄' }],
|
|
|
- icon_map_dpf,
|
|
|
- );
|
|
|
-
|
|
|
- state.markers[0].marker.togglePopup();
|
|
|
+ if (!route.query.id) return;
|
|
|
+ // 如果存在id
|
|
|
+ handleSetDetailMarker({
|
|
|
+ location: '118.288721,33.951047',
|
|
|
+ name: '中心庄',
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
watch(
|
|
|
() => route.query.id,
|
|
|
(next) => {
|
|
|
+ // 返回首页时 需要清除事件相关的
|
|
|
if (!next) {
|
|
|
handleRemoveAllMarkers();
|
|
|
if (state.types.includes('应急事件')) {
|
|
@@ -438,13 +496,10 @@ export default defineComponent({
|
|
|
() => props.marker?.baseInfo?.locations,
|
|
|
(next) => {
|
|
|
if (next && !state.positions.includes(next)) {
|
|
|
- handleRemoveAllMarkers();
|
|
|
- handleAddMarkers(
|
|
|
- '应急事件',
|
|
|
- [{ location: '118.288721,33.951047', name: '中心庄' }],
|
|
|
- icon_map_dpf,
|
|
|
- );
|
|
|
- state.markers[0].marker.togglePopup();
|
|
|
+ handleSetDetailMarker({
|
|
|
+ location: '118.288721,33.951047',
|
|
|
+ name: '中心庄',
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
);
|
|
@@ -458,7 +513,6 @@ export default defineComponent({
|
|
|
item.action();
|
|
|
}
|
|
|
if (!next.includes(item.type) && item.hasActioned) {
|
|
|
- state.hasTypes = state.hasTypes.filter((t) => t !== item.type);
|
|
|
item.remove();
|
|
|
}
|
|
|
});
|
|
@@ -469,7 +523,7 @@ export default defineComponent({
|
|
|
<div class="task-map-container">
|
|
|
<MapView v-model:map={state.map} />
|
|
|
{!props.readonly && (
|
|
|
- <div class="address-type-card">
|
|
|
+ <Popup class="address-type-card">
|
|
|
<el-checkbox-group v-model={state.types}>
|
|
|
{props.adrsMapTypes &&
|
|
|
props.adrsMapTypes.map((t) => (
|
|
@@ -478,7 +532,7 @@ export default defineComponent({
|
|
|
</el-checkbox-group>
|
|
|
<i class="card-border-bottom-left"></i>
|
|
|
<i class="card-border-bottom-right"></i>
|
|
|
- </div>
|
|
|
+ </Popup>
|
|
|
)}
|
|
|
</div>
|
|
|
);
|