This commit is contained in:
2026-08-12 12:19:02 +08:00
parent f9ff9086d5
commit 11e085e30f
24 changed files with 230 additions and 50 deletions
@@ -9,7 +9,7 @@ const props = withDefaults(defineProps<{
label?: string
}>(), {
disabled: false,
label: '目标企业',
label: '目标客户',
})
const emit = defineEmits<{
@@ -36,7 +36,10 @@ const statusLabels: Record<string, string> = {
function tenantLabel(tenant: PlatformTenantResource) {
const status = statusLabels[tenant.status] || tenant.status
return `${tenant.tenantName}(${tenant.id} · ${status})`
const name = tenant.tenantName?.trim()
const code = tenant.tenantCode?.trim()
const identity = name && code ? `${name}(${code})` : name || code || '未命名客户'
return status ? `${identity} · ${status}` : identity
}
async function loadTenants() {
@@ -50,7 +53,7 @@ async function loadTenants() {
emit('update:modelValue', String(preferred.id))
}
} catch (reason) {
error.value = reason instanceof Error ? reason.message : '企业列表加载失败,请重试'
error.value = reason instanceof Error ? reason.message : '客户列表加载失败,请重试'
} finally {
loading.value = false
}
@@ -67,8 +70,8 @@ onMounted(() => void loadTenants())
class="platform-tenant-selector-input"
filterable
:disabled="disabled || loading || tenants.length === 0"
:placeholder="loading ? '正在加载企业' : '请选择目标企业'"
aria-label="目标企业"
:placeholder="loading ? '正在加载客户' : '请选择目标客户'"
:aria-label="label"
>
<el-option v-for="tenant in tenants" :key="String(tenant.id)" :label="tenantLabel(tenant)" :value="String(tenant.id)" />
</el-select>