修改地图选择
parent
20507d4d2e
commit
0692292549
|
|
@ -7,11 +7,30 @@
|
||||||
width="1000px"
|
width="1000px"
|
||||||
@ok="handleSubmit"
|
@ok="handleSubmit"
|
||||||
>
|
>
|
||||||
<BasicForm @register="registerForm"> </BasicForm>
|
<BasicForm @register="registerForm">
|
||||||
<Map v-model:modelValue="mapInfo" />
|
<!-- 基地经度 -->
|
||||||
|
<template #address_lng="{ model, field }">
|
||||||
|
<InputNumber
|
||||||
|
allowClear
|
||||||
|
@change="inputChange('longitude', $event)"
|
||||||
|
v-model:value="model[field]"
|
||||||
|
placeholder="请输入"
|
||||||
|
></InputNumber>
|
||||||
|
</template>
|
||||||
|
<!-- 基地纬度 -->
|
||||||
|
<template #address_lat="{ model, field }">
|
||||||
|
<InputNumber
|
||||||
|
@change="inputChange('latitude', $event)"
|
||||||
|
v-model:value="model[field]"
|
||||||
|
placeholder="请输入"
|
||||||
|
></InputNumber>
|
||||||
|
</template>
|
||||||
|
</BasicForm>
|
||||||
|
<Map v-model:modelValue="mapInfo" :params="params" />
|
||||||
</BasicDrawer>
|
</BasicDrawer>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { InputNumber } from 'ant-design-vue'
|
||||||
import { ref, computed, unref, watch } from 'vue'
|
import { ref, computed, unref, watch } from 'vue'
|
||||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||||
import { accountFormSchema } from './base.data'
|
import { accountFormSchema } from './base.data'
|
||||||
|
|
@ -23,6 +42,8 @@
|
||||||
latitude: '',
|
latitude: '',
|
||||||
longitude: '',
|
longitude: '',
|
||||||
})
|
})
|
||||||
|
//
|
||||||
|
const params = ref<any>({})
|
||||||
const emits = defineEmits(['success', 'register'])
|
const emits = defineEmits(['success', 'register'])
|
||||||
const isUpdate = ref(false)
|
const isUpdate = ref(false)
|
||||||
const getTitle = computed(() => (!isUpdate.value ? '新增基地' : '编辑基地'))
|
const getTitle = computed(() => (!isUpdate.value ? '新增基地' : '编辑基地'))
|
||||||
|
|
@ -55,7 +76,9 @@
|
||||||
address_lng: newValue.longitude,
|
address_lng: newValue.longitude,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
const inputChange = (e, event) => {
|
||||||
|
params.value[e] = event
|
||||||
|
}
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
try {
|
try {
|
||||||
const values = await validate()
|
const values = await validate()
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ export const columns: BasicColumn[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '基地经度',
|
title: '基地经度',
|
||||||
dataIndex: 'address_lat',
|
dataIndex: 'address_lng',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '基地纬度',
|
title: '基地纬度',
|
||||||
dataIndex: 'address_lng',
|
dataIndex: 'address_lat',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '基地地址',
|
title: '基地地址',
|
||||||
|
|
@ -140,15 +140,17 @@ export const accountFormSchema: FormSchema[] = [
|
||||||
component: 'InputTextArea',
|
component: 'InputTextArea',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'address_lat',
|
field: 'address_lng',
|
||||||
label: '基地经度',
|
label: '基地经度',
|
||||||
required: false,
|
required: false,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
|
slot: 'address_lng',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'address_lng',
|
field: 'address_lat',
|
||||||
label: '基地纬度',
|
label: '基地纬度',
|
||||||
required: false,
|
required: false,
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
|
slot: 'address_lat',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,12 @@
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
const map = shallowRef(null)
|
const map = shallowRef(null)
|
||||||
|
|
@ -30,6 +36,22 @@
|
||||||
emit('update:modelValue', val)
|
emit('update:modelValue', val)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
const Values = computed(() => {
|
||||||
|
return Object.values(props.params)
|
||||||
|
})
|
||||||
|
watch(Values, ([newV, newEV], [oldV, oldEV]) => {
|
||||||
|
if (newV && newEV) {
|
||||||
|
nextTick(() => {
|
||||||
|
const obj = {
|
||||||
|
lnglat: {
|
||||||
|
lng: newV,
|
||||||
|
lat: newEV,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
onMapClick(obj)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
watch(location, (val) => {
|
watch(location, (val) => {
|
||||||
if (val.longitude && val.latitude) {
|
if (val.longitude && val.latitude) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue