地图数据添加组合暂提

This commit is contained in:
fan 2023-10-12 13:23:04 +08:00
parent 3d7b75fb78
commit a269851c53
7 changed files with 759 additions and 3 deletions

@ -1 +1 @@
Subproject commit 85290a8ba96ee41ab47a61f44e913f308c8599d7
Subproject commit 6a2a393bf035066167d68d8538a8160aa866da4e

View File

@ -0,0 +1,151 @@
<template>
<draggable-dialog
seamless
@show="onDialogShow"
title="车站关联的设备"
:width="600"
:height="0"
>
<template v-slot:footer>
<q-table
ref="tableRef"
row-key="id"
v-model:pagination="pagination"
:loading="loading"
:rows="rows"
:columns="columns"
@request="onRequest"
:rows-per-page-options="[5, 10, 20, 50]"
>
<template v-slot:body-cell="props">
<q-td :props="props" class="custom-column">
{{ props.value }}
</q-td>
</template>
<template v-slot:body-cell-operations="props">
<q-td :props="props">
<div class="q-gutter-sm row justify-center">
<q-btn color="primary" label="编辑" @click="onEdit(props.row)" />
<q-btn color="red" label="删除" @click="deleteData(props.row)" />
</div>
</q-td>
</template>
</q-table>
</template>
<template v-slot:titleButton>
<q-btn
color="primary"
label="新建"
style="margin-right: 10px"
@click="creatData"
/>
</template>
</draggable-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { QTable, useQuasar } from 'quasar';
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
import {
deleteStationRelateDevice,
loadStationRelateDeviceList,
RelateDevicelistItem,
} from 'src/drawApp/thApp';
import { useDrawStore } from 'src/stores/draw-store';
const drawStore = useDrawStore();
const $q = useQuasar();
const tableRef = ref<QTable>();
const deviceTypeMap = {
6: '车站',
};
const columns: QTable['columns'] = [
{
name: 'deviceType',
label: '设备类型',
field: (row) => deviceTypeMap[row.deviceType as keyof typeof deviceTypeMap],
align: 'center',
},
{ name: 'code', label: '设备编号', field: 'code', align: 'center' },
{
name: 'combinationtypes',
label: '关联的组合类型',
field: (row: RelateDevicelistItem) => {
if (row.combinationtypes) {
const ref = row.combinationtypes.map(
(combinationtype) => combinationtype.code
);
return ref.join('\\');
}
},
align: 'center',
},
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
];
const rows = ref<RelateDevicelistItem[]>([]);
const loading = ref(false);
const pagination = ref({
sortBy: 'desc',
descending: false,
page: 1,
rowsPerPage: 10,
rowsNumber: 10,
});
const onRequest: QTable['onRequest'] = async (props) => {
const { page, rowsPerPage } = props.pagination;
loading.value = true;
const refDatas = loadStationRelateDeviceList();
pagination.value.rowsNumber = refDatas.length;
pagination.value.page = page;
pagination.value.rowsPerPage = rowsPerPage;
rows.value = refDatas.slice((page - 1) * rowsPerPage, page * rowsPerPage);
loading.value = false;
};
const onDialogShow = () => {
tableRef.value?.requestServerInteraction();
drawStore.table = tableRef.value;
};
const props = defineProps<{
onEditClick: (row: RelateDevicelistItem) => void;
}>();
function onEdit(row: RelateDevicelistItem) {
drawStore.showRelateDeviceConfig = true;
setTimeout(() => {
props.onEditClick(row);
}, 0);
}
function creatData() {
drawStore.showRelateDeviceConfig = true;
}
function deleteData(row: RelateDevicelistItem) {
$q.dialog({ message: `确定删除 "${row.code}" 吗?`, cancel: true }).onOk(
async () => {
try {
deleteStationRelateDevice(row);
successNotify('删除数据成功!');
} catch (err) {
errorNotify('删除失败:', err);
} finally {
tableRef.value?.requestServerInteraction();
}
}
);
}
</script>
<style scoped>
.custom-column {
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@ -0,0 +1,327 @@
<template>
<div v-if="showRangeConfig">
<q-card class="q-gutter-sm q-pa-sm">
<q-card-section>
<div class="text-h6">{{ handleState }}</div>
</q-card-section>
<q-separator inset></q-separator>
<q-form ref="myForm" @submit="onSubmit" @reset="onReset">
<q-select
outlined
v-model="relateDeviceConfig.deviceType"
:options="optionsType"
label="设备类型"
:map-options="true"
:emit-value="true"
:rules="[(val) => val != '' || '设备类型不能为空']"
/>
<q-input
outlined
label="设备编号"
v-model="relateDeviceConfig.code"
:rules="[(val) => val.trim() != '' || '名称不能为空']"
/>
<q-list bordered separator class="rounded-borders">
<q-expansion-item
expand-separator
v-for="(
combinationtype, index
) in relateDeviceConfig.combinationtypes"
:key="index"
v-model="combinationtype.expanded"
:label="combinationtype.code"
@click="toggleItem(index)"
>
<q-card>
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-input
outlined
v-model="combinationtype.code"
label="组合类型"
lazy-rules
/>
<div class="q-gutter-sm row">
<q-chip
v-for="item in combinationtype.refDevicesCode"
:key="item"
square
color="primary"
text-color="white"
removable
@remove="removeSelect(item)"
>
{{ item }}
</q-chip>
</div>
<div>
<q-btn
v-show="combinationtype.refDevicesCode.length > 0"
style="width: 130px"
label="清空框选的设备"
color="red"
class="q-mr-md"
@click="clearAllSelect(index)"
/>
<q-btn
label="删除组合类型"
color="secondary"
@click="deleteCombinationtype(index)"
/>
</div>
</q-item-section>
</q-item>
</q-card>
</q-expansion-item>
</q-list>
<q-btn
class="q-mt-md"
label="增加组合类型"
color="secondary"
@click="addCombinationtype"
/>
<div class="q-gutter-sm q-pa-md row justify-center">
<q-btn label="提交" type="submit" color="primary" class="q-mr-md" />
<q-btn label="重置" type="reset" color="primary" class="q-mr-md" />
<q-btn label="返回" color="primary" @click="goBack" />
</div>
</q-form>
</q-card>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue';
import { QForm, useQuasar } from 'quasar';
import { JlGraphic } from 'src/jl-graphic';
import { usePslDrawStore } from 'src/stores/psl-draw-store';
import { PslKey } from 'src/graphics/pslKey/pslKey';
import { PslButton } from 'src/graphics/pslButton/pslButton';
import { PslLight } from 'src/graphics/pslLight/pslLight';
import { pslGraphicData } from 'src/protos/pslGraphics';
import {
creatGatedRelateDevice,
editGatedRelateDevice,
RelateDevicelistItem,
} from 'src/drawApp/pslApp';
import { graphicData } from 'src/protos/stationLayoutGraphics';
defineExpose({ editRelateDevices });
const pslDrawStore = usePslDrawStore();
const $q = useQuasar();
const showRangeConfig = ref(true);
const relateDeviceConfig = ref<{
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
refDevicesCode: string[];
expanded: boolean;
}[];
}>({
deviceType: undefined,
code: '',
combinationtypes: [
{ code: '组合类型', refDevices: [], refDevicesCode: [], expanded: false },
],
});
const handleState = ref('新建车站关联设备');
const optionsType = [
{ label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout },
{ label: '信号机', value: graphicData.RelatedRef.DeviceType.signal },
];
let selectGraphic: JlGraphic[] = [];
watch(
() => pslDrawStore.selectedGraphics,
(val) => {
if (val && val.length > 0 && clickIndex !== null) {
const selectFilter = pslDrawStore.selectedGraphics?.filter(
(g) =>
g.type == PslKey.Type ||
g.type == PslButton.Type ||
g.type == PslLight.Type
) as JlGraphic[];
selectGraphic.push(...selectFilter);
selectGraphic = Array.from(new Set(selectGraphic));
pslDrawStore.getDrawApp().updateSelected(...selectGraphic);
relateDeviceConfig.value.combinationtypes[clickIndex].refDevicesCode =
selectGraphic.map((g) =>
(g as PslKey | PslButton | PslLight).datas.code == ''
? g.id
: (g as PslKey | PslButton | PslLight).datas.code
);
relateDeviceConfig.value.combinationtypes[clickIndex].refDevices =
selectGraphic.map((g) => g.id) as string[];
}
}
);
onMounted(() => {
onReset();
});
const myForm = ref<QForm | null>(null);
let editRow: RelateDevicelistItem;
let handle = ref('');
let handleError = ref('');
async function onSubmit() {
myForm.value?.validate().then(async (res) => {
if (res) {
try {
const combinationtypes: pslGraphicData.Combinationtype[] = [];
relateDeviceConfig.value.combinationtypes.forEach((combinationtype) => {
combinationtypes.push(
new pslGraphicData.Combinationtype({
code: combinationtype.code,
refDevices: combinationtype.refDevices,
})
);
});
const gatedRelateDevice = new pslGraphicData.GatedRelateDevice({
deviceType: relateDeviceConfig.value.deviceType,
code: relateDeviceConfig.value.code,
combinationtypes: combinationtypes,
});
if (handleState.value == '新建车站关联设备') {
handle.value = '创建成功';
handleError.value = '创建失败';
creatGatedRelateDevice(gatedRelateDevice);
} else {
handle.value = '更新成功';
handleError.value = '更新失败';
editGatedRelateDevice(editRow, gatedRelateDevice);
}
pslDrawStore.table?.requestServerInteraction();
$q.notify({
type: 'positive',
message: handle.value,
});
onReset();
showRangeConfig.value = false;
} catch (err) {
$q.notify({
type: 'negative',
message: handleError.value,
});
} finally {
setTimeout(() => {
showRangeConfig.value = true;
}, 0);
}
}
});
}
async function editRelateDevices(row: RelateDevicelistItem) {
try {
const drawApp = pslDrawStore.getDrawApp();
handleState.value = '编辑车站关联设备';
selectGraphic = [];
drawApp.updateSelected();
editRow = row;
relateDeviceConfig.value.deviceType = row.deviceType;
relateDeviceConfig.value.code = row.code;
row.combinationtypes.forEach((combinationtype) => {
const refCode: string[] = [];
combinationtype.refDevices.forEach((id) => {
const g = drawApp.queryStore.queryById(id);
refCode.push(g.code);
});
combinationtype.refDevicesCode = refCode;
combinationtype.expanded = false;
});
relateDeviceConfig.value.combinationtypes = [];
row.combinationtypes.forEach((combinationtype) => {
const { code, refDevices, refDevicesCode, expanded } = combinationtype;
relateDeviceConfig.value.combinationtypes.push({
code,
refDevices,
refDevicesCode: refDevicesCode as string[],
expanded: expanded as boolean,
});
});
} catch (err) {
$q.notify({
type: 'negative',
message: '没有需要编辑的详细信息',
});
}
}
let clickIndex: null | number = null;
function toggleItem(index: number) {
const drawApp = pslDrawStore.getDrawApp();
selectGraphic = [];
drawApp.updateSelected();
const combinationtypes = relateDeviceConfig.value.combinationtypes;
if (combinationtypes[index].expanded == true) {
clickIndex = index;
const select: JlGraphic[] = [];
combinationtypes[index].refDevices.forEach((id: string) => {
const g = drawApp.queryStore.queryById(id);
select.push(g);
});
drawApp.updateSelected(...select);
} else {
clickIndex = null;
}
}
function removeSelect(code: string) {
const clickTarget =
relateDeviceConfig.value.combinationtypes[clickIndex as number];
const removeIndex = clickTarget.refDevicesCode.findIndex(
(item) => item == code
);
selectGraphic.splice(removeIndex, 1);
clickTarget.refDevicesCode.splice(removeIndex, 1);
clickTarget.refDevices.splice(removeIndex, 1);
pslDrawStore.getDrawApp().updateSelected(...selectGraphic);
}
function clearAllSelect(index: number) {
relateDeviceConfig.value.combinationtypes[index].refDevices = [];
relateDeviceConfig.value.combinationtypes[index].refDevicesCode = [];
clearAllSelectAtCanvas();
}
function clearAllSelectAtCanvas() {
selectGraphic = [];
pslDrawStore.getDrawApp().updateSelected();
}
function addCombinationtype() {
relateDeviceConfig.value.combinationtypes.push({
code: '组合类型',
refDevices: [],
refDevicesCode: [],
expanded: false,
});
}
function deleteCombinationtype(index: number) {
relateDeviceConfig.value.combinationtypes.splice(index, 1);
clearAllSelectAtCanvas();
}
function onReset() {
clickIndex = null;
handleState.value = '新建车站关联设备';
relateDeviceConfig.value = {
deviceType: undefined,
code: '',
combinationtypes: [
{ code: '组合类型', refDevices: [], refDevicesCode: [], expanded: false },
],
};
clearAllSelectAtCanvas();
}
function goBack() {
onReset();
pslDrawStore.showRelateDeviceConfig = false;
}
</script>

