状态字段下拉选择+后端拦截
This commit is contained in:
1 parent
703dea2655
commit
50d90e3540
1 file changed
+8
@@ -132,6 +132,12 @@ function renderTags(value: unknown, separator = ','): string[] {
|
|||||||
function renderUuid(value: unknown): string {
|
function renderUuid(value: unknown): string {
|
||||||
return value ? String(value).slice(0, 8) + '...' : ''
|
return value ? String(value).slice(0, 8) + '...' : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// select 类型渲染:按 options 匹配 label 回显(状态码等只读展示为中文)
|
||||||
|
function renderSelectLabel(col: ColumnSchema, value: unknown): string {
|
||||||
|
const opt = col.options?.find((o) => String(o.value) === String(value))
|
||||||
|
return opt ? opt.label : value == null || value === '' ? '' : String(value)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -235,6 +241,8 @@ function renderUuid(value: unknown): string {
|
|||||||
</template>
|
</template>
|
||||||
<!-- uuid:前 8 位 + ... -->
|
<!-- uuid:前 8 位 + ... -->
|
||||||
<span v-else-if="col.type === 'uuid'">{{ renderUuid((row as Record<string, unknown>)[col.field]) }}</span>
|
<span v-else-if="col.type === 'uuid'">{{ renderUuid((row as Record<string, unknown>)[col.field]) }}</span>
|
||||||
|
<!-- select:options 匹配显示 label(状态码等) -->
|
||||||
|
<span v-else-if="col.type === 'select'">{{ renderSelectLabel(col, (row as Record<string, unknown>)[col.field]) }}</span>
|
||||||
<!-- 默认:原值 -->
|
<!-- 默认:原值 -->
|
||||||
<span v-else>{{ (row as Record<string, unknown>)[col.field] }}</span>
|
<span v-else>{{ (row as Record<string, unknown>)[col.field] }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in new issue
Block a user