fix(Map): 修复人员位置信息获取逻辑

- 移除对 locationRawJson 的解析,改为直接使用 item.lon 和 item.lat
master
LiuJiaNan 2026-08-21 14:59:16 +08:00
parent 4bc3b5c80f
commit 9f3bf572fd
1 changed files with 2 additions and 7 deletions

View File

@ -20,19 +20,14 @@ export default function usePeoplePosition(mapMethods, currentBranchOffice, portA
const peopleList = Array.isArray(data) ? data : [data]; const peopleList = Array.isArray(data) ? data : [data];
for (let i = 0; i < peopleList.length; i++) { for (let i = 0; i < peopleList.length; i++) {
const item = peopleList[i]; const item = peopleList[i];
if (!item?.locationRawJson)
continue;
const location = JSON.parse(item.locationRawJson).position;
if (!location || !location.lon || !location.lat)
continue;
const id = item.terminalNo || item.staffNo; const id = item.terminalNo || item.staffNo;
if (!id) if (!id)
continue; continue;
const index = points.current.findIndex( const index = points.current.findIndex(
item1 => item1.id.toString() === id.toString(), item1 => item1.id.toString() === id.toString(),
); );
const x = location.lon; const x = item.lon;
const y = location.lat; const y = item.lat;
// 封闭区域模式只保留围栏内人员;人员离开围栏后立即移除已有点位。 // 封闭区域模式只保留围栏内人员;人员离开围栏后立即移除已有点位。
if (filterAreas.current.length > 0 && !isPointInAreas(filterAreas.current, x, y)) { if (filterAreas.current.length > 0 && !isPointInAreas(filterAreas.current, x, y)) {
if (index !== -1) { if (index !== -1) {