This commit is contained in:
fan 2023-10-13 14:31:56 +08:00
commit 53a35ab177
25 changed files with 1420 additions and 444 deletions

@ -1 +1 @@
Subproject commit b33cc6eee0d88f566a6370e12633da50883b4d34
Subproject commit 7d027a7e5e284dc2f20e3380472efad533435ace

View File

@ -19,8 +19,10 @@
"@pixi/graphics-extras": "^7.2.4",
"@quasar/extras": "^1.0.0",
"@stomp/stompjs": "^7.0.0",
"centrifuge": "^4.0.1",
"axios": "^1.2.1",
"centrifuge": "^4.0.1",
"default-passive-events": "^2.0.0",
"echarts": "^5.4.3",
"google-protobuf": "^3.21.2",
"js-base64": "^3.7.5",
"pinia": "^2.0.11",

View File

@ -0,0 +1,135 @@
<script setup lang="ts">
import { QTable, useQuasar } from 'quasar';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import {
RelateDevicelistItem,
deleteIbpRelateDevice,
loadIbpRelateDeviceList,
} from 'src/drawApp/ibpDrawApp';
import { useIBPDrawStore } from 'src/stores/ibp-draw-store';
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
import { ref } from 'vue';
const $q = useQuasar();
const tableRef = ref<QTable>();
const rows = ref<RelateDevicelistItem[]>([]);
const loading = ref(false);
const pagination = ref({
sortBy: 'desc',
descending: false,
page: 1,
rowsPerPage: 10,
rowsNumber: 10,
});
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) {
return row.combinationtypes.map((type) => type.code).join('\\');
}
},
align: 'center',
},
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
];
const ibpDrawStore = useIBPDrawStore();
const onRequest: QTable['onRequest'] = async (props) => {
const { page, rowsPerPage } = props.pagination;
loading.value = true;
const data = loadIbpRelateDeviceList();
pagination.value.rowsNumber = data.length;
pagination.value.page = page;
pagination.value.rowsPerPage = rowsPerPage;
rows.value = data.slice((page - 1) * rowsPerPage, page * rowsPerPage);
loading.value = false;
};
const onDialogShow = () => {
tableRef.value?.requestServerInteraction();
ibpDrawStore.table = tableRef.value;
};
const props = defineProps<{
onEditClick: (row: RelateDevicelistItem) => void;
}>();
function onEdit(row: RelateDevicelistItem) {
ibpDrawStore.showRelateDeviceConfig = true;
setTimeout(() => {
props.onEditClick(row);
}, 0);
}
function createData() {
ibpDrawStore.showRelateDeviceConfig = true;
}
function deleteData(row: RelateDevicelistItem) {
$q.dialog({ message: `确定删除 "${row.code}" 吗?`, cancel: true }).onOk(
async () => {
try {
deleteIbpRelateDevice(row);
successNotify('删除数据成功!');
} catch (err) {
errorNotify('删除失败:', err);
} finally {
tableRef.value?.requestServerInteraction();
}
}
);
}
</script>
<template>
<DraggableDialog
seamless
@show="onDialogShow"
title="IBP关联的车站"
:width="600"
:height="0"
>
<template #footer>
<QTable
ref="tableRef"
ref_key="id"
v-model:pagination="pagination"
:rows="rows"
:columns="columns"
:loading="loading"
@request="onRequest"
:rows-per-page-options="[5, 10, 20, 50]"
>
<template v-slot:body-cell="props">
<QTd :props="props" class="custom-column">
{{ props.value }}
</QTd>
</template>
<template v-slot:body-cell-operations="props">
<QTd :props="props">
<div class="q-gutter-sm row justify-center">
<QBtn color="primary" label="编辑" @click="onEdit(props.row)" />
<QBtn color="red" label="删除" @click="deleteData(props.row)" />
</div>
</QTd> </template
></QTable>
</template>
<template #titleButton>
<QBtn
color="primary"
label="新建"
class="q-mr-md"
@click="createData"
></QBtn>
</template>
</DraggableDialog>
</template>
<style scoped></style>

View File

@ -25,33 +25,38 @@
lazy-rules
autogrow
/>
<q-select
outlined
style="margin-top: 10px"
v-model="axleCountingModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="axleCountingModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="axleCountingModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-select
outlined
style="margin-top: 10px"
v-model="axleCountingModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
style="margin-top: 10px"
v-model.number="axleCountingModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="axleCountingModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
<q-select
outlined
v-model="axleCountingModel.type"

View File

