|
@@ -60,26 +60,39 @@ export const useFacilityPointStore = defineStore('facilityPointStore', () => {
|
|
|
cancelPointLocate()
|
|
cancelPointLocate()
|
|
|
useDetailStore().closeDetail()
|
|
useDetailStore().closeDetail()
|
|
|
locate.value = { result: 'ok', pointCode: '', reasonText: '', at: Date.now() }
|
|
locate.value = { result: 'ok', pointCode: '', reasonText: '', at: Date.now() }
|
|
|
- await entityStore.show(identity, prefill, options)
|
|
|
|
|
- if (mine !== selectToken || !entityStore.open || !sameEntity(entityStore.identity, identity)) return false
|
|
|
|
|
- const point = selectedPoint.value
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * `openDetail: false` = 只定位、不开设施详情。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 关联管网聚焦要走这条:管网是线段对象,按 `facility` 去请求详情会 404,
|
|
|
|
|
+ * 用户看到的会是一个「设施详情未取到」的空卡。定位点本身仍由
|
|
|
|
|
+ * `resolveFacilityPoint` 从管线图层算出,不依赖详情。
|
|
|
|
|
+ */
|
|
|
|
|
+ const inline = options.openDetail === false
|
|
|
|
|
+ if (!inline) await entityStore.show(identity, prefill, options)
|
|
|
|
|
+ if (mine !== selectToken) return false
|
|
|
|
|
+ if (!inline && (!entityStore.open || !sameEntity(entityStore.identity, identity))) return false
|
|
|
|
|
+ const point = inline
|
|
|
|
|
+ ? resolveFacilityPoint({ identity, network: pipeStore.layer.data })
|
|
|
|
|
+ : selectedPoint.value
|
|
|
const finish = (result, reasonText = '') => {
|
|
const finish = (result, reasonText = '') => {
|
|
|
locate.value = { result, pointCode: point?.code || identity.id, reasonText, at: Date.now() }
|
|
locate.value = { result, pointCode: point?.code || identity.id, reasonText, at: Date.now() }
|
|
|
return locate.value
|
|
return locate.value
|
|
|
}
|
|
}
|
|
|
if (!point || point.placement === 'pending') return finish('unavailable', point?.reasonText || '设施位置尚未取到,请稍后重试')
|
|
if (!point || point.placement === 'pending') return finish('unavailable', point?.reasonText || '设施位置尚未取到,请稍后重试')
|
|
|
if (point.placement !== 'drawn') return finish('blocked', point.reasonText || '设施没有可定位的地图位置')
|
|
if (point.placement !== 'drawn') return finish('blocked', point.reasonText || '设施没有可定位的地图位置')
|
|
|
- if (!(renderPoints.value || []).some(row => row.key === point.key)) return finish('missing', '设施不在当前筛选范围,请调整筛选后定位')
|
|
|
|
|
|
|
+ // 只定位时不做「当前筛选内」的检查:管网本来就不在设施点图层里。
|
|
|
|
|
+ if (!inline && !(renderPoints.value || []).some(row => row.key === point.key)) return finish('missing', '设施不在当前筛选范围,请调整筛选后定位')
|
|
|
let failure = TERRAIN_LOCATE_REASON.MAP
|
|
let failure = TERRAIN_LOCATE_REASON.MAP
|
|
|
let applied = false
|
|
let applied = false
|
|
|
try {
|
|
try {
|
|
|
applied = await (options.fly || locateFacilityPoint)(point, {
|
|
applied = await (options.fly || locateFacilityPoint)(point, {
|
|
|
tier: 'device', onFailure: reason => { failure = reason },
|
|
tier: 'device', onFailure: reason => { failure = reason },
|
|
|
- isCurrent: () => mine === selectToken && entityStore.open && sameEntity(entityStore.identity, identity)
|
|
|
|
|
- && (renderPoints.value || []).some(row => row.key === point.key),
|
|
|
|
|
|
|
+ isCurrent: () => mine === selectToken && (inline || (entityStore.open && sameEntity(entityStore.identity, identity)
|
|
|
|
|
+ && (renderPoints.value || []).some(row => row.key === point.key))),
|
|
|
})
|
|
})
|
|
|
} catch { applied = false }
|
|
} catch { applied = false }
|
|
|
- if (mine !== selectToken || !entityStore.open || !sameEntity(entityStore.identity, identity)) return false
|
|
|
|
|
|
|
+ if (mine !== selectToken) return false
|
|
|
|
|
+ if (!inline && (!entityStore.open || !sameEntity(entityStore.identity, identity))) return false
|
|
|
return finish(applied === true ? 'ok' : 'unavailable', applied === true ? '' : locateFailureText(failure))
|
|
return finish(applied === true ? 'ok' : 'unavailable', applied === true ? '' : locateFailureText(failure))
|
|
|
}
|
|
}
|
|
|
|
|
|