采集继电器列表初提交

This commit is contained in:
joylink_zhaoerwei 2023-10-24 17:04:49 +08:00
parent b41a25b95c
commit eb0b8a9655
6 changed files with 742 additions and 2 deletions

View File

@ -0,0 +1,96 @@
<template>
<draggable-dialog seamless title="采集列表" :width="600" :height="500">
<div class="row" v-for="row in setCellMessage.rows" :key="row">
<div
class="ceil"
v-for="col in setCellMessage.cols"
:key="col"
@click="handleCellClick(row, col)"
>
{{ row + '-' + col }}
</div>
</div>
<template v-slot:titleButton>
<q-btn
color="primary"
label="设置"
style="margin-right: 10px"
@click="setCellDialog = true"
/>
</template>
<q-dialog
v-model="setCellDialog"
persistent
transition-show="scale"
transition-hide="scale"
>
<q-card style="width: 300px">
<q-card-section>
<div class="text-h6">采集列表设置</div>
</q-card-section>
<q-card-section>
<q-input
outlined
label="数据集位数"
v-model.number="setCellMessage.rows"
type="number"
lazy-rules
:rules="[(val) => val || '请输入数据集位数!']"
/>
<q-input
outlined
label="数据集个数"
v-model.number="setCellMessage.cols"
type="number"
lazy-rules
:rules="[(val) => val || '请输入数据集个数!']"
/>
</q-card-section>
<q-card-actions align="right">
<q-btn color="primary" label="确认" @click="setCellDialog = false" />
</q-card-actions>
</q-card>
</q-dialog>
</draggable-dialog>
</template>
<script setup lang="ts">
import { ref, watchEffect } from 'vue';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { loadCiCjList, creatCiCjList } from 'src/drawApp/relayCabinetLayoutApp';
const relayCabinetStore = useRelayCabinetStore();
const setCellDialog = ref(false);
const setCellMessage = ref<{ rows: number; cols: number }>({
rows: 32,
cols: 8,
});
const ciCjList = loadCiCjList();
watchEffect(() => {
if (ciCjList == undefined)
creatCiCjList(setCellMessage.value.rows, setCellMessage.value.cols);
});
function handleCellClick(row: number, col: number) {
relayCabinetStore.showCollectionConfig = true;
relayCabinetStore.setEditCollectionConfig({ row, col });
}
</script>
<style scoped>
.row {
display: flex;
}
.ceil {
width: 60px;
height: 30px;
border: solid 1px red;
margin: 7px;
cursor: pointer;
text-align: center;
line-height: 30px;
}
</style>

View File

