|
@@ -41,7 +41,7 @@
|
|
@change="handleSearch(0)"
|
|
@change="handleSearch(0)"
|
|
></JAreaSelect>
|
|
></JAreaSelect>
|
|
<div class="mt20px">
|
|
<div class="mt20px">
|
|
- <Input v-model:value="model['addressString']">
|
|
|
|
|
|
+ <Input v-model:value="model['address']">
|
|
<template #suffix>
|
|
<template #suffix>
|
|
<Button @click="handleSearch(1)">定位</Button>
|
|
<Button @click="handleSearch(1)">定位</Button>
|
|
</template>
|
|
</template>
|
|
@@ -49,7 +49,7 @@
|
|
</div>
|
|
</div>
|
|
<div class="mt20px mb20px relative">
|
|
<div class="mt20px mb20px relative">
|
|
<div id="container" class="h-500px"></div>
|
|
<div id="container" class="h-500px"></div>
|
|
- <div id="panel"></div>
|
|
|
|
|
|
+ <!-- <div id="panel"></div> -->
|
|
</div>
|
|
</div>
|
|
</FormItem>
|
|
</FormItem>
|
|
</template>
|
|
</template>
|
|
@@ -87,7 +87,7 @@
|
|
import { getSprotProject } from '@/api/common/api';
|
|
import { getSprotProject } from '@/api/common/api';
|
|
import { getDetaile, saveOrUpdate } from './competition.api';
|
|
import { getDetaile, saveOrUpdate } from './competition.api';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
- import { ref, toRefs, unref, watch, watchEffect } from 'vue';
|
|
|
|
|
|
+ import { nextTick, onUnmounted, ref, toRefs, unref, watch, watchEffect } from 'vue';
|
|
import { areAllItemsAllFieldsFilled } from '/@/utils';
|
|
import { areAllItemsAllFieldsFilled } from '/@/utils';
|
|
import { message } from 'ant-design-vue/lib';
|
|
import { message } from 'ant-design-vue/lib';
|
|
import { useRoute } from 'vue-router';
|
|
import { useRoute } from 'vue-router';
|
|
@@ -97,7 +97,7 @@
|
|
import { matchCityByFirstFourDigits, matchProvinceByFirstThreeDigits } from '/@/utils/map';
|
|
import { matchCityByFirstFourDigits, matchProvinceByFirstThreeDigits } from '/@/utils/map';
|
|
const { close: closeTab } = useTabs();
|
|
const { close: closeTab } = useTabs();
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
- const { locateByCityAndAddress, setCityByCode, currentObj, lnglat } = useAMapEnhanced();
|
|
|
|
|
|
+ const { locateByCityAndAddress, setCityByCode, currentObj, lnglat, initMap, getAddressByLngLat, destroyMap } = useAMapEnhanced();
|
|
|
|
|
|
const [registerForm, { setProps, resetFields, setFieldsValue, updateSchema, validate, clearValidate, getFieldsValue }] = useForm({
|
|
const [registerForm, { setProps, resetFields, setFieldsValue, updateSchema, validate, clearValidate, getFieldsValue }] = useForm({
|
|
schemas: formSchema,
|
|
schemas: formSchema,
|
|
@@ -248,6 +248,13 @@
|
|
};
|
|
};
|
|
}),
|
|
}),
|
|
});
|
|
});
|
|
|
|
+ if (res.game.siteType == 1) {
|
|
|
|
+ await initMap('container');
|
|
|
|
+ await getAddressByLngLat(res.game.longitude, res.game.latitude);
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ handleSearch(1);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
watch(
|
|
watch(
|
|
@@ -267,10 +274,10 @@
|
|
const proce = getDataByCode(Number(proviceCode[0].code));
|
|
const proce = getDataByCode(Number(proviceCode[0].code));
|
|
const cityCode = matchCityByFirstFourDigits(proce, currentObj.value.currentAdcode);
|
|
const cityCode = matchCityByFirstFourDigits(proce, currentObj.value.currentAdcode);
|
|
setFieldsValue({
|
|
setFieldsValue({
|
|
- provinceCode: Number(proviceCode[0].code),
|
|
|
|
|
|
+ provinceCode: proviceCode[0].code,
|
|
cityCode: cityCode?.value,
|
|
cityCode: cityCode?.value,
|
|
areaCode: currentObj.value.currentAdcode,
|
|
areaCode: currentObj.value.currentAdcode,
|
|
- addressString: currentObj.value.currentAddress,
|
|
|
|
|
|
+ address: currentObj.value.currentAddress,
|
|
longitude: lnglat.value[0],
|
|
longitude: lnglat.value[0],
|
|
latitude: lnglat.value[1],
|
|
latitude: lnglat.value[1],
|
|
});
|
|
});
|
|
@@ -279,12 +286,13 @@
|
|
{ immediate: true }
|
|
{ immediate: true }
|
|
);
|
|
);
|
|
async function handleSearch(type: number) {
|
|
async function handleSearch(type: number) {
|
|
- const { addressString, areaCode } = getFieldsValue();
|
|
|
|
|
|
+ const { address, areaCode } = getFieldsValue();
|
|
if (type == 0) {
|
|
if (type == 0) {
|
|
setCityByCode(areaCode);
|
|
setCityByCode(areaCode);
|
|
}
|
|
}
|
|
- if (addressString && type == 1 && areaCode) {
|
|
|
|
- const res = await locateByCityAndAddress(areaCode, addressString);
|
|
|
|
|
|
+ if (address && type == 1 && areaCode) {
|
|
|
|
+ const res = await locateByCityAndAddress(areaCode, address);
|
|
|
|
+
|
|
setFieldsValue({
|
|
setFieldsValue({
|
|
longitude: res.location.lng,
|
|
longitude: res.location.lng,
|
|
latitude: res.location.lat,
|
|
latitude: res.location.lat,
|
|
@@ -294,9 +302,12 @@
|
|
message.error('请选择省市区');
|
|
message.error('请选择省市区');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
+ destroyMap();
|
|
|
|
+ });
|
|
</script>
|
|
</script>
|
|
<style>
|
|
<style>
|
|
- #panel {
|
|
|
|
|
|
+ /* #panel {
|
|
position: absolute;
|
|
position: absolute;
|
|
background-color: white;
|
|
background-color: white;
|
|
max-height: 300px;
|
|
max-height: 300px;
|
|
@@ -304,5 +315,5 @@
|
|
top: 10px;
|
|
top: 10px;
|
|
right: 10px;
|
|
right: 10px;
|
|
width: 280px;
|
|
width: 280px;
|
|
- }
|
|
|
|
|
|
+ } */
|
|
</style>
|
|
</style>
|