Просмотр исходного кода

fix 设备测试界面显示添加

zhanghaijun лет назад: 2
Родитель
Сommit
84fa23fb14

+ 1 - 1
train-web/.vscode/settings.json

@@ -92,4 +92,4 @@
     },
     "node_modules": true
   }
-}
+}

+ 6 - 1
train-web/src/pages/device/DeviceTest.vue

@@ -3,7 +3,7 @@
     <el-tabs tab-position="left" style="height: 500px" class="demo-tabs">
       <el-tab-pane v-for="(device, deviceIndex) in deviceList" :key="deviceIndex" :label="device.description">
         {{ device.description }}
-        <el-table :data="getDevice(device)" stripe style="">
+        <el-table :data="getDevice(device)" stripe class="device-table">
           <el-table-column prop="code" label="设备名称" />
           <el-table-column prop="status" label="设备状态" width="180" />
           <el-table-column prop="" label="操作" width="260" />
@@ -35,5 +35,10 @@ function getDevice(deviceType: DeviceType): DeviceItem[] {
   overflow: hidden;
   margin: auto;
   overflow: auto;
+
+  .device-table {
+    width: 900px;
+    margin-left: 20px;
+  }
 }
 </style>

+ 6 - 2
train-web/src/pages/train/controller/DrewTrain.ts

