完善财务对账渠道与日期展示

This commit is contained in:
czl231
2026-08-17 01:37:00 +08:00
parent a6560f99b6
commit e9db59509c
5 changed files with 31 additions and 1 deletions

View File

@@ -321,6 +321,11 @@ assertIncludes(
"field.type === 'datetime'",
'日期时间必须按字段类型统一格式化,不能依赖 `_at` 字段名后缀',
);
assertIncludes(
display,
"field.type === 'date'",
'纯日期必须按字段类型格式化,不能回显后端序列化的时间部分',
);
for (const settlementContract of [
"{ label: '气站', value: 'gas' }",
"{ label: '配送点', value: 'delivery' }",
@@ -333,6 +338,11 @@ for (const settlementContract of [
`财务结算缺少主体类型联动契约:${settlementContract}`,
);
}
assertIncludes(
resources,
"unknownValueLabel: '未知对账渠道'",
'财务对账渠道必须使用中文枚举并保留未知值提示',
);
assertIncludes(
detailPage,
'!hasResourceFieldLabel(props.definition, actualKey)',

View File

@@ -513,6 +513,11 @@ export function displayResourceField(
? numericValue.toFixed(field.displayPrecision)
: String(value);
}
// 纯日期字段不展示后端序列化附带的时间和时区部分。
if (field.type === 'date') {
const date = dayjs(String(value));
return date.isValid() ? date.format('YYYY-MM-DD') : String(value);
}
// 日期时间应以字段类型为准,避免 period_start 等非 `_at` 字段回显原始 RFC3339 文本。
if (field.type === 'datetime') {
const date = dayjs(String(value));

View File

@@ -869,7 +869,17 @@ export const resources: ResourceUiDefinition[] = [
},
}), f('period_start', { required: true }), f('period_end', { required: true })]),
define('fin_reconciliation', '财务对账', 'readonly', [
f('reconciliation_status'), f('channel'), f('bill_date'), f('difference_amount'),
f('reconciliation_status'),
f('channel', {
type: 'select',
options: [
{ label: '余额支付', value: 'wallet' },
{ label: '支付宝', value: 'alipay' },
{ label: '微信支付', value: 'wechat' },
],
unknownValueLabel: '未知对账渠道',
}),
f('bill_date'), f('difference_amount'),
]),
define('cms_content', '内容', 'writable', [f('content_type', { required: true }), f('title', { required: true }), f('body', { required: true }), f('version_no'), f('publish_status')]),
define('cs_ticket', '客服工单', 'writable', [relation('user_account_identity', '/user_account', true), f('ticket_no', { required: true }), f('category', { required: true }), f('priority', { required: true })]),