|
@@ -235,15 +235,26 @@ export default defineComponent({
|
|
|
const marker = ref([])
|
|
|
|
|
|
function initMap() {
|
|
|
+ var marker = new AMap.Marker({})
|
|
|
+
|
|
|
// AMap start
|
|
|
var map = new AMap.Map('mapF', {
|
|
|
resizeEnable: true,
|
|
|
})
|
|
|
- //为地图注册click事件获取鼠标点击出的经纬度坐标
|
|
|
+
|
|
|
+ //地图点标记回显
|
|
|
+ if (props.dialogTitle != '新增') {
|
|
|
+ var newArray = form.value.geoPosition&&form.value.geoPosition.indexOf(',')!=-1?form.value.geoPosition.split(','):[0,0 ]
|
|
|
+ marker = new AMap.Marker({
|
|
|
+ position: new AMap.LngLat(newArray[0], newArray[1]), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
|
|
+ })
|
|
|
+ map.add([marker])
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- var marker = new AMap.Marker({})
|
|
|
+ //为地图注册click事件获取鼠标点击出的经纬度坐标
|
|
|
map.on('click', function (e) {
|
|
|
- form.value.geoPosition = e.lnglat.getLng() + ',' + e.lnglat.getLat()
|
|
|
+ form.value.geoPosition = e.lnglat.getLng() + ',' + e.lnglat.getLat()
|
|
|
|
|
|
map.remove([marker])
|
|
|
marker = new AMap.Marker({
|
|
@@ -251,20 +262,17 @@ export default defineComponent({
|
|
|
})
|
|
|
|
|
|
map.add([marker])
|
|
|
-
|
|
|
})
|
|
|
// AMap end
|
|
|
}
|
|
|
|
|
|
const open = () => {
|
|
|
- // initMap()
|
|
|
- setTimeout(function () {
|
|
|
- initMap()
|
|
|
- }, 10)
|
|
|
-
|
|
|
form.value = props.itemInfo
|
|
|
console.log('form.value')
|
|
|
console.log(form.value)
|
|
|
+ setTimeout(function () {
|
|
|
+ initMap()
|
|
|
+ }, 10)
|
|
|
|
|
|
optionselect()
|
|
|
}
|
|
@@ -350,7 +358,7 @@ export default defineComponent({
|
|
|
],
|
|
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
|
|
geoPosition: [
|
|
|
- { required: true, message: '请选输入地理位置', trigger: 'blur' },
|
|
|
+ { required: true, message: '请选则地理位置', trigger: 'blur' },
|
|
|
],
|
|
|
|
|
|
tenantType: [
|