This commit is contained in:
fan 2023-12-08 17:30:07 +08:00
commit ed7f879970
3 changed files with 27 additions and 7 deletions

View File

@ -244,7 +244,13 @@ function controlDelayTimeFormat(v: number) {
return `${v} ms`;
}
function trainKilometerFormat(v: number) {
function trainKilometerFormat(val: number) {
let z = '';
let v = val;
if (v < 0) {
z = '-';
v = 0 - val;
}
const f = floatDecimal(v, 0);
const r = f.split('').reverse();
const x = r.slice(0, 3).reverse();
@ -252,11 +258,11 @@ function trainKilometerFormat(v: number) {
const k = r.slice(6).reverse();
let n = '';
if (k.length) {
n = `k${k.join('')}+${m.join('')}.${x.join('')}`;
n = `k ${z}${k.join('')},${m.join('')}.${x.join('')}`;
} else if (m.length) {
n = `${m.join('')}.${x.join('')}`;
n = `${z}${m.join('')}.${x.join('')}`;
} else if (x.length) {
n = `0.${x.join('')}`;
n = `${z}0.${x.join('')}`;
}
return n;
}

View File

@ -18,7 +18,10 @@ import {
RelayOperationPlugin,
RelayState,
} from './relayCabinetGraphics/RelayInteraction';
import { PhaseFailureProtectorTemplate } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
import {
PhaseFailureProtector,
PhaseFailureProtectorTemplate,
} from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
import { PhaseFailureProtectorData } from './relayCabinetGraphics/PhaseFailureProtectorInteraction';
import { state } from 'src/protos/device_state';
import { Notify, QNotifyUpdateOptions } from 'quasar';
@ -57,6 +60,15 @@ export function initRelayScene(lineApp: IGraphicApp, sceneName: string) {
relays.forEach((relay) => {
relay.refDevice.text = map.get(relay.id)?.replace(/_/g, '\n') as string;
});
const phaseFailureProtectors =
relayScene.queryStore.queryByType<PhaseFailureProtector>(
PhaseFailureProtector.Type
);
phaseFailureProtectors.forEach((phaseFailureProtector) => {
phaseFailureProtector.refDevice.text = map
.get(phaseFailureProtector.id)
?.replace(/_/g, '\n') as string;
});
});
lineApp.on('destroy', () => {
refRelaysList = [];

View File

@ -119,7 +119,9 @@ export function generateRelayLayout(relays: GenerateRelaysCongig[]) {
}
}
const canvasWidth =
relayCabinet[relayCabinet.length - 1].position.x + relayCabinetConsts.width;
relayCabinet[relayCabinet.length - 1].position.x +
relayCabinetConsts.width +
1000;
relayCabinetStore.getJlCanvas().properties.width =
canvasWidth > 1920 ? canvasWidth : 1920;
canvasWidth > 2920 ? canvasWidth : 2920;
}