diff --git a/admin/src/views/fence_house/edit.vue b/admin/src/views/fence_house/edit.vue index d150794..f09f1aa 100644 --- a/admin/src/views/fence_house/edit.vue +++ b/admin/src/views/fence_house/edit.vue @@ -28,6 +28,9 @@ + + + - + + + - - + + + + +
+ + + +
+
@@ -72,19 +103,37 @@ import Popup from '@/components/popup/index.vue' import {apiFenceHouseAdd, apiFenceHouseEdit, apiFenceHouseDetail, apiFenceHouseLists, apiFarmLists} from '@/api/fence_house' import { timeFormat } from '@/utils/util' import type { PropType } from 'vue' -import {useDictOptions} from "@/hooks/useDictOptions"; -import {ref} from "vue"; +import {useDictOptions} from "@/hooks/useDictOptions" +import {ref} from "vue" +import config from "@/config"; +import useUserStore from "@/stores/modules/user"; +import {ElMessage, type UploadProps} from "element-plus"; + defineProps({ dictData: { type: Object as PropType>, default: () => ({}) } }) + const emit = defineEmits(['success', 'close']) const formRef = shallowRef() const popupRef = shallowRef>() const mode = ref('add') +const acceptFileTypes = ref(".png, .jpg, .jpeg, image/png, image/jpeg") +const action = ref(`${config.baseUrl}${config.urlPrefix}/upload/image`) +const userStore = useUserStore() +const handleAvatarSuccessAvatar: UploadProps["onSuccess"] = ( + response, + uploadFile +) => { + if (response.code == 0) { + ElMessage.error(response.msg); + return; + } + formData.image = response.data.uri; +} // 弹窗标题 const popupTitle = computed(() => { @@ -95,6 +144,7 @@ const popupTitle = computed(() => { const formData = reactive({ id: '', farm_id: '', + animal_name: '', fence_house_name: '', animal_type: '', fence_house_type: '', @@ -102,6 +152,7 @@ const formData = reactive({ master: '', status: '', qr_code: '', + image: '', }) @@ -130,7 +181,6 @@ const queryFarm= async (query: string) => { optionsData.farmList = farmList loading.value = false } -console.log(optionsData) // 获取详情 @@ -183,3 +233,35 @@ defineExpose({ getDetail }) + + + \ No newline at end of file diff --git a/admin/src/views/fence_house/index.vue b/admin/src/views/fence_house/index.vue index 5ed311c..e22fe9c 100644 --- a/admin/src/views/fence_house/index.vue +++ b/admin/src/views/fence_house/index.vue @@ -47,7 +47,11 @@ - + + +