Squashed commit of the following:
All checks were successful
CI / Docker-Build (push) Successful in 1m49s

commit 2e3fc1a1f2
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Tue May 7 15:12:28 2024 +0800

    切换列车驾驶台重新加载(订阅路径变)

commit a337216236
Author: joylink_zhaoerwei <Bob_Engineer@163.com>
Date:   Tue May 7 13:09:16 2024 +0800

    列车驾驶台加对应列车索引+生成继电器时加是否覆盖之前的采集驱动数据
This commit is contained in:
joylink_zhaoerwei 2024-05-07 15:16:37 +08:00
parent b368560398
commit 05dd848aba

View File

@ -7,6 +7,7 @@ import { errorNotify } from 'src/utils/CommonNotify';
import { request } from 'src/protos/request';
import { TccHandle } from 'src/graphics/tccHandle/TccHandle';
import { TccKey } from 'src/graphics/tccKey/TccKey';
import { IGraphicApp } from 'jl-graphic';
export const useTccStore = defineStore('tcc', {
state: () => ({
@ -23,12 +24,8 @@ export const useTccStore = defineStore('tcc', {
getTccScene() {
const lineApp = getLineApp();
if (!lineApp) throw Error('未初始化app');
try {
return lineApp.getScene('tcc');
} catch (error) {
const tccScene = initTccScene(lineApp, 'tcc');
return tccScene;
}
lineApp.removeScene('tcc');
return initTccScene(lineApp, 'tcc');
},
setTccParam(tccId: number, trainControlMapId: number) {
this.tccId = tccId;
@ -42,9 +39,9 @@ export const useTccStore = defineStore('tcc', {
},
onMouseUpFromTccHandle() {
const simulationId = useLineStore().simulationId;
const tccHandle = this.getTccScene().queryStore.queryById<TccHandle>(
this.tccHandleId
);
const tccHandle = (getLineApp() as IGraphicApp)
.getScene('tcc')
.queryStore.queryById<TccHandle>(this.tccHandleId);
if (!simulationId) return;
const handleVal = Number(
(-(tccHandle._tccHandle.y / 144) * 100).toFixed()
@ -62,9 +59,9 @@ export const useTccStore = defineStore('tcc', {
});
},
onMouseUpFromTccKeyDir() {
const tccKeyDir = this.getTccScene().queryStore.queryById<TccKey>(
this.tccKeyDirId
);
const tccKeyDir = (getLineApp() as IGraphicApp)
.getScene('tcc')
.queryStore.queryById<TccKey>(this.tccKeyDirId);
let position = 0;
switch (tccKeyDir._tccKey.rotation) {
case Math.PI / 4: