2026-03-10 10:07:54 +08:00
|
|
|
<template>
|
|
|
|
|
<uni-data-select
|
|
|
|
|
v-model="modelValue"
|
|
|
|
|
:localdata="options"
|
|
|
|
|
placeholder="请选择商业公司"
|
|
|
|
|
v-bind="omit($attrs,['change'])"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-03-10 10:21:10 +08:00
|
|
|
import {defineModel, defineOptions, defineProps, getCurrentInstance, nextTick, onMounted, ref, withDefaults} from 'vue'
|
2026-03-10 10:07:54 +08:00
|
|
|
import {omit} from "radash";
|
|
|
|
|
import {getBusinessCompanyList} from "../api/orderManager";
|
|
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
name: "BusinessCompany",
|
|
|
|
|
inheritAttrs: false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const modelValue = defineModel()
|
2026-03-10 10:21:10 +08:00
|
|
|
// default: type = all_name
|
|
|
|
|
/**
|
|
|
|
|
* type:
|
|
|
|
|
* all_name = 显示所有名称
|
|
|
|
|
* id = value 值是 ID
|
|
|
|
|
*/
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
type: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: 'all_name'
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-03-10 10:07:54 +08:00
|
|
|
const {proxy} = getCurrentInstance()
|
|
|
|
|
|
|
|
|
|
const options = ref([])
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
2026-03-10 10:21:10 +08:00
|
|
|
await nextTick()
|
2026-03-10 10:07:54 +08:00
|
|
|
const {data} = await getBusinessCompanyList({
|
|
|
|
|
isUnit: 0,
|
|
|
|
|
queryParam: {
|
|
|
|
|
areaId: 0
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
options.value = data.map(item => {
|
|
|
|
|
return {
|
2026-03-10 10:21:10 +08:00
|
|
|
value: props.type === 'id' ? item.userid : item.businessname,
|
2026-03-10 10:07:54 +08:00
|
|
|
text: item.businessname
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|