|
@@ -1,5 +1,9 @@
|
|
|
<template>
|
|
|
- <div id="global-search" v-if="custom.showSearch">
|
|
|
+ <div
|
|
|
+ id="global-search"
|
|
|
+ v-if="custom.showSearch"
|
|
|
+ :class="{ nul: fuseModels.length === 0 }"
|
|
|
+ >
|
|
|
<Select
|
|
|
:filter-option="filter"
|
|
|
v-model:value="value"
|
|
@@ -10,7 +14,7 @@
|
|
|
show-search
|
|
|
@search="handleSearch"
|
|
|
:dropdownMatchSelectWidth="false"
|
|
|
- popupClassName="global-search-menu"
|
|
|
+ :popupClassName="popupClassName || 'global-search-menu'"
|
|
|
allowClear
|
|
|
placeholder="搜索"
|
|
|
>
|
|
@@ -26,7 +30,11 @@
|
|
|
:key="item.key + option.id"
|
|
|
:class="{ 'last-item': ndx + 1 === item.options.length }"
|
|
|
>
|
|
|
- <component :is="item.comp" :data="(option as any)" />
|
|
|
+ <component
|
|
|
+ :is="item.comp"
|
|
|
+ :data="(option as any)"
|
|
|
+ @update:data="(data: any) => emit('update:data', data)"
|
|
|
+ />
|
|
|
</SelectOption>
|
|
|
</SelectOptGroup>
|
|
|
</template>
|
|
@@ -65,8 +73,11 @@ import { debounce } from "@/utils";
|
|
|
import { searchAddress, Address } from "@/store/map";
|
|
|
import { fuseModels } from "@/store";
|
|
|
|
|
|
+const props = defineProps<{ popupClassName?: string; enable?: string }>();
|
|
|
+const emit = defineEmits<{ (e: "update:data", val: any): void }>();
|
|
|
+
|
|
|
const addressItems = ref<Address[]>([]);
|
|
|
-const options = computed(() => [
|
|
|
+const optionsAll = computed(() => [
|
|
|
{
|
|
|
key: "mode-",
|
|
|
name: "模型",
|
|
@@ -102,13 +113,13 @@ const options = computed(() => [
|
|
|
getLabel: (tag: Guide) => tag.title,
|
|
|
comp: GuideComp,
|
|
|
},
|
|
|
- {
|
|
|
- key: "view-",
|
|
|
- name: "视图提取",
|
|
|
- options: views.value,
|
|
|
- getLabel: (tag: View) => tag.title,
|
|
|
- comp: ViewComp,
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // key: "view-",
|
|
|
+ // name: "视图提取",
|
|
|
+ // options: views.value,
|
|
|
+ // getLabel: (tag: View) => tag.title,
|
|
|
+ // comp: ViewComp,
|
|
|
+ // },
|
|
|
// {
|
|
|
// key: "monitor-",
|
|
|
// name: "监控",
|
|
@@ -125,6 +136,12 @@ const options = computed(() => [
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
+const options = computed(() =>
|
|
|
+ !props.enable
|
|
|
+ ? optionsAll.value
|
|
|
+ : optionsAll.value.filter((item) => item.key === props.enable)
|
|
|
+);
|
|
|
+
|
|
|
const filterOption = (input: string, key: string) => {
|
|
|
if (key.indexOf("map-") === 0) return true;
|
|
|
const option = options.value.find((option) => key.indexOf(option.key) === 0);
|
|
@@ -174,6 +191,10 @@ const handleSearch = (val: string) => {
|
|
|
top: calc(var(--editor-head-height) + var(--header-top) + 20px);
|
|
|
// background: #000;
|
|
|
transition: all 0.3s ease;
|
|
|
+
|
|
|
+ &.nul {
|
|
|
+ left: 20px;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|
|
|
|