驱动继电器列表初提交

This commit is contained in:
joylink_zhaoerwei 2023-10-25 14:38:36 +08:00
parent a72b2e444e
commit d829bd45d8
8 changed files with 704 additions and 56 deletions

View File

@ -5,7 +5,7 @@
class="ceil"
:class="{
heightLight:
ciCjList.cjList[col - 1].bitList[row - 1].refRelays.length,
ciCjList?.cjList[col - 1].bitList[row - 1].refRelays.length,
}"
v-for="col in setCellMessage.cols"
:key="col"
@ -52,7 +52,8 @@
</q-card-section>
<q-card-actions align="right">
<q-btn color="primary" label="确认" @click="setCellDialog = false" />
<q-btn color="primary" label="确定" @click="setCellListConfig()" />
<q-btn label="取消" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
@ -60,10 +61,11 @@
</template>
<script setup lang="ts">
import { ref, watchEffect } from 'vue';
import { onMounted, ref } from 'vue';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { loadCiCjList, creatCiCjList } from 'src/drawApp/relayCabinetLayoutApp';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
const relayCabinetStore = useRelayCabinetStore();
const setCellDialog = ref(false);
@ -71,16 +73,28 @@ const setCellMessage = ref<{ rows: number; cols: number }>({
rows: 32,
cols: 8,
});
const ciCjList = loadCiCjList();
let ciCjList: relayCabinetGraphicData.CiCj | undefined;
watchEffect(() => {
if (ciCjList == undefined)
onMounted(() => {
ciCjList = loadCiCjList();
if (ciCjList == undefined) {
creatCiCjList(setCellMessage.value.rows, setCellMessage.value.cols);
} else {
setCellMessage.value.rows = ciCjList.dsCount;
setCellMessage.value.cols = ciCjList.cjList.length;
}
});
function handleCellClick(row: number, col: number) {
relayCabinetStore.showCollectionConfig = true;
relayCabinetStore.setEditCollectionConfig({ row, col });
relayCabinetStore.showCiQdConfig = false;
relayCabinetStore.showCiCjConfig = true;
relayCabinetStore.setEditCiCjConfig({ row, col });
}
function setCellListConfig() {
setCellDialog.value = false;
creatCiCjList(setCellMessage.value.rows, setCellMessage.value.cols);
ciCjList = loadCiCjList();
}
</script>

View File

@ -0,0 +1,117 @@
<template>
<draggable-dialog seamless title="驱动列表" :width="600" :height="485">
<div class="row" v-for="row in setCellMessage.rows" :key="row">
<div
class="ceil"
:class="{
heightLight:
ciQdList?.qdList[col - 1].bitList[row - 1].refRelays.length,
}"
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="setCellListConfig()" />
<q-btn label="取消" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</draggable-dialog>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
import { loadCiQdList, creatCiQdList } from 'src/drawApp/relayCabinetLayoutApp';
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
const relayCabinetStore = useRelayCabinetStore();
const setCellDialog = ref(false);
const setCellMessage = ref<{ rows: number; cols: number }>({
rows: 32,
cols: 4,
});
let ciQdList: relayCabinetGraphicData.CiQd | undefined;
onMounted(() => {
ciQdList = loadCiQdList();
if (ciQdList == undefined) {
creatCiQdList(setCellMessage.value.rows, setCellMessage.value.cols);
} else {
setCellMessage.value.rows = ciQdList.dsCount;
setCellMessage.value.cols = ciQdList.qdList.length;
}
});
function handleCellClick(row: number, col: number) {
relayCabinetStore.showCiCjConfig = false;
relayCabinetStore.showCiQdConfig = true;
relayCabinetStore.setEditCiCjConfig({ row, col });
}
function setCellListConfig() {
setCellDialog.value = false;
creatCiQdList(setCellMessage.value.rows, setCellMessage.value.cols);
ciQdList = loadCiQdList();
}
</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;
}
.heightLight {
background-color: red;
}
</style>

View File

