Merge branch 'master' of git.code.tencent.com:beijing-rtss-test/bj-rtss-client

This commit is contained in:
Yuan 2023-09-13 15:33:47 +08:00
commit 40ae549484
3 changed files with 30 additions and 0 deletions

View File

@ -77,6 +77,11 @@ const list: KeyType[] = [
{ label: '车头所在设备的偏移量', key: 'headOffset', formatFn: offsetFormat },
{ label: '是否上行', key: 'runDirection', formatFn: upFormat },
{ label: '车头方向是否上行', key: 'headDirection', formatFn: upFormat },
{
label: '所在公里标',
key: 'trainKilometer',
formatFn: trainKilometerFormat,
},
];
const list2: DynamicKeyType[] = [
//
@ -212,6 +217,23 @@ function trainLoadFormat(v: number) {
return `${n} ton`;
}
function trainKilometerFormat(v: number) {
const f = floatDecimal(v, 0);
const r = f.split('').reverse();
const x = r.slice(0, 3).reverse();
const m = r.slice(3, 6).reverse();
const k = r.slice(6).reverse();
let n = '';
if (k.length) {
n = `k${k.join('')}+${m.join('')}.${x.join('')}`;
} else if (m.length) {
n = `${m.join('')}.${x.join('')}`;
} else if (x.length) {
n = `0.${x.join('')}`;
}
return n;
}
function getDeviveName() {
const headDeviceId = trainInfo.value?.headDeviceId;
const devicePort = trainInfo.value?.devicePort;

View File

@ -110,6 +110,12 @@ export class TrainState extends GraphicStateBase implements ITrainState {
set vobcState(v: state.TrainVobcState) {
this.states.vobcState = new state.TrainVobcState(v);
}
get trainKilometer(): number {
return this.states.trainKilometer;
}
set trainKilometer(v: number) {
this.states.trainKilometer = v;
}
clone(): TrainState {
return new TrainState(this.states.cloneMessage());
}

View File

@ -49,6 +49,8 @@ export interface ITrainState extends GraphicState {
set dynamicState(v: state.TrainDynamicState);
get vobcState(): state.TrainVobcState;
set vobcState(v: state.TrainVobcState);
get trainKilometer(): number;
set trainKilometer(v: number);
}
interface bodyWH {