|
@@ -10,14 +10,16 @@
|
|
|
:label="back.label"
|
|
|
:url="back.image"
|
|
|
:active="activeParent === back.value"
|
|
|
- @click="value !== back.value && $emit('update:value', back.value)"
|
|
|
/>
|
|
|
</div>
|
|
|
<template #overlay>
|
|
|
<Menu :selectedKeys="[value]">
|
|
|
<MenuItem
|
|
|
v-for="item in back.children"
|
|
|
- @click="value !== item.value && $emit('update:value', item.value)"
|
|
|
+ @click="
|
|
|
+ value[1] !== item.value &&
|
|
|
+ $emit('update:value', [undefined, item.value])
|
|
|
+ "
|
|
|
:key="item.value"
|
|
|
>
|
|
|
{{ item.label }}
|
|
@@ -31,8 +33,8 @@
|
|
|
:type="back.type"
|
|
|
:label="back.label"
|
|
|
:url="back.image"
|
|
|
- :active="value === back.value"
|
|
|
- @click="value !== back.value && $emit('update:value', back.value)"
|
|
|
+ :active="value[0] === back.value"
|
|
|
+ @click="value[0] !== back.value && $emit('update:value', [back.value, undefined])"
|
|
|
/>
|
|
|
</template>
|
|
|
</div>
|
|
@@ -42,22 +44,22 @@
|
|
|
import { Dropdown, MenuItem, Menu } from "ant-design-vue";
|
|
|
import { computed, ref } from "vue";
|
|
|
import BackItem from "./back-item.vue";
|
|
|
+import { fetchMapTiles } from "@/api/map-tile";
|
|
|
+import { sysTiles } from "@/store";
|
|
|
|
|
|
-const props = defineProps<{ value: string | undefined }>();
|
|
|
-defineEmits<{ (e: "update:value", value: string): void }>();
|
|
|
+const props = defineProps<{ value: [string | undefined, number | undefined] }>();
|
|
|
+defineEmits<{
|
|
|
+ (e: "update:value", value: [string | undefined, number | undefined]): void;
|
|
|
+}>();
|
|
|
|
|
|
-const backs = ref([
|
|
|
+const backs = computed(() => [
|
|
|
{ label: "无", type: "icon", image: "icon-without", value: "none" },
|
|
|
{
|
|
|
label: "地图",
|
|
|
type: "map",
|
|
|
image: "/oss/fusion/default/images/map.png",
|
|
|
value: "dt",
|
|
|
- children: [
|
|
|
- { label: "天地图", value: "map" },
|
|
|
- { label: "高德地图", value: "gdMap" },
|
|
|
- { label: "谷歌地图", value: "gMap" },
|
|
|
- ],
|
|
|
+ children: sysTiles.value.map((t) => ({ label: t.name, value: t.id })),
|
|
|
},
|
|
|
{
|
|
|
label: "蓝天白云",
|
|
@@ -87,11 +89,11 @@ const backs = ref([
|
|
|
|
|
|
const activeParent = computed(() => {
|
|
|
for (const back of backs.value) {
|
|
|
- if (back.value === props.value) {
|
|
|
+ if (back.value === props.value[0]) {
|
|
|
return back.value;
|
|
|
} else if (back.children) {
|
|
|
for (const c of back.children) {
|
|
|
- if (c.value === props.value) {
|
|
|
+ if (c.value === props.value[1]) {
|
|
|
return back.value;
|
|
|
}
|
|
|
}
|