完善合同关联主体名称展示
This commit is contained in:
@@ -98,6 +98,15 @@ const collectionAliases: Record<string, Record<string, string>> = {
|
||||
},
|
||||
};
|
||||
|
||||
/** 主记录关系字段按资源覆盖全局技术名称,避免把内部关联键暴露为页面文案。 */
|
||||
const resourceAliases: Record<string, Record<string, string>> = {
|
||||
gasorder_contract: {
|
||||
user_account_identity: '用户账户',
|
||||
gas_basic_identity: '所属气站',
|
||||
delivery_basic_identity: '所属配送点',
|
||||
},
|
||||
};
|
||||
|
||||
const moneyKeys = new Set([
|
||||
'amount',
|
||||
'unit_price',
|
||||
@@ -128,6 +137,7 @@ export function detailFieldLabel(
|
||||
const normalized = key.endsWith('_masked') ? key.slice(0, -7) : key;
|
||||
return (
|
||||
collectionAliases[`${definition.name}.${collectionKey}`]?.[normalized] ??
|
||||
resourceAliases[definition.name]?.[normalized] ??
|
||||
definition.fields.find((field) => field.key === normalized)?.label ??
|
||||
aliases[normalized] ??
|
||||
defaultResourceFieldLabel(normalized)
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
</a-popover>
|
||||
<a-tag
|
||||
v-else-if="entry.key === 'contract_status'"
|
||||
class="detail-status-tag"
|
||||
:color="contractStatusColor(Number(entry.rawValue))"
|
||||
>{{ entry.value }}</a-tag>
|
||||
<a-tag
|
||||
v-else-if="entry.key === 'user_service_active'"
|
||||
class="detail-status-tag"
|
||||
:color="entry.rawValue === true ? 'green' : 'red'"
|
||||
>{{ entry.value }}</a-tag>
|
||||
<IdentityText
|
||||
@@ -99,6 +101,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import {
|
||||
collectionRelationIdentityKey,
|
||||
isCollectionJsonField,
|
||||
isResourceJsonField,
|
||||
resourceDetailContract,
|
||||
} from '@/api/resource-detail-contract';
|
||||
import {
|
||||
contractStatusColor,
|
||||
detailFieldLabel,
|
||||
@@ -107,12 +115,6 @@ import {
|
||||
isEmptyDeletedAt,
|
||||
primaryRecord,
|
||||
} from '@/api/resource-display';
|
||||
import {
|
||||
collectionRelationIdentityKey,
|
||||
isCollectionJsonField,
|
||||
isResourceJsonField,
|
||||
resourceDetailContract,
|
||||
} from '@/api/resource-detail-contract';
|
||||
import type { ResourceRow } from '@/api/resource-record-form';
|
||||
import type { ResourceUiDefinition } from '@/api/resources';
|
||||
import IdentityText from '@/components/IdentityText.vue';
|
||||
@@ -308,6 +310,7 @@ const collections = computed(() =>
|
||||
}
|
||||
.detail-item-wide { grid-column: 1 / -1; }
|
||||
.detail-label { color: var(--color-text-3); white-space: nowrap; }
|
||||
.detail-status-tag { width: fit-content; justify-self: start; }
|
||||
.detail-value { min-width: 0; color: var(--color-text-1); white-space: pre-wrap; word-break: break-word; }
|
||||
.json-value,
|
||||
.collection-json-value {
|
||||
|
||||
Reference in New Issue
Block a user