@ -0,0 +1,217 @@
<template>
<div v-if="showCollectionConfig">
<q-card class="q-gutter-sm q-pa-sm">
<q-card-section>
<div class="text-h6">
{{
'编辑采集' +
relayCabinetStore.editCollectionConfigIndex.row +
'-' +
relayCabinetStore.editCollectionConfigIndex.col
}}
</div>
</q-card-section>
<q-separator inset></q-separator>
<q-form ref="myForm" @submit="onSubmit">
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-list bordered separator class="rounded-borders">
<q-item>
<q-item-section no-wrap class="q-gutter-y-sm column">
<q-item-label> 采集的继电器 </q-item-label>
<div class="q-gutter-sm row">
<q-chip
v-for="item in collectionConfig.refRelaysCode"
:key="item"
square
color="primary"
text-color="white"
removable
@remove="removeSelect(item)"
>
{{ item }}
</q-chip>
</div>
</q-item-section>
</q-item>
</q-list>
<div>
<q-btn
v-show="collectionConfig.refRelaysCode.length > 0"
style="width: 130px"
label="清空框选的继电器"
color="red"
class="q-mr-md"
@click="clearAllSelect()"
/>
</div>
</q-item-section>
</q-item>
<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="返回" color="primary" @click="goBack" />
</div>
</q-form>
</q-card>
</div>
</template>
<script setup lang="ts">
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { QForm, useQuasar } from 'quasar';
import { JlGraphic } from 'src/jl-graphic';
import {
CollectionConfigCeil,
useRelayCabinetStore,
} from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay';
import { loadCiCjList } from 'src/drawApp/relayCabinetLayoutApp';
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
const relayCabinetStore = useRelayCabinetStore();
const $q = useQuasar();
const showCollectionConfig = ref(true);
const collectionConfig = ref<{
code: string;
refRelays: string[];
refRelaysCode: string[];
}>({
code: '',
refRelays: [],
refRelaysCode: [],
});
//
let selectGraphic: JlGraphic[] = [];
watch(
() => relayCabinetStore.selectedGraphics,
(val) => {
if (val && val.length > 0) {
const selectFilter = relayCabinetStore.selectedGraphics?.filter(
(g) => g.type == Relay.Type || g.type == PhaseFailureProtector.Type
) as JlGraphic[];
selectGraphic.push(...selectFilter);
selectGraphic = Array.from(new Set(selectGraphic));
relayCabinetStore.getDrawApp().updateSelected(...selectGraphic);
collectionConfig.value.refRelaysCode = selectGraphic.map(
(g) => (g as Relay).datas.code
) as string[];
collectionConfig.value.refRelays = selectGraphic.map(
(g) => g.id
) as string[];
}
}
);
//
watch(
() => relayCabinetStore.editCollectionConfigIndex,
(val) => {
if (val) {
getEditData();
}
}
);
onMounted(() => {
onReset();
getEditData();
});
function getEditData() {
selectGraphic = [];
const app = relayCabinetStore.getDrawApp();
app.updateSelected();
collectionConfig.value.refRelays = [];
const ciCjList = loadCiCjList();
const click =
relayCabinetStore.editCollectionConfigIndex as CollectionConfigCeil;
ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays.forEach(
(relay) => {
collectionConfig.value.refRelays.push(relay.relayId);
}
);
collectionConfig.value.refRelaysCode = [];
const select: JlGraphic[] = [];
collectionConfig.value.refRelays.forEach((id) => {
const g = app.queryStore.queryById(id) as Relay;
select.push(g);
collectionConfig.value.refRelaysCode.push(g.datas.code);
});
app.updateSelected(...select);
}
const myForm = ref<QForm | null>(null);
async function onSubmit() {
myForm.value?.validate().then(async (res) => {
if (res) {
try {
const ciCjList = loadCiCjList();
const click =
relayCabinetStore.editCollectionConfigIndex as CollectionConfigCeil;
ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays = [];
collectionConfig.value.refRelays.forEach((relayId) => {
ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays.push(
new relayCabinetGraphicData.CjDataItem({ relayId, position: 0 })
);
});
$q.notify({
type: 'positive',
message: '更新成功',
});
showCollectionConfig.value = false;
} catch (err) {
$q.notify({
type: 'negative',
message: '更新失败',
});
} finally {
setTimeout(() => {
showCollectionConfig.value = true;
}, 0);
}
}
});
}
function removeSelect(code: string) {
const removeIndex = collectionConfig.value.refRelaysCode.findIndex(
(item) => item == code
);
selectGraphic.splice(removeIndex, 1);
collectionConfig.value.refRelaysCode.splice(removeIndex, 1);
collectionConfig.value.refRelays.splice(removeIndex, 1);
relayCabinetStore.getDrawApp().updateSelected(...selectGraphic);
}
function clearAllSelect() {
collectionConfig.value.refRelays = [];
collectionConfig.value.refRelaysCode = [];
clearAllSelectAtCanvas();
}
function clearAllSelectAtCanvas() {
selectGraphic = [];
relayCabinetStore.getDrawApp().updateSelected();
}
function onReset() {
collectionConfig.value = {
code: '',
refRelays: [],
refRelaysCode: [],
};
clearAllSelectAtCanvas();
}
function goBack() {
onReset();
relayCabinetStore.showCollectionConfig = false;
}
onUnmounted(() => {
relayCabinetStore.showCollectionConfig = false;
relayCabinetStore.editCollectionConfigIndex = null;
});
</script>

