地图重复渲染图标问题修改

This commit is contained in:
fanjia 2026-04-29 15:55:12 +08:00
parent 82e10762a4
commit fce1c6817e
5 changed files with 194 additions and 36 deletions

View File

@ -136,7 +136,7 @@
<div class="f1 display ai_center jc_end" style="gap: 8px"> <div class="f1 display ai_center jc_end" style="gap: 8px">
<span class="responsibility-name">{{ hazardData.roadKeeper.name }}</span> <span class="responsibility-name">{{ hazardData.roadKeeper.name }}</span>
<span class="responsibility-name" style="width: 100px;">{{ hazardData.roadKeeper.phone }}</span> <span class="responsibility-name" style="width: 100px">{{ hazardData.roadKeeper.phone }}</span>
<span class="responsibility-frequency">{{ hazardData.roadKeeper.frequency }}</span> <span class="responsibility-frequency">{{ hazardData.roadKeeper.frequency }}</span>
<div class="action-btns"> <div class="action-btns">
<div class="action-btn" @click="handleVideo(hazardData.roadKeeper)" title="视频"> <div class="action-btn" @click="handleVideo(hazardData.roadKeeper)" title="视频">
@ -331,13 +331,19 @@ const handleVideo = (item) => {
// //
const handleVoice = (item) => { const handleVoice = (item) => {
console.log('语音通话:', item) console.log('语音通话:', item)
emit('voice', item) emit('voice', {
...item,
id: hazardData.value.id,
})
} }
// //
const handleCall = (item) => { const handleCall = (item) => {
console.log('拨打电话:', item) console.log('拨打电话:', item)
emit('call', item) emit('call', {
...item,
id: hazardData.value.id,
})
} }
// visible // visible

View File

@ -344,7 +344,7 @@ const dialogItems = computed(() => {
.info-label { .info-label {
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
font-size: vw(13); font-size: vw(13);
// min-width: vw(100); max-width: vw(150);
flex-shrink: 0; flex-shrink: 0;
} }

View File

@ -412,17 +412,22 @@ const filterDataByCounty = (dataList, flag, options) => {
item[countyField] = '两江新区'; item[countyField] = '两江新区';
} }
// const matchValue = item[matchField];
affectedCountyData.value.sortedList.forEach(j => {
const matchValue = item[matchField]; if (!flag) {
if (flag && matchValue && j.name && matchValue.includes(j.name)) { //
item.COORDINATE_POINT = coordinateParser(item); item.COORDINATE_POINT = coordinateParser(item);
filteredData.push(item); filteredData.push(item);
} else if (!flag) { } else {
//
const isMatched = affectedCountyData.value.sortedList.some(j => {
return matchValue && j.name && matchValue.includes(j.name);
});
if (isMatched) {
item.COORDINATE_POINT = coordinateParser(item); item.COORDINATE_POINT = coordinateParser(item);
filteredData.push(item); filteredData.push(item);
} }
}); }
}); });
return filteredData; return filteredData;
@ -432,6 +437,12 @@ const affectedBridgeData = ref([]);
// //
const getAffectedBridgeData = async flag => { const getAffectedBridgeData = async flag => {
try { try {
//
if (hasProjectMarkersByType('bridge')) {
console.log('类型为 bridge 的标记已存在,跳过接口调用');
return [];
}
const timeParams = getTimeParams(); const timeParams = getTimeParams();
const res = await request({ const res = await request({
url: '/snow-ops-platform/map/bridge', url: '/snow-ops-platform/map/bridge',
@ -459,6 +470,12 @@ const tunnelInfoDialogRef = ref([]);
// //
const getAffectedTunnelData = async flag => { const getAffectedTunnelData = async flag => {
try { try {
//
if (hasProjectMarkersByType('tunnel')) {
console.log('类型为 tunnel 的标记已存在,跳过接口调用');
return [];
}
const timeParams = getTimeParams(); const timeParams = getTimeParams();
const res = await request({ const res = await request({
url: '/snow-ops-platform/map/tunnel', url: '/snow-ops-platform/map/tunnel',
@ -487,6 +504,12 @@ const getAffectedTunnelData = async flag => {
const affectedProjectData = ref([]); const affectedProjectData = ref([]);
const getAffectedProjectData = async flag => { const getAffectedProjectData = async flag => {
try { try {
//
if (hasProjectMarkersByType('project')) {
console.log('类型为 project 的标记已存在,跳过接口调用');
return [];
}
const timeParams = getTimeParams(); const timeParams = getTimeParams();
const res = await request({ const res = await request({
url: '/snow-ops-platform/weather-warning/affected-object/project', url: '/snow-ops-platform/weather-warning/affected-object/project',
@ -552,6 +575,14 @@ const getAffectedRoadSectionData = async flag => {
} else if (props.roadItem.label == '低风险路段') { } else if (props.roadItem.label == '低风险路段') {
riskLevel = '低风险'; riskLevel = '低风险';
} }
//
const typeKey = `road-${riskLevel}`;
if (hasProjectMarkersByType(typeKey)) {
console.log(`类型为 ${typeKey} 的标记已存在,跳过接口调用`);
return [];
}
const res = await request({ const res = await request({
// url: '/snow-ops-platform/weather-warning/affected-object/road-section', // url: '/snow-ops-platform/weather-warning/affected-object/road-section',
url: '/snow-ops-platform/risk-point/road-section', url: '/snow-ops-platform/risk-point/road-section',
@ -608,7 +639,12 @@ const getAffectedRoadSectionData = async flag => {
} }
emit('update:roadvalArr ==== 风险点总数', roadvalArr.value); emit('update:roadvalArr ==== 风险点总数', roadvalArr.value);
addProjectMarkers(affectedRoadSectionData.value, img, 'road'); // addProjectMarkers
const dataWithRiskLevel = affectedRoadSectionData.value.map(item => ({
...item,
riskLevel: riskLevel
}));
addProjectMarkers(dataWithRiskLevel, img, 'road');
} }
return []; return [];
} catch (error) { } catch (error) {
@ -621,6 +657,12 @@ const emergencyForceData = ref([]);
// //
const getEmergencyForceData = async () => { const getEmergencyForceData = async () => {
try { try {
//
if (hasProjectMarkersByType('emergency')) {
console.log('类型为 emergency 的标记已存在,跳过接口调用');
return [];
}
const timeParams = getTimeParams(); const timeParams = getTimeParams();
const res = await request({ const res = await request({
url: '/snow-ops-platform/yhYjll/listForcesAndMaterials', url: '/snow-ops-platform/yhYjll/listForcesAndMaterials',
@ -653,6 +695,12 @@ const dangerProjectData = ref([]);
// //
const getDangerProjectData = async flag => { const getDangerProjectData = async flag => {
try { try {
//
if (hasProjectMarkersByType('engineering')) {
console.log('类型为 engineering 的标记已存在,跳过接口调用');
return [];
}
const res = await request({ const res = await request({
url: '/snow-ops-platform/dangerProjectInfo/listAll', url: '/snow-ops-platform/dangerProjectInfo/listAll',
method: 'GET', method: 'GET',
@ -696,6 +744,30 @@ const riskPointStats = ref({
// //
const getRiskPointData = async (riskLevel, item) => { const getRiskPointData = async (riskLevel, item) => {
try { try {
// 线
let riskTypeKey = 'riskPoint';
if (riskLevel) {
if (riskLevel.includes('重大') && item.isWithinRedLine === '是') {
riskTypeKey = 'riskPoint-重大路内';
} else if (riskLevel.includes('重大') && item.isWithinRedLine === '否') {
riskTypeKey = 'riskPoint-重大路外';
} else if (riskLevel.includes('较大') && item.isWithinRedLine === '是') {
riskTypeKey = 'riskPoint-较大路内';
} else if (riskLevel.includes('较大') && item.isWithinRedLine === '否') {
riskTypeKey = 'riskPoint-较大路外';
} else if (riskLevel.includes('一般') && item.isWithinRedLine === '是') {
riskTypeKey = 'riskPoint-一般路内';
} else if (riskLevel.includes('一般') && item.isWithinRedLine === '否') {
riskTypeKey = 'riskPoint-一般路外';
}
}
//
if (hasProjectMarkersByType(riskTypeKey)) {
console.log(`类型为 ${riskTypeKey} 的标记已存在,跳过接口调用`);
return [];
}
const res = await request({ const res = await request({
url: '/snow-ops-platform/risk-point', url: '/snow-ops-platform/risk-point',
method: 'GET', method: 'GET',
@ -735,9 +807,13 @@ const getRiskPointData = async (riskLevel, item) => {
isWithinRedLine: item.isWithinRedLine, isWithinRedLine: item.isWithinRedLine,
value: riskPointData.value.length, value: riskPointData.value.length,
}); });
// // 线 addProjectMarkers
clearProjectMarkers(); const dataWithRiskInfo = riskPointData.value.map(riskItem => ({
addProjectMarkers(riskPointData.value, iconUrl, 'riskPoint'); ...riskItem,
riskLevel: riskLevel,
isWithinRedLine: item.isWithinRedLine
}));
addProjectMarkers(dataWithRiskInfo, iconUrl, 'riskPoint');
// //
} else { } else {
console.warn('没有获取到风险点数据或返回码错误:', res); console.warn('没有获取到风险点数据或返回码错误:', res);
@ -749,23 +825,47 @@ const getRiskPointData = async (riskLevel, item) => {
} }
}; };
let projectMarkers = []; // //
// : { 'road-': [...], 'road-': [...], 'riskPoint-': [...], ... }
let projectMarkersMap = new Map();
// //
const clearProjectMarkers = () => { const clearProjectMarkers = () => {
projectMarkers.forEach(marker => { projectMarkersMap.forEach((markers, type) => {
if (mapInstance) { markers.forEach(marker => {
mapInstance.removeLayer(marker); if (mapInstance) {
} mapInstance.removeLayer(marker);
}
});
}); });
projectMarkersMap.clear();
clearCountyCardMarkers(); clearCountyCardMarkers();
projectMarkers = [];
// //
mapInfoDialogVisible.value = false; mapInfoDialogVisible.value = false;
centerCardVisible.value = false; centerCardVisible.value = false;
}; };
//
const clearProjectMarkersByType = (typeKey) => {
const markers = projectMarkersMap.get(typeKey);
if (markers) {
markers.forEach(marker => {
if (mapInstance) {
mapInstance.removeLayer(marker);
}
});
projectMarkersMap.delete(typeKey);
console.log(`已清除类型为 ${typeKey} 的标记,共 ${markers.length}`);
}
};
//
const hasProjectMarkersByType = (typeKey) => {
const markers = projectMarkersMap.get(typeKey);
return markers && markers.length > 0;
};
// //
const getIconByType = (item, type) => { const getIconByType = (item, type) => {
// 线 // 线
@ -811,8 +911,50 @@ const addProjectMarkers = (data, iconUrl, type = 'project') => {
return; return;
} }
// // //
// clearProjectMarkers(); // : 'road-', 'road-', 'riskPoint-', 'project', 'tunnel', 'bridge'
let typeKey = type;
//
if (type === 'road' && data.length > 0) {
const riskLevel = data[0].GL1_FXDJ || data[0].riskLevel || '';
if (riskLevel) {
typeKey = `road-${riskLevel}`;
}
}
// 线
if (type === 'riskPoint' && data.length > 0) {
const riskLevel = data[0].GL1_FXDJ || data[0].riskLevel || '';
const isWithinRedLine = data[0].GL1_SFHXN || data[0].isWithinRedLine || '';
if (riskLevel) {
// 线
if (riskLevel.includes('重大') && isWithinRedLine === '是') {
typeKey = 'riskPoint-重大路内';
} else if (riskLevel.includes('重大') && isWithinRedLine === '否') {
typeKey = 'riskPoint-重大路外';
} else if (riskLevel.includes('较大') && isWithinRedLine === '是') {
typeKey = 'riskPoint-较大路内';
} else if (riskLevel.includes('较大') && isWithinRedLine === '否') {
typeKey = 'riskPoint-较大路外';
} else if (riskLevel.includes('一般') && isWithinRedLine === '是') {
typeKey = 'riskPoint-一般路内';
} else if (riskLevel.includes('一般') && isWithinRedLine === '否') {
typeKey = 'riskPoint-一般路外';
} else {
typeKey = `riskPoint-${riskLevel}`;
}
}
}
//
if (hasProjectMarkersByType(typeKey)) {
console.log(`类型为 ${typeKey} 的标记已存在,跳过添加`);
return;
}
//
const newMarkers = [];
// //
data.forEach(item => { data.forEach(item => {
@ -856,7 +998,7 @@ const addProjectMarkers = (data, iconUrl, type = 'project') => {
}); });
marker.addTo(mapInstance); marker.addTo(mapInstance);
projectMarkers.push(marker); newMarkers.push(marker);
} else { } else {
console.warn('无效的坐标:', item.COORDINATE_POINT, item); console.warn('无效的坐标:', item.COORDINATE_POINT, item);
} }
@ -865,7 +1007,9 @@ const addProjectMarkers = (data, iconUrl, type = 'project') => {
} }
}); });
console.log(`已添加 ${projectMarkers.length} 个项目标记`); //
projectMarkersMap.set(typeKey, newMarkers);
console.log(`已添加 ${newMarkers.length} 个类型为 ${typeKey} 的标记`);
}; };
// //

View File

@ -333,15 +333,15 @@ export const openVideoConference = async (item) => {
phone: item.phone, phone: item.phone,
}, },
}) })
const userId = 1279134 // const userId = 1279134
if (res.code === '00000') { if (res.code === '00000' && res.data != null) {
// const userId = res.data const userId = res.data
const url = `taurusykz://taurusclient/action/avmeeting/conferenceCreateByIds?title=重庆渝路畅行风险预警&isVideoConference=true&calleeStaffIds=${userId}` const url = `taurusykz://taurusclient/action/avmeeting/conferenceCreateByIds?title=重庆渝路畅行风险预警&isVideoConference=true&calleeStaffIds=${userId}`
window.location.href = url window.location.href = url
// 监听用户点击"打开"按钮后记录日志 // 监听用户点击"打开"按钮后记录日志
let jsobj = { let jsobj = {
name: item.name, userName: item.name,
phone: item.phone, userPhone: item.phone,
id: item.id, id: item.id,
userId: userId, userId: userId,
text: '打开视频会议', text: '打开视频会议',
@ -381,8 +381,8 @@ export const openVoiceConference = async (item) => {
window.location.href = url window.location.href = url
// 监听用户点击"打开"按钮后记录日志 // 监听用户点击"打开"按钮后记录日志
let jsobj = { let jsobj = {
name: item.name, userName: item.name,
phone: item.phone, userPhone: item.phone,
id: item.id, id: item.id,
userId: userId, userId: userId,
text: '打开语音通话', text: '打开语音通话',
@ -408,8 +408,8 @@ export const opencallConference = async (item) => {
} }
// 监听用户点击"打开"按钮后记录日志 // 监听用户点击"打开"按钮后记录日志
let jsobj = { let jsobj = {
name: item.name, userName: item.name,
phone: item.phone, userPhone: item.phone,
id: item.id, id: item.id,
userId: '', userId: '',
text: '拨打电话', text: '拨打电话',

View File

@ -363,11 +363,19 @@ const chongqingMapRef = ref(null)
// //
const changeActiveIndex = (index) => { const changeActiveIndex = (index) => {
activeitem.value = index activeitem.value = index
console.log('切换导航项:', index)
if (index.label === '路段') {
showRoadStats.value = true
} else {
showRoadStats.value = false
}
} }
const roadItem = ref({}) const roadItem = ref({})
const showRoadStats = ref(false) const showRoadStats = ref(false)
const roadItemClick = (item) => { const roadItemClick = (item) => {
console.log('点击路段:', item) console.log('点击路段:', item)
roadItem.value = {}
roadItem.value = item roadItem.value = item
showRoadStats.value = true showRoadStats.value = true
} }