mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
feat: 地图组件支持更多字段的回填
This commit is contained in:
@@ -161,6 +161,7 @@
|
||||
var address = response.result.formatted_address;
|
||||
var locationLongitude = e.latlng.lng;
|
||||
var locationLatitude = e.latlng.lat;
|
||||
var addressComponent = response.result.addressComponent;
|
||||
|
||||
if (options.location) {
|
||||
$(options.location).val(address);
|
||||
@@ -171,6 +172,33 @@
|
||||
if (options.locationLongitude) {
|
||||
$(options.locationLongitude).val(locationLongitude);
|
||||
}
|
||||
if (options.locationProvince) {
|
||||
$(options.locationProvince).val(addressComponent.province);
|
||||
}
|
||||
if (options.locationCity) {
|
||||
$(options.locationCity).val(addressComponent.city);
|
||||
}
|
||||
if (options.locationCounty) {
|
||||
$(options.locationCounty).val(addressComponent.county);
|
||||
}
|
||||
if (options.locationTown) {
|
||||
$(options.locationTown).val(addressComponent.town);
|
||||
}
|
||||
if (options.locationRoad) {
|
||||
$(options.locationRoad).val(addressComponent.road);
|
||||
}
|
||||
if (options.locationProvinceCode) {
|
||||
$(options.locationProvinceCode).val((addressComponent.province_code || '').replace(/^156/, ''));
|
||||
}
|
||||
if (options.locationCityCode) {
|
||||
$(options.locationCityCode).val((addressComponent.city_code || '').replace(/^156/, ''));
|
||||
}
|
||||
if (options.locationCountyCode) {
|
||||
$(options.locationCountyCode).val((addressComponent.county_code || '').replace(/^156/, ''));
|
||||
}
|
||||
if (options.locationTownCode) {
|
||||
$(options.locationTownCode).val((addressComponent.town_code || '').replace(/^156/, ''));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user