diff --git a/admin/src/views/farm/edit.vue b/admin/src/views/farm/edit.vue index 1afd5a7..1cce666 100644 --- a/admin/src/views/farm/edit.vue +++ b/admin/src/views/farm/edit.vue @@ -12,6 +12,23 @@ + + + + + - +
@@ -235,6 +252,9 @@ import { ref } from 'vue' import config from '@/config' import useUserStore from '@/stores/modules/user' import { ElMessage, type UploadProps, type UploadFile } from 'element-plus' +import {useDictOptions} from "@/hooks/useDictOptions"; +import {apiFarmLists} from "@/api/fence_house"; +import {getUserList} from "@/api/land"; defineProps({ dictData: { type: Object as PropType>, @@ -257,7 +277,7 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { console.log(uploadFile) console.log(uploadFiles) - console.log(formData.image) + console.log(formData.pic) } const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => { dialogImageUrl.value = uploadFile.url! @@ -272,7 +292,7 @@ const handleAvatarSuccessAvatar: UploadProps['onSuccess'] = (response, uploadFil return } - formData.image = response.data.uri + formData.pic.push(response.data.uri) } // 弹窗标题 const popupTitle = computed(() => { @@ -290,6 +310,7 @@ const popupTitle = computed(() => { const formData = reactive({ id: '', farm_name: '', + user_id: 0, farm_type: '', breed_type: '', form_scale: '', @@ -302,12 +323,33 @@ const formData = reactive({ village: '', bridge: '', address: '', - image: '' + pic: [], + longitude: '', + latitude: '' }) // 表单验证 const formRules = reactive({}) +const { optionsData } = useDictOptions<{ + user: any[] +}>({ + user: { + api: getUserList + } +}) + +const loading = ref(false) + +const queryUser = async (query: string) => { + loading.value = true + const userList = await getUserList({ + keyword: query ?? '' + }) + optionsData.user = userList + loading.value = false +} + // 获取详情 const setFormData = async (data: Record) => { for (const key in formData) { diff --git a/admin/src/views/fence_house/edit.vue b/admin/src/views/fence_house/edit.vue index f09f1aa..85f1b5b 100644 --- a/admin/src/views/fence_house/edit.vue +++ b/admin/src/views/fence_house/edit.vue @@ -57,6 +57,10 @@ + + + + - +
@@ -132,7 +136,7 @@ const handleAvatarSuccessAvatar: UploadProps["onSuccess"] = ( ElMessage.error(response.msg); return; } - formData.image = response.data.uri; + formData.pic.push(response.data.uri); } // 弹窗标题 @@ -150,9 +154,10 @@ const formData = reactive({ fence_house_type: '', capacity: '', master: '', + master_phone: '', status: '', qr_code: '', - image: '', + pic: [], })