列车信息调整

This commit is contained in:
dong 2023-07-21 10:57:07 +08:00
parent 1dac72be9d
commit ebe06adac5

View File

@ -7,204 +7,18 @@
</q-card-section> </q-card-section>
<q-separator inset /> <q-separator inset />
<q-list v-if="trainInfo" dense> <q-list v-if="trainInfo" dense>
<q-item> <q-item v-for="(item, index) in list" :key="index">
<q-item-section> <q-item-section>
<q-item-label>列车索引</q-item-label> <q-item-label>{{ item.label }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ trainInfo.id }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>是否上行</q-item-label>
</q-item-section> </q-item-section>
<q-item-section side> <q-item-section side>
<q-item-label caption>{{ <q-item-label caption>{{
trainInfo.up ? '是' : '否' item.formatFn
? item.formatFn(trainInfo[item.key])
: trainInfo[item.key]
}}</q-item-label> }}</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item>
<q-item-section>
<q-item-label>车头所在link的索引</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ trainInfo.headLinkId }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>车头所在link内的偏移量</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
trainInfo.headLinkOffset
}}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>车尾所在link的索引</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ trainInfo.tailLinkId }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>车尾所在link内的偏移量</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
trainInfo.tailLinkOffset
}}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>生命信号</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ trainInfo.heartbeat }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>列车所在位置坡度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ trainInfo.slope }}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>列车所在位置坡度走势</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
trainInfo.upslope ? '上坡' : '下坡'
}}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>列车当前运行方向</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{
trainInfo.runningUp ? '上行' : '下行'
}}</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>实际运行阻力</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.runningResistanceSum }}KN</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>空气阻力</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.airResistance }}KN</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>坡道阻力</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.rampResistance }}KN</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>曲线阻力</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.curveResistance }}KN</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>列车运行速度</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption>{{ trainInfo.speed }}km/h</q-item-label>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>头车速传1速度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.headSensorSpeed1 }}km/h</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>头车速传2速度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.headSensorSpeed2 }}km/h</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>尾车速传1速度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.tailSensorSpeed1 }}km/h</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>尾车速传2速度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.tailSensorSpeed2 }}km/h</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>头车雷达速度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.headRadarSpeed }}km/h</q-item-label
>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-item-label>尾车雷达速度值</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label caption
>{{ trainInfo.tailRadarSpeed }}km/h</q-item-label
>
</q-item-section>
</q-item>
</q-list> </q-list>
</q-card> </q-card>
</div> </div>
@ -215,9 +29,55 @@
import { ITrainState, Train } from 'src/graphics/train/Train'; import { ITrainState, Train } from 'src/graphics/train/Train';
import { useLineStore } from 'src/stores/line-store'; import { useLineStore } from 'src/stores/line-store';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
interface keyType {
label: string;
key: keyof ITrainState;
formatFn?(v: ITrainState[keyof ITrainState]): string;
}
const lineStore = useLineStore(); const lineStore = useLineStore();
const trainInfo = ref<ITrainState | null>(); const trainInfo = ref<ITrainState | null>();
const list: keyType[] = [
{ label: '列车索引', key: 'id' },
{ label: '是否上行', key: 'up', formatFn: upFormat },
{ label: '车头所在link的索引', key: 'headLinkId' },
{ label: '车头所在link内的偏移量', key: 'headLinkOffset' },
{ label: '车尾所在link的索引', key: 'tailLinkId' },
{ label: '车尾所在link内的偏移量', key: 'tailLinkOffset' },
{ label: '生命信号', key: 'heartbeat' },
{ label: '列车所在位置坡度值', key: 'slope' },
{ label: '列车所在位置坡度走势', key: 'upslope', formatFn: upslopeFormat },
{ label: '列车当前运行方向', key: 'runningUp', formatFn: runningUpFormat },
{
label: '实际运行阻力',
key: 'runningResistanceSum',
formatFn: resistanceFormat,
},
{ label: '空气阻力', key: 'airResistance', formatFn: resistanceFormat },
{ label: '坡道阻力', key: 'rampResistance', formatFn: resistanceFormat },
{ label: '曲线阻力', key: 'curveResistance', formatFn: resistanceFormat },
{ label: '列车运行速度', key: 'speed', formatFn: speedFormat },
{ label: '头车速传1速度值', key: 'headSensorSpeed1', formatFn: speedFormat },
{ label: '头车速传2速度值', key: 'headSensorSpeed2', formatFn: speedFormat },
{ label: '尾车速传1速度值', key: 'tailSensorSpeed1', formatFn: speedFormat },
{ label: '尾车速传2速度值', key: 'tailSensorSpeed2', formatFn: speedFormat },
{ label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat },
{ label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat },
];
function upFormat(v: boolean) {
return v ? '是' : '否';
}
function upslopeFormat(v: boolean) {
return v ? '上坡' : '下坡';
}
function runningUpFormat(v: boolean) {
return v ? '上行' : '下行';
}
function resistanceFormat(v: number) {
return `${v}KN`;
}
function speedFormat(v: number) {
return `${v}km/h`;
}
watch( watch(
() => lineStore.selectedGraphics, () => lineStore.selectedGraphics,
(val) => { (val) => {