|
|
@@ -2,7 +2,7 @@
|
|
|
<GoogleMap
|
|
|
ref="mapRef"
|
|
|
:center="center"
|
|
|
- api-key="AIzaSyBGUvCR1bppO9pfuS0MUWzuftiZ127y4Os"
|
|
|
+ :api-key="googleKey"
|
|
|
mapId="DEMO_MAP_ID"
|
|
|
:map-type-control="true"
|
|
|
:disable-default-ui="false"
|
|
|
@@ -43,7 +43,7 @@
|
|
|
<CustomControl position="TOP_LEFT">
|
|
|
<div class="top_left_control">
|
|
|
<div>
|
|
|
- <a-input
|
|
|
+ <!-- <a-input
|
|
|
type="text"
|
|
|
style="width: 220px"
|
|
|
v-model:value="form.searchValue"
|
|
|
@@ -51,19 +51,33 @@
|
|
|
:placeholder="t('common.inputText')"
|
|
|
>
|
|
|
<template #prefix><SearchOutlined /></template>
|
|
|
- </a-input>
|
|
|
+ </a-input> -->
|
|
|
+
|
|
|
+ <AutoComplete
|
|
|
+ v-model:value="form.searchValue"
|
|
|
+ :options="options"
|
|
|
+ size="large"
|
|
|
+ allowClear
|
|
|
+ style="width: 300px"
|
|
|
+ :placeholder="t('common.inputText')"
|
|
|
+ @select="handleSelect"
|
|
|
+ @search="onSearch"
|
|
|
+ >
|
|
|
+ <template #option="{ title, value: num }">
|
|
|
+ <span style="font-weight: bold" :value="num">{{ title }}</span>
|
|
|
+ </template>
|
|
|
+ </AutoComplete>
|
|
|
</div>
|
|
|
<div>
|
|
|
<Select
|
|
|
ref="select"
|
|
|
v-model:value="form.type"
|
|
|
style="width: 120px"
|
|
|
- allow-clear
|
|
|
size="large"
|
|
|
:placeholder="t('common.chooseText')"
|
|
|
>
|
|
|
- <SelectOption value="jack">全部项目</SelectOption>
|
|
|
- <SelectOption value="lucy">全部场景</SelectOption>
|
|
|
+ <SelectOption :value="0">全部项目</SelectOption>
|
|
|
+ <SelectOption :value="1">全部场景</SelectOption>
|
|
|
</Select>
|
|
|
</div>
|
|
|
|
|
|
@@ -80,8 +94,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
- import { SearchOutlined } from '@ant-design/icons-vue';
|
|
|
- import { ref, onMounted, watch } from 'vue';
|
|
|
+ // import { SearchOutlined } from '@ant-design/icons-vue';
|
|
|
+ import { ref, onMounted, watch, computed } from 'vue';
|
|
|
import {
|
|
|
GoogleMap,
|
|
|
AdvancedMarker,
|
|
|
@@ -91,131 +105,53 @@
|
|
|
} from 'vue3-google-map';
|
|
|
import { useRouteQuery } from '@vueuse/router';
|
|
|
// import { Loading } from '/@/components/Loading';
|
|
|
- import { Select, SelectOption } from 'ant-design-vue';
|
|
|
+ import { Select, SelectOption, AutoComplete } from 'ant-design-vue';
|
|
|
// import { ApiTreeSelect } from '/@/components/Form';
|
|
|
// import { all } from './test';
|
|
|
const loadingRef = ref(true);
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
|
|
|
- import { AllGpsApi } from '/@/api/scene/list';
|
|
|
+ import { AllGpsApi } from '/@/api/mapOpt/list';
|
|
|
const { t } = useI18n();
|
|
|
-
|
|
|
+ const googleKey = computed(() => import.meta.env.VITE_GOOGLE_KEY);
|
|
|
const center = { lat: 35.717, lng: 139.731 };
|
|
|
+ const options = ref([]);
|
|
|
// const pinOptions = { background: '#FBBC04' };
|
|
|
const lang = useRouteQuery('lang', 'ja');
|
|
|
// console.log('lang', lang);
|
|
|
|
|
|
const form = ref({
|
|
|
searchValue: '',
|
|
|
- type: undefined,
|
|
|
+ type: 1,
|
|
|
orgId: undefined,
|
|
|
});
|
|
|
|
|
|
const mapRef = ref();
|
|
|
-
|
|
|
- const locations = ref([
|
|
|
- { lat: 35.717, lng: 139.731 },
|
|
|
- { lat: 35.717222, lng: 139.199731 },
|
|
|
- { lat: 35.717222, lng: 139.199731 },
|
|
|
- { lat: 35.717222, lng: 139.199731 },
|
|
|
- { lat: 35.417222, lng: 139.192731 },
|
|
|
- { lat: 35.717222, lng: 139.199731 },
|
|
|
- { lat: 35.717222, lng: 139.199731 },
|
|
|
- { lat: 34.717222, lng: 139.27819 },
|
|
|
-
|
|
|
- { lat: 36.31296720118859, lng: 139.3926063119922 },
|
|
|
- { lat: 35.62235838888284, lng: 139.71015593805745 },
|
|
|
- { lat: 35.86823489038979, lng: 140.14478176589813 },
|
|
|
- { lat: 35.666319244178254, lng: 139.68656650039 },
|
|
|
- { lat: 35.66210809403935, lng: 139.69871520996094 },
|
|
|
- { lat: 35.6555101891923, lng: 139.6854507014398 },
|
|
|
- { lat: 35.65383639825058, lng: 139.67137446852965 },
|
|
|
- { lat: 35.63160781942685, lng: 139.69101567233477 },
|
|
|
- { lat: 35.6370693778054, lng: 139.7189712524414 },
|
|
|
- { lat: 35.6370693778054, lng: 139.7189712524414 },
|
|
|
- { lat: 35.63368820266599, lng: 139.69704879782842 },
|
|
|
- { lat: 35.671210059759105, lng: 139.78837265036748 },
|
|
|
- { lat: 35.67953081677376, lng: 139.81919354352647 },
|
|
|
- { lat: 35.71480112339862, lng: 139.84185284528428 },
|
|
|
- { lat: 35.689848647011665, lng: 139.86931866559678 },
|
|
|
- { lat: 35.6370835731761, lng: 139.73909710131483 },
|
|
|
- { lat: 35.64524468393014, lng: 139.7480234929164 },
|
|
|
- { lat: 35.62850304525592, lng: 139.74750850878553 },
|
|
|
- { lat: 35.65654330733842, lng: 139.73094318590955 },
|
|
|
- { lat: 35.25333139421992, lng: 140.1328670531019 },
|
|
|
- { lat: 35.520945427155084, lng: 139.70861514045217 },
|
|
|
- { lat: 35.52835001979981, lng: 139.72466547919728 },
|
|
|
- { lat: 35.53219175620018, lng: 139.72543795539357 },
|
|
|
- { lat: 36.06471592950127, lng: 139.56015044311627 },
|
|
|
- { lat: 35.99663544599227, lng: 139.51716429913103 },
|
|
|
-
|
|
|
- { lat: 36.00330154326686, lng: 139.73277098858415 },
|
|
|
- { lat: 34.85159530859275, lng: 135.79240136718747 },
|
|
|
-
|
|
|
- { lat: 33.39618823869116, lng: 130.68578108352963 },
|
|
|
- { lat: 32.90613073777195, lng: 131.45866324766476 },
|
|
|
- { lat: 31.571382620455626, lng: 131.29605440525106 },
|
|
|
- { lat: 43.484211753270436, lng: 143.19908481320442 },
|
|
|
-
|
|
|
- { lat: 43.04453309951811, lng: 141.92720114193736 },
|
|
|
- { lat: 43.70103868045711, lng: 143.26774936398567 },
|
|
|
- { lat: 39.59910275038968, lng: 140.79112971490326 },
|
|
|
- { lat: 39.038147596858046, lng: 141.42833674615326 },
|
|
|
-
|
|
|
- { lat: 39.852593533335906, lng: 141.58214533990326 },
|
|
|
- { lat: 39.40536603650614, lng: 141.81934919778516 },
|
|
|
- { lat: 37.280345063819624, lng: 140.40488676127148 },
|
|
|
- { lat: 37.650945729111164, lng: 140.66306547220898 },
|
|
|
-
|
|
|
- { lat: 26.2115166886031, lng: 127.75279725182631 },
|
|
|
- { lat: 44.34833983328789, lng: 143.34691816315754 },
|
|
|
- { lat: 43.00128806366339, lng: 144.3869447551281 },
|
|
|
- { lat: 28.192627956555494, lng: 129.313005376943 },
|
|
|
- { lat: 28.259479947389917, lng: 129.36450379002895 },
|
|
|
-
|
|
|
- { lat: 38.735843285553415, lng: 140.10460862452084 },
|
|
|
- { lat: 39.23754027286606, lng: 140.19249924952084 },
|
|
|
-
|
|
|
- { lat: 36.552075508234424, lng: 136.70281355238654 },
|
|
|
- { lat: 36.28575067992493, lng: 136.49407331801154 },
|
|
|
-
|
|
|
- { lat: 36.22987124498562, lng: 137.90955145716998 },
|
|
|
- { lat: 35.8122427890604, lng: 137.86835272670123 },
|
|
|
-
|
|
|
- { lat: 37.57569302701527, lng: 139.43412377785248 },
|
|
|
- { lat: 37.18502777318644, lng: 138.82987573097748 },
|
|
|
-
|
|
|
- { lat: 37.10846065439149, lng: 138.6381507062294 },
|
|
|
- { lat: 37.106817847812714, lng: 138.68896247380752 },
|
|
|
- { lat: 37.11502932699901, lng: 138.62138419322386 },
|
|
|
- { lat: 37.1148924396862, lng: 138.67133765391722 },
|
|
|
- { lat: 37.07600642884621, lng: 138.64267020396605 },
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-loss-of-precision
|
|
|
- { lat: 35.43717666390691, lng: 139.45083618164062 },
|
|
|
- { lat: 35.45060223946404, lng: 139.53495025634766 },
|
|
|
- { lat: 35.38645461274881, lng: 139.44146351130624 },
|
|
|
- { lat: 35.39750986273954, lng: 139.49442104609628 },
|
|
|
- { lat: 35.40366656004627, lng: 139.49115947993417 },
|
|
|
- { lat: 34.85417907268749, lng: 136.55081855570842 },
|
|
|
- ]);
|
|
|
-
|
|
|
+ const locations = ref([]);
|
|
|
// locations.value = locations.value.concat(all);
|
|
|
console.log('total', locations.value.length);
|
|
|
|
|
|
watch(
|
|
|
- () => mapRef.value?.ready,
|
|
|
- (ready) => {
|
|
|
+ () => [mapRef.value?.ready, locations],
|
|
|
+ ([ready, lo]) => {
|
|
|
if (!ready) return;
|
|
|
- console.log('ready', ready);
|
|
|
+ console.log('ready', ready, lo.value.length);
|
|
|
loadingRef.value = false;
|
|
|
- mapFitBounds(mapRef, locations.value);
|
|
|
+ if (ready && lo.value.length > 2) {
|
|
|
+ // debugger;
|
|
|
+ mapFitBounds(mapRef, locations.value);
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
deep: true,
|
|
|
},
|
|
|
);
|
|
|
+ const getGps = () => {
|
|
|
+ return AllGpsApi({ searchKey: form.value.searchValue, type: form.value.type });
|
|
|
+ };
|
|
|
onMounted(async () => {
|
|
|
- const allGps = await AllGpsApi();
|
|
|
+ const allGps = await getGps();
|
|
|
+
|
|
|
console.log('allGps', allGps);
|
|
|
let data = allGps.map((item) => {
|
|
|
const mapper = {
|
|
|
@@ -226,10 +162,22 @@
|
|
|
};
|
|
|
return mapper;
|
|
|
});
|
|
|
-
|
|
|
locations.value = data;
|
|
|
});
|
|
|
|
|
|
+ watch(
|
|
|
+ () => form,
|
|
|
+ async () => {
|
|
|
+ // const allGps = await getGps();
|
|
|
+ // // const opts = allGps.map
|
|
|
+ // options.value = allGps;
|
|
|
+ // console.log('allGps', allGps);
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ );
|
|
|
+
|
|
|
function mapFitBounds(mapRef, markers) {
|
|
|
let bounds;
|
|
|
const api = mapRef.value.api;
|
|
|
@@ -255,9 +203,18 @@
|
|
|
// infowindowPosition.value.lat = lat();
|
|
|
// infowindowPosition.value.lng = lng();
|
|
|
};
|
|
|
- // const render = ({ count, position }) => {
|
|
|
- // console.log('count', count, position);
|
|
|
- // };
|
|
|
+
|
|
|
+ const onSearch = async (item) => {
|
|
|
+ console.log('onSearch', item);
|
|
|
+ const allGps = await getGps();
|
|
|
+ // const opts = allGps.map
|
|
|
+ options.value = allGps;
|
|
|
+ // debugger;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSelect = (item: any) => {
|
|
|
+ console.log('onSelect', item);
|
|
|
+ };
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
// @import './dark.less';
|