@ -24,64 +24,68 @@ const directionOptions = [
<template>
<q-form class="q-gutter-sm">
<q-input
outlined
readonly
v-model="kiloMarkerModel.id"
label="id"
hint=""
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input outlined readonly v-model="kiloMarkerModel.id" label="id" />
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
</q-form>
</template>

View File

@ -0,0 +1,326 @@
<script setup lang="ts">
import { onMounted, ref, watch } from 'vue';
import { QForm, useQuasar } from 'quasar';
import { JlGraphic } from 'src/jl-graphic';
import { useIBPDrawStore } from 'src/stores/ibp-draw-store';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { IbpAlarm } from 'src/graphics/ibpAlarm/IbpAlarm';
import { IBPButton } from 'src/graphics/IBPButton/IBPButton';
import { IbpKey } from 'src/graphics/ibpKey/IbpKey';
import { ibpGraphicData } from 'src/protos/ibpGraphics';
import {
editIbpRelateDevice,
createIbpRelateDevice,
RelateDevicelistItem,
} from 'src/drawApp/ibpDrawApp';
defineExpose({ editRelateDevices });
const ibpDrawStore = useIBPDrawStore();
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.station },
];
let selectGraphic: JlGraphic[] = [];
watch(
() => ibpDrawStore.selectedGraphics,
(val) => {
if (val && val.length > 0 && clickIndex !== null) {
const selectFilter = ibpDrawStore.selectedGraphics?.filter(
(g) =>
g.type == IBPButton.Type ||
g.type == IbpAlarm.Type ||
g.type == IbpKey.Type
) as JlGraphic[];
selectGraphic.push(...selectFilter);
selectGraphic = Array.from(new Set(selectGraphic));
ibpDrawStore.getDrawApp().updateSelected(...selectGraphic);
relateDeviceConfig.value.combinationtypes[clickIndex].refDevicesCode =
selectGraphic.map((g) =>
(g as IBPButton | IbpAlarm | IbpKey).datas.code == ''
? g.id
: (g as IBPButton | IbpAlarm | IbpKey).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: ibpGraphicData.Combinationtype[] = [];
relateDeviceConfig.value.combinationtypes.forEach((combinationtype) => {
combinationtypes.push(
new ibpGraphicData.Combinationtype({
code: combinationtype.code,
refDevices: combinationtype.refDevices,
})
);
});
const ibpRelateDevice = new ibpGraphicData.IbpRelatedDevice({
deviceType: relateDeviceConfig.value.deviceType,
code: relateDeviceConfig.value.code,
combinationtypes: combinationtypes,
});
if (handleState.value == '新建门控箱关联设备') {
handle.value = '创建成功';
handleError.value = '创建失败';
createIbpRelateDevice(ibpRelateDevice);
} else {
handle.value = '更新成功';
handleError.value = '更新失败';
editIbpRelateDevice(editRow, ibpRelateDevice);
}
ibpDrawStore.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 = ibpDrawStore.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 = ibpDrawStore.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);
ibpDrawStore.getDrawApp().updateSelected(...selectGraphic);
}
function clearAllSelect(index: number) {
relateDeviceConfig.value.combinationtypes[index].refDevices = [];
relateDeviceConfig.value.combinationtypes[index].refDevicesCode = [];
clearAllSelectAtCanvas();
}
function clearAllSelectAtCanvas() {
selectGraphic = [];
ibpDrawStore.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();
ibpDrawStore.showRelateDeviceConfig = false;
}
</script>
<template>
<div v-if="showRangeConfig">
<QCard class="q-gutter-sm q-pa-sm">
<QCardSection>
<div class="text-h6">{{ handleState }}</div>
</QCardSection>
<QSeparator inset></QSeparator>
<QForm ref="myForm" @submit="onSubmit" @reset="onReset">
<QSelect
outlined
v-model="relateDeviceConfig.deviceType"
:options="optionsType"
label="设备类型"
:map-options="true"
:emit-value="true"
:rules="[(val) => val != '' || '设备类型不能为空']"
/>
<QInput
outlined
label="设备编号"
v-model="relateDeviceConfig.code"
:rules="[(val) => val.trim() != '' || '名称不能为空']"
/>
<QList bordered separator class="rounded-borders">
<QExpansionItem
expand-separator
v-for="(
combinationtype, index
) in relateDeviceConfig.combinationtypes"
:key="index"
v-model="combinationtype.expanded"
:label="combinationtype.code"
@click="toggleItem(index)"
>
<QCard>
<QItem>
<QItemSection no-wrap class="q-gutter-y-sm column">
<QInput
outlined
v-model="combinationtype.code"
label="组合类型"
lazy-rules
/>
<div class="q-gutter-sm row">
<QChip
v-for="item in combinationtype.refDevicesCode"
:key="item"
square
color="primary"
text-color="white"
removable
@remove="removeSelect(item)"
>
{{ item }}
</QChip>
</div>
<div>
<QBtn
v-show="combinationtype.refDevicesCode.length > 0"
style="width: 130px"
label="清空框选的设备"
color="red"
class="q-mr-md"
@click="clearAllSelect(index)"
/>
<QBtn
label="删除组合类型"
color="secondary"
@click="deleteCombinationtype(index)"
/>
</div>
</QItemSection>
</QItem>
</QCard>
</QExpansionItem>
</QList>
<QBtn
class="q-mt-md"
label="增加组合类型"
color="secondary"
@click="addCombinationtype"
/>
<div class="q-gutter-sm q-pa-md row justify-center">
<QBtn label="提交" type="submit" color="primary" class="q-mr-md" />
<QBtn label="重置" type="reset" color="primary" class="q-mr-md" />
<QBtn label="返回" color="primary" @click="goBack" />
</div>
</QForm>
</QCard>
</div>
</template>

View File

@ -1,6 +1,6 @@
<template>
<q-form>
<q-input outlined readonly v-model="signalModel.id" label="id" hint="" />
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="signalModel.id" label="id" />
<q-input
outlined
v-model="signalModel.code"
@ -15,34 +15,39 @@
@blur="onUpdate"
label="索引"
/>
<q-select
outlined
class="q-mt-sm"
v-model="signalModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-select
outlined
class="q-mt-sm"
v-model="signalModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="signalModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-sm"
v-model="signalModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-select
outlined
class="q-mt-sm"
v-model="signalModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="signalModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
</q-item>
</q-list>
<q-select
outlined
class="q-mt-sm"

View File

@ -24,58 +24,68 @@ const directionOptions = [
<template>
<QForm class="q-gutter-sm">
<QInput outlined readonly v-model="kiloMarkerModel.id" label="id" hint="" />
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></QSelect>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
<QSelect
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></QSelect>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
<QInput outlined readonly v-model="kiloMarkerModel.id" label="id" />
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></QSelect>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
</q-item>
</q-list>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<QSelect
outlined
class="q-mt-lg"
v-model="kiloMarkerModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></QSelect>
<QInput
outlined
v-model.number="kiloMarkerModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<QSelect
outlined
v-model="kiloMarkerModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></QSelect>
</q-item>
</q-list>
</QForm>
</template>

View File

@ -17,54 +17,59 @@
@blur="onUpdate"
label="索引"
/>
<template v-if="stationModel.kilometerSystem">
<q-select
outlined
class="q-mt-md"
v-model="stationModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="stationModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="stationModel.kilometerSystem.direction"
:options="directionOptions"
map-options
emit-value
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-md"
@blur="onUpdate"
v-model="stationModel.concentrationStations"
:options="optionsControl"
map-options
emit-value
label="是否集中站"
/>
<q-select
outlined
class="q-mt-md"
@blur="onUpdate"
v-model="stationModel.refIbpMapCode"
:options="props.ibpNameList"
label="关联IBP地图"
/>
</template>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<template v-if="stationModel.kilometerSystem">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-md"
v-model="stationModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="stationModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="stationModel.kilometerSystem.direction"
:options="directionOptions"
map-options
emit-value
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
</q-item>
</q-list>
<q-select
outlined
class="q-mt-md"
@blur="onUpdate"
v-model="stationModel.concentrationStations"
:options="optionsControl"
map-options
emit-value
label="是否集中站"
/>
<q-select
outlined
class="q-mt-md"
@blur="onUpdate"
v-model="stationModel.refIbpMapCode"
:options="props.ibpNameList"
label="关联IBP地图"
/>
</q-form>
</template>

View File

@ -1,12 +1,6 @@
<template>
<q-form>
<q-input
outlined
readonly
v-model="stopPositionModel.id"
label="id"
hint=""
/>
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="stopPositionModel.id" label="id" />
<q-input
outlined
v-model.number="stopPositionModel.index"
@ -24,36 +18,41 @@
@update:model-value="onUpdate"
label="编组数量"
/>
<template v-if="stopPositionModel.kilometerSystem">
<q-select
outlined
class="q-mt-md"
v-model="stopPositionModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-select
outlined
class="q-mt-md"
v-model="stopPositionModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="stopPositionModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
</template>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<template v-if="stopPositionModel.kilometerSystem">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-md"
v-model="stopPositionModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-select
outlined
class="q-mt-md"
v-model="stopPositionModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="stopPositionModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
</template>
</q-item>
</q-list>
<q-select
outlined
class="q-mt-md"

View File

@ -1,12 +1,6 @@
<template>
<q-form>
<q-input
outlined
readonly
v-model="transponderModel.id"
label="id"
hint=""
/>
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="transponderModel.id" label="id" />
<q-input
outlined
class="q-mt-md"
@ -21,36 +15,41 @@
@blur="onUpdate"
label="索引"
/>
<template v-if="transponderModel.kilometerSystem">
<q-select
outlined
class="q-mt-md"
v-model="transponderModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="transponderModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="transponderModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<template v-if="transponderModel.kilometerSystem">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-md"
v-model="transponderModel.kilometerSystem.coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-md"
v-model.number="transponderModel.kilometerSystem.kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-md"
v-model="transponderModel.kilometerSystem.direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</template>
</q-item>
</q-list>
<q-select
outlined
class="q-mt-md"

View File

@ -1,6 +1,6 @@
<template>
<q-form>
<q-input outlined readonly v-model="turnoutModel.id" label="id" hint="" />
<q-form class="q-gutter-sm">
<q-input outlined readonly v-model="turnoutModel.id" label="id" />
<q-input
outlined
v-model="turnoutModel.code"
@ -15,62 +15,72 @@
@blur="onUpdate"
label="索引"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标2(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[0].kilometer"
type="number"
@blur="onUpdate"
label="公里标(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[0].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
<q-list bordered separator class="rounded-borders">
<q-item no-wrap class="q-gutter-y-sm column">
<div>公里标配置</div>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].coordinateSystem"
:options="CoordinateSystemOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="坐标系"
></q-select>
<q-input
outlined
class="q-mt-sm"
v-model.number="turnoutModel.kilometerSystem[1].kilometer"
type="number"
@blur="onUpdate"
label="公里标2(mm):"
/>
<q-select
outlined
class="q-mt-sm"
v-model="turnoutModel.kilometerSystem[1].direction"
:options="directionOptions"
:map-options="true"
:emit-value="true"
@update:model-value="onUpdate"
label="方向"
></q-select>
</q-item>
</q-list>
<q-select
outlined
class="q-mt-sm"

View File

@ -1,7 +1,8 @@
<template>
<q-card flat bordered>
<q-card-section>
<div class="text-h6">列车信息</div>
<q-card-section class="flex justify-between">
<span class="text-h6">列车信息</span>
<q-btn color="primary" label="曲线图" @click="open" />
</q-card-section>
<q-separator inset />
<q-list v-if="trainInfo" dense>
@ -52,6 +53,7 @@ import { ref, watch, onMounted } from 'vue';
import { state } from 'src/protos/device_state';
import { Turnout } from 'src/graphics/turnout/Turnout';
import { Section } from 'src/graphics/section/Section';
interface KeyType {
label: string;
key: keyof ITrainState;
@ -67,6 +69,7 @@ interface VobcStateType {
key: keyof state.TrainVobcState;
formatFn?(v: state.TrainVobcState[keyof state.TrainVobcState]): string;
}
const lineStore = useLineStore();
const trainInfo = ref<ITrainState | null>();
const dynamicInfo = ref<state.TrainDynamicState | null>();
@ -115,6 +118,7 @@ const list2: DynamicKeyType[] = [
{ label: '尾车速传2速度值', key: 'tailSensorSpeed2', formatFn: speedFormat },
{ label: '头车雷达速度值', key: 'headRadarSpeed', formatFn: speedFormat },
{ label: '尾车雷达速度值', key: 'tailRadarSpeed', formatFn: speedFormat },
{ label: '加速', key: 'acceleration', formatFn: accelerationFormat },
];
const list3: VobcStateType[] = [
//
@ -198,6 +202,10 @@ function speedFormat(v: number) {
// }
return `${n} km/h`;
}
function accelerationFormat(v: number) {
const n = floatDecimal(v);
return `${n} m/s`;
}
function trainLengthFormat(v: number) {
return `${v / 1000} m`;
}
@ -311,4 +319,9 @@ function getAllSection() {
.appCurrentScene()
.queryStore.queryByType<Section>(Section.Type);
}
function open() {
if (!trainInfo.value) return;
lineStore.setEchartsTrainId(trainInfo.value.id);
}
</script>

View File

@ -0,0 +1,147 @@
<template>
<DraggableDialog
seamless
title="列车属性曲线图"
@show="onDialogShow"
:height="510"
:width="710"
>
<div style="height: 510px; width: 710px">
<div
id="train-echarts"
class="overflow-hidden"
style="height: 100%; width: 100%"
></div>
</div>
</DraggableDialog>
</template>
<script setup lang="ts">
import { watch } from 'vue';
import { useLineStore } from 'src/stores/line-store';
import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import * as echarts from 'echarts';
import 'default-passive-events';
const lineStore = useLineStore();
let speedList: [Date, number][] = [];
let accelerationList: [Date, number][] = [];
let tractionForceList: [Date, number][] = [];
let brakeForceList: [Date, number][] = [];
const props = defineProps<{
trainId: string;
}>();
function onDialogShow() {
if (props.trainId) {
getDataList();
initEcharts();
}
}
function getDataList() {
speedList = [];
accelerationList = [];
tractionForceList = [];
brakeForceList = [];
lineStore.trainStateMap.forEach((list, key) => {
const find = list.find((ii) => {
return ii.id == props.trainId;
});
if (find) {
speedList.push([key, find.dynamicState.speed / 100]);
accelerationList.push([key, find.dynamicState.acceleration]);
tractionForceList.push([key, find.vobcState.tractionForce / 100]);
brakeForceList.push([key, find.vobcState.brakeForce / 100]);
}
});
}
let myChart: echarts.EChartsType;
function initEcharts() {
const dom = document.getElementById('train-echarts');
if (!dom) return;
myChart = echarts.init(dom, null, {
renderer: 'canvas',
useDirtyRect: false,
});
const option = {
title: {
text: '',
},
tooltip: {
trigger: 'axis',
valueFormatter: (value: number) => value.toFixed(2),
},
legend: {
data: ['速度', '加速度', '牵引力', '制动力'],
},
xAxis: {
type: 'time',
minInterval: 10000,
splitNumber: 6,
splitLine: {
show: false,
},
},
yAxis: {
type: 'value',
boundaryGap: [0, '100%'],
},
series: [
{
name: '速度',
type: 'line',
showSymbol: false,
data: speedList,
},
{
name: '加速度',
type: 'line',
showSymbol: false,
data: accelerationList,
},
{
name: '牵引力',
type: 'line',
showSymbol: false,
data: tractionForceList,
},
{
name: '制动力',
type: 'line',
showSymbol: false,
data: brakeForceList,
},
],
};
myChart.setOption(option);
}
watch(
() => lineStore.socketStates,
() => {
getDataList();
myChart?.setOption({
series: [
{
data: speedList,
},
{
data: accelerationList,
},
{
data: tractionForceList,
},
{
data: brakeForceList,
},
],
});
}
);
</script>
<style scoped></style>

View File

@ -106,18 +106,6 @@ export function initIBPDrawApp() {
return drawApp;
}
//所属集中站
let uniqueIdPrefix = new ibpGraphicData.UniqueIdType();
export function loadUniqueIdPrefix() {
return uniqueIdPrefix;
}
export function setUniqueIdPrefix(
newUniqueIdPrefix: ibpGraphicData.UniqueIdType
) {
uniqueIdPrefix = newUniqueIdPrefix;
}
export function saveIBPDrawToServer(app: IDrawApp) {
const base64 = saveIBPDrawDatas(app);
const ibpDrawStore = useIBPDrawStore();
@ -156,7 +144,6 @@ export function saveIBPDrawDatas(app: IDrawApp) {
storage.IBPTexts.push(g.saveData<IbpTextData>().data);
}
});
storage.UniqueIdPrefix = uniqueIdPrefix;
const base64 = fromUint8Array(storage.serialize());
return base64;
}
@ -188,9 +175,6 @@ async function IBPDrawDataLoader() {
storage.IBPTexts.forEach((ibpText) => {
datas.push(new IbpTextData(ibpText));
});
if (storage.UniqueIdPrefix) {
setUniqueIdPrefix(storage.UniqueIdPrefix);
}
return {
canvasProperty: storage.canvas,
datas: datas,
@ -201,3 +185,52 @@ async function IBPDrawDataLoader() {
});
}
}
export interface RelateDevicelistItem {
deviceType: graphicData.RelatedRef.DeviceType | undefined;
code: string;
combinationtypes: {
code: string;
refDevices: string[];
refDevicesCode?: string[];
expanded?: boolean;
}[];
}
const refDevicesList: ibpGraphicData.IbpRelatedDevice[] = [];
export function loadIbpRelateDeviceList() {
return refDevicesList;
}
export function createIbpRelateDevice(row: ibpGraphicData.IbpRelatedDevice) {
refDevicesList.push(row);
drawApp?.emit('postdataloaded');
}
export function editIbpRelateDevice(
editRow: RelateDevicelistItem,
newData: ibpGraphicData.IbpRelatedDevice
) {
for (let i = 0; i < refDevicesList.length; i++) {
if (
refDevicesList[i].deviceType == editRow.deviceType &&
refDevicesList[i].code == editRow.code
) {
refDevicesList[i] = newData;
break;
}
}
drawApp?.emit('postdataloaded');
}
export function deleteIbpRelateDevice(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

@ -21,6 +21,11 @@ import {
PlatformState,
} from './graphics/PlatformInteraction';
import { PlatformTemplate, Platform } from 'src/graphics/platform/Platform';
import { ScreenDoorData } from './graphics/ScreenDoorInteraction';
import {
ScreenDoor,
ScreenDoorTemplate,
} from 'src/graphics/screenDoor/ScreenDoor';
import {
StationData,
StationOperateInteraction,
@ -145,6 +150,7 @@ export const layerList = [
{ label: 'SectionLink', value: SectionLink.Type, defaultShow: false },
{ label: '区段检测点', value: AxleCounting.Type, defaultShow: false },
{ label: '站台', value: Platform.Type, defaultShow: true },
{ label: '屏蔽门', value: ScreenDoor.Type, defaultShow: true },
{ label: '车站', value: Station.Type, defaultShow: true },
{ label: '道岔', value: Turnout.Type, defaultShow: true },
{ label: '信号机', value: Signal.Type, defaultShow: true },
@ -191,6 +197,7 @@ export function initLineScene(lineApp: IGraphicApp, sceneName: string) {
new TrainTemplate(new TrainState()),
new SignalTemplate(new SignalData(), new SignalState()),
new PlatformTemplate(new PlatformData(), new PlatformState()),
new ScreenDoorTemplate(new ScreenDoorData()),
new StationTemplate(new StationData(), new StationState()),
new TurnoutTemplate(new TurnoutData(), new TurnoutStates()),
new SectionTemplate(new SectionData()),
@ -386,8 +393,10 @@ export async function loadLineDatas(): Promise<IGraphicStorage> {
const datas: GraphicData[] = [];
storage.Platforms.forEach((platform) => {
const g = new PlatformData(platform);
datas.push(g);
datas.push(new PlatformData(platform));
});
storage.screenDoors.forEach((screenDoor) => {
datas.push(new ScreenDoorData(screenDoor));
});
storage.stations.forEach((station) => {
datas.push(new StationData(station));

View File

@ -35,7 +35,6 @@ export class IBPButton extends JlGraphic {
}
doRepaint(): void {
console.log(1);
this.sprite.texture = this.textures.get(this.datas.color, false, false);
}
}

View File

@ -43,7 +43,7 @@ export class RelayCabinetDraw extends GraphicDrawAssistant<
relayCabinetGraphic: RelayCabinet;
constructor(app: IDrawApp, template: RelayCabinetTemplate) {
super(app, template, 'sym_o_square', '继电器柜');
super(app, template, 'door_sliding', '继电器柜');
this.relayCabinetGraphic = this.graphicTemplate.new();
this.container.addChild(this.relayCabinetGraphic);
relayCabinetInteraction.init(app);

View File

@ -21,7 +21,7 @@ export class ScreenDoorDraw extends GraphicDrawAssistant<
> {
screenDoorGraphic: ScreenDoor;
constructor(app: IDrawApp, template: ScreenDoorTemplate) {
super(app, template, 'sym_o_square', '屏蔽门ScreenDoor');
super(app, template, 'door_sliding', '屏蔽门ScreenDoor');
this.screenDoorGraphic = this.graphicTemplate.new();
this.container.addChild(this.screenDoorGraphic);
screenDoorInteraction.init(app);

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, reactive, ref, shallowRef, toRaw, watch } from 'vue';
import { onMounted, reactive, ref, watch } from 'vue';
import { useIBPDrawStore } from '../stores/ibp-draw-store';
import { useRoute, useRouter } from 'vue-router';
import { IBPButton } from 'src/graphics/IBPButton/IBPButton';
@ -8,14 +8,14 @@ import { IbpKey } from 'src/graphics/ibpKey/IbpKey';
import { Arrow } from 'src/graphics/arrow/Arrow';
import { TextContent } from 'src/graphics/textContent/TextContent';
import {
RelateDevicelistItem,
getIBPDrawApp,
saveIBPDrawToServer,
loadUniqueIdPrefix,
setUniqueIdPrefix,
saveIBPDrawDatas,
} from 'src/drawApp/ibpDrawApp';
import IbpDrawProperties from 'src/components/draw-app/IbpDrawProperties.vue';
import { ibpGraphicData } from 'src/protos/ibpGraphics';
import { DialogChainObject, useQuasar } from 'quasar';
import IBpRelatedDeviceList from 'src/components/draw-app/dialogs/IBpRelatedDeviceList.vue';
import RelateIbpConfig from 'src/components/draw-app/properties/RelateIbpConfig.vue';
const ibpDrawStore = useIBPDrawStore();
const route = useRoute();
@ -127,22 +127,29 @@ function saveData() {
}
}
const isPrefixDialogOpen = ref(false);
const uniqueIdPrefix = ref(new ibpGraphicData.UniqueIdType().toObject());
function openUniqueIdPrefixDialog() {
isPrefixDialogOpen.value = true;
uniqueIdPrefix.value = loadUniqueIdPrefix();
}
function saveUniqueIdPrefix() {
setUniqueIdPrefix(new ibpGraphicData.UniqueIdType(uniqueIdPrefix.value));
isPrefixDialogOpen.value = false;
saveData();
}
function backConfirm() {
router.go(-1);
}
const $q = useQuasar();
let relateDeviceDialogInstance: DialogChainObject | null = null;
const relateDeviceConfigEdit = ref<InstanceType<typeof RelateIbpConfig>>();
function openDeviceRelateList() {
if (relateDeviceDialogInstance) return;
relateDeviceDialogInstance = $q
.dialog({
component: IBpRelatedDeviceList,
componentProps: {
onEditClick: (row: RelateDevicelistItem) => {
relateDeviceConfigEdit.value?.editRelateDevices(row);
},
},
})
.onCancel(() => {
relateDeviceDialogInstance = null;
});
}
</script>
<template>
@ -156,13 +163,6 @@ function backConfirm() {
<QItem clickable @click="saveData" v-close-popup>
<QItemSection>保存</QItemSection>
</QItem>
<QItem
clickable
@click="openUniqueIdPrefixDialog"
v-close-popup
>
<QItemSection>UniqueId配置</QItemSection>
</QItem>
</QList>
</QMenu>
</QBtn>
@ -185,6 +185,19 @@ function backConfirm() {
</template></QBtnToggle
>
</QToolbarTitle>
<QBtnDropdown
color="orange"
label="数据管理"
style="margin-right: 10px"
>
<QList>
<QItem clickable v-close-popup @click="openDeviceRelateList">
<QItemSection>
<QItemLabel>关联设备列表</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QBtnDropdown>
<QBtn color="info" label="返回" @click="backConfirm" />
<QBtn dense flat round icon="menu" @click="toggleRightDrawer" />
</QToolbar>
@ -192,47 +205,11 @@ function backConfirm() {
</QHeader>
<QDrawer show-if-above bordered v-model="rightDrawerOpen" side="right">
<QResizeObserver @resize="onRightResize" />
<IbpDrawProperties />
<IbpDrawProperties v-if="!ibpDrawStore.showRelateDeviceConfig" />
<RelateIbpConfig v-else ref="relateDeviceConfigEdit" />
</QDrawer>
<QPageContainer>
<div id="draw-app-container" class="overflow-hidden"></div>
</QPageContainer>
</QLayout>
<QDialog
v-model="isPrefixDialogOpen"
persistent
transition-show="scale"
transition-hide="scale"
>
<QCard style="width: 300px">
<QCardSection>
<div class="text-h6">UniqueId配置</div>
</QCardSection>
<QCardSection>
<QInput
outlined
label="所属城市"
v-model="uniqueIdPrefix.city"
:rules="[(val) => val.trim() != '' || '城市不能为空']"
/>
<QInput
outlined
label="线路号"
v-model="uniqueIdPrefix.lineId"
:rules="[(val) => val.trim() != '' || '线路号不能为空']"
/>
<QInput
outlined
label="所属车站"
v-model="uniqueIdPrefix.belongsStation"
:rules="[(val) => val.trim() != '' || '所属车站不能为空']"
/>
</QCardSection>
<QCardActions align="right">
<QBtn color="primary" label="提交" @click="saveUniqueIdPrefix()" />
<QBtn label="取消" v-close-popup />
</QCardActions>
</QCard>
</QDialog>
</template>

View File

@ -69,6 +69,7 @@ import { IGraphicScene } from 'src/jl-graphic';
import { ISceneName, getSceneName } from 'src/drawApp/lineApp';
import { useTestManageStore } from 'src/stores/testManage-store';
import { CategoryType } from 'src/components/CategoryType';
import TrainInfoEcharts from 'src/components/line-app/infos/TrainInfoEcharts.vue';
const $q = useQuasar();
const canvasWidth = ref(0);
@ -142,6 +143,12 @@ onMounted(async () => {
if (find) {
sceneInfo.value = find;
sceneName = getSceneNameFn(find);
} else {
if (projectInfo.mapInfoLinks && projectInfo.mapInfoLinks[0]) {
const f = projectInfo.mapInfoLinks[0];
sceneInfo.value = f;
sceneName = getSceneNameFn(f);
}
}
lineStore.addAllScene(projectInfo.mapInfoLinks || []);
}
@ -171,6 +178,11 @@ onUnmounted(() => {
dialogInstance.value.hide();
}
lineStore.setCategoryType(null);
if (echartsDialog.value) {
echartsDialog.value.hide();
lineStore.setEchartsTrainId('');
}
lineStore.clearTrainStateMap();
lineStore.setSimulationId(null);
lineStore.destroy();
});
@ -307,4 +319,23 @@ function getSceneNameFn(val: MapInfo) {
};
return getSceneName(obj);
}
const echartsDialog = ref();
watch(
() => lineStore.echartsTrainId,
(val) => {
if (!val || echartsDialog.value) return;
echartsDialog.value = $q
.dialog({
component: TrainInfoEcharts,
componentProps: {
trainId: val,
},
})
.onCancel(() => {
echartsDialog.value = null;
lineStore.setEchartsTrainId('');
});
}
);
</script>

View File

@ -17,9 +17,10 @@ export namespace ibpGraphicData {
ibpArrows?: IbpArrow[];
IBPTexts?: IBPText[];
UniqueIdPrefix?: dependency_2.relayCabinetGraphicData.UniqueIdType;
ibpRelatedDevices?: IbpRelatedDevice[];
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6], this.#one_of_decls);
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2, 3, 4, 5, 6, 8], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("canvas" in data && data.canvas != undefined) {
this.canvas = data.canvas;
@ -39,8 +40,8 @@ export namespace ibpGraphicData {
if ("IBPTexts" in data && data.IBPTexts != undefined) {
this.IBPTexts = data.IBPTexts;
}
if ("UniqueIdPrefix" in data && data.UniqueIdPrefix != undefined) {
this.UniqueIdPrefix = data.UniqueIdPrefix;
if ("ibpRelatedDevices" in data && data.ibpRelatedDevices != undefined) {
this.ibpRelatedDevices = data.ibpRelatedDevices;
}
}
}
@ -91,6 +92,11 @@ export namespace ibpGraphicData {
}
get has_UniqueIdPrefix() {
return pb_1.Message.getField(this, 7) != null;
get ibpRelatedDevices() {
return pb_1.Message.getRepeatedWrapperField(this, IbpRelatedDevice, 8) as IbpRelatedDevice[];
}
set ibpRelatedDevices(value: IbpRelatedDevice[]) {
pb_1.Message.setRepeatedWrapperField(this, 8, value);
}
static fromObject(data: {
canvas?: ReturnType<typeof dependency_1.graphicData.Canvas.prototype.toObject>;
@ -100,6 +106,7 @@ export namespace ibpGraphicData {
ibpArrows?: ReturnType<typeof IbpArrow.prototype.toObject>[];
IBPTexts?: ReturnType<typeof IBPText.prototype.toObject>[];
UniqueIdPrefix?: ReturnType<typeof dependency_2.relayCabinetGraphicData.UniqueIdType.prototype.toObject>;
ibpRelatedDevices?: ReturnType<typeof IbpRelatedDevice.prototype.toObject>[];
}): IBPGraphicStorage {
const message = new IBPGraphicStorage({});
if (data.canvas != null) {
@ -122,6 +129,8 @@ export namespace ibpGraphicData {
}
if (data.UniqueIdPrefix != null) {
message.UniqueIdPrefix = dependency_2.relayCabinetGraphicData.UniqueIdType.fromObject(data.UniqueIdPrefix);
if (data.ibpRelatedDevices != null) {
message.ibpRelatedDevices = data.ibpRelatedDevices.map(item => IbpRelatedDevice.fromObject(item));
}
return message;
}
@ -134,6 +143,7 @@ export namespace ibpGraphicData {
ibpArrows?: ReturnType<typeof IbpArrow.prototype.toObject>[];
IBPTexts?: ReturnType<typeof IBPText.prototype.toObject>[];
UniqueIdPrefix?: ReturnType<typeof dependency_2.relayCabinetGraphicData.UniqueIdType.prototype.toObject>;
ibpRelatedDevices?: ReturnType<typeof IbpRelatedDevice.prototype.toObject>[];
} = {};
if (this.canvas != null) {
data.canvas = this.canvas.toObject();
@ -153,8 +163,8 @@ export namespace ibpGraphicData {
if (this.IBPTexts != null) {
data.IBPTexts = this.IBPTexts.map((item: IBPText) => item.toObject());
}
if (this.UniqueIdPrefix != null) {
data.UniqueIdPrefix = this.UniqueIdPrefix.toObject();
if (this.ibpRelatedDevices != null) {
data.ibpRelatedDevices = this.ibpRelatedDevices.map((item: IbpRelatedDevice) => item.toObject());
}
return data;
}
@ -174,8 +184,8 @@ export namespace ibpGraphicData {
writer.writeRepeatedMessage(5, this.ibpArrows, (item: IbpArrow) => item.serialize(writer));
if (this.IBPTexts.length)
writer.writeRepeatedMessage(6, this.IBPTexts, (item: IBPText) => item.serialize(writer));
if (this.has_UniqueIdPrefix)
writer.writeMessage(7, this.UniqueIdPrefix, () => this.UniqueIdPrefix.serialize(writer));
if (this.ibpRelatedDevices.length)
writer.writeRepeatedMessage(8, this.ibpRelatedDevices, (item: IbpRelatedDevice) => item.serialize(writer));
if (!w)
return writer.getResultBuffer();
}
@ -205,6 +215,8 @@ export namespace ibpGraphicData {
break;
case 7:
reader.readMessage(message.UniqueIdPrefix, () => message.UniqueIdPrefix = dependency_2.relayCabinetGraphicData.UniqueIdType.deserialize(reader));
case 8:
reader.readMessage(message.ibpRelatedDevices, () => pb_1.Message.addToRepeatedWrapperField(message, 8, IbpRelatedDevice.deserialize(reader), IbpRelatedDevice));
break;
default: reader.skipField();
}
@ -830,4 +842,207 @@ export namespace ibpGraphicData {
return IbpArrow.deserialize(bytes);
}
}
export class IbpRelatedDevice extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
code?: string;
combinationtypes?: Combinationtype[];
deviceType?: dependency_1.graphicData.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, dependency_1.graphicData.RelatedRef.DeviceType.Section) as dependency_1.graphicData.RelatedRef.DeviceType;
}
set deviceType(value: dependency_1.graphicData.RelatedRef.DeviceType) {
pb_1.Message.setField(this, 3, value);
}
static fromObject(data: {
code?: string;
combinationtypes?: ReturnType<typeof Combinationtype.prototype.toObject>[];
deviceType?: dependency_1.graphicData.RelatedRef.DeviceType;
}): IbpRelatedDevice {
const message = new IbpRelatedDevice({});
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?: dependency_1.graphicData.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 != dependency_1.graphicData.RelatedRef.DeviceType.Section)
writer.writeEnum(3, this.deviceType);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IbpRelatedDevice {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new IbpRelatedDevice();
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): IbpRelatedDevice {
return IbpRelatedDevice.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,4 +1,5 @@
import { defineStore } from 'pinia';
import { QTable } from 'quasar';
import { getIBPDrawApp, initIBPDrawApp } from 'src/drawApp/ibpDrawApp';
import { DrawAssistant, IDrawApp, IJlCanvas, JlGraphic } from 'src/jl-graphic';
import { markRaw } from 'vue';
@ -9,6 +10,8 @@ export const useIBPDrawStore = defineStore('ibpDraw', {
selectedGraphics: null as JlGraphic[] | null,
draftId: null as number | null,
draftType: 'IBP',
showRelateDeviceConfig: false,
table: undefined as QTable | undefined,
}),
getters: {
selectedObjName: (state) => {

View File

@ -15,6 +15,8 @@ import {
import { markRaw } from 'vue';
import { MapInfo } from 'src/api/ProjectLinkApi';
import { CategoryType } from 'src/components/CategoryType';
import { Train } from 'src/graphics/train/Train';
import { TrainState } from 'src/drawApp/graphics/TrainInteraction';
export const useLineStore = defineStore('line', {
state: () => ({
@ -29,6 +31,8 @@ export const useLineStore = defineStore('line', {
mapId: null as number | null,
sceneName: '', // 场景名称
categoryType: null as CategoryType | null,
echartsTrainId: '',
trainStateMap: new Map() as Map<Date, TrainState[]>,
}),
getters: {
selectedGraphicType: (state) => {
@ -82,8 +86,28 @@ export const useLineStore = defineStore('line', {
setSimulationId(id: string | null) {
this.simulationId = id;
},
setEchartsTrainId(id: string) {
this.echartsTrainId = id;
},
setSocketStates(v: GraphicState[] | null) {
this.socketStates = v;
const t = v
?.filter((item) => {
return item.graphicType == Train.Type;
})
.map((ii) => {
return ii.clone();
});
if (t && t.length) {
this.setTrainStateMap(t as TrainState[]);
}
},
setTrainStateMap(v: TrainState[]) {
const a = new Date();
this.trainStateMap.set(a, v);
},
clearTrainStateMap() {
this.trainStateMap.clear();
},
stateProCountIncrease() {
this.stateProCount++;

View File

@ -1277,6 +1277,11 @@ deep-is@^0.1.3:
resolved "https://registry.npmmirror.com/deep-is/-/deep-is-0.1.4.tgz"
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
default-passive-events@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/default-passive-events/-/default-passive-events-2.0.0.tgz#79b1aa67becbaab38b718469b5480fef92eda649"
integrity sha512-eMtt76GpDVngZQ3ocgvRcNCklUMwID1PaNbCNxfpDXuiOXttSh0HzBbda1HU9SIUsDc02vb7g9+3I5tlqe/qMQ==
defaults@^1.0.3:
version "1.0.4"
resolved "https://registry.npmmirror.com/defaults/-/defaults-1.0.4.tgz"
@ -1330,6 +1335,14 @@ earcut@^2.2.4:
resolved "https://registry.npmmirror.com/earcut/-/earcut-2.2.4.tgz"
integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==
echarts@^5.4.3:
version "5.4.3"
resolved "https://registry.yarnpkg.com/echarts/-/echarts-5.4.3.tgz#f5522ef24419164903eedcfd2b506c6fc91fb20c"
integrity sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==
dependencies:
tslib "2.3.0"
zrender "5.4.4"
ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz"
@ -3246,6 +3259,11 @@ ts-md5@^1.3.1:
resolved "https://registry.npmmirror.com/ts-md5/-/ts-md5-1.3.1.tgz"
integrity sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==
tslib@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e"
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==
tslib@^1.8.1:
version "1.14.1"
resolved "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz"
@ -3491,3 +3509,10 @@ zip-stream@^4.1.0:
archiver-utils "^2.1.0"
compress-commons "^4.1.0"
readable-stream "^3.6.0"
zrender@5.4.4:
version "5.4.4"
resolved "https://registry.yarnpkg.com/zrender/-/zrender-5.4.4.tgz#8854f1d95ecc82cf8912f5a11f86657cb8c9e261"
integrity sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==
dependencies:
tslib "2.3.0"