|
|
@@ -82,6 +82,7 @@
|
|
|
labelField="title"
|
|
|
valueField="num"
|
|
|
optionFilterProp="label"
|
|
|
+ v-model:value="form.sceneValue"
|
|
|
immediate
|
|
|
show-search
|
|
|
:placeholder="t('layout.map.keywords')"
|
|
|
@@ -169,6 +170,8 @@
|
|
|
const isJA = computed(() => localeStore.getLocale === 'ja');
|
|
|
const lang = useRouteQuery('lang', isJA.value ? 'ja' : 'zh');
|
|
|
const projectId = useRouteQuery('projectId');
|
|
|
+ const allProjectData = ref<any[]>([]);
|
|
|
+ const allSceneData = ref<any[]>([]);
|
|
|
const type = useRouteQuery('type', 0);
|
|
|
const form = ref<{
|
|
|
searchValue: undefined | string;
|
|
|
@@ -273,19 +276,42 @@
|
|
|
};
|
|
|
|
|
|
const handleSelect = (num: any) => {
|
|
|
- const select = locations.value.find((item) => item?.num === num);
|
|
|
- console.log('handleSelect', num);
|
|
|
+ const select = allSceneData.value.find((item) => item?.num === num);
|
|
|
if (select) {
|
|
|
+ console.log('handleSelect', num);
|
|
|
+ // const selectMarker = getMarkerData([select]);
|
|
|
+ locations.value = [select];
|
|
|
const { lat, lng } = select;
|
|
|
setCenter(Number(lat), Number(lng));
|
|
|
}
|
|
|
};
|
|
|
const handleProSelect = (id: any) => {
|
|
|
- const select = locations.value.find((item) => item?.id === Number(id));
|
|
|
+ const select = allProjectData.value.find((item) => {
|
|
|
+ return item?.id === Number(id);
|
|
|
+ });
|
|
|
if (select) {
|
|
|
- const { lat, lng } = select;
|
|
|
- console.log('handleProSelect', { id, lat, lng });
|
|
|
- setCenter(Number(lat), Number(lng));
|
|
|
+ // const { lat, lng } = select;
|
|
|
+ createMessage.destroy();
|
|
|
+ console.log('handleProSelect', select);
|
|
|
+ if (select?.sceneList.length > 0) {
|
|
|
+ const selectMarker = getMarkerData(select?.sceneList);
|
|
|
+ console.log('handleProSelect', select?.sceneList, selectMarker);
|
|
|
+ locations.value = getMarkerData(select?.sceneList);
|
|
|
+ } else {
|
|
|
+ locations.value = [];
|
|
|
+ setDefaultCenter();
|
|
|
+ createMessage.open({
|
|
|
+ type: 'warning',
|
|
|
+ content: '当前项目暂没场景',
|
|
|
+ duration: 2000,
|
|
|
+ style: {
|
|
|
+ marginTop: '10vh',
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // createMessage.warning('当前项目暂没场景');
|
|
|
+ }
|
|
|
+
|
|
|
+ // setCenter(Number(lat), Number(lng));
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -298,6 +324,15 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const setDefaultCenter = () => {
|
|
|
+ if (mapRef.value) {
|
|
|
+ // debugger;
|
|
|
+ // console.log('mapRef.value', mapRef.value);
|
|
|
+ mapRef.value.map?.setCenter(center);
|
|
|
+ mapRef.value.map?.setZoom(7);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const handleShare = async () => {
|
|
|
const res = await CreateShareMapApi(form.value.type, projectId.value);
|
|
|
console.log('handleShare', res);
|
|
|
@@ -350,16 +385,28 @@
|
|
|
|
|
|
const projectFetch = async (params) => {
|
|
|
const res = await AllGpsApi(params);
|
|
|
- const data = getProjectMarkerData(res);
|
|
|
- console.log('项目的marker', data.length);
|
|
|
- locations.value = data;
|
|
|
+ allProjectData.value = res;
|
|
|
+
|
|
|
+ if (!form.value.projectValue || projectId.value) {
|
|
|
+ // search 和 地图模式下
|
|
|
+ createMessage.destroy();
|
|
|
+ const data = getProjectMarkerData(res);
|
|
|
+ console.log('项目的marker', data.length);
|
|
|
+ locations.value = data;
|
|
|
+ }
|
|
|
return res;
|
|
|
};
|
|
|
const sceneFetch = async (params) => {
|
|
|
const res = await AllGpsApi(params);
|
|
|
const data = getMarkerData(res);
|
|
|
- console.log('result', data.length);
|
|
|
- locations.value = data;
|
|
|
+ allSceneData.value = data;
|
|
|
+
|
|
|
+ if (!form.value.sceneValue) {
|
|
|
+ // search 和 地图模式下
|
|
|
+ createMessage.destroy();
|
|
|
+ console.log('sceneFetch', data.length);
|
|
|
+ locations.value = data;
|
|
|
+ }
|
|
|
return res;
|
|
|
};
|
|
|
|