完善内容类型与发布状态中文展示
This commit is contained in:
45
docs/操作日志_内容类型与发布状态中文展示修复_20260817.md
Normal file
45
docs/操作日志_内容类型与发布状态中文展示修复_20260817.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# 内容类型与发布状态中文展示修复操作日志
|
||||
|
||||
操作时间:2026-08-17
|
||||
|
||||
操作类型:修改
|
||||
|
||||
影响模块:平台总后台、内容管理
|
||||
|
||||
## 操作前状态
|
||||
|
||||
- 内容类型直接显示 `notice` 等后端编码。
|
||||
- 字符串发布状态被通用数字状态格式化误判,显示“未知状态(published)”。
|
||||
- 新建和编辑页面允许手工输入未定义编码。
|
||||
|
||||
## 具体操作
|
||||
|
||||
1. 内容类型按模型与需求文档明确的范围配置为“公告”“协议”。
|
||||
2. 发布状态配置为“草稿”“已发布”,新建默认使用草稿。
|
||||
3. 列表、详情、新建和编辑共用同一字段枚举;历史未知值显示明确提示。
|
||||
4. 增加静态展示契约,防止英文编码重新进入业务页面。
|
||||
|
||||
## 行为变化
|
||||
|
||||
- `notice` 显示为“公告”。
|
||||
- `draft`、`published` 分别显示为“草稿”“已发布”。
|
||||
- 不修改接口字段、数据库存储值或客户端已发布内容查询规则。
|
||||
|
||||
## 代码变更
|
||||
|
||||
- `frontend/platform_admin/src/api/resources.ts`:补齐内容类型和发布状态中文枚举。
|
||||
- `frontend/platform_admin/scripts/check-resource-display-contracts.mjs`:增加内容管理中文展示契约。
|
||||
- `docs/项目文档_平台资源中文展示统一_v1.0.md`:记录 v1.17 变更。
|
||||
|
||||
## 验证结果
|
||||
|
||||
- `pnpm resource-display-contracts:check`:通过。
|
||||
- `pnpm contract:check`:通过,48 个资源契约一致。
|
||||
- 修改文件定向 Biome lint:通过,无错误和警告。
|
||||
- `pnpm type:check`:通过。
|
||||
- `pnpm build`:通过,TypeScript 类型检查及 Vite 生产构建完成,共转换 2621 个模块。
|
||||
|
||||
## 风险评估
|
||||
|
||||
- 仅将文档与模型已明确的公告、协议纳入下拉,未知历史类型不会被静默改写。
|
||||
- 发布状态保持后端 `draft`、`published` 编码,用户端已发布内容筛选逻辑不变。
|
||||
@@ -79,3 +79,4 @@ frontend/platform_admin/
|
||||
- v1.14:日期时间统一按字段类型格式化,财务结算周期完整显示为 `YYYY-MM-DD HH:mm:ss`,不再回显带 `T` 的截断 RFC3339 文本。
|
||||
- v1.15:财务结算主体类型改为气站、配送点、工作人员中文枚举,并按类型联动对应主体资源,切换类型时清空旧主体。
|
||||
- v1.16:财务对账渠道统一显示余额支付、支付宝、微信支付;账单日期按 `YYYY-MM-DD` 展示,不再回显时间和时区。
|
||||
- v1.17:内容类型统一显示公告、协议,发布状态统一显示草稿、已发布;新建和编辑改用中文下拉并保留未知值提示。
|
||||
|
||||
@@ -343,6 +343,19 @@ assertIncludes(
|
||||
"unknownValueLabel: '未知对账渠道'",
|
||||
'财务对账渠道必须使用中文枚举并保留未知值提示',
|
||||
);
|
||||
for (const contentContract of [
|
||||
"{ label: '公告', value: 'notice' }",
|
||||
"{ label: '协议', value: 'agreement' }",
|
||||
"{ label: '草稿', value: 'draft' }",
|
||||
"{ label: '已发布', value: 'published' }",
|
||||
"unknownValueLabel: '未知发布状态'",
|
||||
]) {
|
||||
assertIncludes(
|
||||
resources,
|
||||
contentContract,
|
||||
`内容管理缺少中文枚举契约:${contentContract}`,
|
||||
);
|
||||
}
|
||||
assertIncludes(
|
||||
detailPage,
|
||||
'!hasResourceFieldLabel(props.definition, actualKey)',
|
||||
|
||||
@@ -881,7 +881,27 @@ export const resources: ResourceUiDefinition[] = [
|
||||
}),
|
||||
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('cms_content', '内容', 'writable', [
|
||||
f('content_type', {
|
||||
required: true,
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '公告', value: 'notice' },
|
||||
{ label: '协议', value: 'agreement' },
|
||||
],
|
||||
unknownValueLabel: '未知内容类型',
|
||||
}),
|
||||
f('title', { required: true }), f('body', { required: true }), f('version_no'),
|
||||
f('publish_status', {
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '草稿', value: 'draft' },
|
||||
{ label: '已发布', value: 'published' },
|
||||
],
|
||||
defaultValue: 'draft',
|
||||
unknownValueLabel: '未知发布状态',
|
||||
}),
|
||||
]),
|
||||
define('cs_ticket', '客服工单', 'writable', [relation('user_account_identity', '/user_account', true), f('ticket_no', { required: true }), f('category', { required: true }), f('priority', { required: true })]),
|
||||
define('platform_account', '平台账户', 'writable', [f('username', { required: true }), f('password', { required: true }), f('display_name'), f('avatar'), f('platform_role_code', { required: true, unknownValueLabel: '未知角色' }), f('phone')]),
|
||||
define('platform_role', '平台角色', 'writable', [f('role_code', { required: true }), f('name', { required: true }), f('location_scope', { required: true, type: 'select', options: resourceSearchEnumOptions('platform_role', 'location_scope') })], 'list', [
|
||||
|
||||
Reference in New Issue
Block a user