diff --git a/src/views/DialogTabs/component/GongDanPaiFa.vue b/src/views/DialogTabs/component/GongDanPaiFa.vue index 3f2a0a3..48ac857 100644 --- a/src/views/DialogTabs/component/GongDanPaiFa.vue +++ b/src/views/DialogTabs/component/GongDanPaiFa.vue @@ -94,7 +94,7 @@ ], }); const { form, orderForm, needTime } = toRefs(AllData); -// 关闭弹窗 +// 工单派发 const CloseDialog = () => { console.log( `在${form.value.eventAddress}出现了${form.value.eventDetails},请于${form.value.requestFeedbackHourNum}进行确认与反馈` @@ -129,6 +129,9 @@ proxy.$modal.msgSuccess('派发成功'); bus.emit('nowDynamic'); bus.emit('publicDialog_Close'); + + // 关闭 当前预警点 + bus.emit('changeOnePointShow', orderForm.value); }) .catch(err => { console.log('🚀 ~ alarmWorkOrderAdd ~ err:', err); diff --git a/src/views/DialogTabs/component/GongDanPaiFa.vue b/src/views/DialogTabs/component/GongDanPaiFa.vue index 3f2a0a3..48ac857 100644 --- a/src/views/DialogTabs/component/GongDanPaiFa.vue +++ b/src/views/DialogTabs/component/GongDanPaiFa.vue @@ -94,7 +94,7 @@ ], }); const { form, orderForm, needTime } = toRefs(AllData); -// 关闭弹窗 +// 工单派发 const CloseDialog = () => { console.log( `在${form.value.eventAddress}出现了${form.value.eventDetails},请于${form.value.requestFeedbackHourNum}进行确认与反馈` @@ -129,6 +129,9 @@ proxy.$modal.msgSuccess('派发成功'); bus.emit('nowDynamic'); bus.emit('publicDialog_Close'); + + // 关闭 当前预警点 + bus.emit('changeOnePointShow', orderForm.value); }) .catch(err => { console.log('🚀 ~ alarmWorkOrderAdd ~ err:', err); diff --git a/src/views/oneMap/index.vue b/src/views/oneMap/index.vue index db090fc..abaa0db 100644 --- a/src/views/oneMap/index.vue +++ b/src/views/oneMap/index.vue @@ -237,46 +237,54 @@ // const useSocket = inject('useSocket'); +// 预警点位数组 +const warningFeatures = ref([]); + watch( () => useSocket.chatMessage.value, (newVal, oldVal) => { console.log('更新---------', newVal); - bus.emit('removeMapDatas', ['warning_monitor1']); - if (newVal.type == 'warnInfo') { - // 地图操作 - if (!newVal.content.length) return; - let warningFeatures = []; - newVal.content.forEach(element => { - if (element.location) { - let warningFeature = turf.point(element.location.split(',').map(Number), element); - warningFeature.properties.name = element.assessment; - warningFeature.properties.size = 200; - warningFeatures.push(warningFeature); - } - }); - let warningFeaturesGeojson = turf.featureCollection(warningFeatures); - let key = 'warning_monitor1'; - bus.emit('getGeojsonByType', { - type: key, - callback: geojson => { - if (!!!geojson.features.length) bus.emit('setGeoJSON', { json: warningFeaturesGeojson, key: 'warning_monitor1' }); - bus.emit('setLayerVisible', { type: 'point', layername: key, isCheck: true }); - }, - }); - let warningPoint = newfiberMapbox.getLayers().filter(feature => feature.newfiberId == 'warning_monitor1')[0]; - if (warningPoint) { - warningPoint.on('click', e => { - let popupData = e.feature.properties; - console.log('popupData---', '告警12.19---------', popupData); - let data = { - title: popupData.wranLocation, - comIDs: ['gdpf'], - getSiteId: popupData.id, - }; - bus.emit('publicDialog', data); - }); - } - } + + // 添加告警点状态 + // newVal.content.is_alarmOrder = false; // 默认没有告警 此时content返回的是对象 + showAlarm(newVal); + + // bus.emit('removeMapDatas', ['warning_monitor1']); + // if (newVal.type == 'warnInfo') { + // // 地图操作 + // if (!newVal.content.length) return; + // let warningFeatures = []; + // newVal.content.forEach(element => { + // if (element.location) { + // let warningFeature = turf.point(element.location.split(',').map(Number), element); + // warningFeature.properties.name = element.assessment; + // warningFeature.properties.size = 200; + // warningFeatures.push(warningFeature); + // } + // }); + // let warningFeaturesGeojson = turf.featureCollection(warningFeatures); + // let key = 'warning_monitor1'; + // bus.emit('getGeojsonByType', { + // type: key, + // callback: geojson => { + // if (!!!geojson.features.length) bus.emit('setGeoJSON', { json: warningFeaturesGeojson, key: 'warning_monitor1' }); + // bus.emit('setLayerVisible', { type: 'point', layername: key, isCheck: true }); + // }, + // }); + // let warningPoint = newfiberMapbox.getLayers().filter(feature => feature.newfiberId == 'warning_monitor1')[0]; + // if (warningPoint) { + // warningPoint.on('click', e => { + // let popupData = e.feature.properties; + // console.log('popupData---', '告警12.19---------', popupData); + // let data = { + // title: popupData.wranLocation, + // comIDs: ['gdpf'], + // getSiteId: popupData.id, + // }; + // bus.emit('publicDialog', data); + // }); + // } + // } }, { // immediate: true, @@ -284,6 +292,58 @@ } ); +// 地图预警点位展示 +const showAlarm = val => { + bus.emit('removeMapDatas', ['warning_monitor1']); + if (val.type == 'warnInfo') { + // 地图操作 + if (!val.content.length) return; + let warningFeatures = []; // 使用最外面定义的 warningFeatures.value 存储 + val.content.forEach(element => { + if (element.location) { + let warningFeature = turf.point(element.location.split(',').map(Number), element); + warningFeature.properties.name = element.assessment; + warningFeature.properties.size = 200; + warningFeatures.push(warningFeature); + } + }); + let warningFeaturesGeojson = turf.featureCollection(warningFeatures); + let key = 'warning_monitor1'; + bus.emit('getGeojsonByType', { + type: key, + callback: geojson => { + if (!!!geojson.features.length) bus.emit('setGeoJSON', { json: warningFeaturesGeojson, key: 'warning_monitor1' }); + bus.emit('setLayerVisible', { type: 'point', layername: key, isCheck: true }); + }, + }); + let warningPoint = newfiberMapbox.getLayers().filter(feature => feature.newfiberId == 'warning_monitor1')[0]; + if (warningPoint) { + warningPoint.on('click', e => { + let popupData = e.feature.properties; + console.log('popupData---', '告警12.19---------', popupData); + let data = { + title: popupData.wranLocation, + comIDs: ['gdpf'], + getSiteId: popupData.id, + }; + bus.emit('publicDialog', data); + }); + } + } +}; + +const changeOnePoint = data => { + // 改变当前点位展示状态 + warningFeatures.value.forEach(item => { + if (item.id === data.id) { + item.is_alarmOrder = true; + } + }); + + // 更新地图渲染 + +}; + const useDialogTabs = dialogTabsStore(); // 时间以及天气 @@ -544,6 +604,10 @@ bus.on('SiSeTuBol', params => { AllData.SiSeTuBol = params; }); + // 改变点位状态 + bus.on('changeOnePointShow', data => { + changeOnePoint(data); + }); }); onBeforeUnmount(() => { bus.off('BottomHidden'); @@ -554,6 +618,7 @@ bus.off('checkRainL'); bus.off('changeShowPanel'); bus.off('SiSeTuBol'); + bus.off('changeOnePointShow'); }); // 菜单点击 const MenuClick = (item, index) => {