feat(主子表): 引用驱动联动 向导映射 UI + 真事件 e2e

- NewFeatureShell: 主子表步③加「引用联动」combo(引用列 → 目标子列 ← 源实体列),
  childLinkage 透传 compile;构建时分支(不依赖 amis 运行时 step 跳步),页面 data seed []
- e2e/master-detail: 引用驱动联动用例——真后端 schema(GET /api/page/schema) + 真 picker
  数据 + 真 Playwright 事件填充 + 提交落库验证(选物料→带出单价/规格,用户未手填仍随
  _ADD 级联落库;引用 FK 本身也落库)
- e2e/linkage-probe: amis input-table 行内联动机制隔离验证(钉死 selectedItems 是对象非
  数组;远程 source 选项携整行列;多行 ${index} 按行隔离防串台)
- NewFeatureShell.test: 修过时断言(c735f24 类型选择卡后需先选类型才出 amis 挂载点)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-20 22:28:45 +08:00
parent c735f24c64
commit b578d8d41b
4 changed files with 481 additions and 7 deletions

View File

@@ -161,6 +161,30 @@ function buildWizardSchema(recipe: string): Record<string, unknown> {
{ label: '最大 MAX', value: 'MAX' }] },
],
},
{
type: 'combo', name: 'childLinkage', label: '引用联动', multiple: true,
addable: true, removable: true, addButtonText: '加引用联动', minLength: 0,
description: '可选。子表「引用列」(类型=引用)选中某条记录时,自动带出该记录的其它列到同行子列。'
+ '如 选物料→带出单价/规格:引用列填 ITEMID(须为引用类型子列);带出映射 目标子列 ITEMPRICE ← 源列 PRICE。'
+ '选中时实时填充,提交保存所填值。',
items: [
{ type: 'input-text', name: 'refColumn', label: '引用列', required: true, placeholder: 'ITEMID',
columnClassName: 'w-sm', validations: { matchRegexp: '/^[A-Z][A-Z0-9_]{0,40}$/' },
validationErrors: { matchRegexp: '须为大写字母开头的引用类型子列' } },
{
type: 'combo', name: 'fills', label: '带出映射', multiple: true,
addable: true, removable: true, addButtonText: '加带出', minLength: 1,
items: [
{ type: 'input-text', name: 'target', label: '目标子列', required: true, placeholder: 'ITEMPRICE',
validations: { matchRegexp: '/^[A-Z][A-Z0-9_]{0,40}$/' },
validationErrors: { matchRegexp: '须为大写字母开头的子表真实列' } },
{ type: 'input-text', name: 'source', label: '源列(引用实体)', required: true, placeholder: 'PRICE',
validations: { matchRegexp: '/^[A-Z][A-Z0-9_]{0,40}$/' },
validationErrors: { matchRegexp: '须为大写字母开头的引用实体列' } },
],
},
],
},
);
}
const compileData: Record<string, unknown> = {
@@ -169,7 +193,7 @@ function buildWizardSchema(recipe: string): Record<string, unknown> {
if (isMD) {
Object.assign(compileData, {
childTable: '${childTablename}', linkColumn: 'MASTERID', listColumn: 'DETAILS', listLabel: '${childName}',
childDerived: '${childDerived}', childRollup: '${childRollup}',
childDerived: '${childDerived}', childRollup: '${childRollup}', childLinkage: '${childLinkage}',
});
} else {
compileData.pageSize = '${pageSize}';
@@ -210,7 +234,7 @@ function buildWizardSchema(recipe: string): Record<string, unknown> {
return {
type: 'page',
className: 'h-full',
data: { childDerived: [], childRollup: [] },
data: { childDerived: [], childRollup: [], childLinkage: [] },
body: {
type: 'wizard',
mode: 'horizontal',