|
@@ -928,9 +928,40 @@ export default {
|
|
|
const [latStr, lngStr] = this.cancelForm.cancelLocation.split(',');
|
|
const [latStr, lngStr] = this.cancelForm.cancelLocation.split(',');
|
|
|
const latitude = parseFloat(latStr);
|
|
const latitude = parseFloat(latStr);
|
|
|
const longitude = parseFloat(lngStr);
|
|
const longitude = parseFloat(lngStr);
|
|
|
|
|
+
|
|
|
|
|
+ // 调用后台API进行逆地理编码
|
|
|
|
|
+ try {
|
|
|
|
|
+ const geocodingResponse = await request({
|
|
|
|
|
+ url: '/system/SysRegion/reverse-geocode',
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ longitude: longitude,
|
|
|
|
|
+ latitude: latitude,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (geocodingResponse.code === 200 && geocodingResponse.data) {
|
|
|
|
|
+ const formattedAddress = geocodingResponse.data.regeocode?.formattedAddress;
|
|
|
|
|
+ if (formattedAddress) {
|
|
|
|
|
+ console.log('销假位置逆地理编码成功:', formattedAddress);
|
|
|
|
|
+ // 可以选择将地址信息显示给用户或保存到表单中
|
|
|
|
|
+ // this.cancelForm.cancelLocationAddress = formattedAddress; // 如果需要保存地址信息
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.warn('销假位置逆地理编码失败:', geocodingResponse.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('销假位置逆地理编码请求失败:', error);
|
|
|
|
|
+ // 逆地理编码失败不影响地图打开功能
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
|
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
|
|
- await this.wechatSDK.openLocation({ latitude, longitude, name: '销假位置' });
|
|
|
|
|
|
|
+ await this.wechatSDK.openLocation({
|
|
|
|
|
+ latitude,
|
|
|
|
|
+ longitude,
|
|
|
|
|
+ name: formattedAddress,
|
|
|
|
|
+ });
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -949,9 +980,40 @@ export default {
|
|
|
const latitude = parseFloat(latStr);
|
|
const latitude = parseFloat(latStr);
|
|
|
const longitude = parseFloat(lngStr);
|
|
const longitude = parseFloat(lngStr);
|
|
|
if (Number.isNaN(latitude) || Number.isNaN(longitude)) return;
|
|
if (Number.isNaN(latitude) || Number.isNaN(longitude)) return;
|
|
|
|
|
+
|
|
|
|
|
+ // 调用后台API进行逆地理编码
|
|
|
|
|
+ try {
|
|
|
|
|
+ const geocodingResponse = await request({
|
|
|
|
|
+ url: '/system/SysRegion/reverse-geocode',
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ longitude: longitude,
|
|
|
|
|
+ latitude: latitude,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (geocodingResponse.code === 200 && geocodingResponse.data) {
|
|
|
|
|
+ const formattedAddress = geocodingResponse.data.regeocode?.formattedAddress;
|
|
|
|
|
+ if (formattedAddress) {
|
|
|
|
|
+ console.log('请假位置逆地理编码成功:', formattedAddress);
|
|
|
|
|
+ // 可以选择将地址信息显示给用户或保存到表单中
|
|
|
|
|
+ // this.leaveInfo.leaveLocationAddress = formattedAddress; // 如果需要保存地址信息
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.warn('请假位置逆地理编码失败:', geocodingResponse.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('请假位置逆地理编码请求失败:', error);
|
|
|
|
|
+ // 逆地理编码失败不影响地图打开功能
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
|
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
|
|
- await this.wechatSDK.openLocation({ latitude, longitude, name: '请假位置' });
|
|
|
|
|
|
|
+ await this.wechatSDK.openLocation({
|
|
|
|
|
+ latitude,
|
|
|
|
|
+ longitude,
|
|
|
|
|
+ name: formattedAddress,
|
|
|
|
|
+ });
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|