View File

@ -225,6 +225,7 @@ export function saveDrawDatas(app: IDrawApp) {
storage.deviceRelateRelayList = refRelaysList; storage.deviceRelateRelayList = refRelaysList;
storage.combinationtypeList = combinationTypeList; storage.combinationtypeList = combinationTypeList;
storage.UniqueIdPrefix = UniqueIdPrefix; storage.UniqueIdPrefix = UniqueIdPrefix;
storage.ciCjList = ciCjList;
const base64 = fromUint8Array(storage.serialize()); const base64 = fromUint8Array(storage.serialize());
console.log('保存数据', storage); console.log('保存数据', storage);
return base64; return base64;
@ -258,6 +259,7 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
refRelaysList = storage.deviceRelateRelayList; refRelaysList = storage.deviceRelateRelayList;
combinationTypeList = storage.combinationtypeList; combinationTypeList = storage.combinationtypeList;
UniqueIdPrefix = storage.UniqueIdPrefix; UniqueIdPrefix = storage.UniqueIdPrefix;
ciCjList = storage.ciCjList;
return Promise.resolve({ return Promise.resolve({
canvasProperty: storage.canvas, canvasProperty: storage.canvas,
datas: datas, datas: datas,
@ -371,3 +373,21 @@ export function setUniqueIdPrefix(
) { ) {
UniqueIdPrefix = newUniqueIdPrefix; UniqueIdPrefix = newUniqueIdPrefix;
} }
//采集列表的增删改查
let ciCjList = new relayCabinetGraphicData.CiCj();
export function loadCiCjList() {
return ciCjList;
}
export function creatCiCjList(rows: number, cols: number) {
ciCjList = new relayCabinetGraphicData.CiCj();
ciCjList.dsCount = rows;
for (let i = 0; i < cols; i++) {
ciCjList.cjList[i] = new relayCabinetGraphicData.CjDataSet();
ciCjList.cjList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
ciCjList.cjList[i].bitList[j] = new relayCabinetGraphicData.CjData();
}
}
}

View File

@ -74,6 +74,11 @@
<q-item-label>组合类型列表</q-item-label> <q-item-label>组合类型列表</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="openCjList">
<q-item-section>
<q-item-label>采集列表</q-item-label>
</q-item-section>
</q-item>
</q-list> </q-list>
</q-btn-dropdown> </q-btn-dropdown>
<q-btn color="info" label="返回" @click="backConfirm" /> <q-btn color="info" label="返回" @click="backConfirm" />
@ -87,7 +92,8 @@
<draw-relayCabinetProperties <draw-relayCabinetProperties
v-if=" v-if="
!relayCabinetStore.showRelateRelayConfig && !relayCabinetStore.showRelateRelayConfig &&
!relayCabinetStore.showCombinationTypeConfig !relayCabinetStore.showCombinationTypeConfig &&
!relayCabinetStore.showCollectionConfig
" "
></draw-relayCabinetProperties> ></draw-relayCabinetProperties>
<relate-relay-config <relate-relay-config
@ -95,9 +101,10 @@
ref="relateRelayConfigEdit" ref="relateRelayConfigEdit"
></relate-relay-config> ></relate-relay-config>
<combination-type-config <combination-type-config
v-else v-else-if="relayCabinetStore.showCombinationTypeConfig"
ref="combinationTypeConfigEdit" ref="combinationTypeConfigEdit"
></combination-type-config> ></combination-type-config>
<collection-config v-else />
</q-drawer> </q-drawer>
<q-page-container> <q-page-container>
@ -177,6 +184,8 @@ import DeviceRelateRelayList from 'src/components/draw-app/dialogs/DeviceRelateR
import RelateRelayConfig from 'src/components/draw-app/properties/RelateRelayConfig.vue'; import RelateRelayConfig from 'src/components/draw-app/properties/RelateRelayConfig.vue';
import CombinationtypeList from 'src/components/draw-app/dialogs/CombinationtypeList.vue'; import CombinationtypeList from 'src/components/draw-app/dialogs/CombinationtypeList.vue';
import CombinationTypeConfig from 'src/components/draw-app/properties/CombinationTypeConfig.vue'; import CombinationTypeConfig from 'src/components/draw-app/properties/CombinationTypeConfig.vue';
import CollectionList from 'src/components/draw-app/dialogs/CollectionList.vue';
import CollectionConfig from 'src/components/draw-app/properties/CollectionConfig.vue';
import { import {
getDrawApp, getDrawApp,
saveDrawDatas, saveDrawDatas,
@ -429,6 +438,22 @@ function openCombinationTypeList() {
}); });
} }
let collectDialogInstance: DialogChainObject | null = null;
function openCjList() {
if (collectDialogInstance) return;
collectDialogInstance = $q
.dialog({
component: CollectionList,
})
.onCancel(() => {
collectDialogInstance = null;
relayCabinetStore.setEditCollectionConfig(null);
relayCabinetStore.showCollectionConfig = false;
relayCabinetStore.selectedGraphics = [];
relayCabinetStore.getDrawApp().updateSelected();
});
}
function backConfirm() { function backConfirm() {
router.go(-1); router.go(-1);
} }
@ -445,5 +470,8 @@ onUnmounted(() => {
if (combinationTypeDialogInstance) { if (combinationTypeDialogInstance) {
combinationTypeDialogInstance.hide(); combinationTypeDialogInstance.hide();
} }
if (collectDialogInstance) {
collectDialogInstance.hide();
}
}); });
</script> </script>

