优化合同气瓶设备名称显示
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/** 解析固定或由父字段动态决定的关系资源。 */
|
||||
|
||||
Reference in New Issue
Block a user