需求调整--演示、单选、线路Id、站台门

This commit is contained in:
joylink_zhaoerwei 2023-10-08 13:11:46 +08:00
parent 58b04e3024
commit a79f6c71eb
9 changed files with 78 additions and 14 deletions

View File

@ -18,7 +18,7 @@ export function mockLocalDemoTestSet(
return api.post(`${alertUriBase}/localDemoTest/${alertType}`, data);
}
//故障演
//故障演
export function mockAlertSet(data: {
lineId: number;
alertType: string;

View File

@ -2,7 +2,7 @@
<draggable-dialog
v-if="showsetAlartText"
seamless
title="设置故障演"
title="设置故障演"
:width="300"
:height="0"
>
@ -12,6 +12,7 @@
<q-form ref="myForm" @submit="onSubmit" @reset="onReset">
<q-input
outlined
readonly
label="线路ID"
v-model.number="setAlartTextData.lineId"
type="number"
@ -160,11 +161,18 @@ watch(
return select;
}) as JlGraphic[];
if (
['道岔失表', '计轴红光带', '计轴橙光带', '列车信号故障'].includes(
setAlartTextData.value.alertType
)
[
'道岔失表',
'计轴红光带',
'计轴橙光带',
'列车信号故障',
'整侧站台门无法打开',
'整侧站台门无法关闭',
].includes(setAlartTextData.value.alertType)
) {
if (deviceFilter[0] !== undefined) {
selectGraphic = [deviceFilter[0]];
}
} else {
selectGraphic.push(...deviceFilter);
}
@ -178,6 +186,7 @@ watch(
onMounted(() => {
clearSelect();
onReset();
setAlartTextData.value.lineId = lineStore.lineId as unknown as string;
});
const myForm = ref<QForm | null>(null);
@ -198,7 +207,7 @@ async function onSubmit() {
await mockAlertSet(params);
$q.notify({
type: 'positive',
message: '设置故障演成功',
message: '设置故障演成功',
});
onReset();
} catch (err) {
@ -231,7 +240,7 @@ function clearSelect() {
function onReset() {
setAlartTextData.value = {
lineId: '',
lineId: lineStore.lineId as unknown as string,
alertType: '',
deviceCodes: [],
};

View File

@ -12,6 +12,7 @@
<q-form ref="myForm" @submit="onSubmit" @reset="onReset">
<q-input
outlined
readonly
label="线路ID"
v-model.number="setAlartTextData.lineId"
type="number"
@ -179,7 +180,9 @@ watch(
return select;
}) as JlGraphic[];
if (setAlartTextData.value.alertType !== '列车信号故障') {
selectGraphic.push(...deviceFilter);
if (deviceFilter[0] !== undefined) {
selectGraphic = [deviceFilter[0]];
}
} else if (deviceFilter.length) {
selectGraphic = [deviceFilter[0]];
}
@ -199,6 +202,7 @@ watch(
onMounted(() => {
clearSelect();
onReset();
setAlartTextData.value.lineId = lineStore.lineId as unknown as string;
});
const myForm = ref<QForm | null>(null);
@ -255,7 +259,7 @@ function clearSelect() {
function onReset() {
setAlartTextData.value = {
lineId: '',
lineId: lineStore.lineId as unknown as string,
rtuId: '',
alertType: '',
deviceInfos: [],

View File

@ -95,11 +95,18 @@ export class LogicSectionOperationPlugin extends GraphicInteractionPlugin<LogicS
g.eventMode = 'static';
g.cursor = 'pointer';
g.lineGraphic.hitArea = new LogicSectionGraphicHitArea(g);
g.on('_leftclick', this.onLeftClick, this);
g.on('rightclick', this.onContextMenu, this);
}
unbind(g: LogicSection): void {
g.off('_leftclick', this.onLeftClick, this);
g.off('rightclick', this.onContextMenu);
}
onLeftClick(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const section = target.getGraphic() as LogicSection;
this.app.updateSelected(section);
}
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const section = target.getGraphic() as LogicSection;

View File

@ -2,7 +2,13 @@ import * as pb_1 from 'google-protobuf';
import { GraphicDataBase } from './GraphicDataBase';
import { ISectionData, Section } from 'src/graphics/section/Section';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { IPointData } from 'pixi.js';
import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js';
import {
GraphicInteractionPlugin,
IGraphicApp,
JlGraphic,
} from 'src/jl-graphic';
import { SectionGraphicHitArea } from 'src/graphics/section/SectionDrawAssistant';
export class SectionData extends GraphicDataBase implements ISectionData {
constructor(data?: graphicData.Section) {
@ -85,3 +91,30 @@ export class SectionData extends GraphicDataBase implements ISectionData {
return pb_1.Message.equals(this.data, other.data);
}
}
export class sectionOperationPlugin extends GraphicInteractionPlugin<Section> {
static Name = 'logic_section_menu';
constructor(app: IGraphicApp) {
super(sectionOperationPlugin.Name, app);
}
filter(...grahpics: JlGraphic[]): Section[] | undefined {
return grahpics.filter((g): g is Section => g instanceof Section);
}
static init(app: IGraphicApp) {
return new sectionOperationPlugin(app);
}
bind(g: Section): void {
g.eventMode = 'static';
g.cursor = 'pointer';
g.lineGraphic.hitArea = new SectionGraphicHitArea(g);
g.on('_leftclick', this.onLeftClick, this);
}
unbind(g: Section): void {
g.off('_leftclick', this.onLeftClick, this);
}
onLeftClick(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const section = target.getGraphic() as Section;
this.app.updateSelected(section);
}
}

View File

@ -158,6 +158,7 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
sectionGraphic.cursor = 'pointer';
sectionGraphic.hitArea = new TurnoutSectionHitArea(sectionGraphic);
});
g.on('_leftclick', this.onLeftClick, this);
g.on('rightclick', this.onContextMenu, this);
}
unbind(g: Turnout): void {
@ -165,8 +166,14 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
g.graphics.sections.forEach((sectionGraphic) => {
sectionGraphic.eventMode = 'none';
});
g.off('_leftclick', this.onLeftClick, this);
g.on('rightclick', this.onContextMenu, this);
}
onLeftClick(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const section = target.getGraphic() as Turnout;
this.app.updateSelected(section);
}
onContextMenu(e: FederatedMouseEvent) {
const target = e.target as DisplayObject;
const turnout = target.getGraphic() as Turnout;

View File

@ -34,7 +34,10 @@ import {
TurnoutStates,
} from './graphics/TurnoutInteraction';
import { Turnout, TurnoutTemplate } from 'src/graphics/turnout/Turnout';
import { SectionData } from './graphics/SectionInteraction';
import {
SectionData,
sectionOperationPlugin,
} from './graphics/SectionInteraction';
import { SectionTemplate } from 'src/graphics/section/Section';
import { getPublishMapInfoByLineId } from 'src/api/PublishApi';
import { graphicData } from 'src/protos/stationLayoutGraphics';
@ -175,6 +178,7 @@ export function initLineApp(lineId: number): IGraphicApp {
TrainOperateInteraction.init(lineApp);
TurnoutOperationPlugin.init(lineApp);
LogicSectionOperationPlugin.init(lineApp);
sectionOperationPlugin.init(lineApp);
lineApp.enableWsMassaging({
wsUrl: getWebsocketUrl(),

View File

@ -210,7 +210,7 @@ export class SectionDraw extends GraphicDrawAssistant<
}
}
class SectionGraphicHitArea implements IHitArea {
export class SectionGraphicHitArea implements IHitArea {
section: Section;
constructor(section: Section) {
this.section = section;

View File

@ -19,7 +19,7 @@
<q-btn
v-show="route.path.includes('line/monitor')"
color="info"
label="故障演"
label="故障演"
class="q-mr-sm"
@click="openSetAlarmMockDialog"
/>