计轴添加集中站

This commit is contained in:
fan 2023-09-22 09:58:25 +08:00
parent da66269b90
commit c6814bdf37

View File

@ -104,6 +104,21 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<q-field class="q-mt-lg" outlined label="所属集中站" stack-label>
<template #control>
<q-chip
color="primary"
text-color="white"
v-for="(name, index) in axleCountingModel.centralizedStations"
:key="index"
removable
@remove="removeStation(index)"
square
>{{ name }}</q-chip
>
<q-btn round color="primary" size="xs" icon="add" @click="addStation" />
</template>
</q-field>
</q-form> </q-form>
</template> </template>
@ -116,7 +131,9 @@ import { Turnout } from 'src/graphics/turnout/Turnout';
import { GraphicIdGenerator } from 'src/jl-graphic'; import { GraphicIdGenerator } from 'src/jl-graphic';
import { useDrawStore } from 'src/stores/draw-store'; import { useDrawStore } from 'src/stores/draw-store';
import { computed } from 'vue'; import { computed } from 'vue';
import { useQuasar } from 'quasar';
const $q = useQuasar();
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const { data: axleCountingModel, onUpdate } = useFormData( const { data: axleCountingModel, onUpdate } = useFormData(
new AxleCountingData(), new AxleCountingData(),
@ -170,7 +187,22 @@ const turnoutRelations = computed(() => {
); );
return Array.from(new Set(ref)); return Array.from(new Set(ref));
}); });
function removeStation(index: number) {
axleCountingModel.centralizedStations.splice(index, 1);
}
function addStation() {
$q.dialog({
message: '添加设备的集中站',
prompt: {
model: '',
type: 'text', // optional
},
cancel: true,
}).onOk((data: string) => {
axleCountingModel.centralizedStations.push(data);
});
}
function oneClickAxleCounting() { function oneClickAxleCounting() {
const select = drawStore.selectedGraphic as AxleCounting; const select = drawStore.selectedGraphic as AxleCounting;
const axleCountings = select.queryStore.queryByType<AxleCounting>( const axleCountings = select.queryStore.queryByType<AxleCounting>(