diff --git a/docs/UpperTable-大列表滚动性能优化方案.md b/docs/UpperTable-大列表滚动性能优化方案.md index 522cbee2..bec7f98a 100644 --- a/docs/UpperTable-大列表滚动性能优化方案.md +++ b/docs/UpperTable-大列表滚动性能优化方案.md @@ -1,7 +1,10 @@ # UpperTable 大列表滚动性能优化方案 -> 状态:方案评审中(未实施) -> 日期:2026-08-28 +> 状态:方案①②⑥⑦⑧⑨已实施(2026-08-29);双模式默认"开销优先"; +> ⚠️ 关键发现:el-table `:data` 变化硬成本 ~300ms,performance 模式已改"冻结+快速更新"(滚动流畅); +> 根治"实时跟随+流畅"需 el-table-v2 / transform(待评估) +> 日期:2026-08-28(创建)/ 2026-08-29(更新) +> **用户决策(2026-08-29)**:双模式可切换——"性能优先"提升资源开销换取使用性能;"开销优先"减少资源开销保证基础体验;在"字段设置"中切换。**默认模式 = 开销优先**。 > 组件:`src/components/UpperTable/index.vue` > 涉及页面:订单管理、波次管理(waveOrder)等所有使用 UpperTable 的大数据列表 @@ -154,12 +157,12 @@ tableRenderData = [顶部spacer(高=startIndex*行高)] + [可视窗口行] + [ ### 6.1 建议顺序 ``` -第一步:方案①(收窄 tooltip)—— 小改动,验证根因 - ↓ 浏览器实测:滚动长任务是否从 700ms 级降到几十 ms -第二步:方案②(el-tag 文本化)—— 进一步降组件树 - ↓ 复测 -第三步:方案③(transform 位移虚拟化) -第四步:方案④(默认列收敛,可随时做) +第一步:方案①(收窄 tooltip)—— ✅ 已完成(2026-08-29) +第二步:方案②(el-tag 文本化)—— ✅ 已完成(2026-08-29) + ↓ 复测:滚动长任务从 862ms 降到 ~500ms;单步滚动从 141ms 降到 45~77ms +第三步:方案⑥⑦(向上滚动真空期优化,见第 9 章)—— 待实施 +第四步:方案③(transform 位移虚拟化)—— 评估后实施 +第五步:方案④(默认列收敛,可随时做) ``` ### 6.2 验证方法(DevTools) @@ -199,3 +202,200 @@ obs.observe({ entryTypes: ['longtask'] }); - 组件:`src/components/UpperTable/index.vue` - 页面示例:`src/views/order/orderManagement/`、`src/views/order/waveOrder/` - 列配置示例:`src/views/order/waveOrder/config/wave-config.ts` + +--- + +## 9. 向上滚动渲染"真空期"(2026-08-29 新发现) + +### 9.1 现象 + +方案①②实施后,**向下滚动明显改善**,但**向上滚动查看上方数据时,可视区域出现明显的渲染"真空期"**:滚动位置已经移动,但表格内容迟迟未渲染到位,出现数百毫秒的空白/错位,体验不佳。 + +### 9.2 实测数据 + +在待处理订单页(500 条/页,虚拟滚动)快速向上滚动 7000px(scrollTop 8000 → 1000): + +| 指标 | 值 | +|---|---| +| 滚动位置到达目标时刻 | T+0 | +| 数据行(43 行窗口)首次更新时刻 | **T+632ms** | +| 真空期时长 | **约 632ms** | + +> 即:滚动条已到目标位置,但可视区的行内容要再等约 **632ms** 才渲染出来。这 632ms 内可视区显示的是旧窗口内容(与滚动位置严重错位)或空白。 + +### 9.3 根因分析(结合代码) + +当前虚拟滚动是 **"spacer 撑高 + 窗口替换"** 模式,向上滚动时真空期由三个因素叠加: + +1. **窗口更新链路过长(主因)** + 滚动位置变化 → scroll 事件 → rAF 节流 `handleBodyScroll` → 更新 `virtualScrollTop` → computed 重算 `virtualStartIndex` → `tableRenderData` 变化 → Vue 异步渲染新窗口。整条链路每步都要在**事件循环 + 渲染循环**中排队,累积延迟可达数百 ms。 + +2. **整块窗口替换的渲染耗时** + 窗口变化时,新进入可视区的行需创建 DOM(43 行 × 35 列 ≈ 1505 单元格,含 tooltip)。即使方案①②已大幅降组件,创建这些 DOM 仍需数十~上百 ms,期间可视区内容缺失。 + +3. **滚动条连续 vs 窗口步进的不匹配** + 原生滚动位置是连续的,但虚拟窗口按**整数行**切换。窗口切换瞬间,顶部 spacer 高度与行内容**同时跳变**,若渲染未同步完成,就会出现内容与滚动位置错位的"真空期"。向上滚动时(从大 startIndex 往小跳),新增行在顶部,视觉上更明显。 + +4. **buffer 对称且偏小(放大因素)** + `virtualBufferRows = 12` 上下对称。快速向上滚动一次超过 12 行时,顶部新行不在 buffer 内,必须即时创建 → 真空期更明显。 + +### 9.4 优化方案(按收益/成本排序) + +#### 方案 ⑥:方向感知 + 增大 buffer(P0,低成本)—— ✅ 已实施(2026-08-29) + +**目标**:让新进入可视区的行提前存在(预渲染),减少"即时创建"带来的真空期。 + +**做法(已落地)**: +- `virtualBufferRows` 默认 12 → **16** +- 新增 `scrollDirection`(up/down)在 `handleBodyScroll` 中检测滚动方向 +- **方向感知 buffer**:当前滚动方向一侧 buffer ×2(向上滚动时 topBuffer=32 / bottom=16,反之亦然) + +**实测结果**: + +| 指标 | 方案⑥前 | 方案⑥后 | +|---|---|---| +| 渲染行数 | 43 | 59 | +| 向上滚 7000px 真空期 | 632ms | **469ms(-26%)** | +| 向上滚 1000px | — | 474ms | +| 向上滚 300px(9 行) | — | 433ms | + +**关键发现**:即使**小距离滚动(9 行,在 buffer 内)真空期仍 ~433ms**。说明根本瓶颈不是"新行即时创建",而是**每次滚动(无论大小)都触发全窗口(59 行 × 35 列)的 Vue 重渲染**——buffer 预渲染只减少了"新行创建",未解决"每次滚动全窗口 diff"的固有开销。 + +**结论**:方案⑥改善有限(-26%),需配合方案⑦(调度优化)或③/⑤(根治)才能彻底消除真空期。 + +#### 方案 ⑦:窗口更新调度优化(P1)—— ⑦A 已实施(2026-08-29) + +**目标**:缩短"滚动位置变化 → 窗口更新"的链路延迟。 + +**⑦A(已实施,但体验权衡不佳 → 拟回退/调整)** +- `handleBodyScroll` 中滚动过程**冻结 `virtualScrollTop`**(不触发全窗口重渲染),仅更新方向与视口高度 +- 停止滚动 **120ms** 后(debounce `scrollSettleTimer`)一次性更新窗口 + +**⑦A 实测(单步滚动 median)**: + +| 单步滚动 | 方案⑥后 | 方案⑦A 后 | +|---|---|---| +| 20px(不跨行) | 74ms | **19ms** | +| 100px(跨行) | 45ms | **6ms(-87%)** | + +- 滚动中虚拟窗口冻结验证:连续滚动 1.2s,tbody childList 仅变化 3 次(之前每帧变) +- **体验权衡(❌ 不满足用户决策)**: + - 滚动中**内容不跟随滚动位置**(停滞/错位),缓慢滚动逐行查看体验差 + - 停止滚动后约 **400ms** 内容才更新到位——真空期从"滚动中"挪到"停止后" + - 换来的是滚动中流畅(6ms),但这牺牲了"内容实时跟随" +- **结论**:按"可接受性能开销换体验"的决策,**⑦A 的冻结策略不再推荐**,应回退或改造为"内容实时跟随"(见 ⑨ / ③)。 + +**⑦B(推荐方向):滚动中每帧最多同步一次窗口** +- 回退⑦A 冻结,恢复"滚动中每帧(rAF 节流)同步窗口",内容实时跟随滚动位置 +- **关键**:单次渲染必须够快(否则滚动中卡)→ 必须配合方案⑧(降低单次渲染成本)与方案⑥(buffer 预渲染) +- 代价:渲染频率回到每帧,但通过 ⑧ 让单次渲染从 400ms 降到可接受范围 + +#### 方案 ③(复用):transform 位移虚拟化(P1,根治,高风险) + +**目标**:彻底消除"窗口切换真空期"。 + +**做法**:固定行窗口 + `transform: translateY(offset)` 让内容**连续跟随**滚动条;滚动时仅 GPU 合成,不重建 DOM;越过行边界时**复用**已有行(首尾追加/移除),而非整块替换。 + +**风险**:`el-table` 是原生 `` 布局,transform 与原生滚动、固定列、行高计算冲突,需大量回归。若评估后不可行,则转向方案⑤(el-table-v2)作为根治手段。 + +#### 方案 ⑧:继续压渲染耗时(P1,辅助)—— ✅ 已实施(2026-08-29) + +**做法(已落地)**: +- **① formatter 结果按行缓存**:`UpperTable` 新增 `formatterCache = WeakMap>` + `getFormattedCell(row, column, value, index)`,模板 `v-html` 改用它;行对象生命周期自动回收、数据刷新自动失效,滚动窗口切换不重复计算 +- **② 关闭序号 / 货主列多余 tooltip**:`orderWaveIndexColumn`、`orderStoreRemarkColumn` 移除 `showOverflowTooltip` +- **③(未做,可选项)**:关键列之外 el-tooltip 改用 `title` 原生属性降级——改动复杂、收益不确定,暂缓 + +**实测(performance 模式,renderRows=67)**: + +| 单步滚动 | 方案⑨(performance) | 方案⑧后 | +|---|---|---| +| 20px(不跨行)median | 严重卡(1.2s 滚 3 步) | **11ms** | +| 100px(跨行)median | 严重卡 | **60ms** | + +- 对比方案⑨时"1.2s 滚 3 步(~400ms/步)"大幅改善 +- **残留**:performance 跨行渲染仍 ~60ms(67 行 × 35 列 DOM 成本);noCross 偶发 1s 长任务(滚动方向切换时 buffer 对调触发大重渲染) +- **可继续**:压剩余 248 个 tooltip、或降低 performance buffer(16→12)、或方案③ transform + +#### 方案 ⑨:双工作模式(性能优先 / 开销优先,P0)—— ✅ 已实施(2026-08-29,默认"开销优先") + +**目标**:将"性能开销 vs 使用体验"的取舍做成**用户可切换的双模式**,兼顾不同设备与场景需求。用户可在"字段设置"中切换表格工作模式。 + +**背景**:⑦A(冻结省资源但内容不跟随)与 ⑦B+⑧(内容实时跟随但开销大)是互斥取舍。与其二选一,不如**做成两种可切换模式**,把选择权交给用户。 + +**两个模式定义**: + +| 维度 | 性能优先模式 | 开销优先模式(默认) | +|---|---|---| +| 目标 | 滚动体验最佳、**停止后快速到位、真空期小** | 资源开销最小、保证基础体验 | +| 适用场景 | 高性能设备 / 大数据量 | 低性能设备 / 资源紧张 | +| buffer(方案⑥) | 大(base=12,**对称**,避免方向切换突变) | 小(base=8,方向侧 ×2 省资源) | +| 渲染行数 | ~34 行(预渲染较充分) | ~34 行 | +| 滚动调度(方案⑦) | **滚动中冻结 + 停止后 60ms 更新**(流畅) | 滚动中冻结 + 停止后 120ms 更新(省资源) | +| 内容实时跟随 | ❌(el-table 限制,见下方关键发现) | ❌ | +| 停止后到位 | ~350ms(快速) | ~420ms | +| 资源开销 | 高 | 低 | +| 可选增强 | 方案③ transform / ⑤ el-table-v2(根治实时跟随) | — | + +**切换入口**:字段设置弹窗新增"**表格工作模式**"选择器(两个单选:性能优先 / 开销优先),并存 localStorage。 + +**实现要点(已落地)**: +1. `UpperTable` 新增 `tableMode` prop:`'performance' | 'resource'`,**默认 `'resource'`(开销优先)** +2. `activeTableMode` ref 优先读 localStorage,兜底 prop;onMounted `initTableMode` 初始化 +3. 模式驱动: + - `effectiveBufferRows`:performance = 12(**对称**,避免方向切换突变);resource = 8(方向 ×2 省资源) + - 滚动调度(统一冻结):滚动中冻结窗口,停止后统一更新;**debounce:performance=60ms / resource=120ms** +4. 模式存 localStorage,key `upper_table_mode_${userId}_${roleId}`(全局) +5. 字段设置弹窗 toolbar 新增"表格工作模式" radio-group(性能优先 / 开销优先),切换时 `handleTableModeChange` 持久化 + 重置虚拟滚动状态 + +**⚠️ 关键技术发现:el-table `:data` 变化是硬成本 ~300ms** + +实测:单次窗口同步(el-table `:data` 数组替换)耗时 **273~358ms(稳定 ~300ms)**,且与 tooltip 数量、buffer 大小、节流频率**无关**(均已验证无效)。这是 el-table 对 data 变化的**全量重算**所致。 + +**结论**:在 el-table 上,"滚动中实时同步窗口(内容实时跟随)"与"滚动流畅"**不可兼得**。因此 **performance 模式放弃"实时跟随(⑦B)",改为"滚动中冻结 + 停止后快速更新"**(与 resource 同机制,但 debounce 更短、buffer 更大)。 + +**实测验证(待处理订单 500 条/页)**: + +| 指标 | 优化前(实时同步) | 优化后(冻结+快速更新) | +|---|---|---| +| 1.5s 连续滚动 steps | 5(每步 ~300ms,卡) | **29(流畅)** | +| 长任务总数 | 6~10 | **4** | +| 总阻塞 | ~2000ms | **726ms** | +| 渲染行数 | 67 | 34 | +| 停止后到位 | ~400ms | **~350ms(performance)/ ~420ms(resource)** | + +**根治"实时跟随 + 流畅"**:需方案⑤ `el-table-v2`(官方高效虚拟表格,内部窗口管理不依赖 el-table data 全量重算)或方案③ transform 位移(在 el-table 上 hack,高风险)。两者均需重写/改造虚拟滚动部分,待评估。 + +**预期收益**: +- 性能优先:滚动中内容实时跟随、无真空期、体验最佳(开销大) +- 开销优先:资源占用低、滚动流畅(但内容冻结、停止后更新) +- 用户按设备/场景自选,兼顾两端 + +### 9.5 建议实施顺序(双模式:性能优先 / 开销优先) + +``` +第一步:方案⑥(方向感知 + 增大 buffer)—— ✅ 已完成:真空期 632→469ms(-26%) +第二步:方案⑦A(滚动停止后统一更新)—— ✅ 已实施:作为"开销优先"模式的调度基础 +第三步:抽象双模式(方案⑨)—— ✅ 已完成:tableMode prop(默认 resource)+ 字段设置切换 + 存储 +第四步:方案⑧(压渲染耗时)—— ✅ 已完成:formatter 按行缓存 + 关闭序号/货主 tooltip; + performance 模式单步 20px→11ms / 100px→60ms(之前 ~400ms) +第五步:字段设置 UI 切换控件 —— ✅ 已完成(随方案⑨) +第六步:复测两模式—— ⏳ 待做:性能优先(内容实时跟随+单步<30ms) +第七步:方案③ transform 位移(或⑤ el-table-v2)—— 性能优先模式的终极增强,评估后做 +``` + +### 9.6 真空期复测方法(浏览器 Console) + +```js +// 向上滚动后检测数据行更新延迟 +const wrap = document.querySelector('.el-table__body-wrapper .el-scrollbar__wrap'); +const tbody = document.querySelector('.el-table__body-wrapper tbody'); +const mo = new MutationObserver(() => { /* 记录行数变化时刻 */ }); +mo.observe(tbody, { childList: true, subtree: true }); +wrap.scrollTop = 8000; +await new Promise(r => setTimeout(r, 600)); +const t0 = performance.now(); +wrap.scrollTop = 1000; // 快速向上滚 +// 等待首个数据行更新事件,计算与 t0 的差值即真空期 +``` + +> 目标:真空期从当前 **632ms** 降到 **<100ms**。 diff --git a/src/api/inbox/inbox.ts b/src/api/inbox/inbox.ts index 0b9bc0ab..b0848c76 100644 --- a/src/api/inbox/inbox.ts +++ b/src/api/inbox/inbox.ts @@ -258,3 +258,47 @@ export function inboxGroupMessages(data: InboxGroupMessagesParams) { isSystemApi: true } as any) } + +/** 群快速查询参数(下拉选择用,不分页) */ +export interface InboxGroupQuickListParams { + keyword?: string // 关键词,模糊匹配群名称与外部群ID + groupType?: string // 群类型筛选:store(货主) / warehouse(仓库) / express(快递) + limit?: number // 返回条数上限,默认20,最大100(无分页) +} + +/** 群快速查询(inbox.group.quickList) */ +export function inboxGroupQuickList(data: InboxGroupQuickListParams = {}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'inbox.group.quickList', + v, + timestamp: Date.now() + }, + data, + isSystemApi: true + } as any) +} + +/** 查询群成员参数(下拉选择用) */ +export interface InboxGroupMembersParams { + groupId: number // 群记录主键ID(必填) + keyword?: string // 关键词,模糊匹配用户名与用户ID + limit?: number // 返回条数上限,默认20,最大100(无分页) +} + +/** 查询指定群的成员列表(inbox.group.members) */ +export function inboxGroupMembers(data: InboxGroupMembersParams) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'inbox.group.members', + v, + timestamp: Date.now() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/api/report/report.ts b/src/api/report/report.ts new file mode 100644 index 00000000..dfc183a0 --- /dev/null +++ b/src/api/report/report.ts @@ -0,0 +1,439 @@ +import request from '@/utils/request' + +const v = '1.0' + +/* ===== 报表导出任务 ===== */ + +export interface ReportGenerateParams { + /** 报表编码(与 reportCode 二选一;均传时优先 reportCode) */ + report_code?: string + /** 报表编码驼峰别名(兼容,优先级高于 report_code) */ + reportCode?: string + /** 货主ID(可选,货主维度报表时传入;>0 生效,<=0 视为不按货主过滤) */ + store_id?: number + /** 货主ID驼峰别名(兼容,优先级高于 store_id) */ + storeId?: number + /** 查询器业务参数(透传,如 bizDate) */ + params?: { + /** 数据日期(YYYY-MM-DD) */ + bizDate?: string + } +} + +export interface ReportTaskResponse { + /** 导出任务ID(report_generate_ 前缀) */ + task_id: string + /** 任务状态:submitted/running/success/failed */ + status: 'submitted' | 'running' | 'success' | 'failed' + /** 任务进度百分比(0-100) */ + progress: number + /** 任务状态说明 */ + message: string + /** 任务结果对象;导出成功后为 { fileKey, url, filename, size } */ + result: Record | null + /** 失败时的错误信息;成功时为空字符串 */ + error: string + /** 任务状态更新时间(毫秒时间戳) */ + update_time: number + code?: number +} + +/** 提交报表导出异步任务(手动导出):立即返回任务受理信息,后台异步执行 */ +export function generate( + data?: ReportGenerateParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.generate', + v, + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} + +export interface ReportTaskProgressParams { + /** 导出任务ID(下划线写法,与 taskId 二选一) */ + task_id?: string + /** 导出任务ID(驼峰写法,兼容别名) */ + taskId?: string +} + +export interface ReportTaskProgressResponse extends Omit { + /** 任务状态:submitted/running/success/failed/not_found */ + status: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' + /** 任务成功后返回的下载链接;未完成或失败时为空字符串 */ + download_url: string +} + +/** 查询报表导出任务进度与结果 */ +export function generateTaskProgress( + data: ReportTaskProgressParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.generateTaskProgress', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/* ===== 货主报表投递计划 ===== */ + +export interface DeliveryPlanSaveParams { + /** 货主ID(必填,正整数;<=0 报错) */ + store_id: number + /** 报表编码(必填,须为已启用的报表定义) */ + report_code: string + /** 每日投递时间点数组(HH:mm 24 小时制,非空;自动去重并升序) */ + schedule_times: string[] + /** 投递渠道:仅支持 inbox,默认 inbox;wecom/link 已弃用 */ + channel?: string + /** 补投宽限分钟(0-1440),默认 60 */ + late_grace_minutes?: number + /** 备注(最长 500 字符) */ + remark?: string + /** 文本通知模板(≤500,标签 {time}/{url}/{report_name}/{biz_date}) */ + notify_template?: string + /** 通知群ID数组(wms_inbox_group.id,正整数去重 ≤20) */ + notify_group_ids?: number[] + /** 通知成员ID数组(外部 IM 用户 ID,去重 ≤100) */ + notify_member_ids?: string[] +} + +export interface DeliveryPlanItem { + id: number + store_id: number + report_code: string + schedule_times: string[] + channel: string + /** 是否启用:0=停用 1=启用 */ + enabled: number + late_grace_minutes: number + remark: string + notify_template: string + notify_group_ids: number[] | null + notify_member_ids: string[] | null + created_at: string + updated_at: string +} + +/** 新增/更新货主报表投递计划(货主 store_id + 报表 report_code 唯一,存在则更新) */ +export function saveDeliveryPlan( + data: DeliveryPlanSaveParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.deliveryPlan.save', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +export interface DeliveryPlanListParams { + where?: { + /** 货主ID(>0 时精确过滤) */ + store_id?: number + /** 报表编码(精确过滤) */ + report_code?: string + /** 启用状态:0=停用 1=启用;空值/未传不过滤 */ + enabled?: number | string + } + pagination?: { + /** 当前页码(默认 1) */ + page?: number + /** 每页条数(默认 20,上限 200) */ + pageSize?: number + } + sort?: { + /** 排序字段(白名单 id/created_at/updated_at/store_id/report_code,默认 id) */ + sortField?: string + /** 排序方向(ASC/DESC,默认 DESC) */ + sortOrder?: string + } +} + +export interface DeliveryPlanListResult { + list: DeliveryPlanItem[] + total: number + page: number + pageSize: number + code?: number +} + +/** 分页查询货主报表投递计划列表(管理侧) */ +export function listDeliveryPlan( + data?: DeliveryPlanListParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.deliveryPlan.list', + v, + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} + +/* ===== 货主报表投递记录 ===== */ + +export interface DeliveryLogListParams { + where?: { + /** 货主ID(>0 时精确过滤) */ + store_id?: number + /** 报表编码(精确过滤) */ + report_code?: string + /** 投递状态过滤(pending/exporting/delivered/failed/cancelled;非法值忽略) */ + status?: string + } + pagination?: { + page?: number + pageSize?: number + } + sort?: { + sortField?: string + sortOrder?: string + } +} + +export interface DeliveryLogListItem { + id: number + /** 投递目标快照({group_ids, member_ids, notify_text},仅投递成功且配置文本通知时非 null) */ + notify_targets?: { + group_ids?: number[] | null + member_ids?: string[] | null + notify_text?: string + } | null + [key: string]: unknown +} + +export interface DeliveryLogListResult { + list: DeliveryLogListItem[] + total: number + page: number + pageSize: number + code?: number +} + +/** 分页查询货主报表投递记录(审计) */ +export function listDeliveryLog( + data?: DeliveryLogListParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.deliveryLog.list', + v, + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} + +/* ===== 报表元数据 ===== */ + +export interface ReportMetaParams { + /** 报表编码(与 reportCode 二选一;均传时优先 reportCode) */ + report_code?: string + /** 报表编码驼峰别名(兼容,优先级高于 report_code) */ + reportCode?: string +} + +export interface ReportMetaField { + /** 字段键(与查询器返回行字段一一对应,如 item_code) */ + key: string + /** 字段中文名 */ + label: string + /** 字段类型:string/number/boolean/array */ + type: 'string' | 'number' | 'boolean' | 'array' + /** 是否格式化器预计算字段,仅 true 时返回 */ + computed?: boolean + /** 数组类型字段的子字段清单,仅数组类型字段返回 */ + children?: ReportMetaField[] +} + +export interface ReportMetaResponse { + report_code: string + name: string + /** 适用维度:warehouse=仓库 / store=货主 / open=通用 */ + scope: 'warehouse' | 'store' | 'open' + /** 查询器 key */ + query: string + /** 日窗口参数对象 */ + window: { + /** 窗口数量(默认 7) */ + dayCount: number + /** 切点小时 0-23(默认 7) */ + cutoverHour: number + } + /** 查询器静态字段清单 */ + fields: ReportMetaField[] + code?: number +} + +/** 查询报表前端可读的列元数据(只读静态字段清单 + 窗口参数,不执行真实数据查询) */ +export function meta(data?: ReportMetaParams): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.meta', + v, + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} + +/* ===== 报表定义管理 ===== */ + +export interface ReportDefinitionSaveParams { + /** 报表编码(必填,upsert 键):小写字母开头,仅含小写字母/数字/下划线,长度 2-64 */ + code: string + /** 报表名称(必填,≤100 字符) */ + name: string + /** 适用维度:warehouse=仓库 / store=货主 / open=通用;默认 warehouse */ + scope?: string + /** 报表描述(≤500 字符,超出截断) */ + description?: string + /** 输出配置(对象或 JSON 字符串) */ + output_config?: Record + /** 数据源配置(对象或 JSON 字符串),query 须为注册表已有查询器 */ + source_config?: Record + /** 工作表配置(对象或 JSON 字符串) */ + sheet_config?: Record + /** 是否启用:0=停用 1=启用 */ + is_enabled?: number + /** 备注(≤500 字符,超出截断) */ + remark?: string +} + +export interface ReportDefinitionItem { + /** 报表编码(保存后的定义 code 平铺为 report_code) */ + report_code: string + id: number + name: string + /** 适用维度:warehouse/store/open */ + scope: string + description: string + is_enabled: number + remark: string + output_config: Record + source_config: Record + sheet_config: Record + created_at: string + updated_at: string + code?: number +} + +/** 新增/更新报表定义(report.definition.save,按 code upsert) */ +export function saveReportDefinition( + data: ReportDefinitionSaveParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.definition.save', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +export interface ReportDefinitionListParams { + where?: { + /** 报表编码模糊关键字 */ + code?: string + /** 报表名称模糊关键字 */ + name?: string + /** 适用维度精确筛选(warehouse/store/open) */ + scope?: string + /** 启用状态精确筛选:0=停用 1=启用;空值/未传不过滤 */ + is_enabled?: number | string + } + pagination?: { + page?: number + pageSize?: number + } + sort?: { + sortField?: string + sortOrder?: string + } +} + +export interface ReportDefinitionListResult { + list: ReportDefinitionItem[] + total: number + page: number + pageSize: number + code?: number +} + +/** 分页查询报表定义列表(report.definition.list) */ +export function listReportDefinition( + data?: ReportDefinitionListParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.definition.list', + v, + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} + +export interface ReportDefinitionDeleteParams { + /** 报表编码(必填,按 code 软删除;重复删除幂等成功) */ + code: string +} + +export interface ReportDefinitionDeleteResult { + /** 已删除的报表编码(定义 code 平铺为 report_code) */ + report_code: string + /** 删除结果标记(恒为 1) */ + deleted: number + code?: number +} + +/** 软删除报表定义(report.definition.delete) */ +export function deleteReportDefinition( + data: ReportDefinitionDeleteParams +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'report.definition.delete', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/api/workbench/workbench.ts b/src/api/workbench/workbench.ts index 9ac3efa4..25b9e460 100644 --- a/src/api/workbench/workbench.ts +++ b/src/api/workbench/workbench.ts @@ -109,11 +109,65 @@ export function checkBarcode(data: { } as any) } -/** 工作台业务入口(免登录免鉴权,入参 name + data,业务逻辑待实现) */ -export function business(data: { +/** 工作台业务入口入参(免登录免鉴权,入参 name + data) */ +export interface WorkbenchBusinessParams { + /** 业务名称:queryOrder/query(条码查订单)、packOrder、finishPack、sendWeight */ name: string + /** 业务数据(透传)。queryOrder/query 需 barcode(运单号,必填)+ warehouseId(仓库ID,必填) */ data?: Record -}) { +} + +/** 工作台业务入口响应(queryOrder/query 条码查订单结构) */ +export interface WorkbenchBusinessResponse { + /** 条码(运单号) */ + barcode: string + /** 运单号 */ + waybill_code: string + /** 是否散单:1=散单 0=团购 */ + isSandan: number + /** 货主备注 */ + store_remark: string + /** 运单信息 */ + express: { + logistics_name?: string + weighing_weight?: number + package_material_name?: string + } + /** 订单详情 */ + order: Record + /** 订单商品明细 */ + items: Array<{ + id?: number + order_id?: number + item_id?: number + item_code?: string + item_name?: string + plan_qty?: number + actual_price?: number + stock_id?: number + order_line_no?: number + inventory_type?: string + sku_property?: string + stock_unit?: string + barcodes?: string[] + image_url?: string + }> + /** 订单命中分表:current(待处理表)或 dispatch(配送表) */ + source_table: 'current' | 'dispatch' + /** 波次汇总(仅团购 isSandan=0 返回) */ + batch?: { + wave_id?: number + wave_no?: string + wave_type?: number + total_orders?: number + } + code?: number +} + +/** 工作台业务入口(免登录免鉴权,入参 name + data) */ +export function business( + data: WorkbenchBusinessParams +): Promise { return request({ url: '/system', method: 'post', diff --git a/src/components/UpperTable/index.vue b/src/components/UpperTable/index.vue index e41c53b9..bfa6fe63 100644 --- a/src/components/UpperTable/index.vue +++ b/src/components/UpperTable/index.vue @@ -115,7 +115,7 @@ — diff --git a/src/views/mode/index.vue b/src/views/mode/index.vue index 95de6a12..c6b80bd6 100644 --- a/src/views/mode/index.vue +++ b/src/views/mode/index.vue @@ -630,6 +630,9 @@ onMounted(() => { diff --git a/src/views/order/waveOrder/index.vue b/src/views/order/waveOrder/index.vue index 3574b9c8..24b45b82 100644 --- a/src/views/order/waveOrder/index.vue +++ b/src/views/order/waveOrder/index.vue @@ -29,13 +29,15 @@
- - - + + + + +
@@ -54,7 +56,7 @@ @@ -309,4 +300,16 @@ const handleTabChange = (tabName: string | number) => { min-height: 0; } } + +/* ===== 页签切换淡入淡出(对齐 storage/generalreport 的 tab-fade) ===== */ +.tab-fade-enter-active, +.tab-fade-leave-active { + transition: opacity 0.2s ease; + opacity: 1; +} + +.tab-fade-enter-from, +.tab-fade-leave-to { + opacity: 0; +} diff --git a/src/views/stock/stock/index.vue b/src/views/stock/stock/index.vue index 79af25b8..d58626a1 100644 --- a/src/views/stock/stock/index.vue +++ b/src/views/stock/stock/index.vue @@ -141,15 +141,17 @@
+ -
- -
+
diff --git a/src/views/stock/stockManagement/index.vue b/src/views/stock/stockManagement/index.vue index 4d6a6640..896c5790 100644 --- a/src/views/stock/stockManagement/index.vue +++ b/src/views/stock/stockManagement/index.vue @@ -21,21 +21,24 @@
- + + + + +
@@ -215,4 +214,16 @@ const handleTabChange = (tabName: string | number) => { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); overflow: hidden; } + +/* ===== 页签切换淡入淡出(对齐 storage/generalreport 的 tab-fade) ===== */ +.tab-fade-enter-active, +.tab-fade-leave-active { + transition: opacity 0.2s ease; + opacity: 1; +} + +.tab-fade-enter-from, +.tab-fade-leave-to { + opacity: 0; +} diff --git a/src/views/storage/generalreport/components/ColumnCellRenderer.vue b/src/views/storage/generalreport/components/ColumnCellRenderer.vue new file mode 100644 index 00000000..8aa6b3a8 --- /dev/null +++ b/src/views/storage/generalreport/components/ColumnCellRenderer.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/views/storage/generalreport/components/OperationCellRenderer.vue b/src/views/storage/generalreport/components/OperationCellRenderer.vue new file mode 100644 index 00000000..d2515d24 --- /dev/null +++ b/src/views/storage/generalreport/components/OperationCellRenderer.vue @@ -0,0 +1,175 @@ + + + + + + diff --git a/src/views/storage/generalreport/components/TabArea.vue b/src/views/storage/generalreport/components/TabArea.vue new file mode 100644 index 00000000..288ec6f1 --- /dev/null +++ b/src/views/storage/generalreport/components/TabArea.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/src/views/storage/generalreport/config/components/DetailPanel.vue b/src/views/storage/generalreport/config/components/DetailPanel.vue new file mode 100644 index 00000000..b024f3d2 --- /dev/null +++ b/src/views/storage/generalreport/config/components/DetailPanel.vue @@ -0,0 +1,179 @@ + + + + + + diff --git a/src/views/storage/generalreport/config/components/LogPanel.vue b/src/views/storage/generalreport/config/components/LogPanel.vue new file mode 100644 index 00000000..3a79695a --- /dev/null +++ b/src/views/storage/generalreport/config/components/LogPanel.vue @@ -0,0 +1,194 @@ + + + + + + diff --git a/src/views/storage/generalreport/config/template-config.ts b/src/views/storage/generalreport/config/template-config.ts new file mode 100644 index 00000000..fb1c9124 --- /dev/null +++ b/src/views/storage/generalreport/config/template-config.ts @@ -0,0 +1,1103 @@ +/** + * 【页面模板】配置文件 v2 — 基于 waveOrder2 架构设计 + * + * ===== 核心设计 ===== + * + * 1. FIELD_DICT — 全局字段预设表,每个字段拥有唯一翻译(label)和完整元数据 + * 2. VALUE_MAPS — 值翻译映射表(select options 和 tag 翻译共用) + * 3. TAG_RESOLVERS — 标签颜色解析器(集中管理 tag 颜色逻辑) + * 4. 各标签页通过 key 引用所需字段(scanBoxFieldKeys / tableColumnKeys) + * 5. resolveTabConfig() — 加载时将 key 列表展开为完整配置 + * + * ===== 快速上手 ===== + * 1. 复制整个 views/mode/ 文件夹,重命名为你的页面名 + * 2. 在 FIELD_DICT 中添加你需要的字段定义 + * 3. 在 tabPages 中配置标签页(引用 FIELD_DICT 的 key) + * 4. 在 TabPageApiConfig 中接入真实接口 + * 5. 在 router/map.ts 中添加路由 + */ + +import { ref, isRef, type Component, type Ref } from 'vue' +import DetailPanel from './components/DetailPanel.vue' +import LogPanel from './components/LogPanel.vue' +import DeliveryPlanFormDialog from '../pages/DeliveryPlanFormDialog.vue' +import ExportReportDialog from '../pages/ExportReportDialog.vue' +import { listDeliveryPlan, listDeliveryLog, meta } from '@/api/report/report' +import { loadStores } from '@/api/index/index' + +// ============================================================ +// 〇、全局页面配置 +// ============================================================ +export const PAGE_CONFIG = { + /** 是否显示顶部多标签栏 */ + showTabArea: true, + /** 单页模式:不显示标签栏,仅一个标签页内容 */ + singlePage: false, + /** 是否启用详情面板(底部分栏 + 显示/隐藏详情按钮),false 时表格占满全高 */ + enableDetailPanel: true +} + +// ============================================================ +// 〇-A、组件注册表 — 所有可复用组件在此注册 +// ============================================================ +export const COMPONENT_REGISTRY: Record = { + DetailPanel, + LogPanel, + DeliveryPlanFormDialog, + ExportReportDialog +} + +// ============================================================ +// 〇-A1、货主选项数据源(对齐 storage/receiving:index.loadStores) +// ============================================================ +/** 货主下拉选项(value 为货主ID),ScanBox 与表单共用 */ +export const storeOptions = ref<{ value: number; label: string }[]>([]) + +/** + * 将 loadStores / ScanBox 等处的货主项归一化为下拉可用的 { value, label }。 + * 兼容 { value, label }、{ id, store_remask }、{ store_id, store_name } 等形态。 + */ +export function normalizeStoreOptionsForSelect(stores: any[]): { value: number; label: string }[] { + if (!Array.isArray(stores)) return [] + const out: { value: number; label: string }[] = [] + for (const s of stores) { + const rawVal = s?.value ?? s?.id ?? s?.store_id + if (rawVal === undefined || rawVal === null || rawVal === '') continue + const num = typeof rawVal === 'number' ? rawVal : Number(rawVal) + const value = Number.isFinite(num) ? num : (rawVal as number) + const label = + (s?.label != null && String(s.label).trim() !== '' && String(s.label)) || + (s?.store_remask != null && String(s.store_remask)) || + (s?.name != null && String(s.name)) || + (s?.store_name != null && String(s.store_name)) || + String(value) + out.push({ value: value as number, label }) + } + return out +} + +/** 加载货主下拉选项(已加载则复用) */ +export async function loadStoreOptions() { + if (storeOptions.value.length) return storeOptions.value + try { + const res: any = await loadStores() + if (res && res.code === 200) { + const raw = res.stores ?? res.data?.stores ?? [] + storeOptions.value = normalizeStoreOptionsForSelect(raw) + } + } catch (e) { + console.error('加载货主列表失败', e) + } + return storeOptions.value +} + +// ============================================================ +// 〇-B、SCANBOX_GROUPS — ScanBox 分组名称 +// ============================================================ +export const SCANBOX_GROUPS = { + basic: '基础信息', + process: '流程状态', + time: '时间范围', + custom: '自定义字段' +} as const + +// ============================================================ +// 一、FIELD_DICT — 全局字段预设表(唯一真相来源) +// ============================================================ +// 每个字段拥有: +// label — 唯一翻译文本 +// scanBox — ScanBox 渲染配置(type/options/group) +// table — 表格列配置(minWidth/fixed/align/sortable) +// slot — 单元格渲染配置(tag/tagResolver/translateField) +// detailLabel — 明细面板中的标签文本(可选,默认用 label) +// filterParamMap — ScanBox 筛选值 → API 传参值映射 + +export interface FieldDefinition { + key: string + label: string + scanBox: { + type: 'text' | 'select' | 'daterange' | 'number' + group?: string + options?: { label: string; value: any }[] | Ref<{ label: string; value: any }[]> + } | null + table: { + minWidth?: number + width?: number + fixed?: 'left' | 'right' | boolean + align?: 'left' | 'center' | 'right' + sortable?: boolean + showOverflowTooltip?: boolean + copyAction?: 'copy' | 'copyQr' + copyValue?: (row: any) => any + } | null + slot: { + type: 'tag' | 'text' | 'default' | 'operation' | 'pre' + tagType?: string | Record + tagResolver?: string + translateField?: string + format?: 'datetime' + } | null + detailLabel?: string + filterParamMap?: Record +} + +// ============================================================ +// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用) +// ============================================================ +export const VALUE_MAPS: Record> = { + status: { 'pending': '待处理', 'processing': '处理中', 'done': '已完成', '待处理': '待处理', '处理中': '处理中', '已完成': '已完成' }, + type: { 'A': '类型A', 'B': '类型B', 'C': '类型C', '类型A': '类型A', '类型B': '类型B', '类型C': '类型C' }, + bool: { '1': '是', '0': '否', '是': '是', '否': '否' }, + /** 报表投递渠道 */ + channel: { 'wecom': '企业微信', 'inbox': '站内信', 'link': '链接' }, + /** 报表投递记录状态 */ + deliveryStatus: { 'pending': '待投递', 'exporting': '导出中', 'delivered': '已投递', 'failed': '投递失败', 'cancelled': '已取消' }, + /** 报表导出任务状态 */ + taskStatus: { 'submitted': '已提交', 'running': '执行中', 'success': '已完成', 'failed': '失败', 'not_found': '未找到' }, + /** 启用状态 */ + enabled: { '1': '启用', '0': '停用' }, + /** 报表适用维度(report.meta.scope) */ + scope: { 'warehouse': '仓库', 'store': '货主', 'open': '通用' } +} + +/** 从 VALUE_MAPS 衍生 options(优先取中文值作为 option value) */ +export function getOptions(field: string): { label: string; value: string }[] { + const map = VALUE_MAPS[field] + if (!map) return [] + const seen = new Set() + const opts: { label: string; value: string }[] = [] + const chineseKeys: [string, string][] = [] + const otherKeys: [string, string][] = [] + for (const [v, l] of Object.entries(map)) { + if (/^[\u4e00-\u9fa5]/.test(v)) { + chineseKeys.push([v, l]) + } else { + otherKeys.push([v, l]) + } + } + for (const [v, l] of [...chineseKeys, ...otherKeys]) { + if (!seen.has(l)) { + seen.add(l) + opts.push({ label: l, value: v }) + } + } + return opts +} + +/** 翻译 value → label */ +export function translate(field: string, value: any): string { + const map = VALUE_MAPS[field] + if (!map) return String(value ?? '—') + return map[String(value)] ?? String(value ?? '—') +} + +/** 格式化时间戳为 YYYY-MM-DD HH:mm:ss */ +export function formatTime(value: any): string { + if (!value) return '—' + try { + const d = new Date(value) + if (isNaN(d.getTime())) return String(value) + const pad = (n: number) => String(n).padStart(2, '0') + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` + } catch { + return String(value) + } +} + +// ============================================================ +// TAG_RESOLVERS — 标签颜色解析器 +// ============================================================ +// 颜色规则:未xx=info(灰) 已xx=success(绿) xx中/部分xx=warning(黄) 错误=danger(红) +export const TAG_RESOLVERS: Record string> = { + resolveStatusTag(v) { + if (!v) return 'info' + if (v === '已完成' || v === 'done') return 'success' + if (v === '处理中' || v === 'processing') return 'warning' + return 'info' + }, + resolveBoolTag(v) { + if (v === undefined || v === null) return 'info' + if (v === '是' || v === true || v === 1 || v === '1') return 'success' + return 'info' + }, + resolveChannelTag(v) { + const map: Record = { wecom: 'primary', inbox: 'success', link: 'warning' } + return map[String(v)] || 'info' + }, + resolveDeliveryStatusTag(v) { + const map: Record = { delivered: 'success', failed: 'danger', exporting: 'warning', pending: 'info', cancelled: 'info' } + return map[String(v)] || 'info' + }, + resolveTaskStatusTag(v) { + const map: Record = { success: 'success', failed: 'danger', not_found: 'danger', running: 'warning', submitted: 'info' } + return map[String(v)] || 'info' + }, + resolveEnabledTag(v) { + if (v === 1 || v === '1' || v === true) return 'success' + return 'info' + }, + resolveScopeTag(v) { + const map: Record = { warehouse: 'primary', store: 'success', open: 'warning' } + return map[String(v)] || 'info' + }, + resolveProgressTag(v) { + const n = Number(v) + if (!Number.isFinite(n)) return 'info' + if (n >= 100) return 'success' + if (n > 0) return 'warning' + return 'info' + } +} + +// ============================================================ +// 二、FIELD_DICT 实例 — 在此定义页面所需的所有字段 +// ============================================================ +export const FIELD_DICT: Record = { + code: { + key: 'code', + label: '编号', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 160, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true }, + slot: null, + detailLabel: '编号' + }, + name: { + key: 'name', + label: '名称', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 150, showOverflowTooltip: true }, + slot: null, + detailLabel: '名称' + }, + type: { + key: 'type', + label: '类型', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('type') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagType: 'info', translateField: 'type' }, + detailLabel: '类型', + filterParamMap: { '类型A': 'A', '类型B': 'B', '类型C': 'C' } + }, + status: { + key: 'status', + label: '投递状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('deliveryStatus') }, + table: { minWidth: 110, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveDeliveryStatusTag', translateField: 'deliveryStatus' }, + detailLabel: '投递状态' + }, + /** 货主(下拉选择,选项来自 index.loadStores,value 为货主ID) */ + store_id: { + key: 'store_id', + label: '货主', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: storeOptions as any }, + table: { minWidth: 100, align: 'center', sortable: true }, + slot: null, + detailLabel: '货主' + }, + /** 报表编码 */ + report_code: { + key: 'report_code', + label: '报表编码', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 140, copyAction: 'copy', showOverflowTooltip: true }, + slot: null, + detailLabel: '报表编码' + }, + /** 每日投递时间点(HH:mm 数组) */ + schedule_times: { + key: 'schedule_times', + label: '投递时间', + scanBox: null, + table: { minWidth: 180, showOverflowTooltip: true }, + slot: null, + detailLabel: '投递时间' + }, + /** 投递渠道 */ + channel: { + key: 'channel', + label: '投递渠道', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('channel') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveChannelTag', translateField: 'channel' }, + detailLabel: '投递渠道' + }, + /** 启用状态 */ + enabled: { + key: 'enabled', + label: '启用状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('enabled') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveEnabledTag', translateField: 'enabled' }, + detailLabel: '启用状态' + }, + /** 补投宽限分钟 */ + late_grace_minutes: { + key: 'late_grace_minutes', + label: '补投宽限(分)', + scanBox: null, + table: { minWidth: 120, align: 'center' }, + slot: null, + detailLabel: '补投宽限(分)' + }, + /** 备注 */ + remark: { + key: 'remark', + label: '备注', + scanBox: null, + table: { minWidth: 150, showOverflowTooltip: true }, + slot: null, + detailLabel: '备注' + }, + /** 文本通知模板 */ + notify_template: { + key: 'notify_template', + label: '通知模板', + scanBox: null, + table: { minWidth: 200, showOverflowTooltip: true }, + slot: null, + detailLabel: '通知模板' + }, + /** 通知群ID数组 */ + notify_group_ids: { + key: 'notify_group_ids', + label: '通知群', + scanBox: null, + table: { minWidth: 120, showOverflowTooltip: true }, + slot: { type: 'pre' }, + detailLabel: '通知群' + }, + /** 通知成员ID数组 */ + notify_member_ids: { + key: 'notify_member_ids', + label: '通知成员', + scanBox: null, + table: { minWidth: 140, showOverflowTooltip: true }, + slot: { type: 'pre' }, + detailLabel: '通知成员' + }, + /** 投递目标快照 */ + notify_targets: { + key: 'notify_targets', + label: '投递目标快照', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '投递目标快照' + }, + /** 数据日期 */ + biz_date: { + key: 'biz_date', + label: '数据日期', + scanBox: null, + table: { minWidth: 120, align: 'center', sortable: true }, + slot: null, + detailLabel: '数据日期' + }, + /** 适用维度(report.meta.scope) */ + scope: { + key: 'scope', + label: '适用维度', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveScopeTag', translateField: 'scope' }, + detailLabel: '适用维度' + }, + /** 查询器 key(report.meta.query) */ + query: { + key: 'query', + label: '查询器', + scanBox: null, + table: { minWidth: 120, showOverflowTooltip: true }, + slot: null, + detailLabel: '查询器' + }, + /** 窗口数量(report.meta.window.dayCount) */ + day_count: { + key: 'day_count', + label: '窗口天数', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '窗口天数' + }, + /** 切点小时(report.meta.window.cutoverHour) */ + cutover_hour: { + key: 'cutover_hour', + label: '切点小时', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '切点小时' + }, + /** 查询器静态字段清单(report.meta.fields) */ + fields: { + key: 'fields', + label: '字段清单', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '字段清单' + }, + count: { + key: 'count', + label: '数量', + scanBox: null, + table: { minWidth: 80, align: 'center', sortable: true }, + slot: null + }, + amount: { + key: 'amount', + label: '金额(元)', + scanBox: null, + table: { minWidth: 110, align: 'center', sortable: true }, + slot: null + }, + creator: { + key: 'creator', + label: '创建人', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 100 }, + slot: null, + detailLabel: '创建人' + }, + create_time: { + key: 'create_time', + label: '创建时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '创建时间' + }, + update_time: { + key: 'update_time', + label: '更新时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '更新时间' + }, + /** 操作列(虚拟字段,仅用于表格列渲染) */ + operation: { + key: 'operation', + label: '操作', + scanBox: null, + table: { minWidth: 180, fixed: 'right', align: 'center' }, + slot: { type: 'operation' } + } +} + +// ============================================================ +// 三、ColumnSlotConfig — 列单元格渲染配置 +// ============================================================ +export interface ColumnSlotConfig { + type: 'tag' | 'text' | 'default' | 'operation' | 'pre' + tagType?: string | Record + tagResolver?: string + translateField?: string + format?: 'datetime' +} + +// ============================================================ +// 三-A、OperationButtonConfig — 操作列按钮配置 +// ============================================================ +export interface OperationButtonConfig { + key: string + label: string + type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | '' + actionType: 'form' | 'action' + formKey?: string + formTitle?: string + formWidth?: string + paramMap?: Record + extraParams?: Record + disabledOnField?: string + confirmMessage?: string + confirmTitle?: string + confirmType?: 'warning' | 'danger' | 'info' + confirmButtonText?: string +} + +// ============================================================ +// 四、DetailFieldConfig / DetailSectionConfig — 明细面板配置 +// ============================================================ +export interface DetailFieldConfig { + key: string + label?: string + span?: number + renderType?: 'text' | 'tag' | 'pre' + tagType?: string | Record + tagResolver?: string + translateField?: string +} + +export interface DetailSectionConfig { + title: string + columnCount: number + fields: DetailFieldConfig[] +} + +export interface DetailTabConfig { + name: string + label: string + componentKey: string + component?: Component +} + +// ============================================================ +// 五、TabPageApiConfig — 标签页接口插槽配置 +// ============================================================ +export type ApiMethod = (...args: any[]) => Promise +export type ApiSource = 'api' | 'list' +export type ComponentApiConfig = { source: 'list' } | ApiMethod + +export interface TabPageApiConfig { + /** 列表查询接口 */ + list: ApiMethod + /** 明细面板接口(可选,不配则用 row 数据) */ + detail?: ComponentApiConfig + /** 操作日志接口(可选) */ + log?: ComponentApiConfig + /** 导出接口(可选) */ + export?: ApiMethod + /** 导出进度查询接口(可选) */ + exportProgress?: ApiMethod + /** ScanBox 下拉选项数据源接口(可选) */ + scanBoxOptions?: Record + /** 工具栏按钮 → API 方法映射(可选) */ + toolbar?: Record + /** 列表响应解析器 */ + parseListResponse?: (res: any) => { list: any[]; total: number } + /** 构建列表请求参数 */ + buildListParams?: (params: { + pagination: { page: number; pageSize: number } + conditions: Record + sort?: { prop: string; order: string } + }) => Record +} + +// ============================================================ +// 六、TabPageRawConfig — 标签页声明配置(仅用 key 引用) +// ============================================================ +export interface TabPageRawConfig { + name: string + label: string + scanBoxCacheKey: string + /** ScanBox 需要的字段 key 列表(从 FIELD_DICT 中查找) */ + scanBoxFieldKeys: string[] + /** 表格需要的列 key 列表(从 FIELD_DICT 中查找) */ + tableColumnKeys: string[] + upperTableDefaults: { + title: string + enableColumnConfig?: boolean + showIndex?: boolean + showSelection?: boolean + emptyText?: string + } + /** 明细面板标签页配置 */ + detailTabs?: { name: string; label: string; componentKey: string }[] + /** 明细面板分区配置(字段 key 列表,resolveTabConfig 展开) */ + detailSections: { + title: string + columnCount: number + fieldKeys: string[] + }[] + /** 接口配置(有 api 时启用真实接口) */ + api?: TabPageApiConfig + /** 操作列按钮配置(需 tableColumnKeys 包含 'operation') */ + operationButtons?: OperationButtonConfig[] +} + +// ============================================================ +// 七、TabPageConfig — 展开后的完整配置(给 index.vue 使用) +// ============================================================ +export interface TabPageConfig { + name: string + label: string + scanBoxCacheKey: string + scanBoxFields: Record[] + upperTable: { + title: string + enableColumnConfig: boolean + showIndex: boolean + showSelection: boolean + emptyText: string + columns: Record[] + } + columnSlots: Record + detailConfig: DetailSectionConfig[] + detailTabs: DetailTabConfig[] + api?: TabPageApiConfig + operationButtons?: OperationButtonConfig[] +} + +// ============================================================ +// 八、resolveTabConfig — 加载时将 RawConfig 展开为完整配置 +// ============================================================ +export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig { + // 展开 ScanBox 字段 + const scanBoxFields: Record[] = [] + for (const key of raw.scanBoxFieldKeys) { + const def = FIELD_DICT[key] + if (!def || !def.scanBox) continue + scanBoxFields.push({ + label: def.label, + value: def.key, + type: def.scanBox.type, + options: def.scanBox.options + ? (isRef(def.scanBox.options) ? def.scanBox.options.value : [...def.scanBox.options]) + : undefined, + group: def.scanBox.group, + required: (def.scanBox as any).required + }) + } + + // 展开表格列 + const columns: Record[] = [] + for (const key of raw.tableColumnKeys) { + const def = FIELD_DICT[key] + if (!def || !def.table) continue + columns.push({ + prop: def.key, + label: def.label, + ...def.table + }) + } + + // 展开列插槽 + const columnSlots: Record = {} + for (const key of raw.tableColumnKeys) { + const def = FIELD_DICT[key] + if (!def || !def.slot) continue + columnSlots[def.key] = { ...def.slot } + } + + // 展开明细面板配置 + const detailConfig: DetailSectionConfig[] = raw.detailSections.map((sec) => ({ + title: sec.title, + columnCount: sec.columnCount, + fields: sec.fieldKeys + .map((key): DetailFieldConfig | null => { + const def = FIELD_DICT[key] + if (!def) return null + return { + key: def.key, + label: def.detailLabel ?? def.label, + translateField: def.slot?.translateField, + tagResolver: def.slot?.tagResolver, + tagType: def.slot?.tagType, + renderType: def.slot?.type === 'tag' ? 'tag' : def.slot?.type === 'pre' ? 'pre' : 'text' + } + }) + .filter((f): f is DetailFieldConfig => f !== null) + })) + + // 展开明细标签页(解析 componentKey → Component) + const detailTabs: DetailTabConfig[] = raw.detailTabs + ? raw.detailTabs.map((tab) => ({ + name: tab.name, + label: tab.label, + componentKey: tab.componentKey, + component: COMPONENT_REGISTRY[tab.componentKey] + })) + : [{ name: 'detail', label: '明细', componentKey: 'DetailPanel', component: COMPONENT_REGISTRY['DetailPanel'] }] + + return { + name: raw.name, + label: raw.label, + scanBoxCacheKey: raw.scanBoxCacheKey, + scanBoxFields, + upperTable: { + title: raw.upperTableDefaults.title, + enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true, + showIndex: raw.upperTableDefaults.showIndex ?? true, + showSelection: raw.upperTableDefaults.showSelection ?? true, + emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据', + columns + }, + columnSlots, + detailConfig, + detailTabs, + api: raw.api, + operationButtons: raw.operationButtons + } +} + +// ============================================================ +// 九、buildWhereConditions — 将 ScanBox 条件转为 API where 参数 +// ============================================================ +export function buildWhereConditions(rawConditions: Record): Record { + const where: Record = {} + for (const [key, cond] of Object.entries(rawConditions || {})) { + let value: any = undefined + if (cond && typeof cond === 'object' && 'operator' in cond) { + value = (cond as any).value + } else if (cond !== undefined && cond !== null && cond !== '') { + value = Array.isArray(cond) ? cond[0] ?? '' : cond + } + if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) { + continue + } + const def = FIELD_DICT[key] + if (def?.filterParamMap) { + const mapped = def.filterParamMap[String(value)] + if (mapped !== undefined) { + where[key] = mapped + continue + } + } + where[key] = value + } + return where +} + +// ============================================================ +// 十、工具栏按钮系统 +// ============================================================ +// 按钮分为三类: +// common — 公共按钮(刷新、导出) +// function — 功能按钮(打开表单/确认窗口) +// basic — 基础操作(字段设置、隐藏详情) + +export interface ToolbarButtonConfig { + key: string + label: string + category: 'common' | 'function' | 'basic' + size?: '' | 'default' | 'small' | 'large' + type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger' + plain?: boolean + loadingKey?: string + disabledKey?: string + action: string + dynamicLabelKey?: string + onlyForTabs?: string[] + buttonType?: 'default' | 'dropdown' + dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }> + formKey?: string +} + +export const TOOLBAR_BUTTONS: Record = { + // ===== 公共按钮 ===== + refresh: { + key: 'refresh', + label: '刷新', + category: 'common', + type: 'primary', + size: 'small', + loadingKey: 'loading', + action: 'loadData' + }, + export: { + key: 'export', + label: '导出', + category: 'common', + size: 'small', + loadingKey: 'exportLoading', + action: 'handleExport', + buttonType: 'dropdown', + dropdownOptions: [ + { label: '不含明细', action: 'handleExport' }, + { label: '含明细', action: 'handleExportItem', divided: true } + ] + }, + // ===== 基础操作 ===== + columnConfig: { + key: 'columnConfig', + label: '字段设置', + category: 'basic', + size: 'small', + action: 'openColumnConfigPanel' + }, + toggleDetail: { + key: 'toggleDetail', + label: '显示详情', + category: 'basic', + dynamicLabelKey: 'detailToggleLabel', + size: 'small', + action: 'toggleDetailVisible' + }, + // ===== 通用报表功能按钮 ===== + /** 新增投递计划(仅投递计划标签页) */ + createPlan: { + key: 'createPlan', + label: '新增计划', + category: 'function', + type: 'primary', + size: 'small', + action: 'openCreatePlan', + onlyForTabs: ['plan'] + }, + /** 提交报表导出(仅导出任务标签页) */ + submitExport: { + key: 'submitExport', + label: '提交导出', + category: 'function', + type: 'primary', + size: 'small', + action: 'openExportReport', + onlyForTabs: ['export'] + }, +} + +/** 按标签页名称获取工具栏按钮列表(自动根据 PAGE_CONFIG 过滤) */ +export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] { + return Object.values(TOOLBAR_BUTTONS).filter((btn) => { + if (btn.onlyForTabs && !btn.onlyForTabs.includes(tabName)) return false + // 详情面板禁用时,隐藏「显示/隐藏详情」按钮 + if (!PAGE_CONFIG.enableDetailPanel && btn.key === 'toggleDetail') return false + return true + }) +} + +// ============================================================ +// 十一、批量操作配置(可选,接入 BatchOperationForm 时使用) +// ============================================================ +export interface BatchOperationConfig { + action: string + title: string + confirmText: string + confirmType?: 'warning' | 'error' | 'info' | 'success' + confirmButtonText: string + successText: string + failText: string + apiMethod: (...args: any[]) => Promise + payloadKey?: string + idField?: string | string[] + payloadBuilder?: (rows: Record[]) => Record + useProgress?: boolean + progressApiMethod?: (...args: any[]) => Promise +} + +/** ★ 在此配置批量操作 */ +export const BATCH_OPERATION_CONFIGS: Record = { + // batchExample: { + // action: 'batchExample', + // title: '批量操作示例', + // confirmText: '确定对选中的 {count} 项执行操作吗?', + // confirmType: 'warning', + // confirmButtonText: '确认操作', + // successText: '批量操作成功', + // failText: '批量操作失败', + // apiMethod: yourBatchApi, + // payloadKey: 'ids', + // idField: 'id' + // } +} + +// ============================================================ +// 十二、标签页注册表 — 在此定义你的页面标签页 +// ============================================================ +export const tabPages: TabPageRawConfig[] = [ + // ===== 标签页一:报表投递计划 ===== + { + name: 'plan', + label: '投递计划', + scanBoxCacheKey: 'generalreport-plan', + scanBoxFieldKeys: ['store_id', 'report_code', 'enabled'], + tableColumnKeys: ['store_id', 'report_code', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark', 'created_at', 'updated_at', 'operation'], + upperTableDefaults: { + title: '报表投递计划', + showSelection: false + }, + detailTabs: [ + { name: 'detail', label: '计划详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '基础信息', + columnCount: 3, + fieldKeys: ['store_id', 'report_code', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark'] + }, + { + title: '通知配置', + columnCount: 3, + fieldKeys: ['notify_template', 'notify_group_ids', 'notify_member_ids'] + }, + { + title: '时间信息', + columnCount: 2, + fieldKeys: ['created_at', 'updated_at'] + } + ], + api: { + list: listDeliveryPlan, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? res?.list ?? [], total: res?.data?.total ?? res?.total ?? 0 } + }, + buildListParams({ pagination, conditions, sort }) { + return { + where: buildWhereConditions(conditions), + pagination: { page: pagination.page, pageSize: pagination.pageSize }, + ...(sort?.prop ? { sort: { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' } } : {}) + } + } + }, + operationButtons: [ + { + key: 'editPlan', + label: '编辑', + actionType: 'form', + type: 'warning', + formKey: 'DeliveryPlanFormDialog', + paramMap: { + store_id: 'store_id', + report_code: 'report_code', + schedule_times: 'schedule_times', + channel: 'channel', + late_grace_minutes: 'late_grace_minutes', + remark: 'remark', + notify_template: 'notify_template', + notify_group_ids: 'notify_group_ids', + notify_member_ids: 'notify_member_ids' + } + }, + { + key: 'viewDetail', + label: '查看详情', + actionType: 'action', + type: 'primary' + } + ] + }, + + // ===== 标签页二:报表投递记录 ===== + { + name: 'log', + label: '投递记录', + scanBoxCacheKey: 'generalreport-log', + scanBoxFieldKeys: ['store_id', 'report_code', 'status'], + tableColumnKeys: ['id', 'store_id', 'report_code', 'status', 'biz_date', 'created_at', 'operation'], + upperTableDefaults: { + title: '报表投递记录', + showSelection: false + }, + detailTabs: [ + { name: 'detail', label: '记录详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '投递信息', + columnCount: 3, + fieldKeys: ['id', 'store_id', 'report_code', 'status', 'biz_date', 'created_at'] + }, + { + title: '投递目标快照', + columnCount: 1, + fieldKeys: ['notify_targets'] + } + ], + api: { + list: listDeliveryLog, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? res?.list ?? [], total: res?.data?.total ?? res?.total ?? 0 } + }, + buildListParams({ pagination, conditions, sort }) { + return { + where: buildWhereConditions(conditions), + pagination: { page: pagination.page, pageSize: pagination.pageSize }, + ...(sort?.prop ? { sort: { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' } } : {}) + } + } + }, + operationButtons: [ + { + key: 'viewDetail', + label: '查看详情', + actionType: 'action', + type: 'primary' + } + ] + }, + + // ===== 标签页三:导出任务(列表来自 report.meta 查询报表元数据;导出用 report.generate + report.generateTaskProgress) ===== + { + name: 'export', + label: '导出任务', + scanBoxCacheKey: 'generalreport-export', + scanBoxFieldKeys: ['report_code'], + tableColumnKeys: ['report_code', 'name', 'scope', 'query', 'day_count', 'cutover_hour', 'operation'], + upperTableDefaults: { + title: '报表定义(report.meta)', + showSelection: false, + emptyText: '请输入报表编码查询报表元数据' + }, + detailTabs: [ + { name: 'detail', label: '报表详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '报表信息', + columnCount: 3, + fieldKeys: ['report_code', 'name', 'scope', 'query', 'day_count', 'cutover_hour'] + }, + { + title: '可导出字段', + columnCount: 1, + fieldKeys: ['fields'] + } + ], + api: { + list: queryReportMetaList, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? [], total: res?.data?.total ?? 0 } + }, + buildListParams({ conditions }) { + return { report_code: conditions?.report_code } + } + }, + operationButtons: [ + { + key: 'exportThisReport', + label: '导出此报表', + actionType: 'action', + type: 'primary' + } + ] + } +] + +// ============================================================ +// 十三、向后兼容导出 +// ============================================================ +export const templateTabs = tabPages.map((t) => ({ name: t.name, label: t.label, scanBoxCacheKey: t.scanBoxCacheKey })) + +// ============================================================ +// 十四、导出任务:报表元数据查询(report.meta) +// 导出任务页不再维护本地任务列表,改为调用 report.meta 按报表编码查询报表元数据。 +// 提交导出(report.generate)与进度查询(report.generateTaskProgress)由 +// ExportReportDialog 内使用 useAsyncExportTask 处理(不写任何本地存储)。 +// ============================================================ +/** + * 按报表编码调用 report.meta 查询报表元数据,包装为列表行(Tab3 的 api.list)。 + * 未传报表编码时返回空列表。 + */ +export async function queryReportMetaList(params?: { report_code?: string }): Promise { + const code = params?.report_code + if (!code) { + return { code: 1, data: { list: [], total: 0 } } + } + try { + const res: any = await meta({ report_code: code }) + const payload = res?.data ?? res + if (payload && payload.report_code) { + const row = { + report_code: payload.report_code, + name: payload.name, + scope: payload.scope, + query: payload.query, + day_count: payload.window?.dayCount, + cutover_hour: payload.window?.cutoverHour, + fields: payload.fields ?? [] + } + return { code: 1, data: { list: [row], total: 1 } } + } + return { code: 1, data: { list: [], total: 0 } } + } catch (e) { + console.error('查询报表元数据失败', e) + return { code: 1, data: { list: [], total: 0 } } + } +} + diff --git a/src/views/storage/generalreport/index.vue b/src/views/storage/generalreport/index.vue new file mode 100644 index 00000000..aa6ce96d --- /dev/null +++ b/src/views/storage/generalreport/index.vue @@ -0,0 +1,745 @@ + + + + + + diff --git a/src/views/storage/generalreport/pages/DeliveryPlanFormDialog.vue b/src/views/storage/generalreport/pages/DeliveryPlanFormDialog.vue new file mode 100644 index 00000000..f2921aed --- /dev/null +++ b/src/views/storage/generalreport/pages/DeliveryPlanFormDialog.vue @@ -0,0 +1,254 @@ + + + + + + diff --git a/src/views/storage/generalreport/pages/ExampleFormDialog.vue b/src/views/storage/generalreport/pages/ExampleFormDialog.vue new file mode 100644 index 00000000..945481b8 --- /dev/null +++ b/src/views/storage/generalreport/pages/ExampleFormDialog.vue @@ -0,0 +1,107 @@ + + + + + + diff --git a/src/views/storage/generalreport/pages/ExportReportDialog.vue b/src/views/storage/generalreport/pages/ExportReportDialog.vue new file mode 100644 index 00000000..3203f6e5 --- /dev/null +++ b/src/views/storage/generalreport/pages/ExportReportDialog.vue @@ -0,0 +1,170 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/index.vue b/src/views/system/setting/basicManagement/index.vue index bf551d42..d5145059 100644 --- a/src/views/system/setting/basicManagement/index.vue +++ b/src/views/system/setting/basicManagement/index.vue @@ -24,7 +24,7 @@ /> - + + + + + diff --git a/src/views/system/setting/basicManagement/newview/components/OperationCellRenderer.vue b/src/views/system/setting/basicManagement/newview/components/OperationCellRenderer.vue new file mode 100644 index 00000000..d39ab3ea --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/components/OperationCellRenderer.vue @@ -0,0 +1,177 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/components/TabArea.vue b/src/views/system/setting/basicManagement/newview/components/TabArea.vue new file mode 100644 index 00000000..288ec6f1 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/components/TabArea.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/src/views/system/setting/basicManagement/newview/config/components/DetailPanel.vue b/src/views/system/setting/basicManagement/newview/config/components/DetailPanel.vue new file mode 100644 index 00000000..dba6b8b2 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/config/components/DetailPanel.vue @@ -0,0 +1,182 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/config/components/LogPanel.vue b/src/views/system/setting/basicManagement/newview/config/components/LogPanel.vue new file mode 100644 index 00000000..3a79695a --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/config/components/LogPanel.vue @@ -0,0 +1,194 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/config/template-config.ts b/src/views/system/setting/basicManagement/newview/config/template-config.ts new file mode 100644 index 00000000..2c909cdc --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/config/template-config.ts @@ -0,0 +1,1527 @@ +/** + * 【页面模板】配置文件 v2 — 基于 waveOrder2 架构设计 + * + * ===== 核心设计 ===== + * + * 1. FIELD_DICT — 全局字段预设表,每个字段拥有唯一翻译(label)和完整元数据 + * 2. VALUE_MAPS — 值翻译映射表(select options 和 tag 翻译共用) + * 3. TAG_RESOLVERS — 标签颜色解析器(集中管理 tag 颜色逻辑) + * 4. 各标签页通过 key 引用所需字段(scanBoxFieldKeys / tableColumnKeys) + * 5. resolveTabConfig() — 加载时将 key 列表展开为完整配置 + * + * ===== 快速上手 ===== + * 1. 复制整个 views/mode/ 文件夹,重命名为你的页面名 + * 2. 在 FIELD_DICT 中添加你需要的字段定义 + * 3. 在 tabPages 中配置标签页(引用 FIELD_DICT 的 key) + * 4. 在 TabPageApiConfig 中接入真实接口 + * 5. 在 router/map.ts 中添加路由 + */ + +import { ref, isRef, type Component, type Ref } from 'vue' +import DetailPanel from './components/DetailPanel.vue' +import LogPanel from './components/LogPanel.vue' +import WarehouseSettingsForm from '../pages/WarehouseSettingsForm.vue' +import ApiAppFormDialog from '../pages/ApiAppFormDialog.vue' +import DeliveryPlanFormDialog from '../pages/DeliveryPlanFormDialog.vue' +import ExportReportDialog from '../pages/ExportReportDialog.vue' +import DefinitionFormDialog from '../pages/DefinitionFormDialog.vue' +import { apiAppList } from '@/api/apiapp/apiapp' +import { listDeliveryPlan, listDeliveryLog, meta, listReportDefinition } from '@/api/report/report' +import { loadStores } from '@/api/index/index' + +// ============================================================ +// 〇、全局页面配置 +// ============================================================ +export const PAGE_CONFIG = { + /** 是否显示顶部多标签栏 */ + showTabArea: true, + /** 单页模式:不显示标签栏,仅一个标签页内容 */ + singlePage: false, + /** 是否启用详情面板(底部分栏 + 显示/隐藏详情按钮),false 时表格占满全高 */ + enableDetailPanel: true +} + +// ============================================================ +// 〇-A、组件注册表 — 所有可复用组件在此注册 +// ============================================================ +export const COMPONENT_REGISTRY: Record = { + DetailPanel, + LogPanel, + WarehouseSettingsForm, + ApiAppFormDialog, + DeliveryPlanFormDialog, + ExportReportDialog, + DefinitionFormDialog +} + +// ============================================================ +// 〇-A1、货主选项数据源(对齐 storage/receiving:index.loadStores) +// ============================================================ +/** 货主下拉选项(value 为货主ID),ScanBox 与表单共用 */ +export const storeOptions = ref<{ value: number; label: string }[]>([]) + +/** + * 将 loadStores / ScanBox 等处的货主项归一化为下拉可用的 { value, label }。 + * 兼容 { value, label }、{ id, store_remask }、{ store_id, store_name } 等形态。 + */ +export function normalizeStoreOptionsForSelect(stores: any[]): { value: number; label: string }[] { + if (!Array.isArray(stores)) return [] + const out: { value: number; label: string }[] = [] + for (const s of stores) { + const rawVal = s?.value ?? s?.id ?? s?.store_id + if (rawVal === undefined || rawVal === null || rawVal === '') continue + const num = typeof rawVal === 'number' ? rawVal : Number(rawVal) + const value = Number.isFinite(num) ? num : (rawVal as number) + const label = + (s?.label != null && String(s.label).trim() !== '' && String(s.label)) || + (s?.store_remask != null && String(s.store_remask)) || + (s?.name != null && String(s.name)) || + (s?.store_name != null && String(s.store_name)) || + String(value) + out.push({ value: value as number, label }) + } + return out +} + +/** 加载货主下拉选项(已加载则复用) */ +export async function loadStoreOptions() { + if (storeOptions.value.length) return storeOptions.value + try { + const res: any = await loadStores() + if (res && res.code === 200) { + const raw = res.stores ?? res.data?.stores ?? [] + storeOptions.value = normalizeStoreOptionsForSelect(raw) + } + } catch (e) { + console.error('加载货主列表失败', e) + } + return storeOptions.value +} + +// ============================================================ +// 〇-B、SCANBOX_GROUPS — ScanBox 分组名称 +// ============================================================ +export const SCANBOX_GROUPS = { + basic: '基础信息', + process: '流程状态', + time: '时间范围', + custom: '自定义字段' +} as const + +// ============================================================ +// 一、FIELD_DICT — 全局字段预设表(唯一真相来源) +// ============================================================ +// 每个字段拥有: +// label — 唯一翻译文本 +// scanBox — ScanBox 渲染配置(type/options/group) +// table — 表格列配置(minWidth/fixed/align/sortable) +// slot — 单元格渲染配置(tag/tagResolver/translateField) +// detailLabel — 明细面板中的标签文本(可选,默认用 label) +// filterParamMap — ScanBox 筛选值 → API 传参值映射 + +export interface FieldDefinition { + key: string + label: string + scanBox: { + type: 'text' | 'select' | 'daterange' | 'number' + group?: string + options?: { label: string; value: any }[] | Ref<{ label: string; value: any }[]> + } | null + table: { + minWidth?: number + width?: number + fixed?: 'left' | 'right' | boolean + align?: 'left' | 'center' | 'right' + sortable?: boolean + showOverflowTooltip?: boolean + copyAction?: 'copy' | 'copyQr' + copyValue?: (row: any) => any + } | null + slot: { + type: 'tag' | 'text' | 'default' | 'operation' | 'pre' + tagType?: string | Record + tagResolver?: string + translateField?: string + format?: 'datetime' + } | null + detailLabel?: string + filterParamMap?: Record +} + +// ============================================================ +// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用) +// ============================================================ +export const VALUE_MAPS: Record> = { + status: { 'pending': '待处理', 'processing': '处理中', 'done': '已完成', '待处理': '待处理', '处理中': '处理中', '已完成': '已完成' }, + type: { 'A': '类型A', 'B': '类型B', 'C': '类型C', '类型A': '类型A', '类型B': '类型B', '类型C': '类型C' }, + bool: { '1': '是', '0': '否', '是': '是', '否': '否' }, + /** API 应用启用状态 */ + enabled: { '1': '启用', '0': '停用', '启用': '启用', '停用': '停用' }, + /** 报表投递渠道 */ + channel: { 'wecom': '企业微信', 'inbox': '站内信', 'link': '链接' }, + /** 报表投递记录状态 */ + deliveryStatus: { 'pending': '待投递', 'exporting': '导出中', 'delivered': '已投递', 'failed': '投递失败', 'cancelled': '已取消' }, + /** 报表导出任务状态 */ + taskStatus: { 'submitted': '已提交', 'running': '执行中', 'success': '已完成', 'failed': '失败', 'not_found': '未找到' }, + /** 报表适用维度(report.meta.scope) */ + scope: { 'warehouse': '仓库', 'store': '货主', 'open': '通用' } +} + +/** 从 VALUE_MAPS 衍生 options(优先取中文值作为 option value) */ +export function getOptions(field: string): { label: string; value: string }[] { + const map = VALUE_MAPS[field] + if (!map) return [] + const seen = new Set() + const opts: { label: string; value: string }[] = [] + const chineseKeys: [string, string][] = [] + const otherKeys: [string, string][] = [] + for (const [v, l] of Object.entries(map)) { + if (/^[\u4e00-\u9fa5]/.test(v)) { + chineseKeys.push([v, l]) + } else { + otherKeys.push([v, l]) + } + } + for (const [v, l] of [...chineseKeys, ...otherKeys]) { + if (!seen.has(l)) { + seen.add(l) + opts.push({ label: l, value: v }) + } + } + return opts +} + +/** 翻译 value → label */ +export function translate(field: string, value: any): string { + const map = VALUE_MAPS[field] + if (!map) return String(value ?? '—') + return map[String(value)] ?? String(value ?? '—') +} + +/** 格式化时间戳为 YYYY-MM-DD HH:mm:ss */ +export function formatTime(value: any): string { + if (!value) return '—' + try { + const d = new Date(value) + if (isNaN(d.getTime())) return String(value) + const pad = (n: number) => String(n).padStart(2, '0') + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` + } catch { + return String(value) + } +} + +// ============================================================ +// TAG_RESOLVERS — 标签颜色解析器 +// ============================================================ +// 颜色规则:未xx=info(灰) 已xx=success(绿) xx中/部分xx=warning(黄) 错误=danger(红) +export const TAG_RESOLVERS: Record string> = { + resolveStatusTag(v) { + if (!v) return 'info' + if (v === '已完成' || v === 'done') return 'success' + if (v === '处理中' || v === 'processing') return 'warning' + return 'info' + }, + resolveBoolTag(v) { + if (v === undefined || v === null) return 'info' + if (v === '是' || v === true || v === 1 || v === '1') return 'success' + return 'info' + }, + resolveEnabledTag(v) { + if (v === 1 || v === '1' || v === true) return 'success' + return 'info' + }, + resolveChannelTag(v) { + const map: Record = { wecom: 'primary', inbox: 'success', link: 'warning' } + return map[String(v)] || 'info' + }, + resolveDeliveryStatusTag(v) { + const map: Record = { delivered: 'success', failed: 'danger', exporting: 'warning', pending: 'info', cancelled: 'info' } + return map[String(v)] || 'info' + }, + resolveTaskStatusTag(v) { + const map: Record = { success: 'success', failed: 'danger', not_found: 'danger', running: 'warning', submitted: 'info' } + return map[String(v)] || 'info' + }, + resolveScopeTag(v) { + const map: Record = { warehouse: 'primary', store: 'success', open: 'warning' } + return map[String(v)] || 'info' + } +} + +// ============================================================ +// 二、FIELD_DICT 实例 — 在此定义页面所需的所有字段 +// ============================================================ +export const FIELD_DICT: Record = { + code: { + key: 'code', + label: '编号', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 160, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true }, + slot: null, + detailLabel: '编号' + }, + name: { + key: 'name', + label: '报表名称', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 150, showOverflowTooltip: true }, + slot: null, + detailLabel: '报表名称' + }, + type: { + key: 'type', + label: '类型', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('type') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagType: 'info', translateField: 'type' }, + detailLabel: '类型', + filterParamMap: { '类型A': 'A', '类型B': 'B', '类型C': 'C' } + }, + status: { + key: 'status', + label: '投递状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('deliveryStatus') }, + table: { minWidth: 110, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveDeliveryStatusTag', translateField: 'deliveryStatus' }, + detailLabel: '投递状态' + }, + count: { + key: 'count', + label: '数量', + scanBox: null, + table: { minWidth: 80, align: 'center', sortable: true }, + slot: null + }, + amount: { + key: 'amount', + label: '金额(元)', + scanBox: null, + table: { minWidth: 110, align: 'center', sortable: true }, + slot: null + }, + creator: { + key: 'creator', + label: '创建人', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 100 }, + slot: null, + detailLabel: '创建人' + }, + create_time: { + key: 'create_time', + label: '创建时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '创建时间' + }, + update_time: { + key: 'update_time', + label: '更新时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '更新时间' + }, + /** API应用:应用名称 */ + app_name: { + key: 'app_name', + label: '应用名称', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 160, showOverflowTooltip: true }, + slot: null, + detailLabel: '应用名称' + }, + /** API应用:AppKey */ + self_app_key: { + key: 'self_app_key', + label: 'AppKey', + scanBox: null, + table: { minWidth: 200, copyAction: 'copy', showOverflowTooltip: true }, + slot: null, + detailLabel: 'AppKey' + }, + /** API应用:AppSecret */ + self_app_secret: { + key: 'self_app_secret', + label: 'AppSecret', + scanBox: null, + table: { minWidth: 180, showOverflowTooltip: true }, + slot: null, + detailLabel: 'AppSecret' + }, + /** API应用:签名方法 */ + sign_method: { + key: 'sign_method', + label: '签名方法', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagType: 'info' }, + detailLabel: '签名方法' + }, + /** API应用:速率限制 */ + rate_limit: { + key: 'rate_limit', + label: '速率限制(次/秒)', + scanBox: null, + table: { minWidth: 130, align: 'center' }, + slot: null, + detailLabel: '速率限制(次/秒)' + }, + /** API应用:启用状态 */ + is_enabled: { + key: 'is_enabled', + label: '状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('enabled') }, + table: { minWidth: 90, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveEnabledTag', translateField: 'enabled' }, + detailLabel: '状态' + }, + /** 记录ID / API应用ID */ + id: { + key: 'id', + label: 'ID', + scanBox: null, + table: { minWidth: 80, align: 'center' }, + slot: null, + detailLabel: '应用ID' + }, + /** API应用:接口类型 */ + interface_type_id: { + key: 'interface_type_id', + label: '接口类型', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '接口类型' + }, + /** API应用:仓库ID */ + warehouse_id: { + key: 'warehouse_id', + label: '仓库ID', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '仓库ID' + }, + /** API应用:IP白名单 */ + self_ip_whitelist: { + key: 'self_ip_whitelist', + label: 'IP白名单', + scanBox: null, + table: { minWidth: 160, showOverflowTooltip: true }, + slot: { type: 'pre' }, + detailLabel: 'IP白名单' + }, + /** API应用:更新时间 */ + updated_at: { + key: 'updated_at', + label: '更新时间', + scanBox: null, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '更新时间' + }, + /** API应用:回调URL */ + callback_url: { + key: 'callback_url', + label: '回调URL', + scanBox: null, + table: { minWidth: 200, showOverflowTooltip: true }, + slot: null, + detailLabel: '回调URL' + }, + /** API应用:创建时间 */ + created_at: { + key: 'created_at', + label: '创建时间', + scanBox: null, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '创建时间' + }, + /** 货主(下拉选择,选项来自 index.loadStores,value 为货主ID) */ + store_id: { + key: 'store_id', + label: '货主', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: storeOptions as any }, + table: { minWidth: 100, align: 'center', sortable: true }, + slot: null, + detailLabel: '货主' + }, + /** 报表编码 */ + report_code: { + key: 'report_code', + label: '报表编码', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 140, copyAction: 'copy', showOverflowTooltip: true }, + slot: null, + detailLabel: '报表编码' + }, + /** 每日投递时间点(HH:mm 数组) */ + schedule_times: { + key: 'schedule_times', + label: '投递时间', + scanBox: null, + table: { minWidth: 180, showOverflowTooltip: true }, + slot: null, + detailLabel: '投递时间' + }, + /** 投递渠道 */ + channel: { + key: 'channel', + label: '投递渠道', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('channel') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveChannelTag', translateField: 'channel' }, + detailLabel: '投递渠道' + }, + /** 启用状态 */ + enabled: { + key: 'enabled', + label: '启用状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('enabled') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveEnabledTag', translateField: 'enabled' }, + detailLabel: '启用状态' + }, + /** 补投宽限分钟 */ + late_grace_minutes: { + key: 'late_grace_minutes', + label: '补投宽限(分)', + scanBox: null, + table: { minWidth: 120, align: 'center' }, + slot: null, + detailLabel: '补投宽限(分)' + }, + /** 备注 */ + remark: { + key: 'remark', + label: '备注', + scanBox: null, + table: { minWidth: 150, showOverflowTooltip: true }, + slot: null, + detailLabel: '备注' + }, + /** 文本通知模板 */ + notify_template: { + key: 'notify_template', + label: '通知模板', + scanBox: null, + table: { minWidth: 200, showOverflowTooltip: true }, + slot: null, + detailLabel: '通知模板' + }, + /** 通知群ID数组 */ + notify_group_ids: { + key: 'notify_group_ids', + label: '通知群', + scanBox: null, + table: { minWidth: 120, showOverflowTooltip: true }, + slot: { type: 'pre' }, + detailLabel: '通知群' + }, + /** 通知成员ID数组 */ + notify_member_ids: { + key: 'notify_member_ids', + label: '通知成员', + scanBox: null, + table: { minWidth: 140, showOverflowTooltip: true }, + slot: { type: 'pre' }, + detailLabel: '通知成员' + }, + /** 投递目标快照 */ + notify_targets: { + key: 'notify_targets', + label: '投递目标快照', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '投递目标快照' + }, + /** 数据日期 */ + biz_date: { + key: 'biz_date', + label: '数据日期', + scanBox: null, + table: { minWidth: 120, align: 'center', sortable: true }, + slot: null, + detailLabel: '数据日期' + }, + /** 投递时间点(report.deliveryLog.time_point) */ + time_point: { + key: 'time_point', + label: '投递时间点', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '投递时间点' + }, + /** 投递文件链接(report.deliveryLog.file_url) */ + file_url: { + key: 'file_url', + label: '文件链接', + scanBox: null, + table: { minWidth: 220, showOverflowTooltip: true, copyAction: 'copy' }, + slot: null, + detailLabel: '文件链接' + }, + /** 重试次数(report.deliveryLog.retry_count) */ + retry_count: { + key: 'retry_count', + label: '重试次数', + scanBox: null, + table: { minWidth: 90, align: 'center' }, + slot: null, + detailLabel: '重试次数' + }, + /** 下次重试时间(report.deliveryLog.next_retry_at) */ + next_retry_at: { + key: 'next_retry_at', + label: '下次重试时间', + scanBox: null, + table: { minWidth: 170 }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '下次重试时间' + }, + /** 错误信息(report.deliveryLog.error_message) */ + error_message: { + key: 'error_message', + label: '错误信息', + scanBox: null, + table: { minWidth: 220, showOverflowTooltip: true }, + slot: null, + detailLabel: '错误信息' + }, + /** 投递完成时间(report.deliveryLog.delivered_at) */ + delivered_at: { + key: 'delivered_at', + label: '投递完成时间', + scanBox: null, + table: { minWidth: 170, sortable: true }, + slot: { type: 'text', format: 'datetime' }, + detailLabel: '投递完成时间' + }, + /** 报表描述(report.definition.description) */ + description: { + key: 'description', + label: '报表描述', + scanBox: null, + table: { minWidth: 200, showOverflowTooltip: true }, + slot: null, + detailLabel: '报表描述' + }, + /** 输出配置(report.definition.output_config) */ + output_config: { + key: 'output_config', + label: '输出配置', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '输出配置' + }, + /** 数据源配置(report.definition.source_config) */ + source_config: { + key: 'source_config', + label: '数据源配置', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '数据源配置' + }, + /** 工作表配置(report.definition.sheet_config) */ + sheet_config: { + key: 'sheet_config', + label: '工作表配置', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '工作表配置' + }, + /** 适用维度(report.meta.scope / report.definition.scope) */ + scope: { + key: 'scope', + label: '适用维度', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('scope') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveScopeTag', translateField: 'scope' }, + detailLabel: '适用维度' + }, + /** 查询器 key(report.meta.query) */ + query: { + key: 'query', + label: '查询器', + scanBox: null, + table: { minWidth: 120, showOverflowTooltip: true }, + slot: null, + detailLabel: '查询器' + }, + /** 窗口数量(report.meta.window.dayCount) */ + day_count: { + key: 'day_count', + label: '窗口天数', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '窗口天数' + }, + /** 切点小时(report.meta.window.cutoverHour) */ + cutover_hour: { + key: 'cutover_hour', + label: '切点小时', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null, + detailLabel: '切点小时' + }, + /** 查询器静态字段清单(report.meta.fields) */ + fields: { + key: 'fields', + label: '字段清单', + scanBox: null, + table: null, + slot: { type: 'pre' }, + detailLabel: '字段清单' + }, + /** 操作列(虚拟字段,仅用于表格列渲染) */ + operation: { + key: 'operation', + label: '操作', + scanBox: null, + table: { minWidth: 180, fixed: 'right', align: 'center' }, + slot: { type: 'operation' } + } +} + +// ============================================================ +// 三、ColumnSlotConfig — 列单元格渲染配置 +// ============================================================ +export interface ColumnSlotConfig { + type: 'tag' | 'text' | 'default' | 'operation' | 'pre' + tagType?: string | Record + tagResolver?: string + translateField?: string + format?: 'datetime' +} + +// ============================================================ +// 三-A、OperationButtonConfig — 操作列按钮配置 +// ============================================================ +export interface OperationButtonConfig { + key: string + label: string + type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | '' + actionType: 'form' | 'action' + formKey?: string + formTitle?: string + formWidth?: string + paramMap?: Record + extraParams?: Record + disabledOnField?: string + confirmMessage?: string + confirmTitle?: string + confirmType?: 'warning' | 'danger' | 'info' + confirmButtonText?: string +} + +// ============================================================ +// 四、DetailFieldConfig / DetailSectionConfig — 明细面板配置 +// ============================================================ +export interface DetailFieldConfig { + key: string + label?: string + span?: number + renderType?: 'text' | 'tag' | 'pre' + tagType?: string | Record + tagResolver?: string + translateField?: string + format?: 'datetime' +} + +export interface DetailSectionConfig { + title: string + columnCount: number + fields: DetailFieldConfig[] +} + +export interface DetailTabConfig { + name: string + label: string + componentKey: string + component?: Component +} + +// ============================================================ +// 五、TabPageApiConfig — 标签页接口插槽配置 +// ============================================================ +export type ApiMethod = (...args: any[]) => Promise +export type ApiSource = 'api' | 'list' +export type ComponentApiConfig = { source: 'list' } | ApiMethod + +export interface TabPageApiConfig { + /** 列表查询接口 */ + list: ApiMethod + /** 明细面板接口(可选,不配则用 row 数据) */ + detail?: ComponentApiConfig + /** 操作日志接口(可选) */ + log?: ComponentApiConfig + /** 导出接口(可选) */ + export?: ApiMethod + /** 导出进度查询接口(可选) */ + exportProgress?: ApiMethod + /** ScanBox 下拉选项数据源接口(可选) */ + scanBoxOptions?: Record + /** 工具栏按钮 → API 方法映射(可选) */ + toolbar?: Record + /** 列表响应解析器 */ + parseListResponse?: (res: any) => { list: any[]; total: number } + /** 构建列表请求参数 */ + buildListParams?: (params: { + pagination: { page: number; pageSize: number } + conditions: Record + sort?: { prop: string; order: string } + }) => Record +} + +// ============================================================ +// 六、TabPageRawConfig — 标签页声明配置(仅用 key 引用) +// ============================================================ +export interface TabPageRawConfig { + name: string + label: string + scanBoxCacheKey: string + /** ScanBox 需要的字段 key 列表(从 FIELD_DICT 中查找) */ + scanBoxFieldKeys: string[] + /** 表格需要的列 key 列表(从 FIELD_DICT 中查找) */ + tableColumnKeys: string[] + upperTableDefaults: { + title: string + enableColumnConfig?: boolean + showIndex?: boolean + showSelection?: boolean + emptyText?: string + } + /** 明细面板标签页配置 */ + detailTabs?: { name: string; label: string; componentKey: string }[] + /** 明细面板分区配置(字段 key 列表,resolveTabConfig 展开) */ + detailSections: { + title: string + columnCount: number + fieldKeys: string[] + }[] + /** 视图类型:list=scan-box+upper-table 列表(默认);form=表单页(渲染 formPage) */ + viewType?: 'list' | 'form' + /** 表单页组件(viewType='form' 时渲染,替换列表结构,不使用 scan-box/upper-table/明细) */ + formPage?: Component + /** 接口配置(有 api 时启用真实接口) */ + api?: TabPageApiConfig + /** 操作列按钮配置(需 tableColumnKeys 包含 'operation') */ + operationButtons?: OperationButtonConfig[] +} + +// ============================================================ +// 七、TabPageConfig — 展开后的完整配置(给 index.vue 使用) +// ============================================================ +export interface TabPageConfig { + name: string + label: string + scanBoxCacheKey: string + scanBoxFields: Record[] + upperTable: { + title: string + enableColumnConfig: boolean + showIndex: boolean + showSelection: boolean + emptyText: string + columns: Record[] + } + columnSlots: Record + detailConfig: DetailSectionConfig[] + detailTabs: DetailTabConfig[] + viewType: 'list' | 'form' + formPage?: Component + api?: TabPageApiConfig + operationButtons?: OperationButtonConfig[] +} + +// ============================================================ +// 八、resolveTabConfig — 加载时将 RawConfig 展开为完整配置 +// ============================================================ +export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig { + // 展开 ScanBox 字段 + const scanBoxFields: Record[] = [] + for (const key of raw.scanBoxFieldKeys) { + const def = FIELD_DICT[key] + if (!def || !def.scanBox) continue + scanBoxFields.push({ + label: def.label, + value: def.key, + type: def.scanBox.type, + options: def.scanBox.options + ? (isRef(def.scanBox.options) ? def.scanBox.options.value : [...def.scanBox.options]) + : undefined, + group: def.scanBox.group, + required: (def.scanBox as any).required + }) + } + + // 展开表格列 + const columns: Record[] = [] + for (const key of raw.tableColumnKeys) { + const def = FIELD_DICT[key] + if (!def || !def.table) continue + columns.push({ + prop: def.key, + label: def.label, + ...def.table + }) + } + + // 展开列插槽 + const columnSlots: Record = {} + for (const key of raw.tableColumnKeys) { + const def = FIELD_DICT[key] + if (!def || !def.slot) continue + columnSlots[def.key] = { ...def.slot } + } + + // 展开明细面板配置 + const detailConfig: DetailSectionConfig[] = raw.detailSections.map((sec) => ({ + title: sec.title, + columnCount: sec.columnCount, + fields: sec.fieldKeys + .map((key): DetailFieldConfig | null => { + const def = FIELD_DICT[key] + if (!def) return null + return { + key: def.key, + label: def.detailLabel ?? def.label, + translateField: def.slot?.translateField, + tagResolver: def.slot?.tagResolver, + tagType: def.slot?.tagType, + renderType: def.slot?.type === 'tag' ? 'tag' : def.slot?.type === 'pre' ? 'pre' : 'text', + format: def.slot?.format + } + }) + .filter((f): f is DetailFieldConfig => f !== null) + })) + + // 展开明细标签页(解析 componentKey → Component) + const detailTabs: DetailTabConfig[] = raw.detailTabs + ? raw.detailTabs.map((tab) => ({ + name: tab.name, + label: tab.label, + componentKey: tab.componentKey, + component: COMPONENT_REGISTRY[tab.componentKey] + })) + : [{ name: 'detail', label: '明细', componentKey: 'DetailPanel', component: COMPONENT_REGISTRY['DetailPanel'] }] + + return { + name: raw.name, + label: raw.label, + scanBoxCacheKey: raw.scanBoxCacheKey, + viewType: raw.viewType ?? 'list', + formPage: raw.formPage, + scanBoxFields, + upperTable: { + title: raw.upperTableDefaults.title, + enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true, + showIndex: raw.upperTableDefaults.showIndex ?? true, + showSelection: raw.upperTableDefaults.showSelection ?? true, + emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据', + columns + }, + columnSlots, + detailConfig, + detailTabs, + api: raw.api, + operationButtons: raw.operationButtons + } +} + +// ============================================================ +// 九、buildWhereConditions — 将 ScanBox 条件转为 API where 参数 +// ============================================================ +export function buildWhereConditions(rawConditions: Record): Record { + const where: Record = {} + for (const [key, cond] of Object.entries(rawConditions || {})) { + let value: any = undefined + if (cond && typeof cond === 'object' && 'operator' in cond) { + value = (cond as any).value + } else if (cond !== undefined && cond !== null && cond !== '') { + value = Array.isArray(cond) ? cond[0] ?? '' : cond + } + if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) { + continue + } + const def = FIELD_DICT[key] + if (def?.filterParamMap) { + const mapped = def.filterParamMap[String(value)] + if (mapped !== undefined) { + where[key] = mapped + continue + } + } + where[key] = value + } + return where +} + +// ============================================================ +// 十、工具栏按钮系统 +// ============================================================ +// 按钮分为三类: +// common — 公共按钮(刷新、导出) +// function — 功能按钮(打开表单/确认窗口) +// basic — 基础操作(字段设置、隐藏详情) + +export interface ToolbarButtonConfig { + key: string + label: string + category: 'common' | 'function' | 'basic' + size?: '' | 'default' | 'small' | 'large' + type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger' + plain?: boolean + loadingKey?: string + disabledKey?: string + action: string + dynamicLabelKey?: string + onlyForTabs?: string[] + buttonType?: 'default' | 'dropdown' + dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }> + formKey?: string +} + +export const TOOLBAR_BUTTONS: Record = { + // ===== 公共按钮 ===== + refresh: { + key: 'refresh', + label: '刷新', + category: 'common', + type: 'primary', + size: 'small', + loadingKey: 'loading', + action: 'loadData' + }, + export: { + key: 'export', + label: '导出', + category: 'common', + size: 'small', + loadingKey: 'exportLoading', + action: 'handleExport', + buttonType: 'dropdown', + dropdownOptions: [ + { label: '不含明细', action: 'handleExport' }, + { label: '含明细', action: 'handleExportItem', divided: true } + ] + }, + // ===== 基础操作 ===== + columnConfig: { + key: 'columnConfig', + label: '字段设置', + category: 'basic', + size: 'small', + action: 'openColumnConfigPanel' + }, + toggleDetail: { + key: 'toggleDetail', + label: '显示详情', + category: 'basic', + dynamicLabelKey: 'detailToggleLabel', + size: 'small', + action: 'toggleDetailVisible' + }, + // ===== 本页功能按钮 ===== + /** 创建 API 应用(仅 API开放接口标签页) */ + createApiApp: { + key: 'createApiApp', + label: '创建应用', + category: 'function', + type: 'primary', + size: 'small', + action: 'openCreateApiApp', + onlyForTabs: ['apiOpen'] + }, + /** 新增投递计划(仅投递计划标签页) */ + createPlan: { + key: 'createPlan', + label: '新增计划', + category: 'function', + type: 'primary', + size: 'small', + action: 'openCreatePlan', + onlyForTabs: ['plan'] + }, + /** 提交报表导出(仅导出任务标签页) */ + submitExport: { + key: 'submitExport', + label: '提交导出', + category: 'function', + type: 'primary', + size: 'small', + action: 'openExportReport', + onlyForTabs: ['export'] + }, + /** 新增报表定义(仅报表定义标签页) */ + createDefinition: { + key: 'createDefinition', + label: '新增定义', + category: 'function', + type: 'primary', + size: 'small', + action: 'openCreateDefinition', + onlyForTabs: ['definition'] + } + // ★ 在此添加功能按钮(如批量操作)★ +} + +/** 按标签页名称获取工具栏按钮列表(自动根据 PAGE_CONFIG 过滤) */ +export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] { + return Object.values(TOOLBAR_BUTTONS).filter((btn) => { + if (btn.onlyForTabs && !btn.onlyForTabs.includes(tabName)) return false + // 详情面板禁用时,隐藏「显示/隐藏详情」按钮 + if (!PAGE_CONFIG.enableDetailPanel && btn.key === 'toggleDetail') return false + return true + }) +} + +// ============================================================ +// 十一、批量操作配置(可选,接入 BatchOperationForm 时使用) +// ============================================================ +export interface BatchOperationConfig { + action: string + title: string + confirmText: string + confirmType?: 'warning' | 'error' | 'info' | 'success' + confirmButtonText: string + successText: string + failText: string + apiMethod: (...args: any[]) => Promise + payloadKey?: string + idField?: string | string[] + payloadBuilder?: (rows: Record[]) => Record + useProgress?: boolean + progressApiMethod?: (...args: any[]) => Promise +} + +/** ★ 在此配置批量操作 */ +export const BATCH_OPERATION_CONFIGS: Record = { + // batchExample: { + // action: 'batchExample', + // title: '批量操作示例', + // confirmText: '确定对选中的 {count} 项执行操作吗?', + // confirmType: 'warning', + // confirmButtonText: '确认操作', + // successText: '批量操作成功', + // failText: '批量操作失败', + // apiMethod: yourBatchApi, + // payloadKey: 'ids', + // idField: 'id' + // } +} + +// ============================================================ +// 十二、标签页注册表 — 在此定义你的页面标签页 +// ============================================================ +export const tabPages: TabPageRawConfig[] = [ + // ===== 标签页一:基础设置(表单项页面,不使用 scan-box / upper-table / 明细) ===== + { + name: 'form', + label: '基础设置', + viewType: 'form', + formPage: WarehouseSettingsForm, + scanBoxCacheKey: 'basic-settings-form', + scanBoxFieldKeys: [], + tableColumnKeys: [], + upperTableDefaults: { + title: '', + showSelection: false + }, + detailSections: [] + }, + + // ===== 标签页二:API开放接口(scan-box + upper-table 列表) ===== + { + name: 'apiOpen', + label: 'API开放接口', + scanBoxCacheKey: 'basic-settings-apiopen', + scanBoxFieldKeys: ['app_name', 'is_enabled'], + tableColumnKeys: ['app_name', 'self_app_key', 'self_app_secret', 'sign_method', 'rate_limit', 'is_enabled', 'created_at', 'operation'], + upperTableDefaults: { + title: 'API 应用列表', + showSelection: false, + emptyText: '暂无 API 应用数据' + }, + detailTabs: [ + { name: 'detail', label: '应用详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '应用信息', + columnCount: 3, + fieldKeys: ['id', 'app_name', 'self_app_key', 'self_app_secret', 'sign_method', 'rate_limit', 'is_enabled'] + }, + { + title: '归属信息', + columnCount: 2, + fieldKeys: ['interface_type_id', 'warehouse_id'] + }, + { + title: '网络配置', + columnCount: 2, + fieldKeys: ['callback_url', 'self_ip_whitelist'] + }, + { + title: '时间信息', + columnCount: 2, + fieldKeys: ['created_at', 'updated_at'] + } + ], + api: { + list: apiAppList, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.list ?? res?.data?.list ?? [], total: res?.pagination?.total ?? res?.data?.pagination?.total ?? 0 } + }, + buildListParams({ pagination, conditions }) { + return { + page: pagination.page, + pageSize: pagination.pageSize, + app_name: conditions?.app_name || undefined, + is_enabled: conditions?.is_enabled + } + } + }, + operationButtons: [ + { + key: 'editApiApp', + label: '编辑', + actionType: 'form', + type: 'warning', + formKey: 'ApiAppFormDialog', + paramMap: { + id: 'id', + app_name: 'app_name', + rate_limit: 'rate_limit', + callback_url: 'callback_url', + self_ip_whitelist: 'self_ip_whitelist', + is_enabled: 'is_enabled' + } + }, + { + key: 'regenerateSecret', + label: '重置密钥', + actionType: 'action', + type: 'warning', + confirmMessage: '确定要重新生成该应用的 AppSecret 吗?旧密钥将立即失效!', + confirmTitle: '重置密钥确认', + confirmType: 'warning', + confirmButtonText: '确定重置' + }, + { + key: 'deleteApiApp', + label: '停用', + actionType: 'action', + type: 'danger', + confirmMessage: '确定要停用该应用吗?停用后其 API 密钥将立即失效。', + confirmTitle: '停用确认', + confirmType: 'warning', + confirmButtonText: '确定停用' + } + ] + }, + + // ===== 标签页三:报表投递计划 ===== + { + name: 'plan', + label: '投递计划', + scanBoxCacheKey: 'basic-settings-plan', + scanBoxFieldKeys: ['store_id', 'report_code', 'enabled'], + tableColumnKeys: ['id', 'store_id', 'report_code', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'notify_group_ids', 'notify_member_ids', 'remark', 'created_at', 'updated_at', 'operation'], + upperTableDefaults: { + title: '报表投递计划', + showSelection: false + }, + detailTabs: [ + { name: 'detail', label: '计划详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '基础信息', + columnCount: 3, + fieldKeys: ['store_id', 'report_code', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark'] + }, + { + title: '通知配置', + columnCount: 3, + fieldKeys: ['notify_template', 'notify_group_ids', 'notify_member_ids'] + }, + { + title: '时间信息', + columnCount: 2, + fieldKeys: ['created_at', 'updated_at'] + } + ], + api: { + list: listDeliveryPlan, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? res?.list ?? [], total: res?.data?.total ?? res?.total ?? 0 } + }, + buildListParams({ pagination, conditions, sort }) { + return { + where: buildWhereConditions(conditions), + pagination: { page: pagination.page, pageSize: pagination.pageSize }, + ...(sort?.prop ? { sort: { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' } } : {}) + } + } + }, + operationButtons: [ + { + key: 'editPlan', + label: '编辑', + actionType: 'form', + type: 'warning', + formKey: 'DeliveryPlanFormDialog', + paramMap: { + store_id: 'store_id', + report_code: 'report_code', + schedule_times: 'schedule_times', + channel: 'channel', + late_grace_minutes: 'late_grace_minutes', + remark: 'remark', + notify_template: 'notify_template', + notify_group_ids: 'notify_group_ids', + notify_member_ids: 'notify_member_ids' + } + }, + { + key: 'viewDetail', + label: '查看详情', + actionType: 'action', + type: 'primary' + } + ] + }, + + // ===== 标签页四:报表投递记录 ===== + { + name: 'log', + label: '投递记录', + scanBoxCacheKey: 'basic-settings-log', + scanBoxFieldKeys: ['store_id', 'report_code', 'status'], + tableColumnKeys: ['id', 'store_id', 'report_code', 'biz_date', 'time_point', 'status', 'channel', 'retry_count', 'file_url', 'error_message', 'delivered_at', 'created_at', 'operation'], + upperTableDefaults: { + title: '报表投递记录', + showSelection: false + }, + detailTabs: [ + { name: 'detail', label: '记录详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '投递信息', + columnCount: 3, + fieldKeys: ['id', 'store_id', 'report_code', 'biz_date', 'time_point', 'status', 'channel', 'retry_count', 'delivered_at', 'created_at'] + }, + { + title: '文件与错误', + columnCount: 1, + fieldKeys: ['file_url', 'error_message'] + }, + { + title: '投递目标快照', + columnCount: 1, + fieldKeys: ['notify_targets'] + } + ], + api: { + list: listDeliveryLog, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? res?.list ?? [], total: res?.data?.total ?? res?.total ?? 0 } + }, + buildListParams({ pagination, conditions, sort }) { + return { + where: buildWhereConditions(conditions), + pagination: { page: pagination.page, pageSize: pagination.pageSize }, + ...(sort?.prop ? { sort: { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' } } : {}) + } + } + }, + operationButtons: [ + { + key: 'viewDetail', + label: '查看详情', + actionType: 'action', + type: 'primary' + } + ] + }, + + // ===== 标签页五:导出任务(列表来自 report.meta 查询报表元数据;导出用 report.generate + report.generateTaskProgress) ===== + { + name: 'export', + label: '导出任务', + scanBoxCacheKey: 'basic-settings-export', + scanBoxFieldKeys: ['report_code'], + tableColumnKeys: ['report_code', 'name', 'scope', 'query', 'day_count', 'cutover_hour', 'operation'], + upperTableDefaults: { + title: '报表定义(report.meta)', + showSelection: false, + emptyText: '请输入报表编码查询报表元数据' + }, + detailTabs: [ + { name: 'detail', label: '报表详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '报表信息', + columnCount: 3, + fieldKeys: ['report_code', 'name', 'scope', 'query', 'day_count', 'cutover_hour'] + }, + { + title: '可导出字段', + columnCount: 1, + fieldKeys: ['fields'] + } + ], + api: { + list: queryReportMetaList, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? [], total: res?.data?.total ?? 0 } + }, + buildListParams({ conditions }) { + return { report_code: conditions?.report_code } + } + }, + operationButtons: [ + { + key: 'exportThisReport', + label: '导出此报表', + actionType: 'action', + type: 'primary' + } + ] + }, + + // ===== 标签页六:报表定义(wms_report_definition 管理,report.definition.*) ===== + { + name: 'definition', + label: '报表定义', + scanBoxCacheKey: 'basic-settings-definition', + scanBoxFieldKeys: ['report_code', 'name', 'scope', 'is_enabled'], + tableColumnKeys: ['report_code', 'name', 'scope', 'description', 'is_enabled', 'remark', 'updated_at', 'operation'], + upperTableDefaults: { + title: '报表定义', + showSelection: false + }, + detailTabs: [ + { name: 'detail', label: '定义详情', componentKey: 'DetailPanel' } + ], + detailSections: [ + { + title: '基本信息', + columnCount: 3, + fieldKeys: ['report_code', 'name', 'scope', 'description', 'is_enabled', 'remark'] + }, + { + title: '配置信息', + columnCount: 1, + fieldKeys: ['output_config', 'source_config', 'sheet_config'] + }, + { + title: '时间信息', + columnCount: 2, + fieldKeys: ['created_at', 'updated_at'] + } + ], + api: { + list: listReportDefinition, + detail: { source: 'list' }, + parseListResponse(res) { + return { list: res?.data?.list ?? res?.list ?? [], total: res?.data?.total ?? res?.total ?? 0 } + }, + buildListParams({ pagination, conditions, sort }) { + return { + where: buildWhereConditions(conditions), + pagination: { page: pagination.page, pageSize: pagination.pageSize }, + ...(sort?.prop ? { sort: { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' } } : {}) + } + } + }, + operationButtons: [ + { + key: 'editDefinition', + label: '编辑', + actionType: 'form', + type: 'warning', + formKey: 'DefinitionFormDialog', + paramMap: { + report_code: 'report_code', + code: 'code', + name: 'name', + scope: 'scope', + description: 'description', + is_enabled: 'is_enabled', + remark: 'remark', + output_config: 'output_config', + source_config: 'source_config', + sheet_config: 'sheet_config' + } + }, + { + key: 'deleteDefinition', + label: '删除', + actionType: 'action', + type: 'danger', + confirmMessage: '删除后该报表定义将不可用(软删除,可恢复)。确定删除?', + confirmTitle: '删除报表定义', + confirmButtonText: '删除' + } + ] + } +] + +// ============================================================ +// 十三、向后兼容导出 +// ============================================================ +export const templateTabs = tabPages.map((t) => ({ name: t.name, label: t.label, scanBoxCacheKey: t.scanBoxCacheKey })) + +// ============================================================ +// 十四、导出任务:报表元数据查询(report.meta) +// ============================================================ +/** + * 按报表编码调用 report.meta 查询报表元数据,包装为列表行(导出任务页的 api.list)。 + * 未传报表编码时返回空列表。 + */ +export async function queryReportMetaList(params?: { report_code?: string }): Promise { + const code = params?.report_code + if (!code) { + return { code: 1, data: { list: [], total: 0 } } + } + try { + const res: any = await meta({ report_code: code }) + const payload = res?.data ?? res + if (payload && payload.report_code) { + const row = { + report_code: payload.report_code, + name: payload.name, + scope: payload.scope, + query: payload.query, + day_count: payload.window?.dayCount, + cutover_hour: payload.window?.cutoverHour, + fields: payload.fields ?? [] + } + return { code: 1, data: { list: [row], total: 1 } } + } + return { code: 1, data: { list: [], total: 0 } } + } catch (e) { + console.error('查询报表元数据失败', e) + return { code: 1, data: { list: [], total: 0 } } + } +} + diff --git a/src/views/system/setting/basicManagement/newview/index.vue b/src/views/system/setting/basicManagement/newview/index.vue new file mode 100644 index 00000000..a1ce79d5 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/index.vue @@ -0,0 +1,855 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/pages/ApiAppFormDialog.vue b/src/views/system/setting/basicManagement/newview/pages/ApiAppFormDialog.vue new file mode 100644 index 00000000..f7cd8df2 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/pages/ApiAppFormDialog.vue @@ -0,0 +1,350 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/pages/DefinitionFormDialog.vue b/src/views/system/setting/basicManagement/newview/pages/DefinitionFormDialog.vue new file mode 100644 index 00000000..3e4701e0 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/pages/DefinitionFormDialog.vue @@ -0,0 +1,241 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/pages/DeliveryPlanFormDialog.vue b/src/views/system/setting/basicManagement/newview/pages/DeliveryPlanFormDialog.vue new file mode 100644 index 00000000..50306481 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/pages/DeliveryPlanFormDialog.vue @@ -0,0 +1,414 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/pages/ExampleFormDialog.vue b/src/views/system/setting/basicManagement/newview/pages/ExampleFormDialog.vue new file mode 100644 index 00000000..945481b8 --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/pages/ExampleFormDialog.vue @@ -0,0 +1,107 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/pages/ExportReportDialog.vue b/src/views/system/setting/basicManagement/newview/pages/ExportReportDialog.vue new file mode 100644 index 00000000..fb788c5c --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/pages/ExportReportDialog.vue @@ -0,0 +1,171 @@ + + + + + + diff --git a/src/views/system/setting/basicManagement/newview/pages/WarehouseSettingsForm.vue b/src/views/system/setting/basicManagement/newview/pages/WarehouseSettingsForm.vue new file mode 100644 index 00000000..bec996ae --- /dev/null +++ b/src/views/system/setting/basicManagement/newview/pages/WarehouseSettingsForm.vue @@ -0,0 +1,866 @@ + + + + + +