紧急关闭按钮添加地图Code和批量添加

This commit is contained in:
joylink_zhaoerwei 2024-02-02 17:19:38 +08:00
parent c487a649d4
commit a9e4416b0e
7 changed files with 112 additions and 11 deletions

View File

@ -18,6 +18,14 @@
@update:model-value="onUpdate"
label="关联站台"
></q-select>
<q-select
outlined
class="q-mt-sm"
@blur="onUpdate"
v-model="esbButtonModel.refEsbButtonMapCode"
:options="pslNameList"
label="关联PSL地图"
/>
</q-form>
</template>
@ -25,8 +33,10 @@
import { EsbButtonData } from 'src/drawApp/graphics/EsbButtonInteraction';
import { useFormData } from 'src/components/DrawAppFormUtils';
import { useDrawStore } from 'src/stores/draw-store';
import { onMounted, reactive } from 'vue';
import { onMounted, reactive, ref } from 'vue';
import { Platform } from 'src/graphics/platform/Platform';
import { getPublishList } from 'src/api/PublishApi';
import { PictureType } from 'src/protos/picture';
const drawStore = useDrawStore();
const platformList: { label: string; value: number }[] = reactive([]);
@ -35,8 +45,22 @@ const { data: esbButtonModel, onUpdate } = useFormData(
new EsbButtonData(),
drawStore.getDrawApp()
);
const pslNameList = ref<string[]>([]);
onMounted(() => {
const list2: string[] = [];
getPublishList({
type: PictureType.Psl,
category: useDrawStore().categoryType,
}).then((pslMapList) => {
if (pslMapList && pslMapList.length) {
pslMapList.forEach((item) => {
list2.push(item.name);
});
}
pslNameList.value = list2;
});
const platforms = drawStore
.getDrawApp()
.queryStore.queryByType<Platform>(Platform.Type);

View File

@ -80,7 +80,10 @@
</template>
</q-select>
<q-select
v-if="gatedBoxSetProperty.refGatedBoxMapCode"
v-if="
commonSetProperty.commonRefGatedBoxMapCode ||
commonSetProperty.oneDeviceTypeOfPSL
"
outlined
bottom-slots
v-model="refGatedBoxMapCode"
@ -155,6 +158,10 @@ import {
findCommonElements,
handleCentralizedStationsData,
} from 'src/graphics/concentrationDividingLine/ConcentrationDividingLineUtils';
import { EsbButton } from 'src/graphics/esbButton/EsbButton';
import { EsbButtonData } from 'src/drawApp/graphics/EsbButtonInteraction';
import { ZdwxEsb } from 'src/graphics/esbButton/ZdwxEsb';
import { ZdwxEsbData } from 'src/drawApp/graphics/ZdwxEsbInteraction';
const drawStore = useDrawStore();
const $q = useQuasar();
@ -196,7 +203,17 @@ const transponderSetProperty = ref<{
const gatedBoxSetProperty = ref<{
[key: string]: boolean;
}>({
refGatedBoxMapCode: false,
commonRefGatedBoxMapCode: false,
});
const esbButtonSetProperty = ref<{
[key: string]: boolean;
}>({
commonRefGatedBoxMapCode: false,
});
const ZdwxEsbSetProperty = ref<{
[key: string]: boolean;
}>({
commonRefGatedBoxMapCode: false,
});
const screenDoorSetProperty = ref<{
[key: string]: boolean;
@ -215,6 +232,8 @@ const commonSetProperty = ref<{
oneDeviceTypeOfJZZ: false, //
commonCodeEndings: false,
oneDeviceTypeOfCCE: false,
commonRefGatedBoxMapCode: false, //PSL
oneDeviceTypeOfPSL: false,
});
const allDeviceProperty = [
@ -226,6 +245,8 @@ const allDeviceProperty = [
{ type: AxleCounting.Type, setProperty: axleCountingSetProperty }, //
{ type: Transponder.Type, setProperty: transponderSetProperty }, //
{ type: GatedBox.Type, setProperty: gatedBoxSetProperty }, //PSLCode
{ type: EsbButton.Type, setProperty: esbButtonSetProperty }, //PSLCode
{ type: ZdwxEsb.Type, setProperty: ZdwxEsbSetProperty }, //PSLCode
{ type: ScreenDoor.Type, setProperty: screenDoorSetProperty }, //
{ type: Platform.Type, setProperty: platformSetProperty }, //
];
@ -452,15 +473,31 @@ const pslNameList = ref<string[]>([]);
function setGatedBoxPslName() {
if (refGatedBoxMapCode.value) {
$q.dialog({
message: `确定批量设置选中门控箱关联的PSL地图为【${refGatedBoxMapCode.value}】吗?`,
message: `确定批量设置选中门控箱和紧急关闭按钮关联的PSL地图为【${refGatedBoxMapCode.value}】吗?`,
cancel: true,
}).onOk(() => {
drawStore.selectedGraphics?.forEach((gatedBox) => {
const data = new GatedBoxData();
data.copyFrom(gatedBox.saveData());
if (data.refGatedBoxMapCode !== refIbpMapCode.value) {
data.refGatedBoxMapCode = refGatedBoxMapCode.value;
gatedBox.updateData(data);
drawStore.selectedGraphics?.forEach((device) => {
if (device instanceof GatedBox) {
const data = new GatedBoxData();
data.copyFrom(device.saveData());
if (data.refGatedBoxMapCode !== refIbpMapCode.value) {
data.refGatedBoxMapCode = refGatedBoxMapCode.value;
device.updateData(data);
}
} else if (device instanceof EsbButton) {
const data = new EsbButtonData();
data.copyFrom(device.saveData());
if (data.refEsbButtonMapCode !== refIbpMapCode.value) {
data.refEsbButtonMapCode = refGatedBoxMapCode.value;
device.updateData(data);
}
} else {
const data = new ZdwxEsbData();
data.copyFrom(device.saveData());
if (data.refEsbButtonMapCode !== refIbpMapCode.value) {
data.refEsbButtonMapCode = refGatedBoxMapCode.value;
device.updateData(data);
}
}
});
refGatedBoxMapCode.value = '';

View File

@ -53,6 +53,12 @@ export class EsbButtonData extends GraphicDataBase implements IEsbButtonData {
set refStand(v: number) {
this.data.refStand = v;
}
get refEsbButtonMapCode(): string {
return this.data.refEsbButtonMapCode;
}
set refEsbButtonMapCode(v: string) {
this.data.refEsbButtonMapCode = v;
}
clone(): EsbButtonData {
return new EsbButtonData(this.data.cloneMessage());
}
@ -66,7 +72,8 @@ export class EsbButtonData extends GraphicDataBase implements IEsbButtonData {
export class EsbButtonState
extends GraphicStateBase
implements IEsbButtonState {
implements IEsbButtonState
{
constructor(data?: state.ButtonState) {
let ibpButtonState;
if (data) {

View File

@ -53,6 +53,12 @@ export class ZdwxEsbData extends GraphicDataBase implements IZdwxEsbData {
set refStand(v: number) {
this.data.refStand = v;
}
get refEsbButtonMapCode(): string {
return this.data.refEsbButtonMapCode;
}
set refEsbButtonMapCode(v: string) {
this.data.refEsbButtonMapCode = v;
}
clone(): ZdwxEsbData {
return new ZdwxEsbData(this.data.cloneMessage());
}

View File

@ -14,6 +14,8 @@ export interface IEsbButtonData extends GraphicData {
set flip(v: boolean);
get refStand(): number;
set refStand(v: number);
get refEsbButtonMapCode(): string;
set refEsbButtonMapCode(v: string);
clone(): IEsbButtonData;
copyFrom(data: IEsbButtonData): void;
eq(other: IEsbButtonData): boolean;

View File

@ -14,6 +14,8 @@ export interface IZdwxEsbData extends GraphicData {
set flip(v: boolean);
get refStand(): number;
set refStand(v: number);
get refEsbButtonMapCode(): string;
set refEsbButtonMapCode(v: string);
clone(): IZdwxEsbData;
copyFrom(data: IZdwxEsbData): void;
eq(other: IZdwxEsbData): boolean;

View File

@ -6920,6 +6920,7 @@ export namespace graphicData {
flip?: boolean;
oldrefStand?: string;
refStand?: number;
refEsbButtonMapCode?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
@ -6939,6 +6940,9 @@ export namespace graphicData {
if ("refStand" in data && data.refStand != undefined) {
this.refStand = data.refStand;
}
if ("refEsbButtonMapCode" in data && data.refEsbButtonMapCode != undefined) {
this.refEsbButtonMapCode = data.refEsbButtonMapCode;
}
}
}
get common() {
@ -6974,12 +6978,19 @@ export namespace graphicData {
set refStand(value: number) {
pb_1.Message.setField(this, 7, value);
}
get refEsbButtonMapCode() {
return pb_1.Message.getFieldWithDefault(this, 8, "") as string;
}
set refEsbButtonMapCode(value: string) {
pb_1.Message.setField(this, 8, value);
}
static fromObject(data: {
common?: ReturnType<typeof CommonInfo.prototype.toObject>;
code?: string;
flip?: boolean;
oldrefStand?: string;
refStand?: number;
refEsbButtonMapCode?: string;
}): EsbButton {
const message = new EsbButton({});
if (data.common != null) {
@ -6997,6 +7008,9 @@ export namespace graphicData {
if (data.refStand != null) {
message.refStand = data.refStand;
}
if (data.refEsbButtonMapCode != null) {
message.refEsbButtonMapCode = data.refEsbButtonMapCode;
}
return message;
}
toObject() {
@ -7006,6 +7020,7 @@ export namespace graphicData {
flip?: boolean;
oldrefStand?: string;
refStand?: number;
refEsbButtonMapCode?: string;
} = {};
if (this.common != null) {
data.common = this.common.toObject();
@ -7022,6 +7037,9 @@ export namespace graphicData {
if (this.refStand != null) {
data.refStand = this.refStand;
}
if (this.refEsbButtonMapCode != null) {
data.refEsbButtonMapCode = this.refEsbButtonMapCode;
}
return data;
}
serialize(): Uint8Array;
@ -7038,6 +7056,8 @@ export namespace graphicData {
writer.writeString(6, this.oldrefStand);
if (this.refStand != 0)
writer.writeUint32(7, this.refStand);
if (this.refEsbButtonMapCode.length)
writer.writeString(8, this.refEsbButtonMapCode);
if (!w)
return writer.getResultBuffer();
}
@ -7062,6 +7082,9 @@ export namespace graphicData {
case 7:
message.refStand = reader.readUint32();
break;
case 8:
message.refEsbButtonMapCode = reader.readString();
break;
default: reader.skipField();
}
}