feat: 新增商业公司下拉支持地域切换

This commit is contained in:
lonewolfyx 2026-03-10 10:56:58 +08:00
parent 8af8688f20
commit 01e7263de7

View File

@ -8,7 +8,7 @@
</template>
<script setup>
import {defineModel, defineOptions, defineProps, getCurrentInstance, nextTick, onMounted, ref, withDefaults} from 'vue'
import {defineModel, defineOptions, defineProps, getCurrentInstance, nextTick, onMounted, ref, watch} from 'vue'
import {omit} from "radash";
import {getBusinessCompanyList} from "../api/orderManager";
@ -28,18 +28,21 @@ const props = defineProps({
type: {
type: String,
default: 'all_name'
},
areaId: {
type: Number,
default: 0
}
})
const {proxy} = getCurrentInstance()
const options = ref([])
onMounted(async () => {
await nextTick()
const handleQuery = async () => {
const {data} = await getBusinessCompanyList({
isUnit: 0,
queryParam: {
areaId: 0
areaId: props.areaId
}
})
options.value = data.map(item => {
@ -48,5 +51,16 @@ onMounted(async () => {
text: item.businessname
}
})
}
onMounted(async () => {
await nextTick()
await handleQuery()
})
watch(() => props.areaId, async (newValue) => {
if (newValue) {
await handleQuery()
}
})
</script>