Merge branch 'master' of https://git.code.tencent.com/xian-ncc-da/xian-ncc-da-client
This commit is contained in:
commit
266f1ce829
@ -48,6 +48,16 @@
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<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 square color="primary" text-color="white">
|
||||
{{ sectionName }}
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-form>
|
||||
</template>
|
||||
@ -56,16 +66,36 @@
|
||||
import { useFormData } from 'src/components/DrawAppFormUtils';
|
||||
import { PlatformData } from 'src/drawApp/graphics/PlatformInteraction';
|
||||
import { Platform } from 'src/graphics/platform/Platform';
|
||||
import { Section } from 'src/graphics/section/Section';
|
||||
import { Station } from 'src/graphics/station/Station';
|
||||
import { useDrawStore } from 'src/stores/draw-store';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
const drawStore = useDrawStore();
|
||||
const { data: platformModel, onUpdate } = useFormData(
|
||||
new PlatformData(),
|
||||
drawStore.getDrawApp()
|
||||
);
|
||||
const stationName = ref('');
|
||||
const stationName = computed(() => {
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
if (platformModel.refStation) {
|
||||
const refStation = platform.queryStore.queryById<Station>(
|
||||
platformModel.refStation
|
||||
);
|
||||
return refStation.datas.name;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
const sectionName = computed(() => {
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
if (platformModel.refSectionId) {
|
||||
const refSection = platform.queryStore.queryById<Section>(
|
||||
platformModel.refSectionId
|
||||
);
|
||||
return refSection.datas.code;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
const optionsDoor = [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
@ -78,16 +108,4 @@ const optionsUpAndDown = [
|
||||
{ label: '上行', value: true },
|
||||
{ label: '下行', value: false },
|
||||
];
|
||||
|
||||
onMounted(() => {
|
||||
const platform = drawStore.selectedGraphic as Platform;
|
||||
if (platform) {
|
||||
if (platformModel.refStation) {
|
||||
const refStation = platform.queryStore.queryById<Station>(
|
||||
platformModel.refStation
|
||||
) as Station;
|
||||
stationName.value = refStation.datas.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -65,6 +65,12 @@ export class PlatformData extends GraphicDataBase implements IPlatformData {
|
||||
set refStation(v: string) {
|
||||
this.data.refStation = v;
|
||||
}
|
||||
get refSectionId(): string {
|
||||
return this.data.refSectionId;
|
||||
}
|
||||
set refSectionId(v: string) {
|
||||
this.data.refSectionId = v;
|
||||
}
|
||||
|
||||
clone(): PlatformData {
|
||||
return new PlatformData(this.data.cloneMessage());
|
||||
|
@ -6,9 +6,11 @@ import {
|
||||
JlGraphicTemplate,
|
||||
VectorText,
|
||||
calculateMirrorPoint,
|
||||
distance2,
|
||||
getRectangleCenter,
|
||||
} from 'src/jl-graphic';
|
||||
import { Station } from '../station/Station';
|
||||
import { Section } from '../section/Section';
|
||||
|
||||
export interface IPlatformData extends GraphicData {
|
||||
get code(): string; // 编号
|
||||
@ -21,6 +23,8 @@ export interface IPlatformData extends GraphicData {
|
||||
set up(v: boolean);
|
||||
get refStation(): string; // 关联的车站
|
||||
set refStation(v: string);
|
||||
get refSectionId(): string; // 关联的物理区段
|
||||
set refSectionId(v: string);
|
||||
clone(): IPlatformData;
|
||||
copyFrom(data: IPlatformData): void;
|
||||
eq(other: IPlatformData): boolean;
|
||||
@ -435,6 +439,29 @@ export class Platform extends JlGraphic {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const sections = this.queryStore.queryByType<Section>(Section.Type);
|
||||
const minDistanceRefSections: Section[] = [];
|
||||
sections.forEach((section) => {
|
||||
const sP = section.localBoundsToCanvasPoints();
|
||||
if (this.x > sP[0].x && this.x < sP[1].x) {
|
||||
minDistanceRefSections.push(section);
|
||||
}
|
||||
});
|
||||
if (minDistanceRefSections) {
|
||||
const refSection = minDistanceRefSections.reduce((prev, cur) => {
|
||||
return distance2(
|
||||
prev.localToCanvasPoint(getRectangleCenter(prev.getLocalBounds())),
|
||||
this.position
|
||||
) >
|
||||
distance2(
|
||||
cur.localToCanvasPoint(getRectangleCenter(cur.getLocalBounds())),
|
||||
this.position
|
||||
)
|
||||
? cur
|
||||
: prev;
|
||||
});
|
||||
this.datas.refSectionId = refSection.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user