diff --git a/src/apis/map/type.ts b/src/apis/map/type.ts index 9f1b603..16a1f0d 100644 --- a/src/apis/map/type.ts +++ b/src/apis/map/type.ts @@ -32,7 +32,7 @@ export interface MapPointInfo { associatedStorageLocations?: string[]; // 库位名称 deviceId?: string; // 设备ID enabled?: 0 | 1; // 是否启用(充电点/停靠点使用,0=禁用,1=启用) - deviceStatus?: number; // 设备状态(仅自动门点使用,0=关门,1=开门) + doorStatus?: number; // 设备状态(仅自动门点使用,0=关门,1=开门) isConnected?: boolean; // 连接状态(仅自动门点使用,true=已连接,false=未连接) active?: boolean; // 是否激活状态,用于控制光圈显示 } @@ -48,7 +48,7 @@ export interface MapRouteInfo { c2?: Point; // 控制点2 // 门区域:绑定设备与状态(可选) deviceId?: string; - deviceStatus?: number; // 0=关门,1=开门 + doorStatus?: number; // 0=关门,1=开门 isConnected?: boolean; // true=已连接,false=未连接 } //#endregion @@ -62,7 +62,7 @@ export interface MapAreaInfo { inoutflag?: 1 | 2; // 进出限制 // 门区域:绑定设备与状态(可选) doorDeviceId?: string; - deviceStatus?: number; // 0=关门,1=开门 + doorStatus?: number; // 0=关门,1=开门 isConnected?: boolean; // true=已连接,false=未连接 } //#endregion diff --git a/src/components/card/area-detail-card.vue b/src/components/card/area-detail-card.vue index 5f1aea5..4ed8c71 100644 --- a/src/components/card/area-detail-card.vue +++ b/src/components/card/area-detail-card.vue @@ -16,7 +16,7 @@ const editor = inject(props.token)!; // 订阅区域集合变化(含设备状态/连接状态),用于触发详情面板的响应式刷新 const areasTick = computed(() => editor.value.areas.value - .map((v: any) => `${v.id}:${v?.area?.deviceStatus ?? ''}:${v?.area?.isConnected ?? ''}`) + .map((v: any) => `${v.id}:${v?.area?.doorStatus ?? ''}:${v?.area?.isConnected ?? ''}`) .join('|'), ); @@ -170,7 +170,7 @@ watch(area, (newArea) => { {{ $t('门状态') }} - {{ area.deviceStatus === 1 ? $t('开门') : area.deviceStatus === 0 ? $t('关门') : $t('无') }} + {{ area.doorStatus === 1 ? $t('开门') : area.doorStatus === 0 ? $t('关门') : $t('无') }} diff --git a/src/pages/movement-supervision.vue b/src/pages/movement-supervision.vue index df2bf65..b3cb6a8 100644 --- a/src/pages/movement-supervision.vue +++ b/src/pages/movement-supervision.vue @@ -405,7 +405,7 @@ const monitorScene = async () => { canStop: null, canControl: true, targetPoint: null, - deviceStatus: doorMockStatus, + doorStatus: doorMockStatus, x: 0, y: 0, active: true, diff --git a/src/services/auto-door-simulation.service.ts b/src/services/auto-door-simulation.service.ts index fdfd199..28932f0 100644 --- a/src/services/auto-door-simulation.service.ts +++ b/src/services/auto-door-simulation.service.ts @@ -73,7 +73,7 @@ interface AutoDoorStatusData { targetPoint: null; - deviceStatus: 0 | 1; // 设备状态:0=关门,1=开门 + doorStatus: 0 | 1; // 设备状态:0=关门,1=开门 x: number; @@ -125,7 +125,7 @@ export interface AutoDoorWebSocketData { targetPoint: null; - deviceStatus: 0 | 1; // 设备状态:0=关门,1=开门 + doorStatus: 0 | 1; // 设备状态:0=关门,1=开门 x: number; @@ -174,7 +174,7 @@ export class AutoDoorService { private latestAutoDoorData = new Map< string, - { deviceId: string; deviceStatus: number; active: boolean; isConnected: boolean } + { deviceId: string; doorStatus: number; active: boolean; isConnected: boolean } >(); // 设备ID到自动门点ID列表的映射缓存,支持同一设备绑定多个点位 @@ -413,11 +413,11 @@ export class AutoDoorService { handleWebSocketData(data: AutoDoorWebSocketData): void { // 兼容不同字段:优先使用 id 作为设备ID,退回 label const deviceId = (data as any)?.id || (data as any)?.label; - const deviceStatus = (data as any)?.deviceStatus; + const doorStatus = (data as any)?.doorStatus; const active = (data as any)?.active ?? true; const isConnected = (data as any)?.isConnected ?? true; - if (!deviceId || deviceStatus === undefined) { + if (!deviceId || doorStatus === undefined) { console.warn('⚠️ 自动门点数据格式不正确', data); return; @@ -425,10 +425,10 @@ export class AutoDoorService { // 缓存最新数据 - this.latestAutoDoorData.set(deviceId, { deviceId, deviceStatus, active, isConnected }); + this.latestAutoDoorData.set(deviceId, { deviceId, doorStatus, active, isConnected }); this.debugLog('handleWebSocketData -> buffered', { deviceId, - deviceStatus, + doorStatus, active, isConnected, bufferSize: this.latestAutoDoorData.size, @@ -436,7 +436,7 @@ export class AutoDoorService { // console.log( - // `🚪 收到自动门点WebSocket数据: ${deviceStatus === 0 ? '关门(红色)' : '开门(蓝色)'} (deviceId: ${deviceId})`, + // `🚪 收到自动门点WebSocket数据: ${doorStatus === 0 ? '关门(红色)' : '开门(蓝色)'} (deviceId: ${deviceId})`, // ); } @@ -492,7 +492,7 @@ export class AutoDoorService { const updates = pointIds.map((pid) => ({ id: pid, deviceId: data.deviceId, - deviceStatus: data.deviceStatus, + doorStatus: data.doorStatus, isConnected: data.isConnected, active: data.active, })); @@ -500,7 +500,7 @@ export class AutoDoorService { updates.forEach((update) => { this.editorService!.updateAutoDoorByDeviceId( update.deviceId, - update.deviceStatus, + update.doorStatus, update.isConnected, update.active, update.id, @@ -516,7 +516,7 @@ export class AutoDoorService { this.debugLog('sync to routes -> count:', routes.length); routes.forEach((r: any) => { - const patch = { deviceStatus: data.deviceStatus, isConnected: data.isConnected } as any; + const patch = { doorStatus: data.doorStatus, isConnected: data.isConnected } as any; this.editorService!.updateRoute(r.id, patch); this.debugLog('route updated ->', r.id, patch); }); @@ -540,7 +540,7 @@ export class AutoDoorService { this.debugLog('sync to door areas -> count:', areas.length, 'deviceId:', data.deviceId); areas.forEach((a: any) => { - const patch = { deviceStatus: data.deviceStatus, isConnected: data.isConnected } as any; + const patch = { doorStatus: data.doorStatus, isConnected: data.isConnected } as any; this.editorService!.updateArea(a.id, patch); this.debugLog('door area updated ->', a.id, patch); }); @@ -615,11 +615,11 @@ export class AutoDoorService { * @param label 设备标签 - * @param deviceStatus 设备状态 + * @param doorStatus 设备状态 */ - private createMockData(deviceId: string, label: string, deviceStatus: 0 | 1): AutoDoorStatusData { + private createMockData(deviceId: string, label: string, doorStatus: 0 | 1): AutoDoorStatusData { return { gid: '', @@ -647,7 +647,7 @@ export class AutoDoorService { targetPoint: null, - deviceStatus, + doorStatus, x: 0, diff --git a/src/services/editor.service.ts b/src/services/editor.service.ts index 2b700e5..2af6310 100644 --- a/src/services/editor.service.ts +++ b/src/services/editor.service.ts @@ -312,7 +312,7 @@ export class EditorService extends Meta2d { maxSpeed, // 门区域扩展字段 deviceId: (v as any).deviceId, - deviceStatus: (v as any).deviceStatus, + doorStatus: (v as any).doorStatus, isConnected: (v as any).isConnected, }, }, @@ -393,7 +393,7 @@ export class EditorService extends Meta2d { inoutflag, // 门区域扩展字段 doorDeviceId: (v as any).doorDeviceId, - deviceStatus: (v as any).deviceStatus, + doorStatus: (v as any).doorStatus, isConnected: (v as any).isConnected, }, }, @@ -448,7 +448,7 @@ export class EditorService extends Meta2d { #mapSceneRoute(pen?: MapPen): StandardSceneRoute | null { if (!pen?.id || pen.anchors?.length !== 2 || isEmpty(pen?.route)) return null; const { id, anchors, desc, properties } = pen; - const { type, direction = 1, pass, c1, c2, maxSpeed, deviceId, deviceStatus, isConnected } = pen.route as any; + const { type, direction = 1, pass, c1, c2, maxSpeed, deviceId, doorStatus, isConnected } = pen.route as any; const [p1, p2] = anchors.map((v) => this.getPenById(v.connectTo!)); if (isNil(p1) || isNil(p2)) return null; const route: StandardSceneRoute = { @@ -464,7 +464,7 @@ export class EditorService extends Meta2d { }; // 门区域扩展字段:保持到顶层,便于后端识别 (route as any).deviceId = deviceId; - (route as any).deviceStatus = deviceStatus; + (route as any).doorStatus = doorStatus; (route as any).isConnected = isConnected; const { x: x1, y: y1 } = this.getPointRect(p1)!; const { x: x2, y: y2 } = this.getPointRect(p2)!; @@ -492,7 +492,7 @@ export class EditorService extends Meta2d { #mapSceneArea(pen: MapPen): StandardSceneArea | null { if (!pen.id || isEmpty(pen.area)) return null; const { id, label, desc, properties } = pen; - const { type, points, routes, maxAmr, inoutflag, doorDeviceId, deviceStatus, isConnected } = pen.area as any; + const { type, points, routes, maxAmr, inoutflag, doorDeviceId, doorStatus, isConnected } = pen.area as any; const { x, y, width, height } = this.getPenRect(pen); // 进行坐标转换:左上角原点 -> 中心点原点,同时应用ratio缩放 const transformedCoords = this.#transformCoordinate(x, y); @@ -511,7 +511,7 @@ export class EditorService extends Meta2d { // 门区域扩展字段 (area as any).routes = routes; (area as any).doorDeviceId = doorDeviceId; - (area as any).deviceStatus = deviceStatus; + (area as any).doorStatus = doorStatus; (area as any).isConnected = isConnected; if (type === MapAreaType.约束区) { area.maxAmr = maxAmr; @@ -989,14 +989,14 @@ export class EditorService extends Meta2d { /** * 根据设备ID更新自动门点状态 * @param deviceId 设备ID - * @param deviceStatus 设备状态(0=关门,1=开门) + * @param doorStatus 设备状态(0=关门,1=开门) * @param isConnected 连接状态(true=已连接,false=未连接) * @param active 是否显示光圈 * @param pointId 可选的点位ID,如果提供则直接使用,避免查找 */ public updateAutoDoorByDeviceId( deviceId: string, - deviceStatus: number, + doorStatus: number, isConnected: boolean, active = true, pointId?: string, @@ -1034,7 +1034,7 @@ export class EditorService extends Meta2d { { point: { ...autoDoorPoint.point, - deviceStatus, + doorStatus, isConnected, active, }, diff --git a/src/services/editor/editor-drawers.ts b/src/services/editor/editor-drawers.ts index 6fbb793..288a4d3 100644 --- a/src/services/editor/editor-drawers.ts +++ b/src/services/editor/editor-drawers.ts @@ -16,7 +16,7 @@ export function drawPoint(ctx: CanvasRenderingContext2D, pen: MapPen): void { const theme = sTheme.editor; const { active, iconSize: r = 0, fontSize = 14, lineHeight = 1.5, fontFamily } = pen.calculative ?? {}; const { x = 0, y = 0, width: w = 0, height: h = 0 } = pen.calculative?.worldRect ?? {}; - const { type, isConnected, deviceStatus, active: pointActive } = pen.point ?? {}; + const { type, isConnected, doorStatus, active: pointActive } = pen.point ?? {}; const { label = '', statusStyle } = pen ?? {}; ctx.save(); @@ -40,7 +40,7 @@ export function drawPoint(ctx: CanvasRenderingContext2D, pen: MapPen): void { ctx.fillStyle = colorConfig.getColor('autoDoor.strokeClosed') || '#fe5a5ae0'; } else { // 已连接:根据门状态显示颜色(0=关门-浅红,1=开门-蓝色) - if (deviceStatus === 0) { + if (doorStatus === 0) { ctx.fillStyle = colorConfig.getColor('autoDoor.fillClosed') || '#cddc39'; } else { ctx.fillStyle = colorConfig.getColor('autoDoor.fillOpen') || '#1890FF'; @@ -312,8 +312,8 @@ export function drawArea(ctx: CanvasRenderingContext2D, pen: MapPen): void { // 门区域图标背景:根据设备连接与开关状态绘制淡化图标 if ((type as any) === DOOR_AREA_TYPE) { const isConnected = (pen.area as any)?.isConnected; - const deviceStatus = (pen.area as any)?.deviceStatus; - const img = isConnected === false ? __doorImgClosed : deviceStatus === 1 ? __doorImgOpen : __doorImgClosed; + const doorStatus = (pen.area as any)?.doorStatus; + const img = isConnected === false ? __doorImgClosed : doorStatus === 1 ? __doorImgOpen : __doorImgClosed; if (img && img.complete) { const padding = Math.max(2, Math.min(10, Math.min(w, h) * 0.02)); const availW = Math.max(0, w - padding * 2);