|
@@ -42,6 +42,8 @@ import { IncidentItemDetail } from '@/api/incident';
|
|
|
import { useIncidentStore } from '@/store';
|
|
|
import Popup from '../Popup';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
+import { isEmpty } from 'lodash';
|
|
|
+import clsx from 'clsx';
|
|
|
|
|
|
const MARKER_MAP_TYPES = [
|
|
|
// '待派发事件',
|
|
@@ -77,6 +79,15 @@ interface ActionType {
|
|
|
// 路况信息刷新间隔
|
|
|
const REFESH_TRAFFIC_TIME = 60000;
|
|
|
|
|
|
+const getIncidentImage = (status: MarkerType['status']) =>
|
|
|
+ status?.toString() === '1'
|
|
|
+ ? icon_map_yjsj
|
|
|
+ : status?.toString() === '2'
|
|
|
+ ? icon_map_dpf
|
|
|
+ : status?.toString() === '3'
|
|
|
+ ? icon_map_dcz
|
|
|
+ : icon_map_yjsj;
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
name: 'MarkerMap',
|
|
|
props: {
|
|
@@ -101,10 +112,16 @@ export default defineComponent({
|
|
|
|
|
|
const store = useMarkerStore();
|
|
|
const incidentStore = useIncidentStore();
|
|
|
- const markerStore = useMarkerStore();
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
|
|
|
+ const adrsMapTypes = computed(() =>
|
|
|
+ props.adrsMapTypes.map((i) => ({
|
|
|
+ name: i,
|
|
|
+ disabled: route.query.id && i === '应急事件',
|
|
|
+ })),
|
|
|
+ );
|
|
|
+
|
|
|
const actionTypes = computed<ActionType[]>(() => [
|
|
|
{
|
|
|
type: '路况信息',
|
|
@@ -116,8 +133,8 @@ export default defineComponent({
|
|
|
type: '应急事件',
|
|
|
hasActioned: state.hasTypes.includes('应急事件'),
|
|
|
action: () =>
|
|
|
- handleAddMarkers('应急事件', store.pendingIncident, icon_map_dpf),
|
|
|
- remove: () => handleRemoveMarkers('应急事件', store.pendingIncident),
|
|
|
+ handleAddMarkers('应急事件', store.incident, icon_map_dpf),
|
|
|
+ remove: () => handleRemoveMarkers('应急事件', store.incident),
|
|
|
},
|
|
|
|
|
|
{
|
|
@@ -156,16 +173,11 @@ export default defineComponent({
|
|
|
// case '待派发事件':
|
|
|
// case '预警事件':
|
|
|
default:
|
|
|
- return GET_INCIDENT_DIALOG_HTML(
|
|
|
- {
|
|
|
- name: '事件名称',
|
|
|
- addr: 'su qian',
|
|
|
- },
|
|
|
- () => {
|
|
|
- router.push(`/incidentDetail?id=${marker?.id}`);
|
|
|
- handleSetDetailMarker(marker);
|
|
|
- },
|
|
|
- );
|
|
|
+ return GET_INCIDENT_DIALOG_HTML(marker, () => {
|
|
|
+ router.push(`/incidentDetail?id=${marker?.id}`);
|
|
|
+ handleSetDetailMarker(marker);
|
|
|
+ store.currentIncident = marker;
|
|
|
+ });
|
|
|
case '应急仓库':
|
|
|
return GET_WAREHOUSE_DIALOG_HTML({
|
|
|
name: '应急仓库 111',
|
|
@@ -198,17 +210,17 @@ export default defineComponent({
|
|
|
},
|
|
|
() => {
|
|
|
if (route.query.id) {
|
|
|
- markerStore.livevideovisible = true;
|
|
|
- const idx = markerStore.livevideos.findIndex(
|
|
|
- (item) => item.location === marker.location,
|
|
|
+ store.livevideovisible = true;
|
|
|
+ const idx = store.livevideos.findIndex(
|
|
|
+ (item) => item.locations === marker.locations,
|
|
|
);
|
|
|
if (idx < 0) {
|
|
|
- markerStore.livevideos.length === 6
|
|
|
- ? (markerStore.livevideos = [
|
|
|
+ store.livevideos.length === 6
|
|
|
+ ? (store.livevideos = [
|
|
|
marker,
|
|
|
- ...markerStore.livevideos.slice(1, 6),
|
|
|
+ ...store.livevideos.slice(1, 6),
|
|
|
])
|
|
|
- : markerStore.livevideos.push(marker);
|
|
|
+ : store.livevideos.push(marker);
|
|
|
} else {
|
|
|
ElMessage.info({ message: '该点位已经打开~' });
|
|
|
}
|
|
@@ -264,6 +276,8 @@ export default defineComponent({
|
|
|
) => {
|
|
|
state.markers.push(
|
|
|
...markers.map((i) => {
|
|
|
+ const nextImage =
|
|
|
+ type === '应急事件' ? getIncidentImage(i?.status) : image;
|
|
|
const popup = new window.minemap.Popup({
|
|
|
anchor: 'left',
|
|
|
closeOnClick: true,
|
|
@@ -273,21 +287,23 @@ export default defineComponent({
|
|
|
// autoPan: true,
|
|
|
}).setDOMContent(getMarkerPopupHTML(type, i));
|
|
|
return {
|
|
|
- location: i.location,
|
|
|
+ locations: i.locations,
|
|
|
popup,
|
|
|
- marker: new window.minemap.Marker(renderElement(image), {
|
|
|
- offset: [-25, -25],
|
|
|
- })
|
|
|
- .setLngLat({
|
|
|
- lng: i.location?.split(',')[0],
|
|
|
- lat: i.location?.split(',')[1],
|
|
|
+ marker:
|
|
|
+ i.locations &&
|
|
|
+ new window.minemap.Marker(renderElement(nextImage), {
|
|
|
+ offset: [-25, -25],
|
|
|
})
|
|
|
- .setPopup(popup)
|
|
|
- .addTo(state.map),
|
|
|
+ .setLngLat({
|
|
|
+ lng: i.locations?.split(',')[0],
|
|
|
+ lat: i.locations?.split(',')[1],
|
|
|
+ })
|
|
|
+ .setPopup(popup)
|
|
|
+ .addTo(state.map),
|
|
|
};
|
|
|
}),
|
|
|
);
|
|
|
- state.positions.push(...markers.map((i) => i.location).filter(isString));
|
|
|
+ state.positions.push(...markers.map((i) => i.locations).filter(isString));
|
|
|
|
|
|
handleFitBounds();
|
|
|
};
|
|
@@ -335,17 +351,17 @@ export default defineComponent({
|
|
|
) => {
|
|
|
state.hasTypes = state.hasTypes.filter((t) => t !== type);
|
|
|
|
|
|
- const locations = markers.map((i) => i.location);
|
|
|
+ const locations = markers.map((i) => i.locations);
|
|
|
state.markers.forEach((m) => {
|
|
|
- if (locations.includes(m.location)) {
|
|
|
- m.marker.remove();
|
|
|
- m.popup.remove();
|
|
|
+ if (locations.includes(m.locations)) {
|
|
|
+ m.marker?.remove();
|
|
|
+ m.popup?.remove();
|
|
|
m.popup = null;
|
|
|
m.marker = null;
|
|
|
}
|
|
|
});
|
|
|
state.markers = state.markers.filter(
|
|
|
- (m) => !locations.includes(m.location),
|
|
|
+ (m) => !locations.includes(m.locations),
|
|
|
);
|
|
|
state.positions = state.positions.filter((p) => !locations.includes(p));
|
|
|
|
|
@@ -353,8 +369,8 @@ export default defineComponent({
|
|
|
};
|
|
|
const handleRemoveAllMarkers = () => {
|
|
|
state.markers.forEach((m) => {
|
|
|
- m.marker.remove();
|
|
|
- m.popup.remove();
|
|
|
+ m.marker?.remove();
|
|
|
+ m.popup?.remove();
|
|
|
});
|
|
|
state.markers = [];
|
|
|
state.positions = [];
|
|
@@ -362,20 +378,20 @@ export default defineComponent({
|
|
|
|
|
|
const handleSetDetailMarker = (marker: MarkerType) => {
|
|
|
handleRemoveAllMarkers();
|
|
|
- const location = marker.location?.split(',').map(Number);
|
|
|
+ const locations = marker.locations?.split(',').map(Number);
|
|
|
|
|
|
- if (!location) {
|
|
|
+ if (!locations) {
|
|
|
ElMessage.error({ message: '该点位无地址经纬度' });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 获取事件周围的 5km 内的 监控点
|
|
|
- const bounds: number[][] = new window.minemap.LngLat(...location)
|
|
|
+ const bounds: number[][] = new window.minemap.LngLat(...locations)
|
|
|
.toBounds(10000)
|
|
|
.toArray();
|
|
|
|
|
|
- const videos = markerStore.videoSurveillance.reduce((carry, next) => {
|
|
|
- const [lng, lat] = next.location?.split(',') ?? [];
|
|
|
+ const videos = store.videoSurveillance.reduce((carry, next) => {
|
|
|
+ const [lng, lat] = next.locations?.split(',') ?? [];
|
|
|
// bounds [right-bottom[lng, lat],left-top[lng, lat], ]
|
|
|
if (
|
|
|
Number(lng) > bounds[0][0] &&
|
|
@@ -388,8 +404,6 @@ export default defineComponent({
|
|
|
return carry;
|
|
|
}, [] as MarkerType[]);
|
|
|
|
|
|
- console.log(location, bounds, videos, markerStore.videoSurveillance);
|
|
|
-
|
|
|
// 开启路况信息
|
|
|
if (!state.types.includes('路况信息')) {
|
|
|
state.types.push('路况信息');
|
|
@@ -397,11 +411,7 @@ export default defineComponent({
|
|
|
toggleControlTraffic();
|
|
|
}
|
|
|
|
|
|
- handleAddMarkers(
|
|
|
- '应急事件',
|
|
|
- [{ location: marker?.location, name: '中心庄' }],
|
|
|
- icon_map_dpf,
|
|
|
- );
|
|
|
+ handleAddMarkers('应急事件', [marker], icon_map_dpf);
|
|
|
handleAddMarkers('视频监控', videos, icon_map_spjk);
|
|
|
// state.markers[0].marker.togglePopup();
|
|
|
};
|
|
@@ -461,20 +471,23 @@ export default defineComponent({
|
|
|
state.trafficStatus = false;
|
|
|
updateTrafficLayerVisibility('none');
|
|
|
|
|
|
- if (!route.query.id) return;
|
|
|
- // 如果存在id
|
|
|
- handleSetDetailMarker({
|
|
|
- location: '118.288721,33.951047',
|
|
|
- name: '中心庄',
|
|
|
- });
|
|
|
+ store.getAllResources();
|
|
|
+ store.getHDIncidentList();
|
|
|
});
|
|
|
+ if (!route.query.id) return;
|
|
|
+ // 如果存在id
|
|
|
+ await incidentStore.getIncidentItem(route.query.id as string);
|
|
|
+ handleSetDetailMarker(incidentStore.incidentDetail.baseInfo ?? {});
|
|
|
});
|
|
|
|
|
|
watch(
|
|
|
- () => route.query.id,
|
|
|
+ () => store?.currentIncident,
|
|
|
(next) => {
|
|
|
- // 返回首页时 需要清除事件相关的
|
|
|
- if (!next) {
|
|
|
+ if (!isEmpty(next)) {
|
|
|
+ handleSetDetailMarker({
|
|
|
+ ...next,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
handleRemoveAllMarkers();
|
|
|
if (state.types.includes('应急事件')) {
|
|
|
state.types.forEach((next) => {
|
|
@@ -499,18 +512,6 @@ export default defineComponent({
|
|
|
);
|
|
|
|
|
|
watch(
|
|
|
- () => props.marker?.baseInfo?.locations,
|
|
|
- (next) => {
|
|
|
- if (next && !state.positions.includes(next)) {
|
|
|
- // handleSetDetailMarker({
|
|
|
- // location: '118.288721,33.951047',
|
|
|
- // name: '中心庄',
|
|
|
- // });
|
|
|
- }
|
|
|
- },
|
|
|
- );
|
|
|
-
|
|
|
- watch(
|
|
|
() => state.types,
|
|
|
(next) => {
|
|
|
actionTypes.value.forEach((item) => {
|
|
@@ -528,18 +529,28 @@ export default defineComponent({
|
|
|
return () => (
|
|
|
<div class="task-map-container">
|
|
|
<MapView v-model:map={state.map} />
|
|
|
- {!props.readonly && (
|
|
|
- <Popup class="address-type-card">
|
|
|
+ <div
|
|
|
+ class={clsx('address-type-card-container', {
|
|
|
+ ['in-detail']: props.readonly,
|
|
|
+ })}>
|
|
|
+ <Popup
|
|
|
+ class={clsx('address-type-card', {
|
|
|
+ ['in-detail']: props.readonly,
|
|
|
+ })}>
|
|
|
<el-checkbox-group v-model={state.types}>
|
|
|
- {props.adrsMapTypes &&
|
|
|
- props.adrsMapTypes.map((t) => (
|
|
|
- <el-checkbox key={t} class="card-item" label={t} />
|
|
|
+ {adrsMapTypes.value &&
|
|
|
+ adrsMapTypes.value?.map((t) => (
|
|
|
+ <>
|
|
|
+ {!t.disabled && (
|
|
|
+ <el-checkbox key={t} class="card-item" label={t.name} />
|
|
|
+ )}
|
|
|
+ </>
|
|
|
))}
|
|
|
</el-checkbox-group>
|
|
|
<i class="card-border-bottom-left"></i>
|
|
|
<i class="card-border-bottom-right"></i>
|
|
|
</Popup>
|
|
|
- )}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
},
|