feat(主子表): 父级汇总定义 UI + e2e 扩展
- MasterDetailShell step③ 汇总字段 combo(主表列+子表列+函数 SUM/COUNT/AVG/MIN/MAX); page data seed childRollup:[] 防未触碰时占位串致 compile 400 - e2e 派生用例扩展为「派生+汇总」:向导加 TOTAL 主列+汇总字段,断言发布页 __rollup + 主表 TOTAL static SUM(ARRAYMAP) 预览,_ADD 后 _LOAD 主表 TOTAL=55(服务端先派生再聚合) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,9 +35,9 @@ function attrCombo(name: string): Record<string, unknown> {
|
||||
function buildSchema(): Record<string, unknown> {
|
||||
return {
|
||||
type: 'page',
|
||||
// seed childDerived=[] 使 ${childDerived} 恒解析为数组:派生字段 combo 未触碰时也不会发出
|
||||
// 未解析占位串导致 compile 反序列化 400(后端已另做 Object 容错,此处双保险)。
|
||||
data: { childDerived: [] },
|
||||
// seed childDerived/childRollup=[] 使 ${...} 恒解析为数组:combo 未触碰时也不会发出未解析占位串
|
||||
// 导致 compile 反序列化 400(后端已另做 Object 容错,此处双保险)。
|
||||
data: { childDerived: [], childRollup: [] },
|
||||
body: {
|
||||
type: 'wizard',
|
||||
mode: 'horizontal',
|
||||
@@ -92,7 +92,7 @@ function buildSchema(): Record<string, unknown> {
|
||||
tableName: '${masterTable}', recipe: 'master-detail-v1', title: '${title}',
|
||||
displayField: '${displayField}', childTable: '${childTablename}',
|
||||
linkColumn: 'MASTERID', listColumn: 'DETAILS', listLabel: '${childName}',
|
||||
childDerived: '${childDerived}',
|
||||
childDerived: '${childDerived}', childRollup: '${childRollup}',
|
||||
},
|
||||
responseData: { templateId: '${templateId}' },
|
||||
},
|
||||
@@ -114,6 +114,24 @@ function buildSchema(): Record<string, unknown> {
|
||||
{ type: 'input-text', name: 'formula', label: '公式', required: true, placeholder: 'QTY*PRICE' },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'combo', name: 'childRollup', label: '汇总字段', multiple: true,
|
||||
addable: true, removable: true, addButtonText: '加汇总字段', minLength: 0,
|
||||
description: '可选。如 申请总额=明细金额之和:主表列填 TOTAL、子表列填 AMOUNT、函数选 SUM。'
|
||||
+ '主表列须为主实体真实列、子表列须为子表真实列;落库前服务端权威聚合,主表单只读实时预览。',
|
||||
items: [
|
||||
{ type: 'input-text', name: 'masterColumn', label: '主表列', required: true, placeholder: 'TOTAL',
|
||||
validations: { matchRegexp: '/^[A-Z][A-Z0-9_]{0,40}$/' },
|
||||
validationErrors: { matchRegexp: '须为大写字母开头的主表真实列' } },
|
||||
{ type: 'input-text', name: 'childColumn', label: '子表列', required: true, placeholder: 'AMOUNT',
|
||||
validations: { matchRegexp: '/^[A-Z][A-Z0-9_]{0,40}$/' },
|
||||
validationErrors: { matchRegexp: '须为大写字母开头的子表真实列' } },
|
||||
{ type: 'select', name: 'agg', label: '函数', value: 'SUM', options: [
|
||||
{ label: '求和 SUM', value: 'SUM' }, { label: '计数 COUNT', value: 'COUNT' },
|
||||
{ label: '平均 AVG', value: 'AVG' }, { label: '最小 MIN', value: 'MIN' },
|
||||
{ label: '最大 MAX', value: 'MAX' }] },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user