feat: 新增渠道选择器组件
parent
71bb593c48
commit
8b390a404b
|
|
@ -0,0 +1,44 @@
|
||||||
|
<!-- src/components/ChannelSelect.vue -->
|
||||||
|
<template>
|
||||||
|
<a-select
|
||||||
|
:value="modelValue"
|
||||||
|
:options="options"
|
||||||
|
:loading="loading"
|
||||||
|
show-search
|
||||||
|
option-filter-prop="label"
|
||||||
|
placeholder="请选择所属渠道"
|
||||||
|
style="width: 220px"
|
||||||
|
allow-clear
|
||||||
|
@update:value="$emit('update:modelValue', $event)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { fetchCoreEnterprisePageApi } from '@/api/baseConfig'
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
modelValue: { type: String, default: undefined }
|
||||||
|
})
|
||||||
|
defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
const options = ref([])
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
async function loadChannelOptions() {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await fetchCoreEnterprisePageApi({ page: 1, pageSize: 200 })
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
options.value = (res.data.data.records || []).map((item) => ({
|
||||||
|
label: item.enterpriseName,
|
||||||
|
value: item.enterpriseCode
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(loadChannelOptions)
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue