Merge remote-tracking branch 'origin/develop' into local-test
# Conflicts: # src/protos/stationLayoutGraphics.ts
This commit is contained in:
commit
c26f35e008
@ -1 +1 @@
|
|||||||
Subproject commit 5dd8f8963e28e79012656f95999016ad503ae43a
|
Subproject commit 208bcaedccf71e7bfd2535e2889ca4cf7c4bdbb6
|
@ -17,10 +17,19 @@
|
|||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
class="q-mt-sm"
|
class="q-mt-sm"
|
||||||
|
mask="#"
|
||||||
v-model.number="carWashingModel.duanNum"
|
v-model.number="carWashingModel.duanNum"
|
||||||
@blur="onUpdate"
|
@blur="onUpdate"
|
||||||
label="段数"
|
label="段数"
|
||||||
/>
|
/>
|
||||||
|
<q-input
|
||||||
|
outlined
|
||||||
|
class="q-mt-sm"
|
||||||
|
:decimals="0"
|
||||||
|
v-model.number="carWashingModel.width"
|
||||||
|
@blur="onUpdate"
|
||||||
|
label="宽度"
|
||||||
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
style="margin-top: 10px"
|
style="margin-top: 10px"
|
||||||
|
@ -99,7 +99,6 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getNameFormat() {
|
function getNameFormat() {
|
||||||
console.log(code.value, '1111111');
|
|
||||||
return code.value;
|
return code.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ const list: KeyType[] = [
|
|||||||
{ label: '防淹门索引', key: 'id' },
|
{ label: '防淹门索引', key: 'id' },
|
||||||
{ label: '防淹门名称', key: 'code', formatFn: getNameFormat },
|
{ label: '防淹门名称', key: 'code', formatFn: getNameFormat },
|
||||||
{ label: '防淹门关闭', key: 'mgj', formatFn: getName },
|
{ label: '防淹门关闭', key: 'mgj', formatFn: getName },
|
||||||
|
{ label: '控制端', key: 'local', formatFn: getLocal },
|
||||||
{ label: '防淹门强制', key: 'param', formatFn: getForceName },
|
{ label: '防淹门强制', key: 'param', formatFn: getForceName },
|
||||||
{ label: '设置故障', key: 'param', formatFn: getFaultName },
|
{ label: '设置故障', key: 'param', formatFn: getFaultName },
|
||||||
];
|
];
|
||||||
@ -117,6 +118,9 @@ function getName(v: boolean) {
|
|||||||
if (v) return '是';
|
if (v) return '是';
|
||||||
return '否';
|
return '否';
|
||||||
}
|
}
|
||||||
|
function getLocal(v: boolean) {
|
||||||
|
return v ? '本地' : '远程';
|
||||||
|
}
|
||||||
|
|
||||||
function getForceName() {
|
function getForceName() {
|
||||||
return (
|
return (
|
||||||
|
@ -83,6 +83,7 @@ const list: KeyType[] = [
|
|||||||
{ label: '车库门索引', key: 'id' },
|
{ label: '车库门索引', key: 'id' },
|
||||||
{ label: '车库门名称', key: 'code', formatFn: getNameFormat },
|
{ label: '车库门名称', key: 'code', formatFn: getNameFormat },
|
||||||
{ label: '车库门关闭', key: 'mgj', formatFn: getName },
|
{ label: '车库门关闭', key: 'mgj', formatFn: getName },
|
||||||
|
{ label: '控制端', key: 'local', formatFn: getLocal },
|
||||||
// { label: '状态丢失', key: 'stateLoss', formatFn: getName },
|
// { label: '状态丢失', key: 'stateLoss', formatFn: getName },
|
||||||
{ label: '车库门强制', key: 'param', formatFn: getForceName },
|
{ label: '车库门强制', key: 'param', formatFn: getForceName },
|
||||||
{ label: '设置故障', key: 'param', formatFn: getFaultName },
|
{ label: '设置故障', key: 'param', formatFn: getFaultName },
|
||||||
@ -118,6 +119,9 @@ function getName(v: boolean) {
|
|||||||
if (v) return '是';
|
if (v) return '是';
|
||||||
return '否';
|
return '否';
|
||||||
}
|
}
|
||||||
|
function getLocal(v: boolean) {
|
||||||
|
return v ? '本地' : '远程';
|
||||||
|
}
|
||||||
|
|
||||||
function getForceName() {
|
function getForceName() {
|
||||||
return (
|
return (
|
||||||
|
@ -9,7 +9,7 @@ function getHost(): string {
|
|||||||
// return '192.168.3.7:9091';
|
// return '192.168.3.7:9091';
|
||||||
// return '192.168.3.47:9091';
|
// return '192.168.3.47:9091';
|
||||||
// return '192.168.3.37:9091';
|
// return '192.168.3.37:9091';
|
||||||
//return '192.168.33.207:9091'; // 张骞
|
return '192.168.33.207:9091'; // 张骞
|
||||||
// return '192.168.33.93:9091';
|
// return '192.168.33.93:9091';
|
||||||
// return '192.168.3.37:9091'; //卫志宏
|
// return '192.168.3.37:9091'; //卫志宏
|
||||||
// return 'test.joylink.club/bjrtsts-service'; // 测试
|
// return 'test.joylink.club/bjrtsts-service'; // 测试
|
||||||
|
@ -61,6 +61,12 @@ export class CarWashingData extends GraphicDataBase implements ICarWashingData {
|
|||||||
set duanNum(v: number) {
|
set duanNum(v: number) {
|
||||||
this.data.duanNum = v;
|
this.data.duanNum = v;
|
||||||
}
|
}
|
||||||
|
get width(): number {
|
||||||
|
return this.data.width;
|
||||||
|
}
|
||||||
|
set width(v: number) {
|
||||||
|
this.data.width = v;
|
||||||
|
}
|
||||||
clone(): CarWashingData {
|
clone(): CarWashingData {
|
||||||
return new CarWashingData(this.data.cloneMessage());
|
return new CarWashingData(this.data.cloneMessage());
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,12 @@ export class FloodGateState
|
|||||||
set param(param: request.CkmParam) {
|
set param(param: request.CkmParam) {
|
||||||
this.states.param = param;
|
this.states.param = param;
|
||||||
}
|
}
|
||||||
|
get local(): boolean {
|
||||||
|
return this.states.local;
|
||||||
|
}
|
||||||
|
set local(v: boolean) {
|
||||||
|
this.states.local = v;
|
||||||
|
}
|
||||||
get states(): state.CkmState {
|
get states(): state.CkmState {
|
||||||
return this.getState<state.CkmState>();
|
return this.getState<state.CkmState>();
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,12 @@ export class GarageDoorState
|
|||||||
set param(param: request.CkmParam) {
|
set param(param: request.CkmParam) {
|
||||||
this.states.param = param;
|
this.states.param = param;
|
||||||
}
|
}
|
||||||
|
get local(): boolean {
|
||||||
|
return this.states.local;
|
||||||
|
}
|
||||||
|
set local(v: boolean) {
|
||||||
|
this.states.local = v;
|
||||||
|
}
|
||||||
get states(): state.CkmState {
|
get states(): state.CkmState {
|
||||||
return this.getState<state.CkmState>();
|
return this.getState<state.CkmState>();
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,6 @@ import { state } from 'src/protos/device_state';
|
|||||||
import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } from 'jl-graphic';
|
import { GraphicInteractionPlugin, IGraphicScene, JlGraphic } from 'jl-graphic';
|
||||||
import { type FederatedMouseEvent, DisplayObject } from 'pixi.js';
|
import { type FederatedMouseEvent, DisplayObject } from 'pixi.js';
|
||||||
import { useTccStore } from 'src/stores/tcc-store';
|
import { useTccStore } from 'src/stores/tcc-store';
|
||||||
import { useLineStore } from 'src/stores/line-store';
|
|
||||||
import { tccOperation } from 'src/api/Simulation';
|
|
||||||
import { errorNotify } from 'src/utils/CommonNotify';
|
|
||||||
import { request } from 'src/protos/request';
|
|
||||||
|
|
||||||
export class TccHandleData extends GraphicDataBase implements ITccHandleData {
|
export class TccHandleData extends GraphicDataBase implements ITccHandleData {
|
||||||
constructor(data?: tccGraphicData.TccHandle) {
|
constructor(data?: tccGraphicData.TccHandle) {
|
||||||
@ -103,15 +99,15 @@ export class TccHandleInteraction extends GraphicInteractionPlugin<TccHandle> {
|
|||||||
g._tccHandle.eventMode = 'static';
|
g._tccHandle.eventMode = 'static';
|
||||||
g._tccHandle.cursor = 'Move';
|
g._tccHandle.cursor = 'Move';
|
||||||
g._tccHandle.onmousedown = (e) => {
|
g._tccHandle.onmousedown = (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
this.onMouseDown(e);
|
this.onMouseDown(e);
|
||||||
};
|
};
|
||||||
g._tccHandle.onmouseup = (e) => {
|
g._tccHandle.onmouseup = (e) => {
|
||||||
this.onMouseUp(e);
|
e.stopPropagation();
|
||||||
|
this.onMouseUp();
|
||||||
};
|
};
|
||||||
g.onmousemove = (e) => {
|
g.onmousemove = (e) => {
|
||||||
this.onMouseMove(e);
|
e.stopPropagation();
|
||||||
};
|
|
||||||
g.onmouseleave = (e) => {
|
|
||||||
this.onMouseMove(e);
|
this.onMouseMove(e);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -120,12 +116,13 @@ export class TccHandleInteraction extends GraphicInteractionPlugin<TccHandle> {
|
|||||||
g._tccHandle.onmousedown = null;
|
g._tccHandle.onmousedown = null;
|
||||||
g._tccHandle.onmouseup = null;
|
g._tccHandle.onmouseup = null;
|
||||||
g.onmousemove = null;
|
g.onmousemove = null;
|
||||||
g.onmouseleave = null;
|
|
||||||
}
|
}
|
||||||
onMouseDown(e: FederatedMouseEvent) {
|
onMouseDown(e: FederatedMouseEvent) {
|
||||||
const target = e.target as DisplayObject;
|
const target = e.target as DisplayObject;
|
||||||
const tccHandle = target.getGraphic<TccHandle>();
|
const tccHandle = target.getGraphic<TccHandle>();
|
||||||
if (!tccHandle) return;
|
if (!tccHandle) return;
|
||||||
|
useTccStore().tccHandleId = tccHandle.id;
|
||||||
|
useTccStore().mouseDownOnTccHandle = true;
|
||||||
this.isMouseDown = true;
|
this.isMouseDown = true;
|
||||||
this.mouseDownBeginPos = e.clientY;
|
this.mouseDownBeginPos = e.clientY;
|
||||||
this.mouseDownTccHandleBeginPos = tccHandle._tccHandle.y;
|
this.mouseDownTccHandleBeginPos = tccHandle._tccHandle.y;
|
||||||
@ -149,25 +146,8 @@ export class TccHandleInteraction extends GraphicInteractionPlugin<TccHandle> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMouseUp(e: FederatedMouseEvent) {
|
onMouseUp() {
|
||||||
this.isMouseDown = false;
|
this.isMouseDown = false;
|
||||||
const simulationId = useLineStore().simulationId;
|
useTccStore().mouseDownOnTccHandle = false;
|
||||||
const mapId = useLineStore().mapId;
|
|
||||||
const tccId = useTccStore().tccId;
|
|
||||||
const target = e.target as DisplayObject;
|
|
||||||
const tccHandle = target.getGraphic<TccHandle>();
|
|
||||||
if (!tccHandle || !simulationId || !mapId) return;
|
|
||||||
const handleVal = Math.floor(-(tccHandle._tccHandle.y / 144) * 100);
|
|
||||||
tccOperation({
|
|
||||||
simulationId,
|
|
||||||
trainId: tccId + '',
|
|
||||||
deviceId: tccHandle.id,
|
|
||||||
controlType: request.TrainControl.TrainControlType.HANDLER,
|
|
||||||
handler: {
|
|
||||||
val: handleVal,
|
|
||||||
},
|
|
||||||
}).catch((err) => {
|
|
||||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ export enum KeyRotationMethod {
|
|||||||
export interface IKeyInteractionConfig {
|
export interface IKeyInteractionConfig {
|
||||||
gearPositionAmount?: number;
|
gearPositionAmount?: number;
|
||||||
keyRotationMethod: KeyRotationMethod;
|
keyRotationMethod: KeyRotationMethod;
|
||||||
doAfterChangeRotation: (g: JlGraphic, rotation: number) => void;
|
doAfterChangeRotation: () => void;
|
||||||
}
|
}
|
||||||
export abstract class KeyInteraction<
|
export abstract class KeyInteraction<
|
||||||
G extends JlGraphic
|
G extends JlGraphic
|
||||||
@ -105,6 +105,7 @@ export abstract class KeyInteraction<
|
|||||||
ratatingSprite: Sprite = new Sprite();
|
ratatingSprite: Sprite = new Sprite();
|
||||||
mouseDownBeginPos = new Point();
|
mouseDownBeginPos = new Point();
|
||||||
mouseDownBeginRotation = 0;
|
mouseDownBeginRotation = 0;
|
||||||
|
changeRotation = 0;
|
||||||
keyInteractionConfig: IKeyInteractionConfig;
|
keyInteractionConfig: IKeyInteractionConfig;
|
||||||
lastTimenRotation = 0;
|
lastTimenRotation = 0;
|
||||||
constructor(
|
constructor(
|
||||||
@ -122,11 +123,17 @@ export abstract class KeyInteraction<
|
|||||||
g.onmouseup = (e) => {
|
g.onmouseup = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.isMouseDown = false;
|
this.isMouseDown = false;
|
||||||
|
this.keyInteractionConfig.doAfterChangeRotation();
|
||||||
|
};
|
||||||
|
g.onmousedown = () => {
|
||||||
|
useTccStore().tccKeyDirId = g.id;
|
||||||
|
useTccStore().mouseDownOnTccKeyDir = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
totalUnbind(g: G): void {
|
totalUnbind(g: G): void {
|
||||||
g.onmousemove = null;
|
g.onmousemove = null;
|
||||||
g.onmouseup = null;
|
g.onmouseup = null;
|
||||||
|
g.onmousedown = null;
|
||||||
}
|
}
|
||||||
keyBind(g: Sprite): void {
|
keyBind(g: Sprite): void {
|
||||||
this.ratatingSprite = g;
|
this.ratatingSprite = g;
|
||||||
@ -147,6 +154,7 @@ export abstract class KeyInteraction<
|
|||||||
this.isMouseDown = true;
|
this.isMouseDown = true;
|
||||||
this.mouseDownBeginPos = this.app.toCanvasCoordinates(e.global);
|
this.mouseDownBeginPos = this.app.toCanvasCoordinates(e.global);
|
||||||
this.mouseDownBeginRotation = this.ratatingSprite.rotation;
|
this.mouseDownBeginRotation = this.ratatingSprite.rotation;
|
||||||
|
this.changeRotation = this.mouseDownBeginRotation;
|
||||||
this.lastTimenRotation = this.ratatingSprite.rotation;
|
this.lastTimenRotation = this.ratatingSprite.rotation;
|
||||||
}
|
}
|
||||||
onMousemove(e: FederatedMouseEvent) {
|
onMousemove(e: FederatedMouseEvent) {
|
||||||
@ -160,45 +168,46 @@ export abstract class KeyInteraction<
|
|||||||
g.position,
|
g.position,
|
||||||
mouseEndPos
|
mouseEndPos
|
||||||
);
|
);
|
||||||
let changeRotation = 0;
|
|
||||||
if (
|
if (
|
||||||
this.keyInteractionConfig.keyRotationMethod ==
|
this.keyInteractionConfig.keyRotationMethod ==
|
||||||
KeyRotationMethod.jumpChange
|
KeyRotationMethod.jumpChange
|
||||||
) {
|
) {
|
||||||
if (direction == 'ssz') {
|
if (direction == 'ssz') {
|
||||||
if (angle < 45) {
|
if (angle < 45) {
|
||||||
changeRotation = this.mouseDownBeginRotation;
|
this.changeRotation = this.mouseDownBeginRotation;
|
||||||
}
|
} else if (
|
||||||
if (
|
|
||||||
angle >= 45 &&
|
angle >= 45 &&
|
||||||
angle < 90 &&
|
angle < 90 &&
|
||||||
this.mouseDownBeginRotation !== Math.PI / 4
|
this.mouseDownBeginRotation !== Math.PI / 4
|
||||||
) {
|
) {
|
||||||
changeRotation = this.mouseDownBeginRotation + Math.PI / 4;
|
this.changeRotation = this.mouseDownBeginRotation + Math.PI / 4;
|
||||||
} else if (
|
} else if (
|
||||||
angle >= 90 &&
|
angle >= 90 &&
|
||||||
this.mouseDownBeginRotation == -Math.PI / 4
|
this.mouseDownBeginRotation == -Math.PI / 4
|
||||||
) {
|
) {
|
||||||
changeRotation = this.mouseDownBeginRotation + Math.PI / 2;
|
this.changeRotation = this.mouseDownBeginRotation + Math.PI / 2;
|
||||||
}
|
|
||||||
if (this.lastTimenRotation !== changeRotation) {
|
|
||||||
this.lastTimenRotation = changeRotation;
|
|
||||||
this.keyInteractionConfig.doAfterChangeRotation(g, changeRotation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == 'nsz') {
|
if (direction == 'nsz') {
|
||||||
if (angle < 45) {
|
if (angle < 45) {
|
||||||
changeRotation = this.mouseDownBeginRotation;
|
this.changeRotation = this.mouseDownBeginRotation;
|
||||||
} else if (angle >= 45 && angle < 90) {
|
} else if (
|
||||||
changeRotation = this.mouseDownBeginRotation - Math.PI / 4;
|
angle >= 45 &&
|
||||||
} else if (angle >= 90 && changeRotation == Math.PI / 4) {
|
angle < 90 &&
|
||||||
changeRotation = this.mouseDownBeginRotation - Math.PI / 2;
|
this.mouseDownBeginRotation !== -Math.PI / 4
|
||||||
}
|
) {
|
||||||
if (this.lastTimenRotation !== changeRotation) {
|
this.changeRotation = this.mouseDownBeginRotation - Math.PI / 4;
|
||||||
this.lastTimenRotation = changeRotation;
|
} else if (
|
||||||
this.keyInteractionConfig.doAfterChangeRotation(g, changeRotation);
|
angle >= 90 &&
|
||||||
|
this.mouseDownBeginRotation == Math.PI / 4
|
||||||
|
) {
|
||||||
|
this.changeRotation = this.mouseDownBeginRotation - Math.PI / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.lastTimenRotation !== this.changeRotation) {
|
||||||
|
this.lastTimenRotation = this.changeRotation;
|
||||||
|
this.ratatingSprite.rotation = this.changeRotation;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (direction == 'ssz') {
|
if (direction == 'ssz') {
|
||||||
this.ratatingSprite.rotation =
|
this.ratatingSprite.rotation =
|
||||||
@ -218,8 +227,8 @@ export class TccKeyInteraction extends KeyInteraction<TccKey> {
|
|||||||
super(TccKeyInteraction.Name, app, {
|
super(TccKeyInteraction.Name, app, {
|
||||||
gearPositionAmount: 3,
|
gearPositionAmount: 3,
|
||||||
keyRotationMethod: KeyRotationMethod.jumpChange,
|
keyRotationMethod: KeyRotationMethod.jumpChange,
|
||||||
doAfterChangeRotation: (g: JlGraphic, rotation: number) => {
|
doAfterChangeRotation: () => {
|
||||||
this.changeState(g, rotation);
|
this.changeState();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -276,34 +285,8 @@ export class TccKeyInteraction extends KeyInteraction<TccKey> {
|
|||||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
changeState(g: JlGraphic, rotation: number) {
|
changeState() {
|
||||||
let position = 0;
|
useTccStore().mouseDownOnTccKeyDir = false;
|
||||||
switch (rotation) {
|
|
||||||
case Math.PI / 4:
|
|
||||||
position = 0;
|
|
||||||
break;
|
|
||||||
case -Math.PI / 4:
|
|
||||||
position = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
position = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
(g as TccKey).state.position = position;
|
|
||||||
const simulationId = useLineStore().simulationId;
|
|
||||||
const tccId = useTccStore().tccId;
|
|
||||||
if (!simulationId) return;
|
|
||||||
tccOperation({
|
|
||||||
simulationId,
|
|
||||||
trainId: tccId + '',
|
|
||||||
deviceId: g.id,
|
|
||||||
controlType: request.TrainControl.TrainControlType.DIRECTION_KEY_SWITCH,
|
|
||||||
dirKey: {
|
|
||||||
val: position,
|
|
||||||
},
|
|
||||||
}).catch((err) => {
|
|
||||||
errorNotify('操作失败', { message: err.origin.response.data.title });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,14 @@ export function initTccScene(lineApp: IGraphicApp, sceneName: string) {
|
|||||||
};
|
};
|
||||||
tccScene.canvas.onmouseup = () => {
|
tccScene.canvas.onmouseup = () => {
|
||||||
tccStore.canvasMouseDown = false;
|
tccStore.canvasMouseDown = false;
|
||||||
|
if (tccStore.mouseDownOnTccHandle) {
|
||||||
|
tccStore.onMouseUpFromTccHandle();
|
||||||
|
tccStore.mouseDownOnTccHandle = false;
|
||||||
|
}
|
||||||
|
if (tccStore.mouseDownOnTccKeyDir) {
|
||||||
|
tccStore.onMouseUpFromTccKeyDir();
|
||||||
|
tccStore.mouseDownOnTccKeyDir = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
lineApp.on('destroy', () => {
|
lineApp.on('destroy', () => {
|
||||||
tccScene.canvas.onmousedown = null;
|
tccScene.canvas.onmousedown = null;
|
||||||
|
@ -19,6 +19,8 @@ export interface ICarWashingData extends GraphicData {
|
|||||||
set centralizedStations(v: number[]);
|
set centralizedStations(v: number[]);
|
||||||
get duanNum(): number;
|
get duanNum(): number;
|
||||||
set duanNum(v: number);
|
set duanNum(v: number);
|
||||||
|
get width(): number;
|
||||||
|
set width(v: number);
|
||||||
clone(): ICarWashingData;
|
clone(): ICarWashingData;
|
||||||
copyFrom(data: ICarWashingData): void;
|
copyFrom(data: ICarWashingData): void;
|
||||||
eq(other: ICarWashingData): boolean;
|
eq(other: ICarWashingData): boolean;
|
||||||
@ -51,19 +53,23 @@ const carWashingConsts = {
|
|||||||
codeColor: 0xffffff,
|
codeColor: 0xffffff,
|
||||||
bodyRectLineColor: 0xffffff,
|
bodyRectLineColor: 0xffffff,
|
||||||
bodyRectLineWidth: 2,
|
bodyRectLineWidth: 2,
|
||||||
bodyRectWidth: 10,
|
bodyRectWidth: 60,
|
||||||
bodyRectHeight: 20,
|
bodyRectHeight: 40,
|
||||||
bodyColor: 0x000000,
|
bodyColor: 0xffffff,
|
||||||
};
|
};
|
||||||
export class CarWashing extends JlGraphic {
|
export class CarWashing extends JlGraphic {
|
||||||
static Type = 'carWashing';
|
static Type = 'carWashing';
|
||||||
codeGraph: VectorText = new VectorText('');
|
codeGraph: VectorText = new VectorText('');
|
||||||
rectBody: Graphics = new Graphics();
|
rectBody: Graphics = new Graphics();
|
||||||
|
stopText: VectorText = new VectorText('');
|
||||||
|
stateText: VectorText = new VectorText('');
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(CarWashing.Type);
|
super(CarWashing.Type);
|
||||||
this.addChild(this.codeGraph);
|
this.addChild(this.codeGraph);
|
||||||
this.addChild(this.rectBody);
|
this.addChild(this.rectBody);
|
||||||
|
this.addChild(this.stopText);
|
||||||
|
this.addChild(this.stateText);
|
||||||
this.codeGraph.name = 'carw_code';
|
this.codeGraph.name = 'carw_code';
|
||||||
}
|
}
|
||||||
get code(): string {
|
get code(): string {
|
||||||
@ -93,18 +99,49 @@ export class CarWashing extends JlGraphic {
|
|||||||
codeGraph.position.set(0, -30);
|
codeGraph.position.set(0, -30);
|
||||||
}
|
}
|
||||||
this.rectBody.clear();
|
this.rectBody.clear();
|
||||||
this.rectBody.beginFill(carWashingConsts.bodyColor, 0);
|
this.rectBody.beginFill(carWashingConsts.bodyColor, 1);
|
||||||
this.rectBody.lineStyle(
|
const width = this.datas.width || carWashingConsts.bodyRectWidth;
|
||||||
carWashingConsts.bodyRectLineWidth,
|
|
||||||
carWashingConsts.bodyRectLineColor
|
|
||||||
);
|
|
||||||
this.rectBody.drawRect(
|
this.rectBody.drawRect(
|
||||||
-carWashingConsts.bodyRectWidth / 2,
|
-width / 2,
|
||||||
-carWashingConsts.bodyRectHeight / 2,
|
-carWashingConsts.bodyRectHeight / 2,
|
||||||
carWashingConsts.bodyRectWidth,
|
width,
|
||||||
carWashingConsts.bodyRectHeight
|
carWashingConsts.bodyRectHeight
|
||||||
);
|
);
|
||||||
this.rectBody.endFill();
|
this.rectBody.endFill();
|
||||||
|
if (this.states.jtj) {
|
||||||
|
this.stopText.text = '紧';
|
||||||
|
this.stopText.style.fill = carWashingConsts.codeColor;
|
||||||
|
this.stopText.setVectorFontSize(carWashingConsts.codeFontSize);
|
||||||
|
this.stopText.anchor.set(0.5);
|
||||||
|
this.stopText.position.set(width / 2 + 20, -15);
|
||||||
|
}
|
||||||
|
let stateText = '';
|
||||||
|
if (this.states.xcjxj) {
|
||||||
|
stateText = '就绪';
|
||||||
|
} else if (this.states.xcyxj) {
|
||||||
|
stateText = '洗车';
|
||||||
|
} else if (this.states.tgyxj) {
|
||||||
|
stateText = '通过';
|
||||||
|
} else if (this.states.cfjList.length === 2) {
|
||||||
|
if (this.states.cfjList[0]) {
|
||||||
|
stateText = '头部';
|
||||||
|
} else if (this.states.cfjList[1]) {
|
||||||
|
stateText = '尾部';
|
||||||
|
}
|
||||||
|
} else if (this.states.cfjList.length === 3) {
|
||||||
|
if (this.states.cfjList[1]) {
|
||||||
|
stateText = '尾部';
|
||||||
|
} else if (this.states.cfjList[2]) {
|
||||||
|
stateText = '中部';
|
||||||
|
} else if (this.states.cfjList[0]) {
|
||||||
|
stateText = '头部';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.stateText.text = stateText;
|
||||||
|
this.stateText.style.fill = carWashingConsts.codeColor;
|
||||||
|
this.stateText.setVectorFontSize(carWashingConsts.codeFontSize);
|
||||||
|
this.stateText.anchor.set(0.5);
|
||||||
|
this.stateText.position.set(width / 2 + 15, 15);
|
||||||
}
|
}
|
||||||
buildRelation() {
|
buildRelation() {
|
||||||
const sections = this.queryStore
|
const sections = this.queryStore
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
JlGraphic,
|
JlGraphic,
|
||||||
} from 'jl-graphic';
|
} from 'jl-graphic';
|
||||||
import { CarWashing, CarWashingTemplate, ICarWashingData } from './CarWashing';
|
import { CarWashing, CarWashingTemplate, ICarWashingData } from './CarWashing';
|
||||||
|
import { Section } from '../section/Section';
|
||||||
|
|
||||||
export interface ICarWashingDataDrawOptions {
|
export interface ICarWashingDataDrawOptions {
|
||||||
newData: () => ICarWashingData;
|
newData: () => ICarWashingData;
|
||||||
@ -61,24 +62,15 @@ function buildAbsorbablePositions(
|
|||||||
carWashing: CarWashing
|
carWashing: CarWashing
|
||||||
): AbsorbablePosition[] {
|
): AbsorbablePosition[] {
|
||||||
const aps: AbsorbablePosition[] = [];
|
const aps: AbsorbablePosition[] = [];
|
||||||
const carWashings = carWashing.queryStore.queryByType<CarWashing>(
|
const sections = carWashing.queryStore.queryByType<Section>(Section.Type);
|
||||||
CarWashing.Type
|
sections.forEach((item) => {
|
||||||
);
|
const p1 = item.localToCanvasPoint(item.getStartPoint());
|
||||||
const canvas = carWashing.getCanvas();
|
const p2 = item.localToCanvasPoint(item.getEndPoint());
|
||||||
carWashings.forEach((item) => {
|
|
||||||
if (item.id === carWashing.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const ala = new AbsorbableLine(
|
const ala = new AbsorbableLine(
|
||||||
new Point(item.x, 0),
|
new Point(p1.x, p1.y),
|
||||||
new Point(item.x, canvas.height)
|
new Point(p2.x, p2.y)
|
||||||
);
|
|
||||||
const alb = new AbsorbableLine(
|
|
||||||
new Point(0, item.y),
|
|
||||||
new Point(canvas.width, item.y)
|
|
||||||
);
|
);
|
||||||
aps.push(ala);
|
aps.push(ala);
|
||||||
aps.push(alb);
|
|
||||||
});
|
});
|
||||||
return aps;
|
return aps;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ export interface IFloodGateState extends GraphicState {
|
|||||||
set mgj(v: boolean);
|
set mgj(v: boolean);
|
||||||
get param(): request.CkmParam;
|
get param(): request.CkmParam;
|
||||||
set param(v: request.CkmParam);
|
set param(v: request.CkmParam);
|
||||||
|
get local(): boolean;
|
||||||
|
set local(v: boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
const garageConsts = {
|
const garageConsts = {
|
||||||
@ -38,6 +40,7 @@ const garageConsts = {
|
|||||||
codeColor: 0xffffff,
|
codeColor: 0xffffff,
|
||||||
bodyLineColor: 0xffffff,
|
bodyLineColor: 0xffffff,
|
||||||
lossStateColor: 0x0000ff,
|
lossStateColor: 0x0000ff,
|
||||||
|
localStateColor: 0x00ff00,
|
||||||
bodyLineWidth: 2,
|
bodyLineWidth: 2,
|
||||||
bodyColor: 0x000000,
|
bodyColor: 0x000000,
|
||||||
bodyRectWidth: 10,
|
bodyRectWidth: 10,
|
||||||
@ -87,10 +90,13 @@ export class FloodGate extends JlGraphic {
|
|||||||
codeGraph.position.set(0, -30);
|
codeGraph.position.set(0, -30);
|
||||||
}
|
}
|
||||||
this.lineBody.clear();
|
this.lineBody.clear();
|
||||||
const color =
|
let color = garageConsts.bodyLineColor;
|
||||||
this.states.param?.fault === request.Ckm.Fault.FA_State_Loss
|
if (this.states.local) {
|
||||||
? garageConsts.lossStateColor
|
color = garageConsts.localStateColor;
|
||||||
: garageConsts.bodyLineColor;
|
}
|
||||||
|
if (this.states.param?.fault === request.Ckm.Fault.FA_State_Loss) {
|
||||||
|
color = garageConsts.lossStateColor;
|
||||||
|
}
|
||||||
this.lineBody.lineStyle(garageConsts.bodyLineWidth, color);
|
this.lineBody.lineStyle(garageConsts.bodyLineWidth, color);
|
||||||
this.lineBody.moveTo(
|
this.lineBody.moveTo(
|
||||||
-garageConsts.bodyRectWidth / 2,
|
-garageConsts.bodyRectWidth / 2,
|
||||||
|
@ -31,6 +31,8 @@ export interface IGarageDoorState extends GraphicState {
|
|||||||
set mgj(v: boolean);
|
set mgj(v: boolean);
|
||||||
get param(): request.CkmParam;
|
get param(): request.CkmParam;
|
||||||
set param(v: request.CkmParam);
|
set param(v: request.CkmParam);
|
||||||
|
get local(): boolean;
|
||||||
|
set local(v: boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
const garageConsts = {
|
const garageConsts = {
|
||||||
@ -38,6 +40,7 @@ const garageConsts = {
|
|||||||
codeColor: 0xffffff,
|
codeColor: 0xffffff,
|
||||||
bodyLineColor: 0xffffff,
|
bodyLineColor: 0xffffff,
|
||||||
lossStateColor: 0x0000ff,
|
lossStateColor: 0x0000ff,
|
||||||
|
localStateColor: 0x00ff00,
|
||||||
bodyLineWidth: 2,
|
bodyLineWidth: 2,
|
||||||
bodyColor: 0x000000,
|
bodyColor: 0x000000,
|
||||||
bodyRectWidth: 10,
|
bodyRectWidth: 10,
|
||||||
@ -87,10 +90,13 @@ export class GarageDoor extends JlGraphic {
|
|||||||
codeGraph.position.set(0, -30);
|
codeGraph.position.set(0, -30);
|
||||||
}
|
}
|
||||||
this.lineBody.clear();
|
this.lineBody.clear();
|
||||||
const color =
|
let color = garageConsts.bodyLineColor;
|
||||||
this.states.param?.fault === request.Ckm.Fault.FA_State_Loss
|
if (this.states.local) {
|
||||||
? garageConsts.lossStateColor
|
color = garageConsts.localStateColor;
|
||||||
: garageConsts.bodyLineColor;
|
}
|
||||||
|
if (this.states.param?.fault === request.Ckm.Fault.FA_State_Loss) {
|
||||||
|
color = garageConsts.lossStateColor;
|
||||||
|
}
|
||||||
this.lineBody.lineStyle(garageConsts.bodyLineWidth, color);
|
this.lineBody.lineStyle(garageConsts.bodyLineWidth, color);
|
||||||
this.lineBody.moveTo(
|
this.lineBody.moveTo(
|
||||||
-garageConsts.bodyRectWidth / 2,
|
-garageConsts.bodyRectWidth / 2,
|
||||||
|
@ -54,7 +54,7 @@ export class TccHandle extends JlGraphic {
|
|||||||
return this.getStates<ITccHandleState>();
|
return this.getStates<ITccHandleState>();
|
||||||
}
|
}
|
||||||
doRepaint(): void {
|
doRepaint(): void {
|
||||||
this._tccHandle.y = -Math.floor((this.state.gear * 144) / 100);
|
this._tccHandle.y = -(this.state.gear * 144) / 100;
|
||||||
this._tccHandle.texture = this.tccHandleTextures.tccHandle;
|
this._tccHandle.texture = this.tccHandleTextures.tccHandle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,12 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { initTccScene } from 'src/drawApp/tccScene';
|
import { initTccScene } from 'src/drawApp/tccScene';
|
||||||
import { getLineApp } from 'src/drawApp/lineApp';
|
import { getLineApp } from 'src/drawApp/lineApp';
|
||||||
|
import { useLineStore } from './line-store';
|
||||||
|
import { tccOperation } from 'src/api/Simulation';
|
||||||
|
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';
|
||||||
|
|
||||||
export const useTccStore = defineStore('tcc', {
|
export const useTccStore = defineStore('tcc', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@ -8,6 +14,10 @@ export const useTccStore = defineStore('tcc', {
|
|||||||
tccId: 0,
|
tccId: 0,
|
||||||
isTccDialogOpen: false,
|
isTccDialogOpen: false,
|
||||||
canvasMouseDown: false,
|
canvasMouseDown: false,
|
||||||
|
mouseDownOnTccHandle: false,
|
||||||
|
tccHandleId: 0,
|
||||||
|
mouseDownOnTccKeyDir: false,
|
||||||
|
tccKeyDirId: 0,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
getTccScene() {
|
getTccScene() {
|
||||||
@ -30,5 +40,56 @@ export const useTccStore = defineStore('tcc', {
|
|||||||
this.trainControlMapId = 0;
|
this.trainControlMapId = 0;
|
||||||
this.isTccDialogOpen = false;
|
this.isTccDialogOpen = false;
|
||||||
},
|
},
|
||||||
|
onMouseUpFromTccHandle() {
|
||||||
|
const simulationId = useLineStore().simulationId;
|
||||||
|
const tccHandle = this.getTccScene().queryStore.queryById<TccHandle>(
|
||||||
|
this.tccHandleId
|
||||||
|
);
|
||||||
|
if (!simulationId) return;
|
||||||
|
const handleVal = Number(
|
||||||
|
(-(tccHandle._tccHandle.y / 144) * 100).toFixed()
|
||||||
|
);
|
||||||
|
tccOperation({
|
||||||
|
simulationId,
|
||||||
|
trainId: this.tccId + '',
|
||||||
|
deviceId: this.tccHandleId,
|
||||||
|
controlType: request.TrainControl.TrainControlType.HANDLER,
|
||||||
|
handler: {
|
||||||
|
val: handleVal,
|
||||||
|
},
|
||||||
|
}).catch((err) => {
|
||||||
|
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onMouseUpFromTccKeyDir() {
|
||||||
|
const tccKeyDir = this.getTccScene().queryStore.queryById<TccKey>(
|
||||||
|
this.tccKeyDirId
|
||||||
|
);
|
||||||
|
let position = 0;
|
||||||
|
switch (tccKeyDir._tccKey.rotation) {
|
||||||
|
case Math.PI / 4:
|
||||||
|
position = 0;
|
||||||
|
break;
|
||||||
|
case -Math.PI / 4:
|
||||||
|
position = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
position = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const simulationId = useLineStore().simulationId;
|
||||||
|
if (!simulationId) return;
|
||||||
|
tccOperation({
|
||||||
|
simulationId,
|
||||||
|
trainId: this.tccId + '',
|
||||||
|
deviceId: this.tccKeyDirId,
|
||||||
|
controlType: request.TrainControl.TrainControlType.DIRECTION_KEY_SWITCH,
|
||||||
|
dirKey: {
|
||||||
|
val: position,
|
||||||
|
},
|
||||||
|
}).catch((err) => {
|
||||||
|
errorNotify('操作失败', { message: err.origin.response.data.title });
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user