屏蔽门操作调整

This commit is contained in:
fan 2023-12-08 17:30:02 +08:00
parent 664a085d92
commit dac8fdb79a
7 changed files with 82 additions and 42 deletions

@ -1 +1 @@
Subproject commit 4073cc1757807350f46b53eb9229707dbe2934b4
Subproject commit 13ed3c733cea89b06b95d2cc6ac4912ade8cb75a

View File

@ -239,6 +239,7 @@ export async function screenDoorOperate(data: {
deviceId: string;
operation: number;
asdCodes?: number[];
group?: number;
}) {
return await api.post(`${UriBase}/psd/operation`, data);
}

View File

@ -5,7 +5,7 @@
<q-btn-dropdown color="primary" label="操作">
<q-list>
<q-item
v-for="(item, index) in options"
v-for="(item, index) in operationOptions"
:key="index"
clickable
v-close-popup
@ -144,24 +144,19 @@ const selectAsd = ref(false);
const asdCodes = ref<number[]>([]);
const asdOptions = ref<number[]>([]);
let asdOperation: null | request.Psd.Operation = null;
const operationOptions = ref<
{ label: string; value: request.Psd.Operation; group?: number }[]
>([]);
const options = [
{
label: '四编组开门',
value: request.Psd.Operation.Km4,
},
{
label: '取消四编组开门',
value: request.Psd.Operation.CancelKm4,
},
{
label: '八编组开门',
value: request.Psd.Operation.Km8,
},
{
label: '取消八编组开门',
value: request.Psd.Operation.CancelKm8,
},
// {
// label: '',
// value: request.Psd.Operation.Km,
// },
// {
// label: '',
// value: request.Psd.Operation.CancelKm,
// },
{
label: '关门',
value: request.Psd.Operation.Gm,
@ -170,22 +165,14 @@ const options = [
label: '取消关门',
value: request.Psd.Operation.CancelGm,
},
{
label: '强制四编组开门',
value: request.Psd.Operation.ForceKm4,
},
{
label: '强制八编组开门',
value: request.Psd.Operation.ForceKm8,
},
// {
// label: '',
// value: request.Psd.Operation.ForceKm,
// },
{
label: '强制关门',
value: request.Psd.Operation.Gm,
},
{
label: '取消强制',
value: request.Psd.Operation.CancelForce,
},
{
label: '滑动门无法开门',
value: request.Psd.Operation.AsdCannotOpen,
@ -216,7 +203,30 @@ watch(
);
function initScreenDoorState(screenDoor: ScreenDoor) {
code.value = screenDoor.datas.code;
operationOptions.value = [];
asdOptions.value = [];
if (lineStore.screenDoorGroupList.length) {
lineStore.screenDoorGroupList.forEach((item) => {
operationOptions.value.push({
label: `${item.trainGroupAmount}编组开门`,
value: request.Psd.Operation.Km,
group: item.trainGroupAmount,
});
operationOptions.value.push({
label: `取消${item.trainGroupAmount}编组开门`,
value: request.Psd.Operation.CancelKm,
group: item.trainGroupAmount,
});
operationOptions.value.push({
label: `强制${item.trainGroupAmount}编组开门`,
value: request.Psd.Operation.ForceKm,
group: item.trainGroupAmount,
});
});
}
options.forEach((option) => {
operationOptions.value.push(option);
});
if (screenDoor.datas.sonDoorAmount) {
for (let i = 1; i <= screenDoor.datas.sonDoorAmount; i++) {
asdOptions.value.push(i);
@ -236,6 +246,7 @@ function initScreenDoorState(screenDoor: ScreenDoor) {
function doScreenDoorOperation(item: {
label: string;
value: request.Psd.Operation;
group?: number;
}) {
const list = [
request.Psd.Operation.CancelAsdCannotClose,
@ -254,6 +265,7 @@ function doScreenDoorOperation(item: {
mapId,
deviceId: screenDoorState.value.code,
operation: item.value,
group: item.group,
}).catch((err) => {
errorNotify('操作失败', { message: err.origin.response.data.title });
});

View File

@ -7,10 +7,10 @@ function getHost(): string {
// return '192.168.3.7:9091';
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
// return '192.168.3.15:9091';
return '192.168.3.15: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

@ -451,8 +451,10 @@ export async function loadLineDatas(): Promise<IGraphicStorage> {
console.log('加载数据', storage);
// app.updateCanvas(storage.canvas);
kilometerConvertMap.set(lineStore.sceneName, storage.kilometerConvertList);
const datas: GraphicData[] = [];
lineStore.setScreenDoorGroupList(
storage.screenDoorConfig.screenDoorGroupList
);
storage.Platforms.forEach((platform) => {
datas.push(new PlatformData(platform));
});

View File

@ -346,15 +346,12 @@ export namespace request {
export namespace Psd {
export enum Operation {
Undefined = 0,
Km4 = 1,
CancelKm4 = 2,
Km8 = 3,
CancelKm8 = 4,
Gm = 5,
CancelGm = 6,
ForceKm4 = 7,
ForceKm8 = 8,
ForceGm = 9,
Km = 1,
CancelKm = 2,
Gm = 3,
CancelGm = 4,
ForceKm = 5,
ForceGm = 6,
CancelForce = 10,
AsdCannotOpen = 11,
CancelAsdCannotOpen = 12,
@ -374,6 +371,7 @@ export namespace request {
deviceId?: string;
operation?: Psd.Operation;
asdCodes?: number[];
group?: number;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5], this.#one_of_decls);
@ -393,6 +391,9 @@ export namespace request {
if ("asdCodes" in data && data.asdCodes != undefined) {
this.asdCodes = data.asdCodes;
}
if ("group" in data && data.group != undefined) {
this.group = data.group;
}
}
}
get simulationId() {
@ -425,12 +426,19 @@ export namespace request {
set asdCodes(value: number[]) {
pb_1.Message.setField(this, 5, value);
}
get group() {
return pb_1.Message.getFieldWithDefault(this, 6, 0) as number;
}
set group(value: number) {
pb_1.Message.setField(this, 6, value);
}
static fromObject(data: {
simulationId?: string;
mapId?: number;
deviceId?: string;
operation?: Psd.Operation;
asdCodes?: number[];
group?: number;
}): PsdOperationReq {
const message = new PsdOperationReq({});
if (data.simulationId != null) {
@ -448,6 +456,9 @@ export namespace request {
if (data.asdCodes != null) {
message.asdCodes = data.asdCodes;
}
if (data.group != null) {
message.group = data.group;
}
return message;
}
toObject() {
@ -457,6 +468,7 @@ export namespace request {
deviceId?: string;
operation?: Psd.Operation;
asdCodes?: number[];
group?: number;
} = {};
if (this.simulationId != null) {
data.simulationId = this.simulationId;
@ -473,6 +485,9 @@ export namespace request {
if (this.asdCodes != null) {
data.asdCodes = this.asdCodes;
}
if (this.group != null) {
data.group = this.group;
}
return data;
}
serialize(): Uint8Array;
@ -489,6 +504,8 @@ export namespace request {
writer.writeEnum(4, this.operation);
if (this.asdCodes.length)
writer.writePackedInt32(5, this.asdCodes);
if (this.group != 0)
writer.writeInt32(6, this.group);
if (!w)
return writer.getResultBuffer();
}
@ -513,6 +530,9 @@ export namespace request {
case 5:
message.asdCodes = reader.readPackedInt32();
break;
case 6:
message.group = reader.readInt32();
break;
default: reader.skipField();
}
}

View File

@ -19,6 +19,7 @@ import { Train } from 'src/graphics/train/Train';
import { TrainState } from 'src/drawApp/graphics/TrainInteraction';
import { esbButtonOperation } from 'src/api/Simulation';
import { TrainConfigItem, getAllTrainList } from 'src/api/TrainModelApi';
import { graphicData } from 'src/protos/stationLayoutGraphics';
export const useLineStore = defineStore('line', {
state: () => ({
@ -36,6 +37,7 @@ export const useLineStore = defineStore('line', {
echartsTrainId: '',
trainStateMap: new Map() as Map<Date, TrainState[]>,
trainConfigList: null as TrainConfigItem[] | null,
screenDoorGroupList: [] as graphicData.ScreenDoorGroup[],
}),
getters: {
selectedGraphicType: (state) => {
@ -152,5 +154,8 @@ export const useLineStore = defineStore('line', {
this.trainConfigList = [];
});
},
setScreenDoorGroupList(screenDoorGroupList: graphicData.ScreenDoorGroup[]) {
this.screenDoorGroupList = screenDoorGroupList;
},
},
});