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