View File

@ -17,6 +17,7 @@ export namespace relayCabinetGraphicData {
phaseFailureProtectors?: PhaseFailureProtector[]; phaseFailureProtectors?: PhaseFailureProtector[];
combinationtypeList?: Combinationtype[]; combinationtypeList?: Combinationtype[];
signalFaultAlarms?: SignalFaultAlarm[]; signalFaultAlarms?: SignalFaultAlarm[];
ciCjList?: CiCj;
}) { }) {
super(); super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8, 9], this.#one_of_decls); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8, 9], this.#one_of_decls);
@ -45,6 +46,9 @@ export namespace relayCabinetGraphicData {
if ("signalFaultAlarms" in data && data.signalFaultAlarms != undefined) { if ("signalFaultAlarms" in data && data.signalFaultAlarms != undefined) {
this.signalFaultAlarms = data.signalFaultAlarms; this.signalFaultAlarms = data.signalFaultAlarms;
} }
if ("ciCjList" in data && data.ciCjList != undefined) {
this.ciCjList = data.ciCjList;
}
} }
} }
get canvas() { get canvas() {
@ -101,6 +105,15 @@ export namespace relayCabinetGraphicData {
set signalFaultAlarms(value: SignalFaultAlarm[]) { set signalFaultAlarms(value: SignalFaultAlarm[]) {
pb_1.Message.setRepeatedWrapperField(this, 9, value); pb_1.Message.setRepeatedWrapperField(this, 9, value);
} }
get ciCjList() {
return pb_1.Message.getWrapperField(this, CiCj, 10) as CiCj;
}
set ciCjList(value: CiCj) {
pb_1.Message.setWrapperField(this, 10, value);
}
get has_ciCjList() {
return pb_1.Message.getField(this, 10) != null;
}
static fromObject(data: { static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>; canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
relayCabinets?: ReturnType<typeof RelayCabinet.prototype.toObject>[]; relayCabinets?: ReturnType<typeof RelayCabinet.prototype.toObject>[];
@ -110,6 +123,7 @@ export namespace relayCabinetGraphicData {
phaseFailureProtectors?: ReturnType<typeof PhaseFailureProtector.prototype.toObject>[]; phaseFailureProtectors?: ReturnType<typeof PhaseFailureProtector.prototype.toObject>[];
combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[]; combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[];
signalFaultAlarms?: ReturnType<typeof SignalFaultAlarm.prototype.toObject>[]; signalFaultAlarms?: ReturnType<typeof SignalFaultAlarm.prototype.toObject>[];
ciCjList?: ReturnType<typeof CiCj.prototype.toObject>;
}): RelayCabinetGraphicStorage { }): RelayCabinetGraphicStorage {
const message = new RelayCabinetGraphicStorage({}); const message = new RelayCabinetGraphicStorage({});
if (data.canvas != null) { if (data.canvas != null) {
@ -136,6 +150,9 @@ export namespace relayCabinetGraphicData {
if (data.signalFaultAlarms != null) { if (data.signalFaultAlarms != null) {
message.signalFaultAlarms = data.signalFaultAlarms.map(item => SignalFaultAlarm.fromObject(item)); message.signalFaultAlarms = data.signalFaultAlarms.map(item => SignalFaultAlarm.fromObject(item));
} }
if (data.ciCjList != null) {
message.ciCjList = CiCj.fromObject(data.ciCjList);
}
return message; return message;
} }
toObject() { toObject() {
@ -148,6 +165,7 @@ export namespace relayCabinetGraphicData {
phaseFailureProtectors?: ReturnType<typeof PhaseFailureProtector.prototype.toObject>[]; phaseFailureProtectors?: ReturnType<typeof PhaseFailureProtector.prototype.toObject>[];
combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[]; combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[];
signalFaultAlarms?: ReturnType<typeof SignalFaultAlarm.prototype.toObject>[]; signalFaultAlarms?: ReturnType<typeof SignalFaultAlarm.prototype.toObject>[];
ciCjList?: ReturnType<typeof CiCj.prototype.toObject>;
} = {}; } = {};
if (this.canvas != null) { if (this.canvas != null) {
data.canvas = this.canvas.toObject(); data.canvas = this.canvas.toObject();
@ -173,6 +191,9 @@ export namespace relayCabinetGraphicData {
if (this.signalFaultAlarms != null) { if (this.signalFaultAlarms != null) {
data.signalFaultAlarms = this.signalFaultAlarms.map((item: SignalFaultAlarm) => item.toObject()); data.signalFaultAlarms = this.signalFaultAlarms.map((item: SignalFaultAlarm) => item.toObject());
} }
if (this.ciCjList != null) {
data.ciCjList = this.ciCjList.toObject();
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
@ -195,6 +216,8 @@ export namespace relayCabinetGraphicData {
writer.writeRepeatedMessage(8, this.combinationtypeList, (item: Combinationtype) => item.serialize(writer)); writer.writeRepeatedMessage(8, this.combinationtypeList, (item: Combinationtype) => item.serialize(writer));
if (this.signalFaultAlarms.length) if (this.signalFaultAlarms.length)
writer.writeRepeatedMessage(9, this.signalFaultAlarms, (item: SignalFaultAlarm) => item.serialize(writer)); writer.writeRepeatedMessage(9, this.signalFaultAlarms, (item: SignalFaultAlarm) => item.serialize(writer));
if (this.has_ciCjList)
writer.writeMessage(10, this.ciCjList, () => this.ciCjList.serialize(writer));
if (!w) if (!w)
return writer.getResultBuffer(); return writer.getResultBuffer();
} }
@ -228,6 +251,9 @@ export namespace relayCabinetGraphicData {
case 9: case 9:
reader.readMessage(message.signalFaultAlarms, () => pb_1.Message.addToRepeatedWrapperField(message, 9, SignalFaultAlarm.deserialize(reader), SignalFaultAlarm)); reader.readMessage(message.signalFaultAlarms, () => pb_1.Message.addToRepeatedWrapperField(message, 9, SignalFaultAlarm.deserialize(reader), SignalFaultAlarm));
break; break;
case 10:
reader.readMessage(message.ciCjList, () => message.ciCjList = CiCj.deserialize(reader));
break;
default: reader.skipField(); default: reader.skipField();
} }
} }
@ -964,4 +990,347 @@ export namespace relayCabinetGraphicData {
return UniqueIdType.deserialize(bytes); return UniqueIdType.deserialize(bytes);
} }
} }
export class CiCj extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
dsCount?: number;
cjList?: CjDataSet[];
}) {
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 ("dsCount" in data && data.dsCount != undefined) {
this.dsCount = data.dsCount;
}
if ("cjList" in data && data.cjList != undefined) {
this.cjList = data.cjList;
}
}
}
get dsCount() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set dsCount(value: number) {
pb_1.Message.setField(this, 1, value);
}
get cjList() {
return pb_1.Message.getRepeatedWrapperField(this, CjDataSet, 2) as CjDataSet[];
}
set cjList(value: CjDataSet[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
static fromObject(data: {
dsCount?: number;
cjList?: ReturnType<typeof CjDataSet.prototype.toObject>[];
}): CiCj {
const message = new CiCj({});
if (data.dsCount != null) {
message.dsCount = data.dsCount;
}
if (data.cjList != null) {
message.cjList = data.cjList.map(item => CjDataSet.fromObject(item));
}
return message;
}
toObject() {
const data: {
dsCount?: number;
cjList?: ReturnType<typeof CjDataSet.prototype.toObject>[];
} = {};
if (this.dsCount != null) {
data.dsCount = this.dsCount;
}
if (this.cjList != null) {
data.cjList = this.cjList.map((item: CjDataSet) => item.toObject());
}
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.dsCount != 0)
writer.writeInt32(1, this.dsCount);
if (this.cjList.length)
writer.writeRepeatedMessage(2, this.cjList, (item: CjDataSet) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CiCj {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CiCj();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.dsCount = reader.readInt32();
break;
case 2:
reader.readMessage(message.cjList, () => pb_1.Message.addToRepeatedWrapperField(message, 2, CjDataSet.deserialize(reader), CjDataSet));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CiCj {
return CiCj.deserialize(bytes);
}
}
export class CjDataSet extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
name?: string;
bitList?: CjData[];
}) {
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 ("name" in data && data.name != undefined) {
this.name = data.name;
}
if ("bitList" in data && data.bitList != undefined) {
this.bitList = data.bitList;
}
}
}
get name() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set name(value: string) {
pb_1.Message.setField(this, 1, value);
}
get bitList() {
return pb_1.Message.getRepeatedWrapperField(this, CjData, 2) as CjData[];
}
set bitList(value: CjData[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
static fromObject(data: {
name?: string;
bitList?: ReturnType<typeof CjData.prototype.toObject>[];
}): CjDataSet {
const message = new CjDataSet({});
if (data.name != null) {
message.name = data.name;
}
if (data.bitList != null) {
message.bitList = data.bitList.map(item => CjData.fromObject(item));
}
return message;
}
toObject() {
const data: {
name?: string;
bitList?: ReturnType<typeof CjData.prototype.toObject>[];
} = {};
if (this.name != null) {
data.name = this.name;
}
if (this.bitList != null) {
data.bitList = this.bitList.map((item: CjData) => item.toObject());
}
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.name.length)
writer.writeString(1, this.name);
if (this.bitList.length)
writer.writeRepeatedMessage(2, this.bitList, (item: CjData) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CjDataSet {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CjDataSet();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.name = reader.readString();
break;
case 2:
reader.readMessage(message.bitList, () => pb_1.Message.addToRepeatedWrapperField(message, 2, CjData.deserialize(reader), CjData));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CjDataSet {
return CjDataSet.deserialize(bytes);
}
}
export class CjData extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
refRelays?: CjDataItem[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("refRelays" in data && data.refRelays != undefined) {
this.refRelays = data.refRelays;
}
}
}
get refRelays() {
return pb_1.Message.getRepeatedWrapperField(this, CjDataItem, 1) as CjDataItem[];
}
set refRelays(value: CjDataItem[]) {
pb_1.Message.setRepeatedWrapperField(this, 1, value);
}
static fromObject(data: {
refRelays?: ReturnType<typeof CjDataItem.prototype.toObject>[];
}): CjData {
const message = new CjData({});
if (data.refRelays != null) {
message.refRelays = data.refRelays.map(item => CjDataItem.fromObject(item));
}
return message;
}
toObject() {
const data: {
refRelays?: ReturnType<typeof CjDataItem.prototype.toObject>[];
} = {};
if (this.refRelays != null) {
data.refRelays = this.refRelays.map((item: CjDataItem) => item.toObject());
}
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.refRelays.length)
writer.writeRepeatedMessage(1, this.refRelays, (item: CjDataItem) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CjData {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CjData();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
reader.readMessage(message.refRelays, () => pb_1.Message.addToRepeatedWrapperField(message, 1, CjDataItem.deserialize(reader), CjDataItem));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CjData {
return CjData.deserialize(bytes);
}
}
export class CjDataItem extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
relayId?: string;
position?: CjDataItem.PostionType;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("relayId" in data && data.relayId != undefined) {
this.relayId = data.relayId;
}
if ("position" in data && data.position != undefined) {
this.position = data.position;
}
}
}
get relayId() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set relayId(value: string) {
pb_1.Message.setField(this, 1, value);
}
get position() {
return pb_1.Message.getFieldWithDefault(this, 2, CjDataItem.PostionType.Q) as CjDataItem.PostionType;
}
set position(value: CjDataItem.PostionType) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
relayId?: string;
position?: CjDataItem.PostionType;
}): CjDataItem {
const message = new CjDataItem({});
if (data.relayId != null) {
message.relayId = data.relayId;
}
if (data.position != null) {
message.position = data.position;
}
return message;
}
toObject() {
const data: {
relayId?: string;
position?: CjDataItem.PostionType;
} = {};
if (this.relayId != null) {
data.relayId = this.relayId;
}
if (this.position != null) {
data.position = this.position;
}
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.relayId.length)
writer.writeString(1, this.relayId);
if (this.position != CjDataItem.PostionType.Q)
writer.writeEnum(2, this.position);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CjDataItem {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CjDataItem();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.relayId = reader.readString();
break;
case 2:
message.position = reader.readEnum();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CjDataItem {
return CjDataItem.deserialize(bytes);
}
}
export namespace CjDataItem {
export enum PostionType {
Q = 0,
H = 1
}
}
} }

