This commit is contained in:
chenbo 2024-01-13 17:17:18 +08:00
parent 8756ffe09b
commit 54b2e0b57c
2 changed files with 14 additions and 10 deletions

View File

@ -90,10 +90,10 @@ const { optionsData } = useDictOptions<{
const loading = ref(false)
const queryFenceHouse = async (user_id: string) => {
const queryFenceHouse = async (fence_house_name: string) => {
loading.value = true
const fenceHouseList = await apiFenceHouseLists({
user_id: user_id ?? ''
fence_house_name: fence_house_name ?? ''
})
optionsData.fenceHouse = fenceHouseList
loading.value = false

View File

@ -52,6 +52,7 @@
:remote-method="queryUser"
@change="selectedUser"
:loading="loading"
clearable
>
<el-option
v-for="(item, index) in optionsData.user"
@ -70,6 +71,7 @@
placeholder="请选择"
:remote-method="queryFenceHouse"
:loading="loading"
clearable
>
<el-option
v-for="(item, index) in optionsData.fenceHouse"
@ -126,7 +128,7 @@ const handleAvatarSuccessAvatar: UploadProps["onSuccess"] = (
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑产品' : '新增产品'
})
const fence_house_name = ref('')
//
const formData = reactive({
id: '',
@ -183,7 +185,7 @@ const { optionsData } = useDictOptions<{
api: getUserList
},
fenceHouse: {
api: apiLandLists
api: apiFenceHouseLists
}
})
@ -201,13 +203,15 @@ const queryUser = async (query: string) => {
const selectedUser = (value: any) => {
optionsData.fenceHouse = []
formData.fence_house_id = ''
queryFenceHouse(value)
queryFenceHouse({user_id: value})
}
const queryFenceHouse = async (user_id: string) => {
const queryFenceHouse = async (query: any) => {
// string
if(typeof query == 'string') {
query = {fence_house_name: query}
}
loading.value = true
const fenceHouseList = await apiFenceHouseLists({
user_id: user_id ?? ''
})
const fenceHouseList = await apiFenceHouseLists(query)
optionsData.fenceHouse = fenceHouseList
loading.value = false
}
@ -239,7 +243,7 @@ const open = (type = 'add') => {
const root = res.user.root ?? 0
formData.root = root
if (type == 'edit') {
queryFenceHouse(formData.user_id)
queryFenceHouse({user_id: formData.user_id})
}
})
.catch((err: any) => {