完善财务对账渠道与日期展示
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
3. 增加静态展示契约,防止非 `_at` 日期时间字段再次回显原始字符串。
|
||||
4. 结算主体类型改为气站、配送点、工作人员三类中文枚举,并联动相应主体下拉。
|
||||
5. 切换主体类型时清空原主体,防止跨类型标识误提交。
|
||||
6. 财务对账渠道复用支付渠道中文口径,账单日期按纯日期格式展示。
|
||||
|
||||
## 行为变化
|
||||
|
||||
@@ -25,11 +26,13 @@
|
||||
- 修改后:`2026-06-01 09:00:00`。
|
||||
- 仅改变展示格式,不改变结算周期、接口字段、保存值或结算流程。
|
||||
- 新建和编辑结算单不再要求手工输入主体类型编码。
|
||||
- 财务对账的 `wallet` 改为“余额支付”,`2026-07-01T00:00:00Z` 改为 `2026-07-01`。
|
||||
|
||||
## 代码变更
|
||||
|
||||
- `frontend/platform_admin/src/api/resource-display.ts`:日期时间改为按字段类型统一格式化。
|
||||
- `frontend/platform_admin/src/api/resources.ts`:补齐结算主体类型枚举和三类动态关系。
|
||||
- `frontend/platform_admin/src/api/resources.ts`:补齐财务对账渠道中文枚举。
|
||||
- `frontend/platform_admin/scripts/check-resource-display-contracts.mjs`:增加日期时间类型格式化契约。
|
||||
- `docs/项目文档_平台资源中文展示统一_v1.0.md`:记录 v1.14 变更。
|
||||
|
||||
@@ -41,6 +44,7 @@
|
||||
- `pnpm type:check`:通过。
|
||||
- `pnpm build`:通过,TypeScript 类型检查及 Vite 生产构建完成,共转换 2621 个模块。
|
||||
- 补齐结算主体联动后再次执行资源契约、48 资源契约、定向 lint、类型检查和生产构建:全部通过,仍仅有既有建议性警告。
|
||||
- 补齐财务对账渠道和纯日期展示后再次执行上述完整前端验证:全部通过,仍仅有既有建议性警告。
|
||||
|
||||
## 风险评估
|
||||
|
||||
|
||||
@@ -78,3 +78,4 @@ frontend/platform_admin/
|
||||
- v1.13:修正固定 Mock 退款误把气站账号写为平台审核人的数据错误,并在重复初始化时幂等修复历史记录;退款审核人由接口稳定返回平台账号名称。
|
||||
- v1.14:日期时间统一按字段类型格式化,财务结算周期完整显示为 `YYYY-MM-DD HH:mm:ss`,不再回显带 `T` 的截断 RFC3339 文本。
|
||||
- v1.15:财务结算主体类型改为气站、配送点、工作人员中文枚举,并按类型联动对应主体资源,切换类型时清空旧主体。
|
||||
- v1.16:财务对账渠道统一显示余额支付、支付宝、微信支付;账单日期按 `YYYY-MM-DD` 展示,不再回显时间和时区。
|
||||
|
||||
@@ -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)',
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 })]),
|
||||
|
||||
Reference in New Issue
Block a user