@@ -27,8 +27,12 @@ export class DrewTrain {
     if (currentItem.switch) {
       const switchList: SwitchItem[] = storeTrain.getSwitchList;
       // 运行在道岔上
-      const { x, y } = calculateComponents(train.offset);
       const switchItem: SwitchItem | undefined = switchList.find(item => item.sectionId == currentItem.id);
+      if (!switchItem) {
+        return;
+      }
+      const { x, y } = calculateComponents(train.offset);
+      const { x: x2, y: y2 } = calculateComponents(141.42 - train.offset);
       switch (switchItem?.type) {
         case 1:
           this.draw(switchItem.kilometer + x, this.line_up + y, train);
@@ -40,7 +44,7 @@ export class DrewTrain {
           this.draw(switchItem.kilometer - x, this.line_down - y, train);
           break;
         case 4:
-          this.draw(switchItem.kilometer - x, this.line_up + y, train);
+          this.draw(switchItem.kilometer - x2, this.line_up + y2, train);
           break;
       }
     } else {

+ 163 - 24
train-web/src/types/device.ts

@@ -1,4 +1,3 @@
-
 export interface DeviceItem {
   // 唯一标识
   id: string;
@@ -23,53 +22,193 @@ export interface DeviceType {
 }
 
 // 列车车门控制 | 列车编号 | 车门状态 (0关 1开)
-export const TRAIN_OPEN_DOOR: DeviceType = { command: 10105, name: "TRAIN_OPEN_DOOR", description: "列车车门控制", nameStr: "trainNo", statusStr: "state" };
+export const TRAIN_OPEN_DOOR: DeviceType = {
+  command: 10105,
+  name: "TRAIN_OPEN_DOOR",
+  description: "列车车门控制",
+  nameStr: "trainNo",
+  statusStr: "state",
+};
 // 站台紧急停车操作指令 | 站台编号 | 运行方向 (1下行 2上行) 状态 (0弹起/复位 1按下)
-export const PLATFORM_PRESSING_STOP: DeviceType = { command: 20104, name: "PLATFORM_PRESSING_STOP", description: "站台紧急停车操作指令", nameStr: "platformNo", statusStr: "isPressed" };
+export const PLATFORM_PRESSING_STOP: DeviceType = {
+  command: 20104,
+  name: "PLATFORM_PRESSING_STOP",
+  description: "站台紧急停车操作指令",
+  nameStr: "platformNo",
+  statusStr: "isPressed",
+};
 // AFC闸机信息 | 闸机编号 | 闸机状态 (0关闭 1开启 2暂停服务 3故障) | 闸机方向状态 (0进站 1出站)
-export const AFC_GATE_MACHINE: DeviceType = { command: 10201, name: "AFC_GATE_MACHINE", description: "AFC闸机信息", nameStr: "gateMachineNo", statusStr: "state" };
+export const AFC_GATE_MACHINE: DeviceType = {
+  command: 10201,
+  name: "AFC_GATE_MACHINE",
+  description: "AFC闸机信息",
+  nameStr: "gateMachineNo",
+  statusStr: "state"
+};
 // AFC自动售票机信息 | 售票机编号 | 状态 (0正常服务 1暂停服务 2故障)
-export const AFC_TICKETING_AUTO: DeviceType = { command: 10202, name: "AFC_TICKETING_AUTO", description: "AFC自动售票机信息", nameStr: "tvmNo", statusStr: "state" };
+export const AFC_TICKETING_AUTO: DeviceType = {
+  command: 10202,
+  name: "AFC_TICKETING_AUTO",
+  description: "AFC自动售票机信息",
+  nameStr: "tvmNo",
+  statusStr: "state",
+};
 // AFC半自动售票机信息
-export const AFC_TICKETING_SEMI: DeviceType = { command: 10203, name: "AFC_TICKETING_SEMI", description: "AFC半自动售票机信息", nameStr: "ticketNo", statusStr: "state" };
+export const AFC_TICKETING_SEMI: DeviceType = {
+  command: 10203,
+  name: "AFC_TICKETING_SEMI",
+  description: "AFC半自动售票机信息",
+  nameStr: "ticketNo",
+  statusStr: "state"
+};
 // AFC闸机操作指令 | 闸机编号 | 闸机状态 (0关闭 1开启 2暂停服务 3故障)
-export const AFC_GATE_MACHINE_STATUS: DeviceType = { command: 20201, name: "AFC_GATE_MACHINE_STATUS", description: "AFC闸机操作指令", nameStr: "gateMachineNo", statusStr: "state" };
+export const AFC_GATE_MACHINE_STATUS: DeviceType = {
+  command: 20201,
+  name: "AFC_GATE_MACHINE_STATUS",
+  description: "AFC闸机操作指令",
+  nameStr: "gateMachineNo",
+  statusStr: "state"
+};
 // AFC自动售票机操作指令 | 售票机编号 | 状态 (0正常服务 1暂停服务 2故障)
-export const AFC_TICKETING_AUTO_STATUS: DeviceType = { command: 20202, name: "AFC_TICKETING_AUTO_STATUS", description: "AFC自动售票机操作指令", nameStr: "tvmNo", statusStr: "state" };
+export const AFC_TICKETING_AUTO_STATUS: DeviceType = {
+  command: 20202,
+  name: "AFC_TICKETING_AUTO_STATUS",
+  description: "AFC自动售票机操作指令",
+  nameStr: "tvmNo",
+  statusStr: "state"
+};
 // AFC半自动售票机操作指令
-export const AFC_TICKETING_SEMI_STATUS: DeviceType = { command: 20203, name: "AFC_TICKETING_SEMI_STATUS", description: "AFC半自动售票机操作指令", nameStr: "ticketNo", statusStr: "state" };
+export const AFC_TICKETING_SEMI_STATUS: DeviceType = {
+  command: 20203,
+  name: "AFC_TICKETING_SEMI_STATUS",
+  description: "AFC半自动售票机操作指令",
+  nameStr: "ticketNo",
+  statusStr: "state"
+};
 // AFC IBP盘操作指令 | 车站编号 | 紧急释放状态 (0释放 | 1按下)
-export const AFC_IBP: DeviceType = { command: 20204, name: "AFC_IBP", description: "AFC IBP盘操作指令", nameStr: "stationNo", statusStr: "emergency_release" };
+export const AFC_IBP: DeviceType = {
+  command: 20204,
+  name: "AFC_IBP",
+  description: "AFC IBP盘操作指令",
+  nameStr: "stationNo",
+  statusStr: "emergency_release"
+};
 
 // ------ 站台名设备
 // 单活动门锁闭状态状态 | 活动门编号 | 锁闭状态 (0关闭锁紧 | 1未关闭锁紧)
-export const PLATFORM_DOOR_LOCK: DeviceType = { command: 10301, name: "PLATFORM_DOOR_LOCK", description: "单活动门锁闭状态", nameStr: "platformDoorNo", statusStr: "state" };
+export const PLATFORM_DOOR_LOCK: DeviceType = {
+  command: 10301,
+  name: "PLATFORM_DOOR_LOCK",
+  description: "单活动门锁闭状态",
+  nameStr: "platformDoorNo",
+  statusStr: "state"
+};
 // 单活动门控制状态 | 活动门编号 | 控制状态 (0自动 1手动开 2手动关 3隔离)
-export const PLATFORM_DOOR_CONTROL: DeviceType = { command: 10302, name: "PLATFORM_DOOR_CONTROL", description: "单活动门控制状态", nameStr: "platformDoorNo", statusStr: "state" };
+export const PLATFORM_DOOR_CONTROL: DeviceType = {
+  command: 10302,
+  name: "PLATFORM_DOOR_CONTROL",
+  description: "单活动门控制状态",
+
+  nameStr: "platformDoorNo",
+  statusStr: "state"
+};
 // LCW操作指令 | 活动门编号 |  操作指令 (0自动 1手动开 2手动关 3隔离)
-export const PLATFORM_DOOR_LCW: DeviceType = { command: 20301, name: "PLATFORM_DOOR_LCW", description: "LCW操作指令", nameStr: "platformDoorNo", statusStr: "optCmd" };
+export const PLATFORM_DOOR_LCW: DeviceType = {
+  command: 20301,
+  name: "PLATFORM_DOOR_LCW",
+  description: "LCW操作指令",
+
+  nameStr: "platformDoorNo",
+  statusStr: "optCmd"
+};
 // PSL互锁解除操作指令 | PSL编号 | 操作指令 (0正常 | 1互锁解除)
-export const PSL_LOCK: DeviceType = { command: 20302, name: "PSL_LOCK", description: "PSL互锁解除操作指令", nameStr: "pslNo", statusStr: "optCmd" };
+export const PSL_LOCK: DeviceType = {
+  command: 20302,
+  name: "PSL_LOCK",
+  description: "PSL互锁解除操作指令",
+  nameStr: "pslNo",
+  statusStr: "optCmd"
+};
 // PSL允许操作指令 | PSL编号 | 操作指令 (0允许 | 1未允许)
-export const PSL_CONTROL: DeviceType = { command: 20303, name: "PSL_CONTROL", description: "PSL允许操作指令", nameStr: "pslNo", statusStr: "optCmd" };
+export const PSL_CONTROL: DeviceType = {
+  command: 20303,
+  name: "PSL_CONTROL",
+  description: "PSL允许操作指令",
+  nameStr: "pslNo",
+  statusStr: "optCmd"
+};
 // PSL开门操作指令 | PSL编号 | 操作指令 (0关门 | 1未关门)
-export const PSL_DOOR_OPEN: DeviceType = { command: 20304, name: "PSL_DOOR_OPEN", description: "PSL开门操作指令", nameStr: "pslNo", statusStr: "optCmd" };
+export const PSL_DOOR_OPEN: DeviceType = {
+  command: 20304,
+  name: "PSL_DOOR_OPEN",
+  description: "PSL开门操作指令",
+  nameStr: "pslNo",
+  statusStr: "optCmd"
+};
 // PSL关门操作指令 | PSL编号 | 操作指令	(0关门 | 1未关门)
-export const PSL_DOOR_CLOSE: DeviceType = { command: 20305, name: "PSL_DOOR_CLOSE", description: "PSL关门操作指令", nameStr: "pslNo", statusStr: "optCmd" };
+export const PSL_DOOR_CLOSE: DeviceType = {
+  command: 20305,
+  name: "PSL_DOOR_CLOSE",
+  description: "PSL关门操作指令",
+  nameStr: "pslNo",
+  statusStr: "optCmd"
+};
 // IBP允许操作指令 | 站台门编号 | 操作指令 (0允许 1未允许)
-export const IBP_CONTROL: DeviceType = { command: 20306, name: "IBP_CONTROL", description: "IBP允许操作指令", nameStr: "platformDoorNo", statusStr: "optCmd" };
+export const IBP_CONTROL: DeviceType = {
+  command: 20306,
+  name: "IBP_CONTROL",
+  description: "IBP允许操作指令",
+  nameStr: "platformDoorNo",
+  statusStr: "optCmd"
+};
 // IBP开门操作指令 | 站台门编号 | 操作指令 (0开门 1未开门)
-export const IBP_DOOR_OPEN: DeviceType = { command: 20307, name: "IBP_DOOR_OPEN", description: "IBP开门操作指令", nameStr: "platformDoorNo", statusStr: "optCmd" };
+export const IBP_DOOR_OPEN: DeviceType = {
+  command: 20307,
+  name: "IBP_DOOR_OPEN",
+  description: "IBP开门操作指令",
+  nameStr: "platformDoorNo",
+  statusStr: "optCmd"
+};
 // IBP关门操作指令 | 站台门编号 | 操作指令 (0关门 1未关门)
-export const IBP_DOOR_CLOSE: DeviceType = { command: 20308, name: "IBP_DOOR_CLOSE", description: "IBP关门操作指令", nameStr: "platformDoorNo", statusStr: "optCmd" };
+export const IBP_DOOR_CLOSE: DeviceType = {
+  command: 20308,
+  name: "IBP_DOOR_CLOSE",
+  description: "IBP关门操作指令",
+  nameStr: "platformDoorNo",
+  statusStr: "optCmd"
+};
 // 垂直电梯运行状态 | 垂直电梯编号 | 状态 (0运行 1停止 2禁用)
-export const ELEVATOR_VERTICAL: DeviceType = { command: 10401, name: "ELEVATOR_VERTICAL", description: "垂直电梯运行状态", nameStr: "verticalElevatorNo", statusStr: "state" };
+export const ELEVATOR_VERTICAL: DeviceType = {
+  command: 10401,
+  name: "ELEVATOR_VERTICAL",
+  description: "垂直电梯运行状态",
+  nameStr: "verticalElevatorNo",
+  statusStr: "state"
+};
 // 电扶梯运行状态 | 电扶梯编号 | state (0上行 1下行 2停止 3禁用)
-export const ELEVATOR_HAND: DeviceType = { command: 10402, name: "ELEVATOR_HAND", description: "电扶梯运行状态", nameStr: "elevatorNo", statusStr: "state" };
+export const ELEVATOR_HAND: DeviceType = {
+  command: 10402,
+  name: "ELEVATOR_HAND",
+  description: "电扶梯运行状态",
+  nameStr: "elevatorNo",
+  statusStr: "state"
+};
 // 垂直电梯操作指令 | 垂直电梯编号 | 状态 (0运行 1停止 2禁用)
-export const ELEVATOR_VERTICAL_COMMAND: DeviceType = { command: 20401, name: "ELEVATOR_VERTICAL_COMMAND", description: "垂直电梯操作指令", nameStr: "verticalElevatorNo", statusStr: "state" };
+export const ELEVATOR_VERTICAL_COMMAND: DeviceType = {
+  command: 20401,
+  name: "ELEVATOR_VERTICAL_COMMAND",
+  description: "垂直电梯操作指令",
+  nameStr: "verticalElevatorNo",
+  statusStr: "state"
+};
 // 电扶梯操作指令 | 电扶梯编号 | 状态 (0上行 1下行 2停止 3禁用)
-export const ELEVATOR_HAND_COMMAND: DeviceType = { command: 20402, name: "ELEVATOR_HAND_COMMAND", description: "电扶梯操作指令", nameStr: "elevatorNo", statusStr: "state" };
+export const ELEVATOR_HAND_COMMAND: DeviceType = {
+  command: 20402,
+  name: "ELEVATOR_HAND_COMMAND",
+  description: "电扶梯操作指令",
+  nameStr: "elevatorNo",
+  statusStr: "state"
+};
 
 const deviceTypeArray: DeviceType[] = [
   TRAIN_OPEN_DOOR,