fix geolocation-countrycodes were disabled, fix admin/places use of current geocoding provider
This commit is contained in:
@@ -20,7 +20,7 @@ v-card
|
|||||||
persistent-hint
|
persistent-hint
|
||||||
:placeholder="geocoding_provider_default")
|
:placeholder="geocoding_provider_default")
|
||||||
|
|
||||||
v-autocomplete.mb-6(v-model="geocoding_countrycodes" :disabled="geocoding_provider_type != null || geocoding_provider_type != 'Nominatim'"
|
v-autocomplete.mb-6(v-model="geocoding_countrycodes" :disabled="!(geocoding_provider_type === null || geocoding_provider_type === 'Nominatim')"
|
||||||
@blur="save('geocoding_countrycodes', geocoding_countrycodes )"
|
@blur="save('geocoding_countrycodes', geocoding_countrycodes )"
|
||||||
:label="$t('admin.geocoding_countrycodes')"
|
:label="$t('admin.geocoding_countrycodes')"
|
||||||
:items="countries"
|
:items="countries"
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ import debounce from 'lodash/debounce'
|
|||||||
import get from 'lodash/get'
|
import get from 'lodash/get'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data( {$store} ) {
|
||||||
return {
|
return {
|
||||||
mdiPencil, mdiChevronRight, mdiChevronLeft, mdiMagnify, mdiEye, mdiMapSearch, mdiChevronDown,
|
mdiPencil, mdiChevronRight, mdiChevronLeft, mdiMagnify, mdiEye, mdiMapSearch, mdiChevronDown,
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -161,19 +161,54 @@ export default {
|
|||||||
if (searchCoordinates.length) {
|
if (searchCoordinates.length) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
const ret = await this.$axios.$get(`placeOSM/${this.geocoding_provider_type}/${searchCoordinates}`)
|
const ret = await this.$axios.$get(`placeOSM/${this.geocoding_provider_type}/${searchCoordinates}`)
|
||||||
if (ret && ret.length) {
|
if (this.geocoding_provider_type == "Nominatim") {
|
||||||
this.addressList = ret.map(v => {
|
if (ret && ret.length) {
|
||||||
const name = get(v.namedetails, 'alt_name', get(v.namedetails, 'name'))
|
this.addressList = ret.map(v => {
|
||||||
const address = v.display_name ? v.display_name.replace(name, '').replace(/^, ?/, '') : ''
|
const name = get(v.namedetails, 'alt_name', get(v.namedetails, 'name'))
|
||||||
return {
|
const address = v.display_name ? v.display_name.replace(name, '').replace(/^, ?/, '') : ''
|
||||||
lat: v.lat,
|
return {
|
||||||
lon: v.lon,
|
class: v.class,
|
||||||
name,
|
type: v.osm_type,
|
||||||
address
|
lat: v.lat,
|
||||||
}
|
lon: v.lon,
|
||||||
})
|
name,
|
||||||
} else {
|
address
|
||||||
this.addressList = []
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.addressList = []
|
||||||
|
}
|
||||||
|
} else if (this.geocoding_provider_type == "Photon") {
|
||||||
|
let photon_properties = ['housenumber', 'street', 'district', 'city', 'county', 'state', 'postcode', 'country']
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
this.addressList = ret.features.map(v => {
|
||||||
|
let pre_name = v.properties.name || v.properties.street || ''
|
||||||
|
let pre_address = ''
|
||||||
|
|
||||||
|
photon_properties.forEach((item, i) => {
|
||||||
|
let last = i == (photon_properties.length - 1)
|
||||||
|
if (v.properties[item] && !last) {
|
||||||
|
pre_address += v.properties[item]+', '
|
||||||
|
} else if (v.properties[item]) {
|
||||||
|
pre_address += v.properties[item]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let name = pre_name
|
||||||
|
let address = pre_address
|
||||||
|
return {
|
||||||
|
class: v.properties.osm_key,
|
||||||
|
type: v.properties.osm_type,
|
||||||
|
lat: v.geometry.coordinates[1],
|
||||||
|
lon: v.geometry.coordinates[0],
|
||||||
|
name,
|
||||||
|
address
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.addressList = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user