View File

@ -8,6 +8,11 @@ import {
import { DrawAssistant, IJlCanvas, IDrawApp, JlGraphic } from 'src/jl-graphic'; import { DrawAssistant, IJlCanvas, IDrawApp, JlGraphic } from 'src/jl-graphic';
import { markRaw } from 'vue'; import { markRaw } from 'vue';
export interface CollectionConfigCeil {
row: number;
col: number;
}
export const useRelayCabinetStore = defineStore('relayCabinet', { export const useRelayCabinetStore = defineStore('relayCabinet', {
state: () => ({ state: () => ({
drawAssistant: null as DrawAssistant | null, drawAssistant: null as DrawAssistant | null,
@ -17,6 +22,8 @@ export const useRelayCabinetStore = defineStore('relayCabinet', {
table: undefined as QTable | undefined, table: undefined as QTable | undefined,
showCombinationTypeConfig: false, showCombinationTypeConfig: false,
tableOfCombinationType: undefined as QTable | undefined, tableOfCombinationType: undefined as QTable | undefined,
editCollectionConfigIndex: null as CollectionConfigCeil | null,
showCollectionConfig: false,
}), }),
getters: { getters: {
drawMode: (state) => state.drawAssistant != null, drawMode: (state) => state.drawAssistant != null,
@ -91,5 +98,8 @@ export const useRelayCabinetStore = defineStore('relayCabinet', {
setDraftId(id: number | null) { setDraftId(id: number | null) {
this.draftId = id; this.draftId = id;
}, },
setEditCollectionConfig(index: CollectionConfigCeil | null) {
this.editCollectionConfigIndex = index;
},
}, },
}); });