修复财务结算周期与主体展示
This commit is contained in:
@@ -316,6 +316,23 @@ assertIncludes(
|
||||
'hasResourceFieldLabel',
|
||||
'详情必须提供未知字段中文契约检查',
|
||||
);
|
||||
assertIncludes(
|
||||
display,
|
||||
"field.type === 'datetime'",
|
||||
'日期时间必须按字段类型统一格式化,不能依赖 `_at` 字段名后缀',
|
||||
);
|
||||
for (const settlementContract of [
|
||||
"{ label: '气站', value: 'gas' }",
|
||||
"{ label: '配送点', value: 'delivery' }",
|
||||
"{ label: '工作人员', value: 'staff' }",
|
||||
"resources: { gas: '/gas_basic', delivery: '/delivery_basic', staff: '/staff_account' }",
|
||||
]) {
|
||||
assertIncludes(
|
||||
resources,
|
||||
settlementContract,
|
||||
`财务结算缺少主体类型联动契约:${settlementContract}`,
|
||||
);
|
||||
}
|
||||
assertIncludes(
|
||||
detailPage,
|
||||
'!hasResourceFieldLabel(props.definition, actualKey)',
|
||||
|
||||
@@ -513,6 +513,11 @@ export function displayResourceField(
|
||||
? numericValue.toFixed(field.displayPrecision)
|
||||
: String(value);
|
||||
}
|
||||
// 日期时间应以字段类型为准,避免 period_start 等非 `_at` 字段回显原始 RFC3339 文本。
|
||||
if (field.type === 'datetime') {
|
||||
const date = dayjs(String(value));
|
||||
return date.isValid() ? date.format('YYYY-MM-DD HH:mm:ss') : String(value);
|
||||
}
|
||||
if (field.type === 'identity' && typeof value === 'string') {
|
||||
return relationLabel(field, value, relationOptions, row);
|
||||
}
|
||||
|
||||
@@ -850,12 +850,22 @@ export const resources: ResourceUiDefinition[] = [
|
||||
}),
|
||||
f('amount'), f('paid_at'),
|
||||
]),
|
||||
define('fin_settlement', '财务结算', 'writable', [f('settlement_no', { required: true }), f('subject_type', { required: true }), f('subject_identity', {
|
||||
define('fin_settlement', '财务结算', 'writable', [f('settlement_no', { required: true }), f('subject_type', {
|
||||
required: true,
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '气站', value: 'gas' },
|
||||
{ label: '配送点', value: 'delivery' },
|
||||
{ label: '工作人员', value: 'staff' },
|
||||
],
|
||||
unknownValueLabel: '未知结算主体类型',
|
||||
}), f('subject_identity', {
|
||||
required: true, type: 'identity', label: '结算主体', listRelationNameOnly: true,
|
||||
displayRelationLabel: true, showIdentityCopy: true,
|
||||
dynamicRelation: {
|
||||
parentKey: 'subject_type', parentLabel: '结算主体类型',
|
||||
resources: { gas: '/gas_basic', delivery: '/delivery_basic' },
|
||||
resources: { gas: '/gas_basic', delivery: '/delivery_basic', staff: '/staff_account' },
|
||||
parentChangeMessage: '结算主体类型已变更,请重新选择结算主体',
|
||||
},
|
||||
}), f('period_start', { required: true }), f('period_end', { required: true })]),
|
||||
define('fin_reconciliation', '财务对账', 'readonly', [
|
||||
|
||||
Reference in New Issue
Block a user