2020-02-11 16:16:04 +08:00
|
|
|
|
import { deepAssign } from '@/utils/index';
|
2020-03-07 19:12:19 +08:00
|
|
|
|
// import deviceType from './deviceType';
|
2020-02-11 14:50:56 +08:00
|
|
|
|
|
2020-02-11 16:16:04 +08:00
|
|
|
|
// 所有默认状态在这里都要有 用来转换后台发送的数据状态
|
|
|
|
|
class Status {
|
|
|
|
|
// el是宿主元素
|
|
|
|
|
// vm是KVue实例
|
|
|
|
|
constructor(device) {
|
|
|
|
|
// 保存kVue实例
|
|
|
|
|
this.statusObj = {};
|
2020-04-03 13:30:04 +08:00
|
|
|
|
if (device && device._type && this['handle' + device._type]) {
|
2020-02-11 16:16:04 +08:00
|
|
|
|
// 执行编译
|
|
|
|
|
this['handle' + device._type](device);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
handleStationStand(device) {
|
|
|
|
|
this.statusObj = {
|
|
|
|
|
free: device.free, // 站台空闲
|
|
|
|
|
trainParking: device.trainParking, // 列车停站
|
|
|
|
|
emergencyClosed: device.emergencyClosed, // 站台紧急关闭
|
|
|
|
|
stationHoldTrain: device.stationHoldTrain, // 站台是否扣车
|
|
|
|
|
centerHoldTrain: device.centerHoldTrain, // 中心是否扣车 true 扣车 false 非扣车状态
|
|
|
|
|
allSkip: device.allSkip, // 是否全部跳停
|
|
|
|
|
assignSkip: device.assignSkip, // 是否指定跳停
|
|
|
|
|
runLevelTime: device.runLevelTime, // 区间运行时间 自动为 0
|
|
|
|
|
parkingTime: device.parkingTime, // 站台停车时间 自动为0
|
2020-11-20 14:21:57 +08:00
|
|
|
|
fault: device.fault, /** 非故障*/
|
|
|
|
|
num:device.num
|
2020-02-11 16:16:04 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handleSection(device) {
|
|
|
|
|
this.statusObj = {
|
2020-02-28 15:20:26 +08:00
|
|
|
|
blockade: device.blockade, // 轨道是否封锁
|
2020-02-11 16:16:04 +08:00
|
|
|
|
routeLock: device.routeLock, // 是否进路锁闭
|
|
|
|
|
overlapLock: device.overlapLock, // 进路延续保护锁闭
|
|
|
|
|
ctOccupied: device.ctOccupied, // 通信车占用
|
|
|
|
|
nctOccupied: device.nctOccupied, // 非通信车占用
|
|
|
|
|
fault: device.fault /** 非故障*/
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handleSwitch(device) {
|
|
|
|
|
this.statusObj = {
|
|
|
|
|
singleLock: device.singleLock, // 是否单锁
|
|
|
|
|
blockade: device.blockade, // 是否封锁
|
|
|
|
|
routeLock: device.routeLock, // 是否进路锁闭
|
|
|
|
|
overlapLock: device.overlapLock, // 是否进路延续保护锁闭
|
|
|
|
|
normalPosition: device.normalPosition, // 是否定位
|
|
|
|
|
reversePosition: device.reversePosition, // 是否反位
|
|
|
|
|
fault: device.fault /** 非故障*/
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handleSignal(device) {
|
|
|
|
|
this.statusObj = {
|
2020-02-14 18:07:54 +08:00
|
|
|
|
fault: device.fault, /** 非故障*/
|
|
|
|
|
atsControl: device.atsControl, /** 0是人工控制,1是自动控制 */
|
|
|
|
|
blockade: device.blockade,
|
|
|
|
|
logicLight: device.logicLight,
|
|
|
|
|
greenOpen: device.greenOpen,
|
|
|
|
|
redOpen: device.redOpen,
|
2020-06-18 17:29:46 +08:00
|
|
|
|
yellowOpen: device.yellowOpen,
|
2020-06-19 15:19:28 +08:00
|
|
|
|
ciControl: device.ciControl || 0,
|
|
|
|
|
canSetCi: !!device.canSetCi
|
2020-02-11 16:16:04 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handlePsd(device) {
|
|
|
|
|
this.statusObj = {
|
2020-02-19 14:06:43 +08:00
|
|
|
|
screenDoorOpenStatus: device.close, // 屏蔽门是否开门
|
|
|
|
|
lock: device.lock, // 屏蔽门是否锁闭
|
|
|
|
|
interlockRelease: device.interlockRelease, // 是否互锁解除
|
2020-04-13 13:08:17 +08:00
|
|
|
|
fault: device.fault, /** 非故障*/
|
|
|
|
|
alarmStatus:device.alarmStatus, // 收到警报(西安二号线样式 暂时后端没加该字段)
|
|
|
|
|
emergencyDepart:device.emergencyDepart // 紧急出发按钮激活(西安二号线样式 暂时后端没加该字段)
|
2020-02-11 16:16:04 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handleStationDelayUnlock(device) {
|
|
|
|
|
this.statusObj = {
|
|
|
|
|
fault: device.fault /** 非故障*/
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handleTrain(device) {
|
|
|
|
|
this.statusObj = {
|
2020-02-19 11:47:38 +08:00
|
|
|
|
groupNumber: device.groupNumber, /** 车组号 */
|
|
|
|
|
serviceNumber: device.serviceNumber, /** 服务号 */
|
|
|
|
|
tripNumber: device.tripNumber, /** 车次号 */
|
|
|
|
|
destinationCode: device.destinationCode, /** 目的地码 */
|
|
|
|
|
sectionCode: device.sectionCode, /** 列车所在区段 */
|
|
|
|
|
speed: device.speed, /** 列车速度 */
|
|
|
|
|
right: device.right, /** 列车方向 */
|
|
|
|
|
doorCloseLock: device.doorCloseLock, /** 车门是否关闭且锁闭 */
|
|
|
|
|
stop: device.stop, /** 列车是否停稳 */
|
2020-03-13 11:25:43 +08:00
|
|
|
|
type: device.type, /** 列车类型 PLAN计划车 HEAD 头码车 MANUAL 人工车*/
|
2020-02-19 11:47:38 +08:00
|
|
|
|
runLevel: device.runLevel, /** 列车运行级别 */
|
|
|
|
|
driveMode: device.driveMode, /** 驾驶模式 */
|
2020-03-13 11:25:43 +08:00
|
|
|
|
fault: device.fault, /** 非故障*/
|
|
|
|
|
jump: device.jump, /** 是否跳停 */
|
|
|
|
|
hold: device.hold, /** 是否扣车 */
|
|
|
|
|
offsetp:device.offsetp, /** 列车精确位置 (成都一号线使用)*/
|
2020-11-20 14:21:57 +08:00
|
|
|
|
physicalCode:device.physicalCode, /** 列车所在物理区段 */
|
|
|
|
|
num:device.num /** 列车上的人数*/
|
2020-02-11 16:16:04 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
handleStation(device) {
|
|
|
|
|
this.statusObj = {
|
|
|
|
|
controlMode: device.controlMode,
|
|
|
|
|
fault: device.fault /** 非故障*/
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-08-17 16:48:19 +08:00
|
|
|
|
handleOverAp(device) {
|
|
|
|
|
this.statusObj = {
|
|
|
|
|
remainTime: device.remainTime
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-17 15:44:15 +08:00
|
|
|
|
handleZcControl(device) {
|
2020-03-04 18:03:50 +08:00
|
|
|
|
this.statusObj = { };
|
2020-02-17 15:44:15 +08:00
|
|
|
|
}
|
2020-03-05 12:21:28 +08:00
|
|
|
|
handleLcControl(device) {
|
|
|
|
|
this.statusObj = { };
|
|
|
|
|
}
|
2020-03-04 18:03:50 +08:00
|
|
|
|
handleLimitControl(device) {
|
|
|
|
|
this.statusObj = { };
|
2020-03-02 16:16:17 +08:00
|
|
|
|
}
|
2020-06-04 17:29:18 +08:00
|
|
|
|
handleStationTurnBack(device) {
|
|
|
|
|
this.statusObj = { };
|
|
|
|
|
}
|
2020-08-20 13:17:58 +08:00
|
|
|
|
handleFloodGate(device) {
|
|
|
|
|
this.statusObj = { };
|
|
|
|
|
}
|
2020-10-10 17:58:14 +08:00
|
|
|
|
handleDirectionRod(device) {
|
2020-10-12 17:55:57 +08:00
|
|
|
|
this.statusObj = {
|
2020-10-13 09:36:48 +08:00
|
|
|
|
reversed: device.reversed
|
2020-10-12 17:55:57 +08:00
|
|
|
|
};
|
2020-10-10 17:58:14 +08:00
|
|
|
|
}
|
2020-02-11 16:16:04 +08:00
|
|
|
|
getStatus() {
|
|
|
|
|
return this.statusObj;
|
|
|
|
|
}
|
2020-02-11 14:50:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-11 16:16:04 +08:00
|
|
|
|
export default function transitionDeviceStatus(device) {
|
|
|
|
|
const statusDevice = new Status(device);
|
|
|
|
|
const status = statusDevice.getStatus();
|
|
|
|
|
return deepAssign(device, status);
|
|
|
|
|
}
|