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