This commit is contained in:
joylink_zhaoerwei 2023-09-20 10:38:24 +08:00
parent 8146ee4f79
commit 43dffe1c4b
12 changed files with 70 additions and 105 deletions

View File

@ -13,23 +13,29 @@
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="hasDoor" v-model="platformModel.hasdoor"
:options="optionsDoor" :options="optionsDoor"
label="是否有屏蔽门" label="是否有屏蔽门"
map-options
emit-value
/> />
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="direction" v-model="platformModel.direction"
:options="optionsDirection" :options="optionsDirection"
label="方向" label="方向"
map-options
emit-value
/> />
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="upAndDown" v-model="platformModel.up"
:options="optionsUpAndDown" :options="optionsUpAndDown"
label="上下行" label="上下行"
map-options
emit-value
/> />
<q-list bordered separator class="rounded-borders"> <q-list bordered separator class="rounded-borders">
<q-item> <q-item>
@ -55,42 +61,25 @@ import { onMounted, onUnmounted, reactive, ref } from 'vue';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const platformModel = reactive(new PlatformData()); const platformModel = reactive(new PlatformData());
const hasDoor = ref('是');
const optionsDoor = ['是', '否'];
const direction = ref('向上');
const upAndDown = ref('');
const optionsDirection = ['向上', '向下'];
const optionsUpAndDown = ['上行', '下行'];
const stationName = ref(''); const stationName = ref('');
enum showSelect { const optionsDoor = [
= 'true', { label: '是', value: true },
= 'false', { label: '否', value: false },
向上 = 'up', ];
向下 = 'down', const optionsDirection = [
} { label: '向上', value: 'up' },
enum showUp { { label: '向下', value: 'down' },
上行 = 'true', ];
下行 = 'false', const optionsUpAndDown = [
} { label: '上行', value: true },
enum showSelectData { { label: '下行', value: false },
true = '是', ];
false = '否',
up = '向上',
down = '向下',
}
enum showUpData {
true = '上行',
false = '下行',
}
onMounted(() => { onMounted(() => {
const platform = drawStore.selectedGraphic as Platform; const platform = drawStore.selectedGraphic as Platform;
if (platform) { if (platform) {
platformModel.copyFrom(platform.saveData()); platformModel.copyFrom(platform.saveData());
drawStore.bindFormData(platformModel); drawStore.bindFormData(platformModel);
hasDoor.value = (showSelectData as never)[platformModel.hasdoor + ''];
direction.value = (showSelectData as never)[platformModel.direction];
upAndDown.value = (showUpData as never)[platformModel.up + ''];
if (platformModel.refStation) { if (platformModel.refStation) {
const refStation = platform.queryStore.queryById<Station>( const refStation = platform.queryStore.queryById<Station>(
platformModel.refStation platformModel.refStation
@ -101,9 +90,6 @@ onMounted(() => {
}); });
function onUpdate() { function onUpdate() {
platformModel.hasdoor = JSON.parse((showSelect as never)[hasDoor.value]);
platformModel.direction = (showSelect as never)[direction.value];
platformModel.up = JSON.parse((showUp as never)[upAndDown.value]);
const platform = drawStore.selectedGraphic as Platform; const platform = drawStore.selectedGraphic as Platform;
if (platform) { if (platform) {
drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel); drawStore.getDrawApp().updateGraphicAndRecord(platform, platformModel);

View File

@ -24,9 +24,11 @@
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="hasTransfer" v-model="stationLineModel.hasTransfer"
:options="optionsCircle" :options="optionsCircle"
label="是否有换乘" label="是否有换乘"
map-options
emit-value
/> />
</q-form> </q-form>
</template> </template>
@ -39,32 +41,20 @@ import { onMounted, onUnmounted, reactive, ref } from 'vue';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const stationLineModel = reactive(new StationLineData()); const stationLineModel = reactive(new StationLineData());
const hasTransfer = ref('是'); const optionsCircle = [
const optionsCircle = ['是', '否']; { label: '是', value: true },
enum showSelect { { label: '否', value: false },
= 'true', ];
= 'false',
}
enum showSelectData {
true = '是',
false = '否',
}
onMounted(() => { onMounted(() => {
const stationLine = drawStore.selectedGraphic as StationLine; const stationLine = drawStore.selectedGraphic as StationLine;
if (stationLine) { if (stationLine) {
stationLineModel.copyFrom(stationLine.saveData()); stationLineModel.copyFrom(stationLine.saveData());
drawStore.bindFormData(stationLineModel); drawStore.bindFormData(stationLineModel);
hasTransfer.value = (showSelectData as never)[
stationLineModel.hasTransfer + ''
];
} }
}); });
function onUpdate() { function onUpdate() {
stationLineModel.hasTransfer = JSON.parse(
(showSelect as never)[hasTransfer.value]
);
const stationLine = drawStore.selectedGraphic as StationLine; const stationLine = drawStore.selectedGraphic as StationLine;
if (stationLine) { if (stationLine) {
drawStore drawStore

View File

@ -40,16 +40,20 @@
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="hasControl" v-model="stationModel.hasControl"
:options="optionsControl" :options="optionsControl"
label="是否有控制" label="是否有控制"
map-options
emit-value
/> />
<q-select <q-select
outlined outlined
@blur="onUpdate" @blur="onUpdate"
v-model="concentrationStations" v-model="stationModel.concentrationStations"
:options="optionsControl" :options="optionsControl"
label="是否集中站" label="是否集中站"
map-options
emit-value
/> />
</q-form> </q-form>
</template> </template>
@ -58,21 +62,14 @@
import { StationData } from 'src/drawApp/graphics/StationInteraction'; import { StationData } from 'src/drawApp/graphics/StationInteraction';
import { Station } from 'src/graphics/station/Station'; import { Station } from 'src/graphics/station/Station';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, onUnmounted, reactive, ref } from 'vue'; import { onMounted, onUnmounted, reactive } from 'vue';
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const stationModel = reactive(new StationData()); const stationModel = reactive(new StationData());
const hasControl = ref('是'); const optionsControl = [
const concentrationStations = ref('否'); { label: '是', value: true },
const optionsControl = ['是', '否']; { label: '否', value: false },
enum showSelect { ];
= 'true',
= 'false',
}
enum showSelectData {
true = '是',
false = '否',
}
const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 }); const kilometerSystem = reactive({ coordinateSystem: '', kilometer: 0 });
const CoordinateSystemOptions = [ const CoordinateSystemOptions = [
@ -87,10 +84,6 @@ onMounted(() => {
if (station) { if (station) {
stationModel.copyFrom(station.saveData()); stationModel.copyFrom(station.saveData());
drawStore.bindFormData(stationModel); drawStore.bindFormData(stationModel);
hasControl.value = (showSelectData as never)[stationModel.hasControl + ''];
concentrationStations.value = (showSelectData as never)[
stationModel.concentrationStations + ''
];
if (stationModel.kilometerSystem) { if (stationModel.kilometerSystem) {
kilometerSystem.coordinateSystem = kilometerSystem.coordinateSystem =
stationModel.kilometerSystem.coordinateSystem; stationModel.kilometerSystem.coordinateSystem;
@ -100,10 +93,6 @@ onMounted(() => {
}); });
function onUpdate() { function onUpdate() {
stationModel.hasControl = JSON.parse((showSelect as never)[hasControl.value]);
stationModel.concentrationStations = JSON.parse(
(showSelect as never)[concentrationStations.value]
);
stationModel.kilometerSystem = { stationModel.kilometerSystem = {
coordinateSystem: kilometerSystem.coordinateSystem, coordinateSystem: kilometerSystem.coordinateSystem,
kilometer: kilometerSystem.kilometer, kilometer: kilometerSystem.kilometer,

View File

@ -6,7 +6,7 @@ import { GraphicDataBase } from './GraphicDataBase';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -119,12 +119,12 @@ const EpEditMenu: ContextMenu = ContextMenu.init({
export class DrawLinkPlugin extends GraphicInteractionPlugin<Link> { export class DrawLinkPlugin extends GraphicInteractionPlugin<Link> {
static Name = 'link_draw_right_menu'; static Name = 'link_draw_right_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(DrawLinkPlugin.Name, app); super(DrawLinkPlugin.Name, app);
app.registerMenu(LinkEditMenu); app.registerMenu(LinkEditMenu);
app.registerMenu(EpEditMenu); app.registerMenu(EpEditMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new DrawLinkPlugin(app); return new DrawLinkPlugin(app);
} }
filter(...grahpics: JlGraphic[]): Link[] | undefined { filter(...grahpics: JlGraphic[]): Link[] | undefined {

View File

@ -10,7 +10,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js'; import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js';
import { state } from 'src/protos/device_status'; import { state } from 'src/protos/device_status';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -81,14 +81,14 @@ const LogicSectionMenu = ContextMenu.init({
export class LogicSectionOperationPlugin extends GraphicInteractionPlugin<LogicSection> { export class LogicSectionOperationPlugin extends GraphicInteractionPlugin<LogicSection> {
static Name = 'logic_section_menu'; static Name = 'logic_section_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(LogicSectionOperationPlugin.Name, app); super(LogicSectionOperationPlugin.Name, app);
app.registerMenu(LogicSectionMenu); app.registerMenu(LogicSectionMenu);
} }
filter(...grahpics: JlGraphic[]): LogicSection[] | undefined { filter(...grahpics: JlGraphic[]): LogicSection[] | undefined {
return grahpics.filter((g): g is LogicSection => g instanceof LogicSection); return grahpics.filter((g): g is LogicSection => g instanceof LogicSection);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new LogicSectionOperationPlugin(app); return new LogicSectionOperationPlugin(app);
} }
bind(g: LogicSection): void { bind(g: LogicSection): void {

View File

@ -10,7 +10,7 @@ import { state } from 'src/protos/device_status';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -224,11 +224,11 @@ const PlatformOperateMenu: ContextMenu = ContextMenu.init({
export class PlatformOperateInteraction extends GraphicInteractionPlugin<Platform> { export class PlatformOperateInteraction extends GraphicInteractionPlugin<Platform> {
static Name = 'platform_operate_menu'; static Name = 'platform_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(PlatformOperateInteraction.Name, app); super(PlatformOperateInteraction.Name, app);
app.registerMenu(PlatformOperateMenu); app.registerMenu(PlatformOperateMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new PlatformOperateInteraction(app); return new PlatformOperateInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Platform[] | undefined { filter(...grahpics: JlGraphic[]): Platform[] | undefined {

View File

@ -4,7 +4,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js'; import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -128,12 +128,12 @@ const EpEditMenu: ContextMenu = ContextMenu.init({
export class DrawPolygonPlugin extends GraphicInteractionPlugin<Polygon> { export class DrawPolygonPlugin extends GraphicInteractionPlugin<Polygon> {
static Name = 'polygon_draw_right_menu'; static Name = 'polygon_draw_right_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(DrawPolygonPlugin.Name, app); super(DrawPolygonPlugin.Name, app);
app.registerMenu(PolygonEditMenu); app.registerMenu(PolygonEditMenu);
app.registerMenu(EpEditMenu); app.registerMenu(EpEditMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new DrawPolygonPlugin(app); return new DrawPolygonPlugin(app);
} }
filter(...grahpics: JlGraphic[]): Polygon[] | undefined { filter(...grahpics: JlGraphic[]): Polygon[] | undefined {

View File

@ -8,7 +8,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase } from './GraphicDataBase'; import { GraphicDataBase } from './GraphicDataBase';
import { import {
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicApp, IGraphicApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
@ -133,12 +133,12 @@ const EpEditMenu: ContextMenu = ContextMenu.init({
export class DrawRunLinePlugin extends GraphicInteractionPlugin<RunLine> { export class DrawRunLinePlugin extends GraphicInteractionPlugin<RunLine> {
static Name = 'runline_draw_right_menu'; static Name = 'runline_draw_right_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(DrawRunLinePlugin.Name, app); super(DrawRunLinePlugin.Name, app);
app.registerMenu(RunLineEditMenu); app.registerMenu(RunLineEditMenu);
app.registerMenu(EpEditMenu); app.registerMenu(EpEditMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new DrawRunLinePlugin(app); return new DrawRunLinePlugin(app);
} }
filter(...grahpics: JlGraphic[]): RunLine[] | undefined { filter(...grahpics: JlGraphic[]): RunLine[] | undefined {
@ -221,11 +221,11 @@ export class DrawRunLinePlugin extends GraphicInteractionPlugin<RunLine> {
export class RunLineOperateInteraction extends GraphicInteractionPlugin<RunLine> { export class RunLineOperateInteraction extends GraphicInteractionPlugin<RunLine> {
static Name = 'runLine_operate_menu'; static Name = 'runLine_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(RunLineOperateInteraction.Name, app); super(RunLineOperateInteraction.Name, app);
app.registerMenu(EpEditMenu); app.registerMenu(EpEditMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new RunLineOperateInteraction(app); return new RunLineOperateInteraction(app);
} }
filter(...grahpics: JlGraphic[]): RunLine[] | undefined { filter(...grahpics: JlGraphic[]): RunLine[] | undefined {

View File

@ -9,7 +9,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase'; import { GraphicDataBase, GraphicStateBase } from './GraphicDataBase';
import { import {
GraphicInteractionPlugin, GraphicInteractionPlugin,
GraphicApp, IGraphicApp,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
@ -283,11 +283,11 @@ const SignalOperateMenu: ContextMenu = ContextMenu.init({
}); });
export class DrawSignalInteraction extends GraphicInteractionPlugin<Signal> { export class DrawSignalInteraction extends GraphicInteractionPlugin<Signal> {
static Name = 'signal_draw_right_menu'; static Name = 'signal_draw_right_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(DrawSignalInteraction.Name, app); super(DrawSignalInteraction.Name, app);
app.registerMenu(SignalEditMenu); app.registerMenu(SignalEditMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new DrawSignalInteraction(app); return new DrawSignalInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Signal[] | undefined { filter(...grahpics: JlGraphic[]): Signal[] | undefined {
@ -316,11 +316,11 @@ export class DrawSignalInteraction extends GraphicInteractionPlugin<Signal> {
export class SignalOperateInteraction extends GraphicInteractionPlugin<Signal> { export class SignalOperateInteraction extends GraphicInteractionPlugin<Signal> {
static Name = 'signal_operate_menu'; static Name = 'signal_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(SignalOperateInteraction.Name, app); super(SignalOperateInteraction.Name, app);
app.registerMenu(SignalOperateMenu); app.registerMenu(SignalOperateMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new SignalOperateInteraction(app); return new SignalOperateInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Signal[] | undefined { filter(...grahpics: JlGraphic[]): Signal[] | undefined {

View File

@ -10,7 +10,7 @@ import { state } from 'src/protos/device_status';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -160,11 +160,11 @@ const StationOperateMenu: ContextMenu = ContextMenu.init({
export class StationOperateInteraction extends GraphicInteractionPlugin<Station> { export class StationOperateInteraction extends GraphicInteractionPlugin<Station> {
static Name = 'station_operate_menu'; static Name = 'station_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(StationOperateInteraction.Name, app); super(StationOperateInteraction.Name, app);
app.registerMenu(StationOperateMenu); app.registerMenu(StationOperateMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new StationOperateInteraction(app); return new StationOperateInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Station[] | undefined { filter(...grahpics: JlGraphic[]): Station[] | undefined {

View File

@ -7,7 +7,7 @@ import { train } from 'src/protos/train';
import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu';
import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
VectorText, VectorText,
@ -269,12 +269,12 @@ const TrainOperateMenu: ContextMenu = ContextMenu.init({
export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> { export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
static Name = 'train_operate_menu'; static Name = 'train_operate_menu';
hoverLaber: TrainHoverLabel; hoverLaber: TrainHoverLabel;
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(TrainOperateInteraction.Name, app); super(TrainOperateInteraction.Name, app);
this.hoverLaber = new TrainHoverLabel(); this.hoverLaber = new TrainHoverLabel();
app.registerMenu(TrainOperateMenu); app.registerMenu(TrainOperateMenu);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new TrainOperateInteraction(app); return new TrainOperateInteraction(app);
} }
filter(...grahpics: JlGraphic[]): Train[] | undefined { filter(...grahpics: JlGraphic[]): Train[] | undefined {

View File

@ -10,7 +10,7 @@ import { DisplayObject, FederatedMouseEvent, IPointData } from 'pixi.js';
import { KilometerSystem } from 'src/graphics/signal/Signal'; import { KilometerSystem } from 'src/graphics/signal/Signal';
import { state } from 'src/protos/device_status'; import { state } from 'src/protos/device_status';
import { import {
GraphicApp, IGraphicApp,
GraphicInteractionPlugin, GraphicInteractionPlugin,
JlGraphic, JlGraphic,
} from 'src/jl-graphic'; } from 'src/jl-graphic';
@ -139,14 +139,14 @@ const TurnoutOperateMenu = ContextMenu.init({
export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> { export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
static Name = 'turnout_operate_menu'; static Name = 'turnout_operate_menu';
constructor(app: GraphicApp) { constructor(app: IGraphicApp) {
super(TurnoutOperationPlugin.Name, app); super(TurnoutOperationPlugin.Name, app);
app.registerMenu(TurnoutOperateMenu); app.registerMenu(TurnoutOperateMenu);
} }
filter(...grahpics: JlGraphic[]): Turnout[] | undefined { filter(...grahpics: JlGraphic[]): Turnout[] | undefined {
return grahpics.filter((g): g is Turnout => g instanceof Turnout); return grahpics.filter((g): g is Turnout => g instanceof Turnout);
} }
static init(app: GraphicApp) { static init(app: IGraphicApp) {
return new TurnoutOperationPlugin(app); return new TurnoutOperationPlugin(app);
} }
bind(g: Turnout): void { bind(g: Turnout): void {