/** * webapi/report.ts — 镜像 web 端报表 API * * 镜像源: web/apps/jnpf-web-apps-main/src/api/onlineDev/report.ts * - 主 webapp 的 Vue 3 报表 API 客户端 (走 reportHttp, 调后端 REST) * - 端点 /api/Report (大写 R, 被 nginx 代理到报表服务 32000): * - GET /api/Report 列表 * - GET /api/Report/{id} 详情 * - POST /api/Report 新建 * - PUT /api/Report/{id} 修改 * - DELETE /api/Report/{id} 删除 * - POST /api/Report/{id}/Actions/Copy * - POST /api/Report/Data 预览/取数 * - POST /api/Report/Save 保存设计 * * 为什么不是 jnpf-web-datareport? * - jnpf/前端/jnpf-web-datareport 是 jQuery 老设计器, 只有 designer.js, 无 src/api/ * - 报表元数据 CRUD 走主服务 30000 (/api/extend/ReportManage) * - 报表**数据**走报表服务 32000 (/api/Report/*), 但 API 客户端只存在于主 webapp * * 为什么不是 web/packages/jnpf/plugins/jnpf-univer? * - 该包是 Vue 3 UI 组件 (designer/print/preview), 无 api/ 目录 * - 主 webapp 的 report.ts 也不 import 它, 仍用 reportHttp 调后端 */ import { JnpfClient } from '../core/client.ts' import { loadWebModule } from './_loader.ts' const REPORT_SRC = '/home/ubuntu/ccWorkDir/web/apps/jnpf-web-apps-main/src/api/onlineDev/report.ts' let cached: any = null export async function initWebapi(client: JnpfClient): Promise { if (cached) return const { initDefHttpShim } = await import('./_defhttp_shim.ts') initDefHttpShim(client) cached = await loadWebModule(REPORT_SRC) } export function isWebapiLoaded(): boolean { return cached !== null } export const loadReport: any = new Proxy({} as any, { get(_target, prop) { if (!cached) throw new Error('report 模块未初始化, 请先 await initWebapi(client)') return cached[prop] }, }) /** 获取报表列表 (镜像 web report.ts: getReportList) */ export async function getReportList(params?: Record): Promise { return loadReport.getReportList(params) } /** 获取报表信息 (镜像 web report.ts: getReportInfo) */ export async function getReportInfo(id: string): Promise { return loadReport.getReportInfo(id) } /** 创建报表 (镜像 web report.ts:22 createReport) */ export async function createReport(params: Record): Promise { return loadReport.createReport(params) } /** 更新报表 (镜像 web report.ts:23 updateReport) */ export async function updateReport(params: Record & { id: string }): Promise { return loadReport.updateReport(params) } /** 删除报表 (镜像 web report.ts: delReport) */ export async function delReport(id: string): Promise { return loadReport.delReport(id) }