fix: 优化商业公司下拉组件的选择

This commit is contained in:
lonewolfyx 2026-03-10 10:21:10 +08:00
parent 561c9f551b
commit 2b512d0960

View File

@ -8,7 +8,7 @@
</template> </template>
<script setup> <script setup>
import {defineModel, defineOptions, defineProps, getCurrentInstance, ref,onMounted} from 'vue' import {defineModel, defineOptions, defineProps, getCurrentInstance, nextTick, onMounted, ref, withDefaults} from 'vue'
import {omit} from "radash"; import {omit} from "radash";
import {getBusinessCompanyList} from "../api/orderManager"; import {getBusinessCompanyList} from "../api/orderManager";
@ -18,12 +18,24 @@ defineOptions({
}) })
const modelValue = defineModel() const modelValue = defineModel()
const props = defineProps([]) // default: type = all_name
/**
* type:
* all_name = 显示所有名称
* id = value 值是 ID
*/
const props = defineProps({
type: {
type: String,
default: 'all_name'
}
})
const {proxy} = getCurrentInstance() const {proxy} = getCurrentInstance()
const options = ref([]) const options = ref([])
onMounted(async () => { onMounted(async () => {
await nextTick()
const {data} = await getBusinessCompanyList({ const {data} = await getBusinessCompanyList({
isUnit: 0, isUnit: 0,
queryParam: { queryParam: {
@ -32,7 +44,7 @@ onMounted(async () => {
}) })
options.value = data.map(item => { options.value = data.map(item => {
return { return {
value: item.businessname, value: props.type === 'id' ? item.userid : item.businessname,
text: item.businessname text: item.businessname
} }
}) })