@ -5,9 +5,9 @@
<div class="text-h6">
{{
'编辑采集' +
relayCabinetStore.editCollectionConfigIndex.row +
relayCabinetStore.editCiCjConfigIndex.row +
'-' +
relayCabinetStore.editCollectionConfigIndex.col
relayCabinetStore.editCiCjConfigIndex.col
}}
</div>
</q-card-section>
@ -61,7 +61,7 @@ import { onMounted, onUnmounted, ref, watch } from 'vue';
import { QForm, useQuasar } from 'quasar';
import { JlGraphic } from 'src/jl-graphic';
import {
CollectionConfigCeil,
CiCjConfigCeil,
useRelayCabinetStore,
} from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay';
@ -106,7 +106,7 @@ watch(
//
watch(
() => relayCabinetStore.editCollectionConfigIndex,
() => relayCabinetStore.editCiCjConfigIndex,
(val) => {
if (val) {
getEditData();
@ -125,8 +125,7 @@ function getEditData() {
app.updateSelected();
collectionConfig.value.refRelays = [];
const ciCjList = loadCiCjList();
const click =
relayCabinetStore.editCollectionConfigIndex as CollectionConfigCeil;
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
ciCjList.cjList[click.col - 1].bitList[click.row - 1].refRelays.forEach(
(relay) => {
collectionConfig.value.refRelays.push(relay.relayId);
@ -148,8 +147,7 @@ async function onSubmit() {
if (res) {
try {
const ciCjList = loadCiCjList();
const click =
relayCabinetStore.editCollectionConfigIndex as CollectionConfigCeil;
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
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(
@ -207,11 +205,10 @@ function onReset() {
function goBack() {
onReset();
relayCabinetStore.showCollectionConfig = false;
relayCabinetStore.showCiCjConfig = false;
}
onUnmounted(() => {
relayCabinetStore.showCollectionConfig = false;
relayCabinetStore.editCollectionConfigIndex = null;
relayCabinetStore.showCiCjConfig = false;
});
</script>

View File

@ -0,0 +1,205 @@
<template>
<div v-if="showCollectionConfig">
<q-card class="q-gutter-sm q-pa-sm">
<q-card-section>
<div class="text-h6">
{{
'编辑驱动' +
relayCabinetStore.editCiCjConfigIndex.row +
'-' +
relayCabinetStore.editCiCjConfigIndex.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 {
CiCjConfigCeil,
useRelayCabinetStore,
} from 'src/stores/relayCabinet-store';
import { Relay } from 'src/graphics/relay/Relay';
import { loadCiQdList } from 'src/drawApp/relayCabinetLayoutApp';
import { PhaseFailureProtector } from 'src/graphics/phaseFailureProtector/PhaseFailureProtector';
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.editCiCjConfigIndex,
(val) => {
if (val) {
getEditData();
}
}
);
onMounted(() => {
onReset();
getEditData();
});
function getEditData() {
selectGraphic = [];
const app = relayCabinetStore.getDrawApp();
app.updateSelected();
const ciQdList = loadCiQdList();
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
collectionConfig.value.refRelays =
ciQdList.qdList[click.col - 1].bitList[click.row - 1].refRelays;
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 ciQdList = loadCiQdList();
const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil;
ciQdList.qdList[click.col - 1].bitList[click.row - 1].refRelays =
collectionConfig.value.refRelays;
$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.showCiCjConfig = false;
}
onUnmounted(() => {
relayCabinetStore.showCiCjConfig = false;
});
</script>

View File

@ -226,6 +226,7 @@ export function saveDrawDatas(app: IDrawApp) {
storage.combinationtypeList = combinationTypeList;
storage.UniqueIdPrefix = UniqueIdPrefix;
storage.ciCjList = ciCjList;
storage.ciQdList = ciQdList;
const base64 = fromUint8Array(storage.serialize());
console.log('保存数据', storage);
return base64;
@ -260,6 +261,7 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
combinationTypeList = storage.combinationtypeList;
UniqueIdPrefix = storage.UniqueIdPrefix;
ciCjList = storage.ciCjList;
ciQdList = storage.ciQdList;
return Promise.resolve({
canvasProperty: storage.canvas,
datas: datas,
@ -363,7 +365,7 @@ export function deleteCombinationtype(row: CombinationTypeListItem) {
}
//所属集中站
let UniqueIdPrefix = new relayCabinetGraphicData.UniqueIdType();
let UniqueIdPrefix: relayCabinetGraphicData.UniqueIdType;
export function loadUniqueIdPrefix() {
return UniqueIdPrefix;
}
@ -375,7 +377,7 @@ export function setUniqueIdPrefix(
}
//采集列表的增删改查
let ciCjList = new relayCabinetGraphicData.CiCj();
let ciCjList: relayCabinetGraphicData.CiCj;
export function loadCiCjList() {
return ciCjList;
}
@ -391,3 +393,21 @@ export function creatCiCjList(rows: number, cols: number) {
}
}
}
//驱动列表的增删改查
let ciQdList: relayCabinetGraphicData.CiQd;
export function loadCiQdList() {
return ciQdList;
}
export function creatCiQdList(rows: number, cols: number) {
ciQdList = new relayCabinetGraphicData.CiQd();
ciQdList.dsCount = rows;
for (let i = 0; i < cols; i++) {
ciQdList.qdList[i] = new relayCabinetGraphicData.QdDataSet();
ciQdList.qdList[i].name = 'D' + (i + 1);
for (let j = 0; j < rows; j++) {
ciQdList.qdList[i].bitList[j] = new relayCabinetGraphicData.QdData();
}
}
}

View File

@ -64,20 +64,14 @@
style="margin-right: 10px"
>
<q-list>
<q-item clickable v-close-popup @click="openDeviceRelateRelayList">
<q-item-section>
<q-item-label>设备关联继电器列表</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="openCombinationTypeList">
<q-item-section>
<q-item-label>组合类型列表</q-item-label>
</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="openCjList">
<q-item-section>
<q-item-label>采集列表</q-item-label>
</q-item-section>
<q-item
v-for="item in dataManageConfig"
:key="item.label"
clickable
v-close-popup
@click="item.click"
>
<q-item-section>{{ item.label }}</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
@ -93,7 +87,8 @@
v-if="
!relayCabinetStore.showRelateRelayConfig &&
!relayCabinetStore.showCombinationTypeConfig &&
!relayCabinetStore.showCollectionConfig
!relayCabinetStore.showCiCjConfig &&
!relayCabinetStore.showCiQdConfig
"
></draw-relayCabinetProperties>
<relate-relay-config
@ -104,7 +99,8 @@
v-else-if="relayCabinetStore.showCombinationTypeConfig"
ref="combinationTypeConfigEdit"
></combination-type-config>
<collection-config v-else />
<ciCjConfig v-else-if="relayCabinetStore.showCiCjConfig" />
<ciQdConfig v-else />
</q-drawer>
<q-page-container>
@ -184,8 +180,10 @@ import DeviceRelateRelayList from 'src/components/draw-app/dialogs/DeviceRelateR
import RelateRelayConfig from 'src/components/draw-app/properties/RelateRelayConfig.vue';
import CombinationtypeList from 'src/components/draw-app/dialogs/CombinationtypeList.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 CiCjList from 'src/components/draw-app/dialogs/CiCjList.vue';
import CiQdList from 'src/components/draw-app/dialogs/CiQdList.vue';
import CiCjConfig from 'src/components/draw-app/properties/CiCjConfig.vue';
import CiQdConfig from 'src/components/draw-app/properties/CiQdConfig.vue';
import {
getDrawApp,
saveDrawDatas,
@ -255,6 +253,14 @@ const leftMenuConfig = [
{ label: '批量生成继电器或继电器柜', click: batchBuild },
];
//
const dataManageConfig = [
{ label: '设备关联继电器列表', click: openDeviceRelateRelayList },
{ label: '组合类型列表', click: openCombinationTypeList },
{ label: '采集列表', click: openCiCjList },
{ label: '驱动列表', click: openCiQdList },
];
watch(
() => relayCabinetStore.drawMode,
(drawMode) => {
@ -438,19 +444,31 @@ function openCombinationTypeList() {
});
}
let collectDialogInstance: DialogChainObject | null = null;
function openCjList() {
if (collectDialogInstance) return;
collectDialogInstance = $q
let ciCjListDialogInstance: DialogChainObject | null = null;
function openCiCjList() {
if (ciCjListDialogInstance) return;
ciCjListDialogInstance = $q
.dialog({
component: CollectionList,
component: CiCjList,
})
.onCancel(() => {
collectDialogInstance = null;
relayCabinetStore.setEditCollectionConfig(null);
relayCabinetStore.showCollectionConfig = false;
relayCabinetStore.selectedGraphics = [];
relayCabinetStore.getDrawApp().updateSelected();
ciCjListDialogInstance = null;
relayCabinetStore.setEditCiCjConfig(null);
relayCabinetStore.showCiCjConfig = false;
});
}
let ciQdListDialogInstance: DialogChainObject | null = null;
function openCiQdList() {
if (ciQdListDialogInstance) return;
ciQdListDialogInstance = $q
.dialog({
component: CiQdList,
})
.onCancel(() => {
ciQdListDialogInstance = null;
relayCabinetStore.setEditCiCjConfig(null);
relayCabinetStore.showCiQdConfig = false;
});
}
@ -470,8 +488,11 @@ onUnmounted(() => {
if (combinationTypeDialogInstance) {
combinationTypeDialogInstance.hide();
}
if (collectDialogInstance) {
collectDialogInstance.hide();
if (ciCjListDialogInstance) {
ciCjListDialogInstance.hide();
}
if (ciQdListDialogInstance) {
ciQdListDialogInstance.hide();
}
});
</script>

View File

@ -18,6 +18,7 @@ export namespace relayCabinetGraphicData {
combinationtypeList?: Combinationtype[];
signalFaultAlarms?: SignalFaultAlarm[];
ciCjList?: CiCj;
ciQdList?: CiQd;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 7, 8, 9], this.#one_of_decls);
@ -49,6 +50,9 @@ export namespace relayCabinetGraphicData {
if ("ciCjList" in data && data.ciCjList != undefined) {
this.ciCjList = data.ciCjList;
}
if ("ciQdList" in data && data.ciQdList != undefined) {
this.ciQdList = data.ciQdList;
}
}
}
get canvas() {
@ -114,6 +118,15 @@ export namespace relayCabinetGraphicData {
get has_ciCjList() {
return pb_1.Message.getField(this, 10) != null;
}
get ciQdList() {
return pb_1.Message.getWrapperField(this, CiQd, 11) as CiQd;
}
set ciQdList(value: CiQd) {
pb_1.Message.setWrapperField(this, 11, value);
}
get has_ciQdList() {
return pb_1.Message.getField(this, 11) != null;
}
static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
relayCabinets?: ReturnType<typeof RelayCabinet.prototype.toObject>[];
@ -124,6 +137,7 @@ export namespace relayCabinetGraphicData {
combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[];
signalFaultAlarms?: ReturnType<typeof SignalFaultAlarm.prototype.toObject>[];
ciCjList?: ReturnType<typeof CiCj.prototype.toObject>;
ciQdList?: ReturnType<typeof CiQd.prototype.toObject>;
}): RelayCabinetGraphicStorage {
const message = new RelayCabinetGraphicStorage({});
if (data.canvas != null) {
@ -153,6 +167,9 @@ export namespace relayCabinetGraphicData {
if (data.ciCjList != null) {
message.ciCjList = CiCj.fromObject(data.ciCjList);
}
if (data.ciQdList != null) {
message.ciQdList = CiQd.fromObject(data.ciQdList);
}
return message;
}
toObject() {
@ -166,6 +183,7 @@ export namespace relayCabinetGraphicData {
combinationtypeList?: ReturnType<typeof Combinationtype.prototype.toObject>[];
signalFaultAlarms?: ReturnType<typeof SignalFaultAlarm.prototype.toObject>[];
ciCjList?: ReturnType<typeof CiCj.prototype.toObject>;
ciQdList?: ReturnType<typeof CiQd.prototype.toObject>;
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -194,6 +212,9 @@ export namespace relayCabinetGraphicData {
if (this.ciCjList != null) {
data.ciCjList = this.ciCjList.toObject();
}
if (this.ciQdList != null) {
data.ciQdList = this.ciQdList.toObject();
}
return data;
}
serialize(): Uint8Array;
@ -218,6 +239,8 @@ export namespace relayCabinetGraphicData {
writer.writeRepeatedMessage(9, this.signalFaultAlarms, (item: SignalFaultAlarm) => item.serialize(writer));
if (this.has_ciCjList)
writer.writeMessage(10, this.ciCjList, () => this.ciCjList.serialize(writer));
if (this.has_ciQdList)
writer.writeMessage(11, this.ciQdList, () => this.ciQdList.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -254,6 +277,9 @@ export namespace relayCabinetGraphicData {
case 10:
reader.readMessage(message.ciCjList, () => message.ciCjList = CiCj.deserialize(reader));
break;
case 11:
reader.readMessage(message.ciQdList, () => message.ciQdList = CiQd.deserialize(reader));
break;
default: reader.skipField();
}
}
@ -1333,4 +1359,251 @@ export namespace relayCabinetGraphicData {
H = 1
}
}
export class CiQd extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
dsCount?: number;
qdList?: QdDataSet[];
}) {
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 ("qdList" in data && data.qdList != undefined) {
this.qdList = data.qdList;
}
}
}
get dsCount() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set dsCount(value: number) {
pb_1.Message.setField(this, 1, value);
}
get qdList() {
return pb_1.Message.getRepeatedWrapperField(this, QdDataSet, 2) as QdDataSet[];
}
set qdList(value: QdDataSet[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
static fromObject(data: {
dsCount?: number;
qdList?: ReturnType<typeof QdDataSet.prototype.toObject>[];
}): CiQd {
const message = new CiQd({});
if (data.dsCount != null) {
message.dsCount = data.dsCount;
}
if (data.qdList != null) {
message.qdList = data.qdList.map(item => QdDataSet.fromObject(item));
}
return message;
}
toObject() {
const data: {
dsCount?: number;
qdList?: ReturnType<typeof QdDataSet.prototype.toObject>[];
} = {};
if (this.dsCount != null) {
data.dsCount = this.dsCount;
}
if (this.qdList != null) {
data.qdList = this.qdList.map((item: QdDataSet) => 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.qdList.length)
writer.writeRepeatedMessage(2, this.qdList, (item: QdDataSet) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CiQd {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CiQd();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.dsCount = reader.readInt32();
break;
case 2:
reader.readMessage(message.qdList, () => pb_1.Message.addToRepeatedWrapperField(message, 2, QdDataSet.deserialize(reader), QdDataSet));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CiQd {
return CiQd.deserialize(bytes);
}
}
export class QdDataSet extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
name?: string;
bitList?: QdData[];
}) {
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, QdData, 2) as QdData[];
}
set bitList(value: QdData[]) {
pb_1.Message.setRepeatedWrapperField(this, 2, value);
}
static fromObject(data: {
name?: string;
bitList?: ReturnType<typeof QdData.prototype.toObject>[];
}): QdDataSet {
const message = new QdDataSet({});
if (data.name != null) {
message.name = data.name;
}
if (data.bitList != null) {
message.bitList = data.bitList.map(item => QdData.fromObject(item));
}
return message;
}
toObject() {
const data: {
name?: string;
bitList?: ReturnType<typeof QdData.prototype.toObject>[];
} = {};
if (this.name != null) {
data.name = this.name;
}
if (this.bitList != null) {
data.bitList = this.bitList.map((item: QdData) => 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: QdData) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QdDataSet {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QdDataSet();
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, QdData.deserialize(reader), QdData));
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): QdDataSet {
return QdDataSet.deserialize(bytes);
}
}
export class QdData extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
refRelays?: string[];
}) {
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.getFieldWithDefault(this, 1, []) as string[];
}
set refRelays(value: string[]) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: {
refRelays?: string[];
}): QdData {
const message = new QdData({});
if (data.refRelays != null) {
message.refRelays = data.refRelays;
}
return message;
}
toObject() {
const data: {
refRelays?: string[];
} = {};
if (this.refRelays != null) {
data.refRelays = this.refRelays;
}
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.writeRepeatedString(1, this.refRelays);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): QdData {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new QdData();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
pb_1.Message.addToRepeatedField(message, 1, reader.readString());
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): QdData {
return QdData.deserialize(bytes);
}
}
}

View File

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