View File

@ -143,3 +143,53 @@ export function saveThDrawDatas(app: IDrawApp) {
const base64 = fromUint8Array(storage.serialize());
return base64;
}
//关联设备列表的增删改查
export interface RelateDevicelistItem {
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
refDevicesCode?: string[];
expanded?: boolean;
}[];
}
const refDevicesList: graphicData.StationRelateDevice[] = [];
export function loadStationRelateDeviceList() {
return refDevicesList;
}
export function creatStationRelateDevice(row: graphicData.StationRelateDevice) {
refDevicesList.push(row);
thDrawApp?.emit('postdataloaded');
}
export function editStationRelateDevice(
editRow: RelateDevicelistItem,
newData: graphicData.StationRelateDevice
) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == editRow.deviceType &&
refDevicesList[i].code == editRow.code
) {
refDevicesList[i] = newData;
break;
}
}
thDrawApp?.emit('postdataloaded');
}
export function deleteStationRelateDevice(row: RelateDevicelistItem) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == row.deviceType &&
refDevicesList[i].code == row.code
) {
refDevicesList.splice(i, 1);
break;
}
}
}

View File

@ -39,9 +39,10 @@ export namespace graphicData {
UniqueIdPrefix?: UniqueIdOfStationLayout;
kilometerConvertList?: KilometerConvert[];
screenDoors?: ScreenDoor[];
stationRelateDeviceList?: StationRelateDevice[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
@ -124,6 +125,9 @@ export namespace graphicData {
if ("screenDoors" in data && data.screenDoors != undefined) {
this.screenDoors = data.screenDoors;
}
if ("stationRelateDeviceList" in data && data.stationRelateDeviceList != undefined) {
this.stationRelateDeviceList = data.stationRelateDeviceList;
}
}
}
get canvas() {
@ -294,6 +298,12 @@ export namespace graphicData {
set screenDoors(value: ScreenDoor[]) {
pb_1.Message.setRepeatedWrapperField(this, 33, value);
}
get stationRelateDeviceList() {
return pb_1.Message.getRepeatedWrapperField(this, StationRelateDevice, 34) as StationRelateDevice[];
}
set stationRelateDeviceList(value: StationRelateDevice[]) {
pb_1.Message.setRepeatedWrapperField(this, 34, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof Canvas.prototype.toObject>;
Platforms?: ReturnType<typeof Platform.prototype.toObject>[];
@ -322,6 +332,7 @@ export namespace graphicData {
UniqueIdPrefix?: ReturnType<typeof UniqueIdOfStationLayout.prototype.toObject>;
kilometerConvertList?: ReturnType<typeof KilometerConvert.prototype.toObject>[];
screenDoors?: ReturnType<typeof ScreenDoor.prototype.toObject>[];
stationRelateDeviceList?: ReturnType<typeof StationRelateDevice.prototype.toObject>[];
}): RtssGraphicStorage {
const message = new RtssGraphicStorage({});
if (data.canvas != null) {
@ -405,6 +416,9 @@ export namespace graphicData {
if (data.screenDoors != null) {
message.screenDoors = data.screenDoors.map(item => ScreenDoor.fromObject(item));
}
if (data.stationRelateDeviceList != null) {
message.stationRelateDeviceList = data.stationRelateDeviceList.map(item => StationRelateDevice.fromObject(item));
}
return message;
}
toObject() {
@ -436,6 +450,7 @@ export namespace graphicData {
UniqueIdPrefix?: ReturnType<typeof UniqueIdOfStationLayout.prototype.toObject>;
kilometerConvertList?: ReturnType<typeof KilometerConvert.prototype.toObject>[];
screenDoors?: ReturnType<typeof ScreenDoor.prototype.toObject>[];
stationRelateDeviceList?: ReturnType<typeof StationRelateDevice.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -518,6 +533,9 @@ export namespace graphicData {
if (this.screenDoors != null) {
data.screenDoors = this.screenDoors.map((item: ScreenDoor) => item.toObject());
}
if (this.stationRelateDeviceList != null) {
data.stationRelateDeviceList = this.stationRelateDeviceList.map((item: StationRelateDevice) => item.toObject());
}
return data;
}
serialize(): Uint8Array;
@ -578,6 +596,8 @@ export namespace graphicData {
writer.writeRepeatedMessage(32, this.kilometerConvertList, (item: KilometerConvert) => item.serialize(writer));
if (this.screenDoors.length)
writer.writeRepeatedMessage(33, this.screenDoors, (item: ScreenDoor) => item.serialize(writer));
if (this.stationRelateDeviceList.length)
writer.writeRepeatedMessage(34, this.stationRelateDeviceList, (item: StationRelateDevice) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -668,6 +688,9 @@ export namespace graphicData {
case 33:
reader.readMessage(message.screenDoors, () => pb_1.Message.addToRepeatedWrapperField(message, 33, ScreenDoor.deserialize(reader), ScreenDoor));
break;
case 34:
reader.readMessage(message.stationRelateDeviceList, () => pb_1.Message.addToRepeatedWrapperField(message, 34, StationRelateDevice.deserialize(reader), StationRelateDevice));
break;
default: reader.skipField();
}
}
@ -6595,4 +6618,207 @@ export namespace graphicData {
return KilometerConvert.deserialize(bytes);
}
}
export class StationRelateDevice extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code?: string;
combinationtypes?: Combinationtype[];
deviceType?: RelatedRef.DeviceType;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("combinationtypes" in data && data.combinationtypes != undefined) {
this.combinationtypes = data.combinationtypes;
}
if ("deviceType" in data && data.deviceType != undefined) {
this.deviceType = data.deviceType;
}
}
}
get code() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 1, value);
}
get combinationtypes() {
return pb_1.Message.getRepeatedWrapperField(this, Combinationtype, 2) as Combinationtype[];
}
set combinationtypes(value: Combinationtype[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
get deviceType() {
return pb_1.Message.getFieldWithDefault(this, 3, RelatedRef.DeviceType.Section) as RelatedRef.DeviceType;
}
set deviceType(value: RelatedRef.DeviceType) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
code?: string;
combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[];
deviceType?: RelatedRef.DeviceType;
}): StationRelateDevice {
const message = new StationRelateDevice({});
if (data.code != null) {
message.code = data.code;
}
if (data.combinationtypes != null) {
message.combinationtypes = data.combinationtypes.map(item => Combinationtype.fromObject(item));
}
if (data.deviceType != null) {
message.deviceType = data.deviceType;
}
return message;
}
toObject() {
const data: {
code?: string;
combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[];
deviceType?: RelatedRef.DeviceType;
} = {};
if (this.code != null) {
data.code = this.code;
}
if (this.combinationtypes != null) {
data.combinationtypes = this.combinationtypes.map((item: Combinationtype) => item.toObject());
}
if (this.deviceType != null) {
data.deviceType = this.deviceType;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.code.length)
writer.writeString(1, this.code);
if (this.combinationtypes.length)
writer.writeRepeatedMessage(2, this.combinationtypes, (item: Combinationtype) => item.serialize(writer));
if (this.deviceType != RelatedRef.DeviceType.Section)
writer.writeEnum(3, this.deviceType);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StationRelateDevice {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new StationRelateDevice();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.code = reader.readString();
break;
case 2:
reader.readMessage(message.combinationtypes, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Combinationtype.deserialize(reader), Combinationtype));
break;
case 3:
message.deviceType = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): StationRelateDevice {
return StationRelateDevice.deserialize(bytes);
}
}
export class Combinationtype extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code?: string;
refDevices?: string[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("refDevices" in data && data.refDevices != undefined) {
this.refDevices = data.refDevices;
}
}
}
get code() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set code(value: string) {
pb_1.Message.setField(this, 1, value);
}
get refDevices() {
return pb_1.Message.getFieldWithDefault(this, 2, []) as string[];
}
set refDevices(value: string[]) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
code?: string;
refDevices?: string[];
}): Combinationtype {
const message = new Combinationtype({});
if (data.code != null) {
message.code = data.code;
}
if (data.refDevices != null) {
message.refDevices = data.refDevices;
}
return message;
}
toObject() {
const data: {
code?: string;
refDevices?: string[];
} = {};
if (this.code != null) {
data.code = this.code;
}
if (this.refDevices != null) {
data.refDevices = this.refDevices;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.code.length)
writer.writeString(1, this.code);
if (this.refDevices.length)
writer.writeRepeatedString(2, this.refDevices);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Combinationtype {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Combinationtype();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.code = reader.readString();
break;
case 2:
pb_1.Message.addToRepeatedField(message, 2, reader.readString());
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Combinationtype {
return Combinationtype.deserialize(bytes);
}
}
}

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia';
import { CategoryType } from 'src/components/CategoryType';
import { QTable } from 'quasar';
import {
destroyThDrawApp,
getThDrawApp,
@ -27,6 +28,8 @@ export const useDrawStore = defineStore('draw', {
categoryType: null as CategoryType | null,
oneClickType: '',
editKilometerConvertIndex: -1,
table: undefined as QTable | undefined,
showRelateDeviceConfig: false,
}),
getters: {
drawMode: (state) => state.drawAssistant != null,

View File

@ -16,7 +16,6 @@ export const usePslDrawStore = defineStore('pslDraw', {
oneClickType: '',
table: undefined as QTable | undefined,
showRelateDeviceConfig: false,
tableOfCombinationType: undefined as QTable | undefined,
}),
getters: {
drawMode: (state) => state.drawAssistant != null,