diff --git a/src/commands/report/list.ts b/src/commands/report/list.ts index 4bc7dd3..8a7f3c1 100644 --- a/src/commands/report/list.ts +++ b/src/commands/report/list.ts @@ -35,6 +35,9 @@ interface ListOpts { json?: boolean currentPage?: string pageSize?: string + // v0.15+ (P2-1): 兼容旧版 --category/--type, 转发到 keyword + deprecation warn + category?: string + type?: string } export function buildReportListCommand(): Command { @@ -43,14 +46,32 @@ export function buildReportListCommand(): Command { .option('--keyword ', '按名称模糊搜索') .option('--currentPage

', '页码', '1') .option('--pageSize ', '每页', '50') + // v0.15+ (P2-1): 兼容旧版选项, 转发到 keyword 模糊搜索 + deprecation warn + // 旧版 (cmd-review/report.md § 1) 有 --category --type, v0.14 切 webapi 静默丢失 + .option('--category ', '[已弃用] 按分类过滤, 改用 --keyword=<分类名/enCode>') + .option('--type ', '[已弃用] 按报表类型过滤, 改用 --keyword=<类型>') .option('--json', '原始 JSON 输出', false) .action(async (opts: ListOpts) => { const c = await JnpfClient.fromToken() + + // v0.15+ (P2-1): 兼容 --category/--type 转发到 keyword + 提示 + // 旧版用 /api/ReportManage 端点支持 category/type 过滤, 现 webapi 走 /api/Report + // 端点只有 keyword 模糊搜索, 没法 server 端 category/type 过滤 + let finalKeyword = opts.keyword || '' + if (opts.category) { + log.warn('P2-1: --category 已弃用, 改用 --keyword=<分类名/enCode> 客户端过滤') + finalKeyword = finalKeyword ? `${finalKeyword} ${opts.category}` : opts.category + } + if (opts.type) { + log.warn('P2-1: --type 已弃用, 改用 --keyword=<类型> 客户端过滤') + finalKeyword = finalKeyword ? `${finalKeyword} ${opts.type}` : opts.type + } + // v0.14+ webapi 化: 调用 web 端原版 getReportList (走 reportHttp, 端点 /api/Report) await initReportWebapi(c) // web 端 getReportList(params) — params 是 query string, 含 keyword / currentPage / pageSize const r = (await loadReport.getReportList({ - keyword: opts.keyword, + keyword: finalKeyword, currentPage: Number(opts.currentPage || '1'), pageSize: Number(opts.pageSize || '50'), })) as { @@ -86,6 +107,9 @@ export function buildReportListCommand(): Command { '--keyword': '按名称模糊搜索', '--currentPage': '页码 (默认 1)', '--pageSize': '每页 (默认 50)', + // v0.15+ (P2-1): 标 deprecation + '--category': '[已弃用, 兼容保留] 按分类过滤', + '--type': '[已弃用, 兼容保留] 按类型过滤', }, example: 'dacli report list\ndacli report list --keyword=月报', source: { @@ -97,6 +121,9 @@ export function buildReportListCommand(): Command { 'v0.14+: 改用 webapi 镜像 (loadReport.getReportList), 替代旧版 c.get("/extend/ReportManage")', '**报表数据来源**: 报表微服务端口 32000 (jnpf-datareport-univer), 通过 nginx /api/Report/ 路径代理', '**nCOPE BACKEND-7**: 当前 dacli 测试环境 nginx /api/Report 重定向到 /api/Report/ → 404 (Spring 不识别带斜杠根), 需在 _defhttp_shim.ts 改 reportHttp 走独立 32000 client (后续 PR)', + // v0.15+ (P2-1): 兼容说明 + '**v0.15+ (P2-1)**: 旧版 --category/--type 兼容保留, 转发到 --keyword 模糊搜索 + deprecation warn', + ' 老用户脚本继续能用, 不报错, v0.16+ 将彻底移除 (breaking change)', ], }) return cmd