右侧面板调整 && 区段操作

This commit is contained in:
Yuan 2023-10-31 16:50:35 +08:00
parent a33a4dc56f
commit 50798d9d67
8 changed files with 304 additions and 46 deletions

@ -1 +1 @@
Subproject commit 60ed5685cf48665f31df84a62a1182bfcb08dbb2
Subproject commit df9ed054c0bb76f7de1f188ef7fb8c31a6513509

View File

@ -56,12 +56,11 @@ export async function removeTrain(data: {
return response.data;
}
export async function setSaxleSectionState(data: {
export async function setAxleSectionState(data: {
simulationId: string;
mapId: number;
id: string;
operation: number;
reset?: boolean;
}) {
return await api.post(`${UriBase}/axleSection/operation`, data);
}

View File

@ -53,7 +53,7 @@ import { useLineStore } from 'src/stores/line-store';
import { ref, watch, onMounted } from 'vue';
import { Section } from 'src/graphics/section/Section';
import { request } from 'src/protos/request';
import { setSaxleSectionState } from 'src/api/Simulation';
import { setAxleSectionState } from 'src/api/Simulation';
import { useQuasar } from 'quasar';
import { ApiError } from 'src/boot/axios';
@ -103,17 +103,29 @@ onMounted(() => {
});
const options = [
{ label: '设置计轴直接复位', value: request.Section.AxleOperation.Drst },
{ label: '取消计轴直接复位', value: request.Section.AxleOperation.Drst },
{ label: '设置计轴预复位', value: request.Section.AxleOperation.Pdrst },
{ label: '取消计轴预复位', value: request.Section.AxleOperation.Pdrst },
{
label: '设置计轴区段内有车轴',
value: request.Section.AxleOperation.TrainIn,
label: '设置计轴直接复位',
value: request.Section.Operation.SetDrst,
},
{
label: '设置计轴区段内没有车轴',
value: request.Section.AxleOperation.TrainOut,
label: '取消计轴直接复位',
value: request.Section.Operation.CancelDrst,
},
{
label: '设置计轴预复位',
value: request.Section.Operation.SetPdrst,
},
{
label: '取消计轴预复位',
value: request.Section.Operation.CancelPdrst,
},
{
label: '设置区段故障占用',
value: request.Section.Operation.SetFaultOcc,
},
{
label: '取消区段故障占用',
value: request.Section.Operation.CancelFaultOcc,
},
];
function toDo(item: { label: string; value: number }) {
@ -124,16 +136,7 @@ function toDo(item: { label: string; value: number }) {
id: sectionState.value.id,
operation: item.value,
};
if (
[
request.Section.AxleOperation.Drst,
request.Section.AxleOperation.Pdrst,
].includes(item.value)
) {
const s = !item.label.includes('取消');
Object.assign(obj, { reset: s });
}
setSaxleSectionState(obj)
setAxleSectionState(obj)
.then(() => {
$q.notify({ type: 'positive', message: '修改区段状态成功' });
})

View File

@ -8,9 +8,9 @@ function getHost(): string {
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
// return '192.168.3.15:9091';
// return '192.168.3.5:9091';
return '192.168.3.5:9091';
// return '192.168.3.37:9091'; //卫志宏
return '192.168.3.233:9091';
// return '192.168.3.233:9091';
}
export function getHttpBase() {

View File

@ -46,7 +46,7 @@ import { TurnoutDraw } from 'src/graphics/turnout/TurnoutDrawAssistant';
import { TurnoutData, TurnoutStates } from './graphics/TurnoutInteraction';
import { Section, SectionTemplate } from 'src/graphics/section/Section';
import { SectionDraw } from 'src/graphics/section/SectionDrawAssistant';
import { SectionData } from './graphics/SectionInteraction';
import { SectionData, SectionStates } from './graphics/SectionInteraction';
import { toStorageTransform } from './graphics/GraphicDataBase';
import { SeparatorDraw } from 'src/graphics/separator/SeparatorDrawAssistant';
import { Separator, SeparatorTemplate } from 'src/graphics/separator/Separator';
@ -181,7 +181,10 @@ export function initCommonDrawApp(app: IDrawApp) {
);
// new SignalDraw(app, new SignalTemplate(new SignalData(), new SignalState()));
new TrainDraw(app, new TrainTemplate(new TrainState()));
new SectionDraw(app, new SectionTemplate(new SectionData()));
new SectionDraw(
app,
new SectionTemplate(new SectionData(), new SectionStates())
);
new TurnoutDraw(
app,
new TurnoutTemplate(new TurnoutData(), new TurnoutStates())

View File

@ -19,7 +19,13 @@
class="q-mr-md"
@click="destroySimAndBack"
/>
<q-btn color="info" label="返回" @click="backConfirm" />
<q-btn color="info" label="返回" class="q-mr-md" @click="backConfirm" />
<q-btn
round
flat
icon="menu"
@click="drawerRight = !drawerRight"
></q-btn>
</q-toolbar>
<q-resize-observer @resize="onHeaderResize" />
</q-header>
@ -108,7 +114,7 @@ const simulationId = (route.query.simulationId as string) || '';
const projectId = (route.query.projectId as string) || '';
const defaultMapId = (route.query.defaultMapId as string) || '';
let sceneName = '';
const drawerRight = ref(false);
const drawerRight = ref(true);
const projectName = computed(() => projectInfo.name);
@ -192,7 +198,7 @@ onMounted(async () => {
lineStore.setMapId(null);
lineStore.setSimulationId(null);
}
drawerRight.value = false;
// drawerRight.value = false;
});
onUnmounted(() => {
if (dialogInstance.value && lineStore.showLayerDialog) {
@ -209,17 +215,6 @@ onUnmounted(() => {
lineStore.destroy();
});
watch(
[() => lineStore.stateProCount, () => lineStore.selectedGraphics],
([count, sg], [prevCount]) => {
if (count !== prevCount && sg && sg.length === 1) {
drawerRight.value = true;
} else {
drawerRight.value = false;
}
}
);
const pslCanvasWidth = ref(500);
const pslCanvasHeight = ref(600);
watch(

View File

@ -222,6 +222,17 @@ export namespace state {
reverse?: boolean;
dw?: boolean;
fw?: boolean;
force?: boolean;
sb?: boolean;
dwsb?: boolean;
fwsb?: boolean;
jc?: boolean;
qdc?: boolean;
qfc?: boolean;
qyc?: boolean;
dc?: boolean;
fc?: boolean;
yc?: boolean;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -241,6 +252,39 @@ export namespace state {
if ("fw" in data && data.fw != undefined) {
this.fw = data.fw;
}
if ("force" in data && data.force != undefined) {
this.force = data.force;
}
if ("sb" in data && data.sb != undefined) {
this.sb = data.sb;
}
if ("dwsb" in data && data.dwsb != undefined) {
this.dwsb = data.dwsb;
}
if ("fwsb" in data && data.fwsb != undefined) {
this.fwsb = data.fwsb;
}
if ("jc" in data && data.jc != undefined) {
this.jc = data.jc;
}
if ("qdc" in data && data.qdc != undefined) {
this.qdc = data.qdc;
}
if ("qfc" in data && data.qfc != undefined) {
this.qfc = data.qfc;
}
if ("qyc" in data && data.qyc != undefined) {
this.qyc = data.qyc;
}
if ("dc" in data && data.dc != undefined) {
this.dc = data.dc;
}
if ("fc" in data && data.fc != undefined) {
this.fc = data.fc;
}
if ("yc" in data && data.yc != undefined) {
this.yc = data.yc;
}
}
}
get id() {
@ -273,12 +317,89 @@ export namespace state {
set fw(value: boolean) {
pb_1.Message.setField(this, 5, value);
}
get force() {
return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean;
}
set force(value: boolean) {
pb_1.Message.setField(this, 6, value);
}
get sb() {
return pb_1.Message.getFieldWithDefault(this, 7, false) as boolean;
}
set sb(value: boolean) {
pb_1.Message.setField(this, 7, value);
}
get dwsb() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set dwsb(value: boolean) {
pb_1.Message.setField(this, 8, value);
}
get fwsb() {
return pb_1.Message.getFieldWithDefault(this, 9, false) as boolean;
}
set fwsb(value: boolean) {
pb_1.Message.setField(this, 9, value);
}
get jc() {
return pb_1.Message.getFieldWithDefault(this, 10, false) as boolean;
}
set jc(value: boolean) {
pb_1.Message.setField(this, 10, value);
}
get qdc() {
return pb_1.Message.getFieldWithDefault(this, 11, false) as boolean;
}
set qdc(value: boolean) {
pb_1.Message.setField(this, 11, value);
}
get qfc() {
return pb_1.Message.getFieldWithDefault(this, 12, false) as boolean;
}
set qfc(value: boolean) {
pb_1.Message.setField(this, 12, value);
}
get qyc() {
return pb_1.Message.getFieldWithDefault(this, 13, false) as boolean;
}
set qyc(value: boolean) {
pb_1.Message.setField(this, 13, value);
}
get dc() {
return pb_1.Message.getFieldWithDefault(this, 14, false) as boolean;
}
set dc(value: boolean) {
pb_1.Message.setField(this, 14, value);
}
get fc() {
return pb_1.Message.getFieldWithDefault(this, 15, false) as boolean;
}
set fc(value: boolean) {
pb_1.Message.setField(this, 15, value);
}
get yc() {
return pb_1.Message.getFieldWithDefault(this, 16, false) as boolean;
}
set yc(value: boolean) {
pb_1.Message.setField(this, 16, value);
}
static fromObject(data: {
id?: string;
normal?: boolean;
reverse?: boolean;
dw?: boolean;
fw?: boolean;
force?: boolean;
sb?: boolean;
dwsb?: boolean;
fwsb?: boolean;
jc?: boolean;
qdc?: boolean;
qfc?: boolean;
qyc?: boolean;
dc?: boolean;
fc?: boolean;
yc?: boolean;
}): SwitchState {
const message = new SwitchState({});
if (data.id != null) {
@ -296,6 +417,39 @@ export namespace state {
if (data.fw != null) {
message.fw = data.fw;
}
if (data.force != null) {
message.force = data.force;
}
if (data.sb != null) {
message.sb = data.sb;
}
if (data.dwsb != null) {
message.dwsb = data.dwsb;
}
if (data.fwsb != null) {
message.fwsb = data.fwsb;
}
if (data.jc != null) {
message.jc = data.jc;
}
if (data.qdc != null) {
message.qdc = data.qdc;
}
if (data.qfc != null) {
message.qfc = data.qfc;
}
if (data.qyc != null) {
message.qyc = data.qyc;
}
if (data.dc != null) {
message.dc = data.dc;
}
if (data.fc != null) {
message.fc = data.fc;
}
if (data.yc != null) {
message.yc = data.yc;
}
return message;
}
toObject() {
@ -305,6 +459,17 @@ export namespace state {
reverse?: boolean;
dw?: boolean;
fw?: boolean;
force?: boolean;
sb?: boolean;
dwsb?: boolean;
fwsb?: boolean;
jc?: boolean;
qdc?: boolean;
qfc?: boolean;
qyc?: boolean;
dc?: boolean;
fc?: boolean;
yc?: boolean;
} = {};
if (this.id != null) {
data.id = this.id;
@ -321,6 +486,39 @@ export namespace state {
if (this.fw != null) {
data.fw = this.fw;
}
if (this.force != null) {
data.force = this.force;
}
if (this.sb != null) {
data.sb = this.sb;
}
if (this.dwsb != null) {
data.dwsb = this.dwsb;
}
if (this.fwsb != null) {
data.fwsb = this.fwsb;
}
if (this.jc != null) {
data.jc = this.jc;
}
if (this.qdc != null) {
data.qdc = this.qdc;
}
if (this.qfc != null) {
data.qfc = this.qfc;
}
if (this.qyc != null) {
data.qyc = this.qyc;
}
if (this.dc != null) {
data.dc = this.dc;
}
if (this.fc != null) {
data.fc = this.fc;
}
if (this.yc != null) {
data.yc = this.yc;
}
return data;
}
serialize(): Uint8Array;
@ -337,6 +535,28 @@ export namespace state {
writer.writeBool(4, this.dw);
if (this.fw != false)
writer.writeBool(5, this.fw);
if (this.force != false)
writer.writeBool(6, this.force);
if (this.sb != false)
writer.writeBool(7, this.sb);
if (this.dwsb != false)
writer.writeBool(8, this.dwsb);
if (this.fwsb != false)
writer.writeBool(9, this.fwsb);
if (this.jc != false)
writer.writeBool(10, this.jc);
if (this.qdc != false)
writer.writeBool(11, this.qdc);
if (this.qfc != false)
writer.writeBool(12, this.qfc);
if (this.qyc != false)
writer.writeBool(13, this.qyc);
if (this.dc != false)
writer.writeBool(14, this.dc);
if (this.fc != false)
writer.writeBool(15, this.fc);
if (this.yc != false)
writer.writeBool(16, this.yc);
if (!w)
return writer.getResultBuffer();
}
@ -361,6 +581,39 @@ export namespace state {
case 5:
message.fw = reader.readBool();
break;
case 6:
message.force = reader.readBool();
break;
case 7:
message.sb = reader.readBool();
break;
case 8:
message.dwsb = reader.readBool();
break;
case 9:
message.fwsb = reader.readBool();
break;
case 10:
message.jc = reader.readBool();
break;
case 11:
message.qdc = reader.readBool();
break;
case 12:
message.qfc = reader.readBool();
break;
case 13:
message.qyc = reader.readBool();
break;
case 14:
message.dc = reader.readBool();
break;
case 15:
message.fc = reader.readBool();
break;
case 16:
message.yc = reader.readBool();
break;
default: reader.skipField();
}
}

View File

@ -55,7 +55,10 @@ export namespace request {
SetSB = 5,
CancelSB = 6,
SetJC = 7,
CancelJC = 8
CancelJC = 8,
ForceDw = 9,
ForceFw = 10,
CancelForce = 11
}
}
export class TurnoutOperationReq extends pb_1.Message {
@ -291,11 +294,13 @@ export namespace request {
}
}
export namespace Section {
export enum AxleOperation {
Drst = 0,
Pdrst = 1,
TrainIn = 2,
TrainOut = 3
export enum Operation {
SetDrst = 0,
CancelDrst = 1,
SetPdrst = 2,
CancelPdrst = 3,
SetFaultOcc = 4,
CancelFaultOcc = 5
}
}
}