|
|
@ -2,7 +2,7 @@ |
|
|
|
import 'leaflet/dist/leaflet.css' |
|
|
|
import 'leaflet/dist/leaflet.css' |
|
|
|
import * as L from 'leaflet' |
|
|
|
import * as L from 'leaflet' |
|
|
|
// import { ViewTypes } from '~~/../nocodb-sdk/build/main' |
|
|
|
// import { ViewTypes } from '~~/../nocodb-sdk/build/main' |
|
|
|
import { ViewTypes } from 'nocodb-sdk' |
|
|
|
// import { ViewTypes } from 'nocodb-sdk' |
|
|
|
import { IsFormInj, IsGalleryInj, IsGridInj, IsMapInj, ReadonlyInj, onMounted, provide, ref, useUIPermission } from '#imports' |
|
|
|
import { IsFormInj, IsGalleryInj, IsGridInj, IsMapInj, ReadonlyInj, onMounted, provide, ref, useUIPermission } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
const { isUIAllowed } = useUIPermission() |
|
|
|
const { isUIAllowed } = useUIPermission() |
|
|
@ -17,8 +17,30 @@ const reloadViewDataHook = inject(ReloadViewDataHookInj) |
|
|
|
// const meta = inject(MetaInj, ref()) |
|
|
|
// const meta = inject(MetaInj, ref()) |
|
|
|
// const view = inject(ActiveViewInj, ref()) |
|
|
|
// const view = inject(ActiveViewInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const view = inject(ActiveViewInj, ref()) |
|
|
|
|
|
|
|
const meta = inject(MetaInj, ref()) |
|
|
|
|
|
|
|
const { formattedData, loadMapData, mapData } = useMapViewStoreOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
// const { loadData, formattedData: data } = useViewData(meta, view) |
|
|
|
// const { loadData, formattedData: data } = useViewData(meta, view) |
|
|
|
const { formattedData, loadMapData } = useMapViewStoreOrThrow() |
|
|
|
// const { sharedView, sorts, nestedFilters } = useSharedView() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
showSystemFields, |
|
|
|
|
|
|
|
// sortedAndFilteredFields, |
|
|
|
|
|
|
|
fields, |
|
|
|
|
|
|
|
filteredFieldList, |
|
|
|
|
|
|
|
// filterQuery, |
|
|
|
|
|
|
|
showAll, |
|
|
|
|
|
|
|
// hideAll, |
|
|
|
|
|
|
|
// saveOrUpdate, |
|
|
|
|
|
|
|
// metaColumnById, |
|
|
|
|
|
|
|
} = useViewColumns(view, meta) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('fields.value', fields.value) |
|
|
|
|
|
|
|
console.log('showSystemFields.value', showSystemFields.value) |
|
|
|
|
|
|
|
console.log('filteredFieldList.value', filteredFieldList.value) |
|
|
|
|
|
|
|
console.log('showAll.value', showAll.value) |
|
|
|
|
|
|
|
console.log('fields.value', fields.value) |
|
|
|
|
|
|
|
|
|
|
|
const markerRef = ref() |
|
|
|
const markerRef = ref() |
|
|
|
const myMapRef = ref() |
|
|
|
const myMapRef = ref() |
|
|
@ -41,18 +63,32 @@ onMounted(async () => { |
|
|
|
// const geodata = data.value[0].row.geo.split(';') |
|
|
|
// const geodata = data.value[0].row.geo.split(';') |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const geoDataColumn: any = $( |
|
|
|
|
|
|
|
// computed(() => |
|
|
|
|
|
|
|
// meta.value?.columnsById |
|
|
|
|
|
|
|
// ? meta.value.columnsById[mapData?.value?.fk_geo_data_col_id as keyof typeof meta.value.columnsById] |
|
|
|
|
|
|
|
// : {}, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ) |
|
|
|
|
|
|
|
|
|
|
|
watch(formattedData, () => { |
|
|
|
watch(formattedData, () => { |
|
|
|
markersRef.value?.clearLayers() |
|
|
|
markersRef.value?.clearLayers() |
|
|
|
|
|
|
|
console.log('mapData', mapData?.value?.fk_geo_data_col_id) |
|
|
|
formattedData.value?.forEach((row) => { |
|
|
|
formattedData.value?.forEach((row) => { |
|
|
|
// const [lat, long] = |
|
|
|
// const [lat, long] = |
|
|
|
|
|
|
|
console.log('meta', meta?.value?.columns) |
|
|
|
console.log('row', row) |
|
|
|
console.log('row', row) |
|
|
|
if (row?.geo == null) return |
|
|
|
if (row?.geonew == null) return |
|
|
|
const [lat, long] = row?.geo.split(';').map(parseFloat) |
|
|
|
|
|
|
|
// if (lat == null || long == null) { |
|
|
|
const [lat, long] = row?.geonew.split(';').map(parseFloat) |
|
|
|
// return |
|
|
|
if (lat == null || long == null) { |
|
|
|
// } |
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
console.log('lat', lat) |
|
|
|
console.log('lat', lat) |
|
|
|
addMarker(lat, long) |
|
|
|
addMarker(lat, long) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const selected = row?.rowMeta?.selected |
|
|
|
|
|
|
|
console.log(selected) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -62,17 +98,16 @@ reloadViewDataHook?.on(async () => { |
|
|
|
|
|
|
|
|
|
|
|
function addMarker(lat: number, long: number) { |
|
|
|
function addMarker(lat: number, long: number) { |
|
|
|
// markersRef.value?.clearLayers() |
|
|
|
// markersRef.value?.clearLayers() |
|
|
|
const markerNew = markerRef.value([lat, long]) |
|
|
|
const markerNew = markerRef?.value?.([lat, long]) |
|
|
|
console.log(markersRef.value) |
|
|
|
console.log(markersRef.value) |
|
|
|
markersRef.value.addLayer(markerNew) |
|
|
|
markersRef?.value?.addLayer(markerNew) |
|
|
|
|
|
|
|
|
|
|
|
myMapRef.value.addLayer(markersRef.value) |
|
|
|
myMapRef?.value?.addLayer(markersRef.value) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
onMounted(async () => { |
|
|
|
const { map, tileLayer, marker } = await import('leaflet') |
|
|
|
const { map, tileLayer, marker } = await import('leaflet') |
|
|
|
await import('leaflet.markercluster') |
|
|
|
await import('leaflet.markercluster') |
|
|
|
|
|
|
|
|
|
|
|
const myMap = map('map').setView([51.505, -0.09], 13) |
|
|
|
const myMap = map('map').setView([51.505, -0.09], 13) |
|
|
|
markerRef.value = marker |
|
|
|
markerRef.value = marker |
|
|
|
myMapRef.value = myMap |
|
|
|
myMapRef.value = myMap |
|
|
@ -90,7 +125,9 @@ onMounted(async () => { |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="flex flex-col h-full w-full"> |
|
|
|
<div class="flex flex-col h-full w-full"> |
|
|
|
{{ JSON.stringify(formattedData) }} |
|
|
|
{{ JSON.stringify(mapData1) }} |
|
|
|
|
|
|
|
<!-- {{ JSON.stringify(selected) }} --> |
|
|
|
|
|
|
|
<!-- {{ JSON.stringify(meta?.columns) }} --> |
|
|
|
<!-- <div class="flex m-4 gap-4"> |
|
|
|
<!-- <div class="flex m-4 gap-4"> |
|
|
|
<label :for="latitude">latitude</label> |
|
|
|
<label :for="latitude">latitude</label> |
|
|
|
<input v-model="latitude" /> |
|
|
|
<input v-model="latitude" /> |
|
|
|