继电器调整
This commit is contained in:
parent
215dab15c7
commit
66cce194de
@ -59,14 +59,14 @@ const relayCabinetStore = useRelayCabinetStore();
|
|||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const tableRef = ref<QTable>();
|
const tableRef = ref<QTable>();
|
||||||
const deviceTypeMap = {
|
const deviceTypeMap = {
|
||||||
Turnout: '道岔',
|
1: '道岔',
|
||||||
signal: '信号机',
|
5: '信号机',
|
||||||
};
|
};
|
||||||
const columns: QTable['columns'] = [
|
const columns: QTable['columns'] = [
|
||||||
{
|
{
|
||||||
name: 'type',
|
name: 'deviceType',
|
||||||
label: '设备类型',
|
label: '设备类型',
|
||||||
field: (row) => deviceTypeMap[row.type as keyof typeof deviceTypeMap],
|
field: (row) => deviceTypeMap[row.deviceType as keyof typeof deviceTypeMap],
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{ name: 'code', label: '设备编号', field: 'code', align: 'center' },
|
{ name: 'code', label: '设备编号', field: 'code', align: 'center' },
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
<q-form ref="myForm" @submit="onSubmit" @reset="onReset">
|
<q-form ref="myForm" @submit="onSubmit" @reset="onReset">
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
v-model="relateRelayConfig.type"
|
v-model="relateRelayConfig.deviceType"
|
||||||
:options="optionsType"
|
:options="optionsType"
|
||||||
label="设备类型"
|
label="设备类型"
|
||||||
:map-options="true"
|
:map-options="true"
|
||||||
:emit-value="true"
|
:emit-value="true"
|
||||||
:rules="[(val) => val.trim() != '' || '设备类型不能为空']"
|
:rules="[(val) => val != '' || '设备类型不能为空']"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
@ -27,7 +27,7 @@
|
|||||||
v-for="(
|
v-for="(
|
||||||
combinationtype, index
|
combinationtype, index
|
||||||
) in relateRelayConfig.combinationtypes"
|
) in relateRelayConfig.combinationtypes"
|
||||||
:key="combinationtype.code"
|
:key="combinationtype"
|
||||||
v-model="combinationtype.expanded"
|
v-model="combinationtype.expanded"
|
||||||
:label="combinationtype.code"
|
:label="combinationtype.code"
|
||||||
@click="toggleItem(index)"
|
@click="toggleItem(index)"
|
||||||
@ -95,8 +95,6 @@ import { onMounted, ref, watch } from 'vue';
|
|||||||
import { QForm, useQuasar } from 'quasar';
|
import { QForm, useQuasar } from 'quasar';
|
||||||
import { JlGraphic } from 'src/jl-graphic';
|
import { JlGraphic } from 'src/jl-graphic';
|
||||||
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||||
import { Turnout } from 'src/graphics/turnout/Turnout';
|
|
||||||
import { Signal } from 'src/graphics/signal/Signal';
|
|
||||||
import { Relay } from 'src/graphics/relay/Relay';
|
import { Relay } from 'src/graphics/relay/Relay';
|
||||||
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||||
import {
|
import {
|
||||||
@ -104,6 +102,7 @@ import {
|
|||||||
editDeviceRelateRelay,
|
editDeviceRelateRelay,
|
||||||
RelateRelaylistItem,
|
RelateRelaylistItem,
|
||||||
} from 'src/drawApp/relayCabinetLayoutApp';
|
} from 'src/drawApp/relayCabinetLayoutApp';
|
||||||
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
|
|
||||||
defineExpose({ editRelateRelays });
|
defineExpose({ editRelateRelays });
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ const relayCabinetStore = useRelayCabinetStore();
|
|||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const showRangeConfig = ref(true);
|
const showRangeConfig = ref(true);
|
||||||
const relateRelayConfig = ref<{
|
const relateRelayConfig = ref<{
|
||||||
type: string;
|
deviceType: graphicData.RelatedRef.DeviceType | undefined;
|
||||||
code: string;
|
code: string;
|
||||||
combinationtypes: {
|
combinationtypes: {
|
||||||
code: string;
|
code: string;
|
||||||
@ -120,7 +119,7 @@ const relateRelayConfig = ref<{
|
|||||||
expanded: boolean;
|
expanded: boolean;
|
||||||
}[];
|
}[];
|
||||||
}>({
|
}>({
|
||||||
type: '',
|
deviceType: undefined,
|
||||||
code: '',
|
code: '',
|
||||||
combinationtypes: [
|
combinationtypes: [
|
||||||
{ code: '组合类型', refRelays: [], refRelaysCode: [], expanded: false },
|
{ code: '组合类型', refRelays: [], refRelaysCode: [], expanded: false },
|
||||||
@ -129,8 +128,8 @@ const relateRelayConfig = ref<{
|
|||||||
const handleState = ref('新建设备关联继电器');
|
const handleState = ref('新建设备关联继电器');
|
||||||
|
|
||||||
const optionsType = [
|
const optionsType = [
|
||||||
{ label: '道岔', value: Turnout.Type },
|
{ label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout },
|
||||||
{ label: '信号机', value: Signal.Type },
|
{ label: '信号机', value: graphicData.RelatedRef.DeviceType.signal },
|
||||||
];
|
];
|
||||||
|
|
||||||
let selectGraphic: JlGraphic[] = [];
|
let selectGraphic: JlGraphic[] = [];
|
||||||
@ -175,7 +174,7 @@ async function onSubmit() {
|
|||||||
});
|
});
|
||||||
const deviceRelateRelay = new relayCabinetGraphicData.DeviceRelateRelay(
|
const deviceRelateRelay = new relayCabinetGraphicData.DeviceRelateRelay(
|
||||||
{
|
{
|
||||||
type: relateRelayConfig.value.type,
|
deviceType: relateRelayConfig.value.deviceType,
|
||||||
code: relateRelayConfig.value.code,
|
code: relateRelayConfig.value.code,
|
||||||
combinationtypes: combinationtypes,
|
combinationtypes: combinationtypes,
|
||||||
}
|
}
|
||||||
@ -216,7 +215,7 @@ async function editRelateRelays(row: RelateRelaylistItem) {
|
|||||||
selectGraphic = [];
|
selectGraphic = [];
|
||||||
drawApp.updateSelected();
|
drawApp.updateSelected();
|
||||||
editRow = row;
|
editRow = row;
|
||||||
relateRelayConfig.value.type = row.type;
|
relateRelayConfig.value.deviceType = row.deviceType;
|
||||||
relateRelayConfig.value.code = row.code;
|
relateRelayConfig.value.code = row.code;
|
||||||
row.combinationtypes.forEach((combinationtype) => {
|
row.combinationtypes.forEach((combinationtype) => {
|
||||||
const refCode: string[] = [];
|
const refCode: string[] = [];
|
||||||
@ -305,7 +304,7 @@ function onReset() {
|
|||||||
clickIndex = null;
|
clickIndex = null;
|
||||||
handleState.value = '新建设备关联继电器';
|
handleState.value = '新建设备关联继电器';
|
||||||
relateRelayConfig.value = {
|
relateRelayConfig.value = {
|
||||||
type: '',
|
deviceType: undefined,
|
||||||
code: '',
|
code: '',
|
||||||
combinationtypes: [
|
combinationtypes: [
|
||||||
{ code: '组合类型', refRelays: [], refRelaysCode: [], expanded: false },
|
{ code: '组合类型', refRelays: [], refRelaysCode: [], expanded: false },
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { RelayData } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
|
import { RelayData } from 'src/drawApp/relayCabinetGraphics/RelayInteraction';
|
||||||
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||||
import { useFormData } from 'src/components/DrawAppFormUtils';
|
import { useFormData } from 'src/components/relayCabinetAppFormUtils';
|
||||||
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
import { relayCabinetGraphicData } from 'src/protos/relayCabinetLayoutGraphics';
|
||||||
|
|
||||||
const relayCabinetStore = useRelayCabinetStore();
|
const relayCabinetStore = useRelayCabinetStore();
|
||||||
|
30
src/components/relayCabinetAppFormUtils.ts
Normal file
30
src/components/relayCabinetAppFormUtils.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { type GraphicDataBase } from 'src/drawApp/graphics/GraphicDataBase';
|
||||||
|
import { IDrawApp, JlGraphic } from 'src/jl-graphic';
|
||||||
|
import { useRelayCabinetStore } from 'src/stores/relayCabinet-store';
|
||||||
|
import { onMounted, onUnmounted, reactive } from 'vue';
|
||||||
|
|
||||||
|
const drawStore = useRelayCabinetStore();
|
||||||
|
|
||||||
|
export function useFormData<T extends GraphicDataBase>(
|
||||||
|
source: T,
|
||||||
|
app: IDrawApp
|
||||||
|
) {
|
||||||
|
const data = reactive<T>(source);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
app.bindFormData(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
app.unbindFormData(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
function onUpdate() {
|
||||||
|
const graphic = drawStore.selectedGraphic as JlGraphic;
|
||||||
|
if (graphic) {
|
||||||
|
app.updateGraphicAndRecord(graphic, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { data, onUpdate };
|
||||||
|
}
|
@ -229,7 +229,7 @@ export async function loadDrawDatas(): Promise<IGraphicStorage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface RelateRelaylistItem {
|
export interface RelateRelaylistItem {
|
||||||
type: string;
|
deviceType: graphicData.RelatedRef.DeviceType | undefined;
|
||||||
code: string;
|
code: string;
|
||||||
combinationtypes: {
|
combinationtypes: {
|
||||||
code: string;
|
code: string;
|
||||||
@ -258,7 +258,7 @@ export function editDeviceRelateRelay(
|
|||||||
) {
|
) {
|
||||||
for (let i = 0; i < refRelaysList.length; i++) {
|
for (let i = 0; i < refRelaysList.length; i++) {
|
||||||
if (
|
if (
|
||||||
refRelaysList[i].type == editRow.type &&
|
refRelaysList[i].deviceType == editRow.deviceType &&
|
||||||
refRelaysList[i].code == editRow.code
|
refRelaysList[i].code == editRow.code
|
||||||
) {
|
) {
|
||||||
refRelaysList[i] = newData;
|
refRelaysList[i] = newData;
|
||||||
@ -271,7 +271,7 @@ export function editDeviceRelateRelay(
|
|||||||
export function deleteDeviceRelateRelay(row: RelateRelaylistItem) {
|
export function deleteDeviceRelateRelay(row: RelateRelaylistItem) {
|
||||||
for (let i = 0; i < refRelaysList.length; i++) {
|
for (let i = 0; i < refRelaysList.length; i++) {
|
||||||
if (
|
if (
|
||||||
refRelaysList[i].type == row.type &&
|
refRelaysList[i].deviceType == row.deviceType &&
|
||||||
refRelaysList[i].code == row.code
|
refRelaysList[i].code == row.code
|
||||||
) {
|
) {
|
||||||
refRelaysList.splice(i, 1);
|
refRelaysList.splice(i, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user