增加删除选择的图形

This commit is contained in:
joylink_zhaoerwei 2023-08-23 16:25:49 +08:00
parent 3036016928
commit e46997271a

View File

@ -40,6 +40,8 @@
square
color="primary"
text-color="white"
removable
@remove="removeSelect(item)"
>
{{ item }}
</q-chip>
@ -101,7 +103,7 @@ const device = ref<string[]>([]);
const handleState = ref('新建范围配置');
const optionsType = [
{ label: '逻辑区段', value: LogicSection.Type },
{ label: '轨道', value: LogicSection.Type },
{ label: '道岔', value: Turnout.Type },
{ label: '集中站', value: Station.Type },
{ label: '站台', value: Platform.Type },
@ -223,6 +225,14 @@ async function searchById(id: number) {
}
}
function removeSelect(code: string) {
const removeIndex = device.value.findIndex((item) => item == code);
selectGraphic.splice(removeIndex, 1);
device.value.splice(removeIndex, 1);
rangeConfig.device.splice(removeIndex, 1);
lineStore.getLineApp().updateSelected(...selectGraphic);
}
function clearSelect() {
device.value = [];
selectGraphic = [];