站场图组合调整
This commit is contained in:
parent
4939a196e4
commit
b639a1df60
@ -130,8 +130,7 @@ const relateDeviceConfig = ref<{
|
||||
const handleState = ref('新建门控箱关联设备');
|
||||
|
||||
const optionsType = [
|
||||
{ label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout },
|
||||
{ label: '信号机', value: graphicData.RelatedRef.DeviceType.signal },
|
||||
{ label: '车站', value: graphicData.RelatedRef.DeviceType.station },
|
||||
];
|
||||
|
||||
let selectGraphic: JlGraphic[] = [];
|
||||
|
@ -94,21 +94,18 @@
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { QForm, useQuasar } from 'quasar';
|
||||
import { JlGraphic } from 'src/jl-graphic';
|
||||
import { usePslDrawStore } from 'src/stores/psl-draw-store';
|
||||
import { PslKey } from 'src/graphics/pslKey/pslKey';
|
||||
import { PslButton } from 'src/graphics/pslButton/pslButton';
|
||||
import { PslLight } from 'src/graphics/pslLight/pslLight';
|
||||
import { pslGraphicData } from 'src/protos/pslGraphics';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { EsbButton } from 'src/graphics/esbButton/EsbButton';
|
||||
import {
|
||||
creatGatedRelateDevice,
|
||||
editGatedRelateDevice,
|
||||
creatStationRelateDevice,
|
||||
editStationRelateDevice,
|
||||
RelateDevicelistItem,
|
||||
} from 'src/drawApp/pslApp';
|
||||
} from 'src/drawApp/thApp';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
|
||||
defineExpose({ editRelateDevices });
|
||||
|
||||
const pslDrawStore = usePslDrawStore();
|
||||
const drawStore = useDrawStore();
|
||||
const $q = useQuasar();
|
||||
const showRangeConfig = ref(true);
|
||||
const relateDeviceConfig = ref<{
|
||||
@ -130,29 +127,23 @@ const relateDeviceConfig = ref<{
|
||||
const handleState = ref('新建车站关联设备');
|
||||
|
||||
const optionsType = [
|
||||
{ label: '道岔', value: graphicData.RelatedRef.DeviceType.Turnout },
|
||||
{ label: '信号机', value: graphicData.RelatedRef.DeviceType.signal },
|
||||
{ label: '车站', value: graphicData.RelatedRef.DeviceType.station },
|
||||
];
|
||||
|
||||
let selectGraphic: JlGraphic[] = [];
|
||||
watch(
|
||||
() => pslDrawStore.selectedGraphics,
|
||||
() => drawStore.selectedGraphics,
|
||||
(val) => {
|
||||
if (val && val.length > 0 && clickIndex !== null) {
|
||||
const selectFilter = pslDrawStore.selectedGraphics?.filter(
|
||||
(g) =>
|
||||
g.type == PslKey.Type ||
|
||||
g.type == PslButton.Type ||
|
||||
g.type == PslLight.Type
|
||||
const selectFilter = drawStore.selectedGraphics?.filter(
|
||||
(g) => g.type == EsbButton.Type
|
||||
) as JlGraphic[];
|
||||
selectGraphic.push(...selectFilter);
|
||||
selectGraphic = Array.from(new Set(selectGraphic));
|
||||
pslDrawStore.getDrawApp().updateSelected(...selectGraphic);
|
||||
drawStore.getDrawApp().updateSelected(...selectGraphic);
|
||||
relateDeviceConfig.value.combinationtypes[clickIndex].refDevicesCode =
|
||||
selectGraphic.map((g) =>
|
||||
(g as PslKey | PslButton | PslLight).datas.code == ''
|
||||
? g.id
|
||||
: (g as PslKey | PslButton | PslLight).datas.code
|
||||
(g as EsbButton).datas.code == '' ? g.id : (g as EsbButton).datas.code
|
||||
);
|
||||
relateDeviceConfig.value.combinationtypes[clickIndex].refDevices =
|
||||
selectGraphic.map((g) => g.id) as string[];
|
||||
@ -172,16 +163,16 @@ async function onSubmit() {
|
||||
myForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
try {
|
||||
const combinationtypes: pslGraphicData.Combinationtype[] = [];
|
||||
const combinationtypes: graphicData.Combinationtype[] = [];
|
||||
relateDeviceConfig.value.combinationtypes.forEach((combinationtype) => {
|
||||
combinationtypes.push(
|
||||
new pslGraphicData.Combinationtype({
|
||||
new graphicData.Combinationtype({
|
||||
code: combinationtype.code,
|
||||
refDevices: combinationtype.refDevices,
|
||||
})
|
||||
);
|
||||
});
|
||||
const gatedRelateDevice = new pslGraphicData.GatedRelateDevice({
|
||||
const stationRelateDevice = new graphicData.StationRelateDevice({
|
||||
deviceType: relateDeviceConfig.value.deviceType,
|
||||
code: relateDeviceConfig.value.code,
|
||||
combinationtypes: combinationtypes,
|
||||
@ -189,13 +180,13 @@ async function onSubmit() {
|
||||
if (handleState.value == '新建车站关联设备') {
|
||||
handle.value = '创建成功';
|
||||
handleError.value = '创建失败';
|
||||
creatGatedRelateDevice(gatedRelateDevice);
|
||||
creatStationRelateDevice(stationRelateDevice);
|
||||
} else {
|
||||
handle.value = '更新成功';
|
||||
handleError.value = '更新失败';
|
||||
editGatedRelateDevice(editRow, gatedRelateDevice);
|
||||
editStationRelateDevice(editRow, stationRelateDevice);
|
||||
}
|
||||
pslDrawStore.table?.requestServerInteraction();
|
||||
drawStore.table?.requestServerInteraction();
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: handle.value,
|
||||
@ -217,7 +208,7 @@ async function onSubmit() {
|
||||
}
|
||||
async function editRelateDevices(row: RelateDevicelistItem) {
|
||||
try {
|
||||
const drawApp = pslDrawStore.getDrawApp();
|
||||
const drawApp = drawStore.getDrawApp();
|
||||
handleState.value = '编辑车站关联设备';
|
||||
selectGraphic = [];
|
||||
drawApp.updateSelected();
|
||||
@ -253,7 +244,7 @@ async function editRelateDevices(row: RelateDevicelistItem) {
|
||||
|
||||
let clickIndex: null | number = null;
|
||||
function toggleItem(index: number) {
|
||||
const drawApp = pslDrawStore.getDrawApp();
|
||||
const drawApp = drawStore.getDrawApp();
|
||||
selectGraphic = [];
|
||||
drawApp.updateSelected();
|
||||
const combinationtypes = relateDeviceConfig.value.combinationtypes;
|
||||
@ -279,7 +270,7 @@ function removeSelect(code: string) {
|
||||
selectGraphic.splice(removeIndex, 1);
|
||||
clickTarget.refDevicesCode.splice(removeIndex, 1);
|
||||
clickTarget.refDevices.splice(removeIndex, 1);
|
||||
pslDrawStore.getDrawApp().updateSelected(...selectGraphic);
|
||||
drawStore.getDrawApp().updateSelected(...selectGraphic);
|
||||
}
|
||||
|
||||
function clearAllSelect(index: number) {
|
||||
@ -290,7 +281,7 @@ function clearAllSelect(index: number) {
|
||||
|
||||
function clearAllSelectAtCanvas() {
|
||||
selectGraphic = [];
|
||||
pslDrawStore.getDrawApp().updateSelected();
|
||||
drawStore.getDrawApp().updateSelected();
|
||||
}
|
||||
|
||||
function addCombinationtype() {
|
||||
@ -322,6 +313,6 @@ function onReset() {
|
||||
|
||||
function goBack() {
|
||||
onReset();
|
||||
pslDrawStore.showRelateDeviceConfig = false;
|
||||
drawStore.showRelateDeviceConfig = false;
|
||||
}
|
||||
</script>
|
||||
|
@ -299,7 +299,10 @@ export function loadCommonDrawDatas(
|
||||
return datas;
|
||||
}
|
||||
|
||||
export function saveCommonDrawDatas(app: IDrawApp) {
|
||||
export function saveCommonDrawDatas(
|
||||
app: IDrawApp,
|
||||
refDevicesList?: graphicData.StationRelateDevice[]
|
||||
) {
|
||||
const storage = new graphicData.RtssGraphicStorage();
|
||||
const canvasData = app.canvas.saveData();
|
||||
storage.canvas = new graphicData.Canvas({
|
||||
@ -368,6 +371,9 @@ export function saveCommonDrawDatas(app: IDrawApp) {
|
||||
storage.curvatures.push((curvatureData as CurvatureData).data);
|
||||
}
|
||||
});
|
||||
if (refDevicesList) {
|
||||
storage.stationRelateDeviceList = refDevicesList;
|
||||
}
|
||||
storage.UniqueIdPrefix = UniqueIdPrefix;
|
||||
storage.kilometerConvertList = kilometerConvertList;
|
||||
return storage;
|
||||
|
@ -114,6 +114,7 @@ export async function loadThDrawDatas(): Promise<IGraphicStorage> {
|
||||
storage.trackLogicSections.forEach((logicSection) => {
|
||||
datas.push(new TrackLogicSectionData(logicSection));
|
||||
});
|
||||
refDevicesList = storage.stationRelateDeviceList;
|
||||
return Promise.resolve({
|
||||
canvasProperty: storage.canvas,
|
||||
datas: datas,
|
||||
@ -126,7 +127,7 @@ export async function loadThDrawDatas(): Promise<IGraphicStorage> {
|
||||
}
|
||||
|
||||
export function saveThDrawDatas(app: IDrawApp) {
|
||||
const storage = saveCommonDrawDatas(app);
|
||||
const storage = saveCommonDrawDatas(app, refDevicesList);
|
||||
console.log(storage, '保存数据');
|
||||
const graphics = app.queryStore.getAllGraphics();
|
||||
graphics.forEach((g) => {
|
||||
@ -156,7 +157,7 @@ export interface RelateDevicelistItem {
|
||||
}[];
|
||||
}
|
||||
|
||||
const refDevicesList: graphicData.StationRelateDevice[] = [];
|
||||
let refDevicesList: graphicData.StationRelateDevice[] = [];
|
||||
export function loadStationRelateDeviceList() {
|
||||
return refDevicesList;
|
||||
}
|
||||
|
@ -656,7 +656,6 @@ abstract class GraphicSceneBase
|
||||
const storage = await this._options.dataLoader();
|
||||
if (storage.canvasProperty) {
|
||||
this.canvas.update(storage.canvasProperty);
|
||||
console.log(this.canvas, 'canvas');
|
||||
}
|
||||
if (storage.datas) {
|
||||
await this.loadGraphic(storage.datas);
|
||||
|
@ -64,6 +64,20 @@
|
||||
</q-input>
|
||||
</q-popup-edit>
|
||||
</q-btn>
|
||||
<q-btn-dropdown
|
||||
v-if="drawStore.categoryType === CategoryType.TH"
|
||||
color="orange"
|
||||
label="数据管理"
|
||||
style="margin-right: 10px"
|
||||
>
|
||||
<q-list>
|
||||
<q-item clickable v-close-popup @click="openDeviceRelateList">
|
||||
<q-item-section>
|
||||
<q-item-label>关联设备列表</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
<q-btn color="info" label="返回" @click="backConfirm" />
|
||||
<q-btn dense flat round icon="menu" @click="toggleRightDrawer" />
|
||||
</q-toolbar>
|
||||
@ -76,7 +90,13 @@
|
||||
<KilometerConvertConfig
|
||||
v-if="drawStore.showEditKilometerConvert"
|
||||
></KilometerConvertConfig>
|
||||
<draw-properties v-else></draw-properties>
|
||||
<draw-properties
|
||||
v-else-if="!drawStore.showRelateDeviceConfig"
|
||||
></draw-properties>
|
||||
<station-relate-device-config
|
||||
v-else-if="drawStore.showRelateDeviceConfig"
|
||||
ref="relateDeviceConfigEdit"
|
||||
></station-relate-device-config>
|
||||
</q-drawer>
|
||||
|
||||
<q-page-container>
|
||||
@ -153,7 +173,7 @@ import {
|
||||
setUniqueIdPrefix,
|
||||
} from 'src/drawApp/commonApp';
|
||||
import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp';
|
||||
import { saveThDrawDatas } from 'src/drawApp/thApp';
|
||||
import { RelateDevicelistItem, saveThDrawDatas } from 'src/drawApp/thApp';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
@ -173,7 +193,7 @@ import { LogicSection } from 'src/graphics/logicSection/LogicSection';
|
||||
import { LogicSectionDraw } from 'src/graphics/logicSection/LogicSectionDrawAssistant';
|
||||
import { Slope } from 'src/graphics/slope/Slope';
|
||||
import { SlopeDraw } from 'src/graphics/slope/SlopeAssistant';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { DialogChainObject, useQuasar } from 'quasar';
|
||||
import LayerControlDialog from 'src/components/draw-app/dialogs/LayerControlDialog.vue';
|
||||
import { drawThLayerList } from 'src/drawApp/thApp';
|
||||
import { drawJkLayerList } from 'src/drawApp/jkApp';
|
||||
@ -198,6 +218,8 @@ import { CategoryType } from 'src/components/CategoryType';
|
||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import KilometerConvertList from 'src/components/draw-app/dialogs/KilometerConvertList.vue';
|
||||
import KilometerConvertConfig from 'src/components/draw-app/properties/KilometerConvertConfig.vue';
|
||||
import StationRelateDeviceConfig from 'src/components/draw-app/properties/StationRelateDeviceConfig.vue';
|
||||
import StationRelateDeviceList from 'src/components/draw-app/dialogs/StationRelateDeviceList.vue';
|
||||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
@ -600,4 +622,23 @@ function openkilometerConvertList() {
|
||||
drawStore.setEditKilometerConvertIndex(-1);
|
||||
});
|
||||
}
|
||||
|
||||
let relateDeviceDialogInstance: DialogChainObject | null = null;
|
||||
const relateDeviceConfigEdit =
|
||||
ref<InstanceType<typeof StationRelateDeviceConfig>>();
|
||||
function openDeviceRelateList() {
|
||||
if (relateDeviceDialogInstance) return;
|
||||
relateDeviceDialogInstance = $q
|
||||
.dialog({
|
||||
component: StationRelateDeviceList,
|
||||
componentProps: {
|
||||
onEditClick: (row: RelateDevicelistItem) => {
|
||||
relateDeviceConfigEdit.value?.editRelateDevices(row);
|
||||
},
|
||||
},
|
||||
})
|
||||
.onCancel(() => {
|
||||
relateDeviceDialogInstance = null;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
@ -131,6 +131,7 @@ import {
|
||||
savePslDrawDatas,
|
||||
savePslDrawToServer,
|
||||
checkPslDataToServer,
|
||||
RelateDevicelistItem,
|
||||
} from 'src/drawApp/pslApp';
|
||||
import { IDrawApp } from 'src/jl-graphic';
|
||||
import { usePslDrawStore } from 'src/stores/psl-draw-store';
|
||||
@ -330,7 +331,7 @@ function openDeviceRelateList() {
|
||||
component: GatedRelateDeviceList,
|
||||
componentProps: {
|
||||
onEditClick: (row: RelateDevicelistItem) => {
|
||||
relateDeviceConfigEdit.value?.editRelateRelays(row);
|
||||
relateDeviceConfigEdit.value?.editRelateDevices(row);
|
||||
},
|
||||
},
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user