优化合同气瓶设备名称显示

This commit is contained in:
czl231
2026-08-14 01:49:44 +08:00
parent 08f1a917b3
commit 14263416e0
11 changed files with 400 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
<!--
功能以响应式信息卡和子表页签展示标准资源详情
版本v1.3.0
版本v1.4.0
-->
<template>
<div class="detail-stack">
@@ -143,7 +143,7 @@ const collections = computed(() =>
.filter(([, value]) => Array.isArray(value) && value.length > 0)
.map(([key, value]) => {
const rows = value as ResourceRow[];
const columns = [
const availableColumns = [
...new Set(
rows.flatMap((row) =>
Object.keys(row).filter(
@@ -155,7 +155,33 @@ const collections = computed(() =>
),
),
),
].slice(0, 8);
];
const preferredColumns: Record<string, string[]> = {
'gasorder_contract.products': [
'bound_at',
'product_name',
'product_code',
'product_type_name',
'unit_price',
'product_info_identity',
'unbound_at',
'unbind_reason',
],
'gasorder_basic.items': [
'product_name',
'product_code',
'product_type_name',
'product_params',
'unit_price',
'active',
'product_info_identity',
],
};
const preferred =
preferredColumns[`${props.definition.name}.${key}`] ?? [];
const columns = [...new Set([...preferred, ...availableColumns])]
.filter((column) => availableColumns.includes(column))
.slice(0, 8);
return {
key,
title: resourceFieldLabel(props.definition, key),

View File

@@ -1,6 +1,6 @@
<!--
功能渲染标准资源的新建编辑和业务动作字段控件
版本v1.2.0
版本v1.3.0
-->
<template>
<div class="field-grid">
@@ -105,7 +105,13 @@
:key="String(option.identity)"
:value="String(option.identity)"
>
{{ relationOptionLabel(field, option) }}
{{
relationOptionLabel(
field,
option,
relationOptions[relationResource(field)] ?? [],
)
}}
</a-option>
<template #empty>
<div class="relation-empty">{{ relationEmptyText(field) }}</div>
@@ -192,7 +198,13 @@ function readonlyRelationLabel(field: ResourceField) {
const option = (props.relationOptions[relationResource(field)] ?? []).find(
(item) => String(item.identity ?? '') === identity,
);
return option ? relationOptionLabel(field, option) : identity;
return option
? relationOptionLabel(
field,
option,
props.relationOptions[relationResource(field)] ?? [],
)
: identity;
}
/** 解析固定或由父字段动态决定的关系资源。 */