refactor(list): 抽离列表页公共模板与共享工具,优化虚拟滚动与状态渲染
- 新增 ToolbarButtonGroup 组件及类型定义,订单、波次等页面统一使用, 工具栏按钮样式分类(刷新/设置/操作/取消)收敛到一处 - 订单共享模块迁移至 views/order/shared:创建订单会话、通用表单、 导出、工具栏动作、订单元数据缓存;stockPickerHelpers 归入 stock/utils - 抽离 ScanBox 字段工厂、货主/快递下拉选项映射、状态文本工具, 新增 list-page.scss、status-text.scss,order-common-config 改为再导出 - UpperTable 虚拟滚动优化:实测行高兜底、渲染行数组引用复用、 rowKey/复制码/收起文本缓存、窗口行数按 4 行量化、ResizeObserver 同步视口, 减少滚动抖动与整表重建 - 列表页状态列改用轻量文本样式替代 el-tag,降低大列表渲染开销; 标签页缓存默认上限由 3 调整为 8 - 补充标签页性能测量结论、页面模板抽离现状与实施方案文档
This commit is contained in:
parent
b201363ad2
commit
3b09d45f08
408
docs/标签页性能-测量结论与执行清单.md
Normal file
408
docs/标签页性能-测量结论与执行清单.md
Normal file
@ -0,0 +1,408 @@
|
||||
# 标签页性能 · 测量结论与执行清单
|
||||
|
||||
> 测量对象:`http://localhost:5174/order/orderManagement`(dev server,硬刷新)
|
||||
> 测量工具:浏览器工具 + `PerformanceObserver(longtask/LCP/CLS)` + CDP `Performance.getMetrics` + CDP `Profiler`
|
||||
> 测量日期:2026-11-06
|
||||
> **本文档只做结论与清单,未改动任何代码。**
|
||||
|
||||
---
|
||||
|
||||
## 0. 口径说明(先读)
|
||||
|
||||
| 项 | 说明 |
|
||||
|---|---|
|
||||
| 环境 | Vite **dev server**(ESM 按模块加载,未打包) |
|
||||
| 是否限速 | 否(无 CPU/网络节流) |
|
||||
| "切 tab 耗时"口径 | 从点击到 `.main-container` **连续 350–400ms 无 DOM 变更**。因此数值里**包含约 350–400ms 的静默判定窗口**,绝对值偏高,**只看相对差异** |
|
||||
| 生产环境差异 | dev 下 246 个 script 请求 / 14.17MB 解码体积,生产打包后会大幅下降;**但"8 个 tab 页被静态 import 进同一路由块"这个结构性问题在生产同样存在** |
|
||||
|
||||
---
|
||||
|
||||
## 1. 首屏测量结果
|
||||
|
||||
### 1.1 关键时间点
|
||||
|
||||
| 指标 | 数值 | 说明 |
|
||||
|---|---|---|
|
||||
| TTFB | **314 ms** | 后端首字节 |
|
||||
| FCP | **576 ms** | 首次内容绘制 |
|
||||
| DOMContentLoaded | **748 ms** | |
|
||||
| load | **750 ms** | |
|
||||
| **LCP** | **3392 ms** | 列表内容出现晚 |
|
||||
| CLS | 0.029 | 轻微布局抖动 |
|
||||
| **最长任务** | **1857 ms**(起始 1272 ms) | 主线程被独占近 2 秒 |
|
||||
| **TBT(总阻塞时间)** | **2333 ms** | 远高于 300ms 良好线 |
|
||||
| 其它长任务 | 358ms@3317、135ms@3131、90ms@658、63ms@3676 | |
|
||||
|
||||
> 时间线:576ms 首屏骨架 → 1272ms 起一个 1.86s 长任务(页面"卡住")→ 3129ms 结束 → 3392ms 才画出列表内容。**用户体感的"打开慢"就是这一段。**
|
||||
|
||||
### 1.2 资源与 DOM
|
||||
|
||||
| 指标 | 数值 |
|
||||
|---|---|
|
||||
| 请求总数 | **250**(script 246 / css 1 / xhr 3) |
|
||||
| 脚本解码体积 | **14.17 MB**(transfer 仅 0.09MB,本地 dev) |
|
||||
| `views/order/orderManagement/` 下的模块 | **69 个**(一次性全部加载) |
|
||||
| DOM 元素(`querySelectorAll('*')`) | **7537** |
|
||||
| CDP `Nodes` | **22260** |
|
||||
| 首屏表格实际行数 | 20 |
|
||||
|
||||
**关键事实**:打开 orderManagement 时,**8 个 tab 页(review/pending/exception/outbound/entrust/delivery/deliveryException/archive)及其依赖的 api 模块被一次性加载**(`index.vue:104-113` 全是静态 import + `markRaw`)。这是 1.86s 长任务的主要来源。
|
||||
|
||||
### 1.3 CPU 采样归因(7 秒窗口)
|
||||
|
||||
| 分类 | 耗时 |
|
||||
|---|---|
|
||||
| idle(空闲) | 3077 ms |
|
||||
| **program(解析/编译/样式/布局/绘制等浏览器内部)** | **1336 ms** |
|
||||
| garbage collector | 156 ms |
|
||||
| 最高的单个 JS 帧 | `update2 @ element-plus` 91 ms |
|
||||
| 其次 | `track`(响应式) 67ms、`getBoundingClientRect` 59ms、`createReactiveObject` 54ms |
|
||||
|
||||
**结论**:长任务**不是某一段业务 JS 卡住**,而是"大量模块解析 + 大 DOM 样式/布局"的累计。因此优化方向是**减少首屏要加载/渲染的量**,而不是找某个函数优化。
|
||||
|
||||
### 1.4 首屏的其它噪声
|
||||
|
||||
- 8 个 WebSocket 连接失败:`ws://127.0.0.1:13888 / 5000 / 16888 / 10818 / 9113 / 12705 / 13528 / 8000` 全部 `ERR_CONNECTION_REFUSED`(打印组件、摄像头等本地服务)。
|
||||
- 它们在 load 之后异步触发,**不直接阻塞首屏**,但会刷错误、占用连接池、增加控制台噪声。
|
||||
|
||||
---
|
||||
|
||||
## 2. 切 tab 测量结果(核心证据)
|
||||
|
||||
### 2.1 依次访问 5 个 tab(`tabCacheMax = 3`,共 8 个 tab)
|
||||
|
||||
| 顺序 | tab | 耗时 | 期间长任务 |
|
||||
|---|---|---|---|
|
||||
| 1 | 待处理异常订单(首次) | **2006 ms** | 938ms |
|
||||
| 2 | 待出库订单(首次) | **1628 ms** | 879ms |
|
||||
| 3 | 委托外仓订单(首次) | **1313 ms** | 630ms |
|
||||
| 4 | 配送订单(首次) | **2088 ms** | 1083ms |
|
||||
| 5 | **回到**待处理异常订单 | **3075 ms** | 1199 + 763 + 636ms |
|
||||
|
||||
> 第 5 次比第 1 次**还慢 1 秒**。这就是 `KeepAlive :max="3"` 小于 8 个 tab 带来的 **LRU 抖动**:第 1 个 tab 早已被淘汰,回来时要重新挂载;同时缓存里还占着 3 个旧组件,内存压力更大。
|
||||
|
||||
### 2.2 两个 tab 之间往返(都在缓存内)
|
||||
|
||||
| 顺序 | tab | 耗时 |
|
||||
|---|---|---|
|
||||
| A1 | 待出库订单(首次挂载) | 1696 ms |
|
||||
| B1 | 委托外仓订单(首次挂载) | 1548 ms |
|
||||
| **A2** | 待出库订单(**缓存命中**) | **649 ms** |
|
||||
| **B2** | 委托外仓订单(**缓存命中**) | **642 ms** |
|
||||
| **A3** | 待出库订单(**缓存命中**) | **691 ms** |
|
||||
|
||||
**结论:缓存命中确实有效(1.6s → 0.65s,约 2.5 倍)**,但:
|
||||
|
||||
- 0.65s 里包含 350–400ms 的静默判定窗口;
|
||||
- 而 **CSS 过渡本身固定占约 400ms**(`mode="out-in"` + 0.2s 淡出 + 0.2s 淡入)。
|
||||
|
||||
也就是说:**缓存命中时,"CSS 动画时长"已经成了主要成本**,与数据加载无关。
|
||||
|
||||
### 2.3 内存
|
||||
|
||||
访问多个 tab 后:`performance.memory.usedJSHeapSize ≈ 216 MB`,DOM 仍 7105 元素。
|
||||
(对照:刚首屏时 CDP `JSHeapUsedSize` 约 68 MB)
|
||||
|
||||
> 这解释了为什么第 5 次切回会触发 3 个长任务:**重建 + GC**。
|
||||
|
||||
---
|
||||
|
||||
## 3. 结论:慢在哪
|
||||
|
||||
| # | 原因 | 证据 | 影响面 |
|
||||
|---|---|---|---|
|
||||
| **C1** | 8 个 tab 页被静态 import,打开即加载 69 个模块 | 250 请求 / 14.17MB / 长任务 1857ms | 首屏 |
|
||||
| **C2** | 首屏 DOM 2.2 万节点、样式与布局耗时 1336ms | `program` 1336ms、DOM 7537 | 首屏 |
|
||||
| **C3** | `tabCacheMax=3` < tab 数(8 / 5)→ LRU 抖动 | 第 5 次切回 3075ms > 首次 2006ms | 切 tab |
|
||||
| **C4** | 过渡动画固定 400ms | 缓存命中仍 0.65s | 切 tab(缓存命中时是主成本) |
|
||||
| **C5** | 提高缓存后缺少"释放/刷新"配套(见代码) | 各 tab 只在 `onBeforeUnmount` 清理;无 `onActivated` | 提高缓存后暴露 |
|
||||
| **C6** | 8 个本地 WebSocket 连接失败 | 控制台 8 条 ERR_CONNECTION_REFUSED | 噪声/次要 |
|
||||
|
||||
---
|
||||
|
||||
## 4. 执行清单
|
||||
|
||||
> 每项都标了**为什么做(对应哪条证据)**、改动位置、验收标准。
|
||||
> 建议按批次执行,批次 1+2 必须成对上线。
|
||||
|
||||
### 批次 1 · 修缓存策略(P0)
|
||||
|
||||
| # | 事项 | 位置 | 依据 |
|
||||
|---|---|---|---|
|
||||
| 1.1 | `tabCacheMax` 默认值 3 → **8**(或按页面 tab 数取最大) | `src/stores/modules/experimental.ts`(`DEFAULT_TAB_CACHE_MAX`) | C3 |
|
||||
| 1.2 | 支持按页面覆盖缓存上限:`ORDER_PAGE_CONFIG.tabCacheMax`、`WAVE_PAGE_CONFIG.tabCacheMax` | `orderManagement/config/order-common-config.ts`、`waveOrder/config/wave-config.ts` + 两个 `index.vue` | C3(8 tab / 5 tab 需求不同) |
|
||||
| 1.3 | KeepAlive 内 `:key` 统一为 `:key="activeTab"` | `orderManagement/index.vue:56-59`(当前**没有** key)、`waveOrder/index.vue:74-80` | 避免不同 tab 复用同组件类型时串数据 |
|
||||
| 1.4 | 单页模式 `<keep-alive>` 补 `:max` | `waveOrder/index.vue:93-99` | 与多页模式策略一致 |
|
||||
|
||||
**验收**:`A→B→A` 往返时第二次耗时 ≤ 首次的 50%(当前 1.6s → 0.65s 已达标,改后应同样稳定);8 个 tab 依次访问后回到第 1 个,耗时不再高于首次。
|
||||
|
||||
---
|
||||
|
||||
### 批次 2 · 缓存的"配套"(P0,必须与批次 1 同批)
|
||||
|
||||
| # | 事项 | 位置 | 依据 |
|
||||
|---|---|---|---|
|
||||
| 2.1 | 切走的 tab 释放大列表:`useOrderListPageCleanup` 从 `onBeforeUnmount` 扩展到 `onDeactivated` | `orderManagement/utils/use-order-list-page-cleanup.ts` + 3 个列表 tab | C5(否则 8 份大列表常驻,实测 216MB) |
|
||||
| 2.2 | 建单成功回调总线防放大:只让**当前激活 tab** 立刻 `loadData`,其它 tab 打 `dirty` 标记 | `pendingOrder.vue:574`、`exceptionOrder.vue:655`、`reviewOrder.vue:283`(`registerCreateOrderSuccess`) | C5(8 个 tab 全部注册在册 → 一次建单触发 8 次请求) |
|
||||
| 2.3 | 补 `onActivated` 刷新策略:`dirty` 优先,其次 `lastLoadedAt + 阈值` | 同上 3 个列表 tab | C5(当前缓存后切回永远是旧数据) |
|
||||
| 2.4 | 交付时明确"全局开关仍是总闸" | `experimental.ts` | 保留回滚能力 |
|
||||
|
||||
**验收**:
|
||||
- 建单成功 → Network 里**只有 1 个** list 请求;
|
||||
- 在别的菜单改数据后切回 → 最终一致;
|
||||
- 访问 5 个 tab 后内存增量 ≤ 100MB(当前 216MB)。
|
||||
|
||||
---
|
||||
|
||||
### 批次 3 · 首屏模块拆分(P0)
|
||||
|
||||
| # | 事项 | 位置 | 依据 |
|
||||
|---|---|---|---|
|
||||
| 3.1 | 8 个 tab 组件改为**按需加载**:`defineAsyncComponent(() => import('./pendingOrder.vue'))` | `orderManagement/index.vue:104-113` | C1(首屏一次性拉 69 个模块) |
|
||||
| 3.2 | 首屏默认 tab 保持同步或预加载(避免首屏多一次 chunk 等待) | 同上 | 平衡 |
|
||||
| 3.3 | `waveOrder` 同样处理 | `waveOrder/index.vue` 顶部 import | C1 |
|
||||
| 3.4 | 校验分包产物:路由 chunk 体积下降、各 tab 独立 chunk | `npm run build` 输出 | C1 |
|
||||
|
||||
**预期**:首屏加载的 `orderManagement` 模块 69 → 约 10(仅激活 tab 及其依赖),长任务显著下降。
|
||||
|
||||
**验收**:首屏 LCP 下降;首次切到未访问 tab 允许有一次 chunk 等待(≤200ms 内网)。
|
||||
|
||||
> ⚠️ 3.1 会让"首次切某个 tab"多一次网络请求。**必须与批次 1 一起评估**:有缓存上限后,每个 tab 只会懒加载一次。
|
||||
|
||||
---
|
||||
|
||||
### 批次 4 · 过渡动画(P1)
|
||||
|
||||
| # | 事项 | 位置 | 依据 |
|
||||
|---|---|---|---|
|
||||
| 4.1 | `tab-fade` 从 `0.2s` 降到 `0.12s`(或缓存命中时跳过 `out-in`) | 各容器 `<style>` 内 `.tab-fade-enter-active/leave-active` | C4(缓存命中时动画是主成本) |
|
||||
| 4.2 | 四个容器统一同一套时长,避免"有的快有的慢" | `mode` / `newview` / `orderManagement` / `waveOrder` | 观感一致 |
|
||||
|
||||
**验收**:缓存命中切换目视无"等一下";不出现闪白。
|
||||
|
||||
---
|
||||
|
||||
### 批次 5 · 首屏渲染量(P1)
|
||||
|
||||
| # | 事项 | 位置 | 依据 |
|
||||
|---|---|---|---|
|
||||
| 5.1 | 先确认长任务主要来自"模块解析"还是"表格渲染":批次 3 完成后复测一次 | — | C1 vs C2 |
|
||||
| 5.2 | 若仍是渲染:检查首屏默认列数、`enableColumnConfig` 默认值、是否开启虚拟滚动 | `UpperTable`、各 tab 的 columns 配置 | C2 |
|
||||
| 5.3 | ScanBox 首屏只渲染已展开分组,其余折叠 | `components/ScanBox` | C2(首屏左侧约 30 个筛选项) |
|
||||
| 5.4 | 表格容器加 `contain: layout paint` / 固定高度,减少布局传播 | `list-page.scss`、`UpperTable` | C2 |
|
||||
|
||||
---
|
||||
|
||||
### 批次 6 · 壳层对齐(P2,只动标签栏)
|
||||
|
||||
| # | 事项 | 位置 | 注意 |
|
||||
|---|---|---|---|
|
||||
| 6.1 | `el-tabs` → `TabArea` | `orderManagement/index.vue:19-41`、`waveOrder/index.vue:55-70` | TabArea 视觉基准就是这两个页面 |
|
||||
| 6.2 | 给 `TabArea` 增加 **角标插槽** `#label-{name}` | `components/TabArea/index.vue` | orderManagement 有 `el-badge` |
|
||||
| 6.3 | 增加 **右侧操作区插槽** `#header-action` | 同上 | "刷新角标"按钮 |
|
||||
| 6.4 | **删除页面内重复的排序入口** | `orderManagement/index.vue:5-12`、`waveOrder` 同位置、`newview/index.vue:33-40` | TabArea 自带 `showSortEntry`,否则出现两个排序按钮 |
|
||||
| 6.5 | `sortScope` 显式传入(保留 `order.tabs.order` / `order.wave.tabs.order`) | 同上 | 否则默认 scope 变 `tab-order:{path}`,老配置丢失 |
|
||||
| 6.6 | 清理 `newview` 上未被声明的 `header-left-inset` | `newview/index.vue:50` | TabArea 无此 prop |
|
||||
|
||||
---
|
||||
|
||||
### 批次 7 · 噪声清理(P2)
|
||||
|
||||
| # | 事项 | 说明 |
|
||||
|---|---|---|
|
||||
| 7.1 | 8 个本地服务 WS 连接改为**懒连接**(进对应页面/点连接按钮再连)或统一超时 | 首屏固定刷 8 条 `ERR_CONNECTION_REFUSED` |
|
||||
| 7.2 | 修掉 `Vue Router warn: No match found for location with path "/order/orderManagement"` | 该路径未在 `router/map.ts` 注册,靠动态路由兜底 |
|
||||
| 7.3 | 修掉 `Component data/reviewingflow/index not found in componentMap` | 数据库组件与前端 map 不一致 |
|
||||
|
||||
---
|
||||
|
||||
## 5. 明确不做
|
||||
|
||||
| 不做 | 理由(基于本次测量) |
|
||||
|---|---|
|
||||
| ❌ 把 8 个 tab 改写成 `mode` 的 `template-config.ts` 结构 | 长任务归因是"模块量 + DOM 量",不是"结构老旧";重写 1.5 万行收益不成比例 |
|
||||
| ❌ 先做大而全的"配置中心"再优化性能 | 两者无强耦合,配置统一可独立推进 |
|
||||
| ❌ 调 `el-table` 内部实现 | 需先由批次 3/5 确认瓶颈是否在表格 |
|
||||
| ❌ 提高缓存上限但不做批次 2 | 会立刻引入"内存 216MB+ / 建单触发 8 次请求 / 数据变旧" |
|
||||
|
||||
---
|
||||
|
||||
## 6. 风险
|
||||
|
||||
| 风险 | 触发批次 | 说明 | 对策 |
|
||||
|---|---|---|---|
|
||||
| 内存上涨 | 1 | 8 个 tab 常驻(实测已 216MB) | 批次 2.1 释放列表 |
|
||||
| 请求放大 | 1 | 建单成功触发多 tab 刷新 | 批次 2.2 |
|
||||
| 数据变旧 | 1 | 缓存后无 `onActivated` 刷新 | 批次 2.3 |
|
||||
| 监听泄漏 | 1 | 现有清理只在 `onUnmounted` | 一并改 `onDeactivated` |
|
||||
| 懒加载首切变慢 | 3 | 首次切 tab 多一次 chunk 请求 | 内网可接受;可对默认 tab 预取 |
|
||||
| 排序配置丢失 | 6 | `TabArea` 默认 scope 与现有一致性 | 6.5 显式传 scope |
|
||||
|
||||
---
|
||||
|
||||
## 7. 建议执行顺序与预期
|
||||
|
||||
```
|
||||
批次 1 + 2(成对) → 切 tab 稳定在 0.65s 以内,不再出现 3s 卡顿
|
||||
批次 3 → 首屏长任务 1857ms 大幅下降
|
||||
批次 4 → 缓存命中切换再减约 200ms(动画)
|
||||
批次 5 → 视复测结果决定是否继续
|
||||
批次 6、7 → 观感与噪声
|
||||
```
|
||||
|
||||
**量化目标(生产环境)**
|
||||
|
||||
| 指标 | 当前(dev) | 目标 |
|
||||
|---|---|---|
|
||||
| 首屏 LCP | 3392ms | ≤ 1500ms |
|
||||
| 首屏 TBT | 2333ms | ≤ 500ms |
|
||||
| 切 tab(缓存命中) | 649ms | ≤ 350ms |
|
||||
| 切 tab(首次) | 1.3–2.1s | ≤ 900ms |
|
||||
| 访问 5 个 tab 后堆内存 | 216MB | ≤ 120MB |
|
||||
|
||||
---
|
||||
|
||||
## 8. 附录 · 复测方法
|
||||
|
||||
在浏览器工具中执行以下脚本即可复现(同一页面、同一登录态):
|
||||
|
||||
```js
|
||||
// 首屏:硬刷新 + LongTask/LCP/资源统计
|
||||
await page.addInitScript(() => {
|
||||
window.__perf = { longtasks: [], lcp: null, cls: 0 }
|
||||
new PerformanceObserver((l) => {
|
||||
for (const e of l.getEntries()) window.__perf.longtasks.push({ s: Math.round(e.startTime), d: Math.round(e.duration) })
|
||||
}).observe({ type: 'longtask', buffered: true })
|
||||
new PerformanceObserver((l) => {
|
||||
for (const e of l.getEntries()) if (!e.hadRecentInput) window.__perf.cls += e.value
|
||||
}).observe({ type: 'layout-shift', buffered: true })
|
||||
})
|
||||
await page.goto('http://localhost:5174/order/orderManagement', { waitUntil: 'load' })
|
||||
await page.waitForTimeout(7000)
|
||||
console.log(await page.evaluate(() => ({
|
||||
longTasks: window.__perf.longtasks.sort((a, b) => b.d - a.d).slice(0, 8),
|
||||
tbt: window.__perf.longtasks.filter((x) => x.d > 50).reduce((s, x) => s + x.d - 50, 0),
|
||||
requests: performance.getEntriesByType('resource').length,
|
||||
dom: document.querySelectorAll('*').length
|
||||
})))
|
||||
|
||||
// 切 tab:点击 → 等 DOM 静默 350ms
|
||||
async function measureTab(name) {
|
||||
await page.getByRole('tab', { name: new RegExp(name) }).click()
|
||||
return page.evaluate(() => new Promise((resolve) => {
|
||||
const t = document.querySelector('.main-container')
|
||||
let last = performance.now(), start = performance.now()
|
||||
const o = new MutationObserver(() => { last = performance.now() })
|
||||
o.observe(t, { childList: true, subtree: true, characterData: true, attributes: true })
|
||||
const iv = setInterval(() => {
|
||||
if (performance.now() - last > 350) { clearInterval(iv); o.disconnect(); resolve(Math.round(last - start)) }
|
||||
}, 60)
|
||||
}))
|
||||
}
|
||||
```
|
||||
|
||||
**判定口径**:同一会话内比较(dev 与 prod 不可混比);切 tab 数值包含 350ms 静默窗口,仅用于相对比较。
|
||||
|
||||
---
|
||||
|
||||
## 9. 执行记录(2026-11-06 · 批次 1~4 已实施)
|
||||
|
||||
### 9.1 已完成的改动
|
||||
|
||||
| 项 | 文件 | 说明 |
|
||||
|---|---|---|
|
||||
| 1.1 | `stores/modules/experimental.ts` | `DEFAULT_TAB_CACHE_MAX` 3 → **8** |
|
||||
| 1.2 | `orderManagement/config/order-common-config.ts`、`waveOrder/config/wave-config.ts` + 两个 `index.vue` | 新增 `ORDER_PAGE_CONFIG.tabCacheMax = 8`、`WAVE_PAGE_CONFIG.tabCacheMax = 5`;容器取「页面配置 ?? 全局配置」 |
|
||||
| 1.4 | `waveOrder/index.vue` | 单页模式 `<keep-alive>` 补 `:max="tabCacheMax"` |
|
||||
| 2.2 | `pendingOrder.vue`、`exceptionOrder.vue`、`reviewOrder.vue` | 建单成功回调改为 `handleCreateOrderSuccess`:**激活页签立即刷新,非激活只打 dirty** |
|
||||
| 2.3 | 同上 | 新增 `onActivated`(dirty 优先,其次 60s stale 阈值)与 `onDeactivated`(标记非激活) |
|
||||
| 3.1/3.3 | `orderManagement/index.vue`、`waveOrder/index.vue` | 除默认页签外,其余 tab 组件改为 `defineAsyncComponent` 按需加载 |
|
||||
| 4.1/4.2 | 四个容器 | `tab-fade` 过渡 0.2s → **0.12s**,四处统一 |
|
||||
|
||||
### 9.2 与原计划的偏差(含原因)
|
||||
|
||||
| 原项 | 处理 | 原因 |
|
||||
|---|---|---|
|
||||
| 1.3 给 `<component>` 加 `:key="activeTab"` | **未采用** | 8 个 tab 是**不同组件类型**,KeepAlive 按类型缓存已足够;加 key 反而让外层 `<transition>` 介入 leave 流程,在页面不可见(rAF 被节流)时会把旧节点卡在 `leave-active`。保留原行为更稳 |
|
||||
| 2.1 切走时释放列表(`onDeactivated` 清空) | **未采用** | 清空后每次切回都必须重新请求(用户会看到空表+loading);实测单页仅 20 行,列表数组不是内存主因。改为 2.2/2.3 的 dirty + stale 策略 |
|
||||
| 2.4 全局开关语义 | 保留 | `tabCacheEnabled` 仍是总闸,页面配置只覆盖 `max` |
|
||||
|
||||
### 9.3 改后复测(dev,同一会话)
|
||||
|
||||
| 指标 | 改前 | 改后 |
|
||||
|---|---|---|
|
||||
| 首屏 `orderManagement` 目录模块数 | 69 | **47**(懒加载生效) |
|
||||
| 切 tab 期间最长长任务 | 630–1199 ms | **≤ 292 ms**(多数 60–290ms) |
|
||||
| 访问多 tab 后堆内存 | 216 MB | 168 MB(会话内多次切换后) |
|
||||
| 功能 | — | 8 个 tab 切换正常,无 Vue 错误,`npm run build` 通过 |
|
||||
|
||||
> 说明:改前/改后的「切 tab 耗时」用了不同判定方式(改前是 DOM 静默窗口,改后是组件身份切换 + 长任务采样),绝对值不可直接对比,**长任务与模块数是可比的硬指标**。
|
||||
|
||||
### 9.4 测量环境注意(踩坑记录)
|
||||
|
||||
- 浏览器工具打开的页面可能在**后台标签页**(`document.visibilityState === 'hidden'`)。此时 `requestAnimationFrame` 被节流,`<transition mode="out-in">` 会**永远停在 leave 阶段**,表现为"点 tab 内容不变",属于**测量假象**。
|
||||
- 解决办法:CDP `Emulation.setFocusEmulationEnabled` + `Page.setWebLifecycleState('active')`,确认 `visibilityState === 'visible'` 后再测。
|
||||
- 同一页面多次执行 `addInitScript` 会叠加多个 `PerformanceObserver`,导致长任务/TBT 重复计数(曾出现 TBT 7000+ 的假数据)。测长任务时应改用 `observe({ buffered: true })` 的临时观察器,不要依赖全局注入。
|
||||
|
||||
### 9.5 待人工验证(浏览器可见状态下)
|
||||
|
||||
- [ ] 8 个 tab 依次切换:内容确实变化、滚动/选中态保持
|
||||
- [ ] 首次切到未访问过的 tab:允许有一次 chunk 加载(内网应 ≤200ms)
|
||||
- [ ] 建单成功后:Network 中**只有 1 个** list 请求(当前激活 tab)
|
||||
- [ ] 在其它菜单改数据 → 超过 60s 后切回订单页:数据自动刷新
|
||||
- [ ] 切 tab 后条码扫描/快捷键不串、无重复请求
|
||||
- [ ] `waveOrder` 5 个 tab 同样验证(尤其打印相关面板)
|
||||
|
||||
---
|
||||
|
||||
## 10. 第二轮优化:默认页签内联依赖瘦身(2026-11-06)
|
||||
|
||||
### 10.1 问题
|
||||
|
||||
批次 3 只把「非默认页签」改成了按需加载,但**默认页签 `pendingOrder.vue` 自己还有 41 条静态 import**,实测首屏加载了:
|
||||
- `views/order/orderManagement/` 下 47 个模块
|
||||
- `views/order/shared/form|component/` 下 **14 个**弹窗/面板模块
|
||||
- `xlsx`(850KB)——由 `pendingOrder → order-page-export → export.ts` 链路静态带入
|
||||
|
||||
这些弹窗(分配快递、分配储位、录入运单号、同步订单 ID、批量复核、修改地址/留言、克隆订单…)**只有点按钮时才会用到**。
|
||||
|
||||
### 10.2 改动
|
||||
|
||||
| # | 内容 | 文件 |
|
||||
|---|---|---|
|
||||
| 10.1 | 15 个弹窗/明细面板改 `defineAsyncComponent`(分配快递/储位、修改平台/地址/留言、克隆、录入运单号、同步订单、批量复核、批量异步任务、分配子单号、导出进度/列选择、波次打印预览 ×2、任务进度、详情/明细/归档/日志/运单面板) | `orderManagement/pendingOrder.vue` |
|
||||
| 10.2 | 上述弹窗在模板上加 `v-if="<对应 visible>"`,**关闭时卸载**,首次打开才加载对应 chunk | 同上 |
|
||||
| 10.3 | `xlsx` 改为 `await import('xlsx')`(仅在真正导出时加载) | `utils/export.ts`、`utils/order-page-export.ts` |
|
||||
|
||||
> 安全性依据:这些组件在模板中**没有任何 `ref` 调用**(已核对 `ref="..."` 仅用于 ScanBox / splitStack / UpperTable),全部是 `v-model` + 事件,因此 `v-if` 懒挂载不会出现「拿不到实例」的问题。
|
||||
|
||||
### 10.3 复测对比(dev,硬刷新)
|
||||
|
||||
| 指标 | 第一轮后 | 第二轮后 |
|
||||
|---|---|---|
|
||||
| `orderManagement/` 模块数 | 47 | **19** |
|
||||
| `order/shared/form|component` 模块数 | 14 | **0** |
|
||||
| script 请求数 | 241 | **174** |
|
||||
| 脚本解码体积 | 14.2 MB | **11.7 MB** |
|
||||
| 首屏是否加载 xlsx | 是(850KB) | **否** |
|
||||
| LCP | 3452 ms | **2956 ms** |
|
||||
| 最长长任务 | 1895 ms | 1729 ms |
|
||||
| DOM 元素 | 7525 | 7464 |
|
||||
|
||||
> 说明:dev 下「首屏 JS」中约 3MB 是 **vue-devtools overlay / devtools-kit**(生产不存在),element-plus 约 2.4MB。因此 dev 的 LCP 已接近该环境的可优化下限,**真实收益需以生产构建衡量**。
|
||||
|
||||
### 10.4 仍未处理(按性价比排序)
|
||||
|
||||
| # | 项 | 规模 | 说明 |
|
||||
|---|---|---|---|
|
||||
| A | `wave-config.ts` 被订单页静态引入 | **211 KB** | 仅因 3 个打印工具 import 了其中的 `unwrapWavePlatformPrintPayload`;把该函数(含 3 个内部 helper + `WavePlatformPrintDataPayload` 类型)抽到 `views/order/shared/wavePrintPayload.ts` 并从 wave-config 转发即可 |
|
||||
| B | `order-common-config.ts` | **351 KB** | 订单业务字典(工具栏按钮/筛选字段/导出列);split 属于 P6「业务配置归位」,改动面大 |
|
||||
| C | `ScanBox` / `UpperTable` | 335 / 272 KB | 首屏必需组件,只能靠内部拆分或虚拟化 |
|
||||
| D | 生产构建实测 | — | 建议 `npm run build` + `vite preview` 测一次,排除 dev 工具干扰 |
|
||||
|
||||
### 10.5 功能校验
|
||||
|
||||
- 首屏正常渲染 20 行,工具栏 28 个按钮齐备,无 Vue 报错
|
||||
- 首次切到未访问过的 tab:dev 下约 1.2s 完成(含 chunk 加载 + 挂载),之后走缓存
|
||||
- `npm run build` 通过
|
||||
485
docs/页面模板抽离-实施方案.md
Normal file
485
docs/页面模板抽离-实施方案.md
Normal file
@ -0,0 +1,485 @@
|
||||
# 页面模板抽离 · 细化实施方案
|
||||
|
||||
> 配套文档:`docs/页面模板抽离-现状分析.md`
|
||||
> 目标:把当前"寄生在 `views/order/orderManagement/` 里的公共模板资产"搬到公共层,使 `views/mode/` 新结构页面可以独立复用,并让后续"旧页面 → 新结构"替换不再需要改 import。
|
||||
> 本方案分 7 个阶段,**每个阶段可独立编译、独立提交、独立回滚**。
|
||||
|
||||
---
|
||||
|
||||
## 0. 总体原则
|
||||
|
||||
| 原则 | 说明 |
|
||||
|---|---|
|
||||
| **先样式、后组件、再配置** | 样式与组件改动是纯路径替换,风险最低;配置拆分涉及语义判断,放后面 |
|
||||
| **不可行才用兼容层** | SCSS 的 `@use` 没有转发能力 → 样式必须一次性全量替换;TS 可以用 `export type {...} from` 做 shim → 配置可分步迁移 |
|
||||
| **类名不急着改** | `.order-sub-container` 被 53 个模板硬编码,改名会把 diff 放大到模板层。改为"新增别名、不动旧名" |
|
||||
| **不引入新依赖** | 不新增打包插件,全部用现有 `@` 别名 |
|
||||
| **每阶段结束必须 `npm run build` 通过** | 项目是 `vue-tsc` 类型检查 + Vite 构建,路径错误会被构建拦住 |
|
||||
|
||||
---
|
||||
|
||||
## 1. 最终目标结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── styles/
|
||||
│ ├── list-page.scss ← 新增:列表页骨架布局(原 .order-sub-container)
|
||||
│ └── status-text.scss ← 新增:状态文本(原 .ut-status-text*)
|
||||
├── components/
|
||||
│ └── ToolbarButtonGroup/ ← 新增:通用工具栏按钮组
|
||||
│ ├── index.vue ← 原 OrderToolbarButtonGroup.vue
|
||||
│ └── types.ts ← ToolbarButtonConfig / ToolbarApiActionConfig
|
||||
├── utils/
|
||||
│ ├── statusText.ts ← getStatusTextClass(含 class 映射缓存)
|
||||
│ ├── scanFields.ts ← scanBasicField / scanWorkflowField
|
||||
│ └── storeScanOptions.ts ← 货主 / 快递公司选项解析与注入
|
||||
└── views/order/
|
||||
├── config/
|
||||
│ └── order-business-config.ts ← 订单专属字典(原 order-common-config 剩余部分)
|
||||
├── shared/
|
||||
│ ├── orderListExport.ts ← 原 utils/order-index-helpers.ts
|
||||
│ └── createOrderSession/ ← 原 composables/useCreateOrderSession + FloatWidget + Dialog
|
||||
└── orderManagement/ ← 只保留订单管理页面自身
|
||||
```
|
||||
|
||||
> 命名遵循现有约定:`src/styles` 用 kebab-case,`src/utils` 用 camelCase,`src/components` 用 PascalCase。
|
||||
|
||||
---
|
||||
|
||||
## 2. 分阶段实施步骤
|
||||
|
||||
### 阶段依赖关系
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
P1["P1 样式抽离<br/>108 处 @use"] --> P4
|
||||
P2["P2 工具栏组件 + 类型"] --> P3
|
||||
P2 --> P4
|
||||
P3["P3 通用工具函数"] --> P6
|
||||
P4["P4 mode 模板自洽"] --> P7
|
||||
P5["P5 次级资产归位"] --> P6
|
||||
P6["P6 清理 shim / 业务配置归位"] --> P7["P7 副本组件合并(可选)"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## P1 · 样式抽离(先做,风险最低)
|
||||
|
||||
### P1.1 拆分并新建文件
|
||||
|
||||
| 新文件 | 内容来源 | 行范围 |
|
||||
|---|---|---|
|
||||
| `src/styles/list-page.scss` | 原 `order-sub.scss` 第 1–238 行 | `.order-sub-container { ... }` 整块 |
|
||||
| `src/styles/status-text.scss` | 原 `order-sub.scss` 第 239–249 行 | `.ut-status-text` + 5 个修饰类 |
|
||||
|
||||
`list-page.scss` 建议直接改选择器为双名(**保留旧名 + 新增新名**,避免改 53 个模板):
|
||||
|
||||
```scss
|
||||
.order-sub-container,
|
||||
.list-page-container {
|
||||
/* 原内容原样保留,含所有 :deep() 嵌套 */
|
||||
}
|
||||
```
|
||||
|
||||
> ⚠️ 选择器列表里含 `:deep()` 需要编译验证一次(见 P1.4 验收)。若不通过,退化为只保留 `.order-sub-container`,新类名留到"页面替换阶段"再加。
|
||||
|
||||
### P1.2 替换 `@use`(共 108 处,必须一次性完成)
|
||||
|
||||
| 场景 | 文件数 | 原写法 | 新写法 |
|
||||
|---|---|---|---|
|
||||
| 外部,需要布局 + 状态 | 39 | `@use "../../order/orderManagement/styles/order-sub.scss";` | 两条 `@use`(见下) |
|
||||
| 外部,只用布局 | 14 | 同上 | `@use "@/styles/list-page.scss";` |
|
||||
| 外部,只用状态 | 48 | 同上 | `@use "@/styles/status-text.scss";` |
|
||||
| orderManagement 内部 | 9 | `@use "./styles/order-sub.scss";` / `"../styles/order-sub.scss"` | 按需同上 |
|
||||
|
||||
需要两个文件时的写法(`@use` 必须相邻且位于 `<style>` 最前):
|
||||
|
||||
```scss
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
```
|
||||
|
||||
**判定规则(不要只看字面类名)**:
|
||||
|
||||
- 需要 `list-page.scss` ⟺ 模板里出现 `class="...order-sub-container..."`(或用 `:class` 拼出该名)
|
||||
- 需要 `status-text.scss` ⟺ 模板/代码里出现 `ut-status-text` **或** `getStatusTextClass(`(该函数运行时才拼出 `ut-status-text`,纯 grep 类名会漏)
|
||||
|
||||
> 统计口径修正:存在 `:class="getStatusTextClass(...)"` 的页面,即使没有字面量 `ut-status-text` 也必须引 `status-text.scss`。
|
||||
|
||||
### P1.3 保留原文件(可选,建议 1 个版本周期)
|
||||
|
||||
把 `views/order/orderManagement/styles/order-sub.scss` 内容改为:
|
||||
|
||||
```scss
|
||||
@forward "@/styles/list-page.scss";
|
||||
@forward "@/styles/status-text.scss";
|
||||
```
|
||||
|
||||
> `@forward` 只是兜底,正常不应再有引用方;若 1 个版本后 grep 无命中即可删除。
|
||||
|
||||
### P1.4 验收
|
||||
|
||||
- [x] `npm run build` 通过(SCSS 编译 + 类型检查)
|
||||
- [x] `grep -r "orderManagement/styles/order-sub" src/` 仅剩 `@forward` 兜底文件
|
||||
- [ ] 抽查 3 类页面视觉无差异:① 带左侧 ScanBox 的列表页(如 `stock/stock`)② 仅状态文本的(如 `storage/stockcheck/config/components/LogPanel.vue`)③ 新结构页(`mode`、`system/setting/role`)
|
||||
|
||||
### P1.5 回滚
|
||||
|
||||
单次提交,`git revert` 即可;不涉及逻辑。
|
||||
|
||||
### P1.6 执行记录(2026-11-06 已完成)
|
||||
|
||||
| 项 | 结果 |
|
||||
|---|---|
|
||||
| 新增 `src/styles/list-page.scss` | `.order-sub-container, .list-page-container` 双选择器(含全部 `:deep()` 嵌套),编译验证通过 |
|
||||
| 新增 `src/styles/status-text.scss` | `.ut-status-text` + 5 个颜色修饰类 |
|
||||
| `@use` 替换 | 108 个文件 → 155 条 `@use`(`list-page` 61 个文件 / `status-text` 94 个文件 / 两者都引 47 个文件) |
|
||||
| 旧文件处理 | `views/order/orderManagement/styles/order-sub.scss` 改为 12 行 `@forward` 兜底 |
|
||||
| 注释同步 | 40 处提及 `order-sub.scss` 的注释已更新为新路径 |
|
||||
| 产物校验 | `dist/**/*.css` 同时包含 `.order-sub-container`、`.list-page-container`、`.ut-status-text--success` |
|
||||
| 残留检查 | `grep "order-sub.scss" src/` = 0 |
|
||||
|
||||
---
|
||||
|
||||
## P2 · 工具栏组件 + 类型抽离
|
||||
|
||||
### P2.1 新建类型文件
|
||||
|
||||
`src/components/ToolbarButtonGroup/types.ts`:
|
||||
|
||||
| 从 `order-common-config.ts` 迁出 | 行范围 |
|
||||
|---|---|
|
||||
| `ToolbarButtonConfig`(interface) | 296–317 |
|
||||
| `ToolbarApiActionConfig`(interface) | 318–327 |
|
||||
|
||||
> `PendingBatchAsyncTaskType/Config`(328–345)是订单批量任务专属,**不要迁**。
|
||||
|
||||
### P2.2 新建组件
|
||||
|
||||
| 操作 | 说明 |
|
||||
|---|---|
|
||||
| `OrderToolbarButtonGroup.vue` → `src/components/ToolbarButtonGroup/index.vue` | 内容整体搬运 |
|
||||
| 改第 101 行 | `import type { ToolbarButtonConfig } from '../config/order-common-config'` → `from './types'` |
|
||||
| 检查模板/样式中是否有 `order-` 前缀的私有类名 | 有则保留(属组件内部样式,不影响外部) |
|
||||
|
||||
### P2.3 `order-common-config.ts` 加类型转发(保证 78 处 import 不破)
|
||||
|
||||
```ts
|
||||
export type { ToolbarButtonConfig, ToolbarApiActionConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
```
|
||||
|
||||
同时文件内部使用这两个类型的地方,改为从新位置 `import type`。
|
||||
|
||||
### P2.4 替换组件 import(58 处)
|
||||
|
||||
| 原路径 | 新路径 |
|
||||
|---|---|
|
||||
| `@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue` | `@/components/ToolbarButtonGroup/index.vue` |
|
||||
|
||||
> 另有 **32 个文件**仅在注释里提到 `OrderToolbarButtonGroup`(如 `ConfirmWavePrintDialog.vue`、`role/config/template-config.ts` 等),**不要动**;它们不是引用。
|
||||
|
||||
### P2.5 验收
|
||||
|
||||
- [x] `npm run build` 通过
|
||||
- [x] `grep -r "component/OrderToolbarButtonGroup.vue" src/` = 0
|
||||
- [ ] 抽查工具栏按钮组正常:展开/收起、下拉按钮、tile 模式、禁用/loading 态
|
||||
- [x] **类型环已断**:`order-common-config.ts` 不再定义 `ToolbarButtonConfig`,改为转发公共层类型
|
||||
|
||||
### P2.6 执行记录(2026-11-06 已完成)
|
||||
|
||||
| 项 | 结果 |
|
||||
|---|---|
|
||||
| 新增 `src/components/ToolbarButtonGroup/types.ts` | `ToolbarButtonConfig` / `ToolbarApiActionConfig`(含注释) |
|
||||
| 新增 `src/components/ToolbarButtonGroup/index.vue` | 原组件 414 行整体搬运,类型 import 改为 `./types` |
|
||||
| `order-common-config.ts` | 删除 2 个 interface(32 行),改为 `import type` + `export type` 转发 |
|
||||
| 组件 import 替换 | **66 处**(58 处 `@/views/...` + 8 处 `./component/...`) |
|
||||
| 类型 import | 78 处仍走 `order-common-config` 转发(与业务符号混在同一 import 语句,留到 P3/P6 处理) |
|
||||
| 遗留死代码 | `views/order/orderManagement/component/OrderToolbarButtonGroup.vue` → P6 删除 |
|
||||
| 构建 | `npm run build` 通过(1m22s) |
|
||||
|
||||
---
|
||||
|
||||
## P3 · 通用工具函数抽离(配置瘦身第一刀)
|
||||
|
||||
### P3.1 迁移映射表(精确到符号)
|
||||
|
||||
| 新文件 | 迁出符号 | 原行号 | 依赖 |
|
||||
|---|---|---|---|
|
||||
| `src/utils/statusText.ts` | `STATUS_TEXT_CLASS_MAP`(762–770)、`STATUS_TEXT_CLASS_CACHE`(771)、`getStatusTextClass`(773–781) | 762–781 | 无(纯字符串映射) |
|
||||
| `src/utils/storeScanOptions.ts` | `resolveStoreOptionLabel`(1641)、`mapStoreListToSelectOptions`(1657)、`extractStoreListFromResponse`(1673)、`fillStoreScanFieldOptions`(1677) | 1641–1681 | 无 |
|
||||
| `src/utils/storeScanOptions.ts` | `mapExpressListToCompanySelectOptions`(1616)、`fillExpressCompanyScanFieldOptions`(1635) | 1616–1640 | 无(建议同文件,二者共用"选项注入"语义) |
|
||||
| `src/utils/scanFields.ts` | `scanBasicField`(1254)、`scanWorkflowField`(1259) | 1254–1263 | 无 |
|
||||
|
||||
> 迁移后原文件用 re-export shim 保持 129 个引用方不变:
|
||||
> ```ts
|
||||
> export { getStatusTextClass } from '@/utils/statusText'
|
||||
> export { extractStoreListFromResponse, mapStoreListToSelectOptions, fillStoreScanFieldOptions, fillExpressCompanyScanFieldOptions } from '@/utils/storeScanOptions'
|
||||
> export { scanBasicField, scanWorkflowField } from '@/utils/scanFields'
|
||||
> ```
|
||||
|
||||
### P3.2 明确**留在** `order-common-config.ts` 的内容
|
||||
|
||||
| 符号 | 原因 |
|
||||
|---|---|
|
||||
| `getTagType` | 依赖 `COMMON_TAG_TYPES` 订单状态字典与 3 个 normalizer,业务属性强 |
|
||||
| `translateOrderField` / `translateInterceptStatus` / `getInterceptStatusTagType` | 订单字段语义 |
|
||||
| `COMMON_TRANSLATIONS` / `COMMON_TAG_TYPES` | 订单状态字典(如后续确认可通用,再单独评估迁出) |
|
||||
| `ORDER_PAGE_CONFIG` / `ORDER_TAB_LIST` / `ORDER_TOOLBAR_BUTTONS` / `pickToolbarButtons` | 订单专属 |
|
||||
| `ORDER_EXPORT_ALL_COLUMNS` 及导出列工具 | 订单专属 |
|
||||
| `orderDetailFullSections` / `orderItem*Columns` | 订单专属 |
|
||||
| 全部 `*ScanField` / `*FilterOptions` / `*AvailableFields` / `*Columns` / `*Detail` / `*buttonList` / `*toolbarButtons` | 订单专属 |
|
||||
|
||||
### P3.3 迁移引用(可选分批)
|
||||
|
||||
- 第一批(改动小、语义清晰):`statusText` 相关 **84 处** → `@/utils/statusText`
|
||||
- 第二批:`storeScanOptions` 相关 **26 处**(12+7+7) → `@/utils/storeScanOptions`
|
||||
- 第三批:`scanFields` 相关 **3 处** → `@/utils/scanFields`
|
||||
|
||||
> 也可完全不迁移(靠 shim 长期存活),但**不推荐**——新页面模板不应再从订单模块取通用工具。
|
||||
|
||||
### P3.4 验收
|
||||
|
||||
- [x] `npm run build` 通过
|
||||
- [x] `views/mode/`、`views/system/setting/role/` 等新结构页面的 import 全部指向公共层(仅剩 7 条“对齐 xxx 体验”的注释提及)
|
||||
- [x] `order-common-config.ts` 行数 2696 → **2585**(累计减去 P2 的 32 行 + P3 的 84 行)
|
||||
- [ ] 抽查状态文本颜色正确(`success` 绿 / `warning` 橙 / `danger` 红)
|
||||
|
||||
### P3.6 执行记录(2026-11-06 已完成)
|
||||
|
||||
| 项 | 结果 |
|
||||
|---|---|
|
||||
| 新增 `src/utils/statusText.ts` | `getStatusTextClass` + 映射表/缓存 |
|
||||
| 新增 `src/utils/storeScanOptions.ts` | 快递公司、货主选项解析与注入(6 个函数) |
|
||||
| 新增 `src/utils/scanFields.ts` | `SCAN_BASIC_INFO_GROUP` / `scanBasicField` / `scanWorkflowField` |
|
||||
| `order-common-config.ts` | 删除 3 段实现(共 ~124 行),改为 `import` + `export ... from` 转发 |
|
||||
| 新结构页面迁移 | **36 处** import(26 处 `getStatusTextClass` + 10 处 `ToolbarButtonConfig`) |
|
||||
| 里程碑 | 10 个新结构页面已**无 orderManagement 代码依赖**(仅余 7 条历史视觉对齐注释) |
|
||||
| 存量 | 117 个文件仍引用 `order-common-config`(70 个用 `getStatusTextClass`),均属旧结构页面,随页面替换自然消失;P6 统一收口 |
|
||||
| 构建 | `npm run build` 通过(1m34s) |
|
||||
|
||||
---
|
||||
|
||||
## P4 · `mode` 模板自洽(关键里程碑)
|
||||
|
||||
> 目的:让 `views/mode/` 及 10 个新结构页面**完全不依赖** `orderManagement` 目录,成为可独立复制的模板。
|
||||
|
||||
### P4.1 改动点(4 个文件 + 3 个 config/panel)
|
||||
|
||||
| 文件 | 改动 |
|
||||
|---|---|
|
||||
| `views/mode/index.vue` | ① `@use "../order/orderManagement/styles/order-sub.scss"` → 两条新 `@use`(或 `@use "@/styles/list-page.scss"` 单条,视是否用状态文本)② `OrderToolbarButtonGroup` → `@/components/ToolbarButtonGroup/index.vue` ③ `ToolbarButtonConfig` → `@/components/ToolbarButtonGroup/types` |
|
||||
| `views/mode/components/ColumnCellRenderer.vue` | `@use` → `@/styles/status-text.scss`;`getStatusTextClass` → `@/utils/statusText` |
|
||||
| `views/mode/config/components/DetailPanel.vue` | 同上 |
|
||||
| `views/mode/config/components/LogPanel.vue` | 同上 |
|
||||
|
||||
### P4.2 同步处理其余 9 个新结构页面
|
||||
|
||||
`afterSale/typelist`、`data/ordersummary`、`express/waybill`、`storage/generalreport`、`storage/stockcheck`、`system/setting/{basicManagement/newview, printcomputer, role, workbench2}`
|
||||
|
||||
> 每个页面固定 3 类文件:`index.vue` + `components/ColumnCellRenderer.vue` + `config/components/{DetailPanel,LogPanel}.vue`,改法与 `mode` 完全一致。
|
||||
|
||||
### P4.3 验收
|
||||
|
||||
- [ ] `grep -r "orderManagement" src/views/mode/` = 0
|
||||
- [ ] 10 个新结构页面 `grep -r "orderManagement"` 仅剩"业务数据配置"引用(如 `ORDER_TAB_LIST` 等,属 P6 处理范围)
|
||||
- [ ] 模板复制演练:新建 `views/mode-copy/` 复制 `mode` 全部文件 → 不改任何 import 即可编译通过(验证后可删除)
|
||||
|
||||
---
|
||||
|
||||
## P5 · 次级资产归位(订单域内部整理)
|
||||
|
||||
> 这批资产**只在订单域内被复用**,不需要进 `src/utils`,只需离开 `orderManagement` 目录。
|
||||
|
||||
| 原路径 | 新路径 | 外部使用方 |
|
||||
|---|---|---|
|
||||
| `orderManagement/utils/order-index-helpers.ts` | `views/order/shared/orderListExport.ts` | 6(`waveOrder`×2、`orderreview`、`orderWeighing`×2、`returnUnpackwork`) |
|
||||
| `orderManagement/utils/stock-picker-helpers.ts` | `views/stock/utils/stockPickerHelpers.ts` | 5(`combo_stock`×2、`returnUnpack`、`returnUnpackwork`、`storage/receiving`) |
|
||||
| `orderManagement/utils/toolbar-actions.ts` | `views/order/shared/toolbarActions.ts` | 1(`waveOrder/PendingOrderListPanel`) |
|
||||
| `orderManagement/form/ManualWaybillForm.vue` | `views/order/shared/form/ManualWaybillForm.vue` | 2 |
|
||||
| `orderManagement/form/SyncOrderIdsForm.vue` | `views/order/shared/form/SyncOrderIdsForm.vue` | 2(含 `views/test`) |
|
||||
| `orderManagement/form/StorageAllocateForm.vue` | `views/order/shared/form/StorageAllocateForm.vue` | 2 |
|
||||
| `orderManagement/form/BatchAsyncTaskForm.vue` | `views/order/shared/form/BatchAsyncTaskForm.vue` | 1 |
|
||||
| `orderManagement/form/AllocateExpressForm.vue` | `views/order/shared/form/AllocateExpressForm.vue` | 1 |
|
||||
| `orderManagement/component/OrderExportProgressDialog.vue` | `views/order/shared/component/OrderExportProgressDialog.vue` | 1(`views/test`) |
|
||||
|
||||
### P5.1 布局层解耦
|
||||
|
||||
| 原路径 | 新路径 |
|
||||
|---|---|
|
||||
| `orderManagement/composables/useCreateOrderSession.ts` | `views/order/shared/createOrderSession/useCreateOrderSession.ts` |
|
||||
| `orderManagement/component/CreateOrderFloatWidget.vue` | `views/order/shared/createOrderSession/CreateOrderFloatWidget.vue` |
|
||||
| `orderManagement/component/CreatePendingOrderDialog.vue` | `views/order/shared/createOrderSession/CreatePendingOrderDialog.vue` |
|
||||
|
||||
→ `layout/component/CreateOrderSessionHost.vue` 的 3 处 import 改为新路径。
|
||||
|
||||
> 这是唯一的**布局层**依赖,改动后 `layout/` 不再指向任何具体页面目录。
|
||||
|
||||
### P5.2 验收
|
||||
|
||||
- [x] `npm run build` 通过
|
||||
- [ ] 全局建单悬浮窗仍可正常拉起(登录 → 任意页面 → 新建订单 → 关闭)
|
||||
- [x] `grep -r "orderManagement/utils\|orderManagement/form\|orderManagement/composables" src/` = **0**
|
||||
|
||||
### P5.3 执行记录(2026-11-06 已完成)
|
||||
|
||||
> 搬迁方式:用 `git mv` 做纯路径移动(保留 git 历史),内部 import 与引用方改用编辑工具修正。涉及文件合计 ≈7000 行(含 `CreatePendingOrderDialog.vue` 2905 行),不做逐行复制。
|
||||
|
||||
**实际搬迁 15 个文件(比原计划多 3 个,均为内聚依赖)**
|
||||
|
||||
| 原路径 | 新路径 |
|
||||
|---|---|
|
||||
| `orderManagement/utils/order-index-helpers.ts` | `views/order/shared/orderListExport.ts` |
|
||||
| `orderManagement/utils/order-meta-cache.ts` | `views/order/shared/orderMetaCache.ts` ←新增(CreatePendingOrderDialog 依赖) |
|
||||
| `orderManagement/utils/toolbar-actions.ts` | `views/order/shared/toolbarActions.ts` |
|
||||
| `orderManagement/utils/stock-picker-helpers.ts` | `views/stock/utils/stockPickerHelpers.ts` |
|
||||
| `orderManagement/composables/useCreateOrderSession.ts` | `views/order/shared/createOrderSession/useCreateOrderSession.ts` |
|
||||
| `orderManagement/component/CreateOrderFloatWidget.vue` | `views/order/shared/createOrderSession/CreateOrderFloatWidget.vue` |
|
||||
| `orderManagement/component/CreatePendingOrderDialog.vue` | `views/order/shared/createOrderSession/CreatePendingOrderDialog.vue` |
|
||||
| `orderManagement/component/OrderExportProgressDialog.vue` | `views/order/shared/component/OrderExportProgressDialog.vue` |
|
||||
| `orderManagement/component/SelectProductDialog.vue` | `views/order/shared/component/SelectProductDialog.vue` ←新增 |
|
||||
| `orderManagement/form/ManualWaybillForm.vue` | `views/order/shared/form/ManualWaybillForm.vue` |
|
||||
| `orderManagement/form/SyncOrderIdsForm.vue` | `views/order/shared/form/SyncOrderIdsForm.vue` |
|
||||
| `orderManagement/form/StorageAllocateForm.vue` | `views/order/shared/form/StorageAllocateForm.vue` |
|
||||
| `orderManagement/form/BatchAsyncTaskForm.vue` | `views/order/shared/form/BatchAsyncTaskForm.vue` |
|
||||
| `orderManagement/form/AllocateExpressForm.vue` | `views/order/shared/form/AllocateExpressForm.vue` |
|
||||
| `orderManagement/form/UpdateAddressForm.vue` | `views/order/shared/form/UpdateAddressForm.vue` ←新增(toolbar-actions 依赖其类型) |
|
||||
|
||||
**引用改写**:约 90 处(`orderListExport` 25 / `stockPickerHelpers` 7 / `toolbarActions` 9 / `orderMetaCache` 9 / `useCreateOrderSession` 6 / 表单组件 19 / 导出弹窗 9 / 建单会话 3 / 其余 3)
|
||||
|
||||
**结果**:`orderManagement` 目录文件数 55 → **40**,且 `utils/` `form/` `composables/` 已无外部引用。
|
||||
|
||||
**布局层**:`layout/component/CreateOrderSessionHost.vue` 的 3 处 import 已全部指向 `views/order/shared/createOrderSession/`,`layout/` 不再指向任何具体页面目录。
|
||||
|
||||
---
|
||||
|
||||
## P6 · 清理 shim / 业务配置归位
|
||||
|
||||
| 步骤 | 动作 |
|
||||
|---|---|
|
||||
| 6.1 | 全量检查残留:`grep -r "orderManagement/config/order-common-config" src/` |
|
||||
| 6.2 | 订单域内引用(约 20 处内部 + `waveOrder`/`orderreview`/`orderWeighing` 等)改为 `@/views/order/config/order-business-config` |
|
||||
| 6.3 | 文件改名:`orderManagement/config/order-common-config.ts` → `views/order/config/order-business-config.ts` |
|
||||
| 6.4 | 删除 P2/P3 加的 re-export shim |
|
||||
| 6.5 | 删除 `orderManagement/styles/order-sub.scss` 兜底文件(P1.3) |
|
||||
| 6.6 | 删除死代码 `orderManagement/component/OrderToolbarButtonGroup.vue`(P2 已迁移) |
|
||||
|
||||
**验收**:
|
||||
|
||||
- [ ] `grep -r "order-common-config" src/` = 0
|
||||
- [ ] `npm run build` 通过
|
||||
- [ ] `views/order/orderManagement/` 目录内只剩订单页面自身(预期文件数从 55 降至 ≈ 30)
|
||||
|
||||
---
|
||||
|
||||
## P7 · 副本组件合并(可选,建议与"页面替换"合并做)
|
||||
|
||||
现状:
|
||||
|
||||
| 副本 | 数量 | 完全一致的组数 |
|
||||
|---|---|---|
|
||||
| `ColumnCellRenderer.vue` | 13 | 2 对(printcomputer ↔ workbench2) |
|
||||
| `DetailPanel.vue` | 11 | 1 对(printcomputer ↔ workbench2) |
|
||||
| `LogPanel.vue` | 11 | 3 组(printcomputer ↔ workbench2、afterSale/typelist ↔ storage/generalreport、express/waybill ↔ video/newcamara ↔ video/newcamaraserver) |
|
||||
|
||||
建议做法:
|
||||
|
||||
1. 先以 `views/mode/components/` 为基线,抽出 `src/components/ListPageParts/{ColumnCellRenderer,DetailPanel,LogPanel}.vue`(props 化列配置/字段配置)。
|
||||
2. 逐页面替换并删除副本——**每个页面替换时同步完成**,不单独排期。
|
||||
3. 完全一致的 3 组优先合并(改 6 个文件,零风险)。
|
||||
|
||||
---
|
||||
|
||||
## 3. 批量替换规则表
|
||||
|
||||
> 供 IDE 全局替换或脚本批量执行使用。**建议按顺序执行,每批后立即 build**。
|
||||
|
||||
| # | 查找(精确) | 替换为 | 作用域 | 次数 |
|
||||
|---|---|---|---|---|
|
||||
| 1 | `@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue` | `@/components/ToolbarButtonGroup/index.vue` | `src/` | 58 |
|
||||
| 2 | `../config/order-common-config` **仅** `import type { ToolbarButtonConfig` 行 | `@/components/ToolbarButtonGroup/types` | `orderManagement/` 等 | 1 |
|
||||
| 3 | `@/views/order/orderManagement/config/order-common-config`(限 `getStatusTextClass` 所在 import 语句) | `@/utils/statusText` | `src/views` | 84 |
|
||||
| 4 | `@/views/order/orderManagement/config/order-common-config`(限货主/快递选项符号) | `@/utils/storeScanOptions` | `src/views` | 26 |
|
||||
| 5 | `@/views/order/orderManagement/config/order-common-config`(限 `scanBasicField` / `scanWorkflowField`) | `@/utils/scanFields` | `src/views` | 3 |
|
||||
| 6 | `orderManagement/styles/order-sub.scss`(`@use` 行) | 按 §P1.2 三分类 | `src/` | 108 |
|
||||
| 7 | `@/views/order/orderManagement/utils/order-index-helpers` | `@/views/order/shared/orderListExport` | `src/views` | 6 |
|
||||
| 8 | `@/views/order/orderManagement/utils/stock-picker-helpers` | `@/views/stock/utils/stockPickerHelpers` | `src/views` | 5 |
|
||||
| 9 | `@/views/order/orderManagement/utils/toolbar-actions` | `@/views/order/shared/toolbarActions` | `src/views` | 1 |
|
||||
| 10 | `@/views/order/orderManagement/form/` | `@/views/order/shared/form/` | `src/views` | 8 |
|
||||
| 11 | `@/views/order/orderManagement/component/OrderExportProgressDialog.vue` | `@/views/order/shared/component/OrderExportProgressDialog.vue` | `src/views` | 1 |
|
||||
| 12 | `orderManagement/composables/useCreateOrderSession` | `@/views/order/shared/createOrderSession/useCreateOrderSession` | `layout/` + 内部 | 2 |
|
||||
| 13 | `orderManagement/component/CreateOrderFloatWidget.vue` / `CreatePendingOrderDialog.vue` | `@/views/order/shared/createOrderSession/...` | `layout/` + 内部 | 4 |
|
||||
| 14 | `orderManagement/config/order-common-config` | `@/views/order/config/order-business-config` | 剩余 | ≈ 24 |
|
||||
|
||||
> 规则 2–5 属于"同一路径、不同符号",**不能盲目全文替换**,必须按 import 语句中的符号名匹配。
|
||||
|
||||
---
|
||||
|
||||
## 4. 校验清单(每阶段通用)
|
||||
|
||||
```text
|
||||
必过项
|
||||
□ npm run build 成功(vue-tsc + vite)
|
||||
□ 目标路径 grep 结果为 0(见各阶段验收)
|
||||
□ 根目录无新增 untracked 的临时脚本/备份文件
|
||||
|
||||
抽查项(按阶段选择)
|
||||
□ 页面视觉:布局、状态文本颜色、工具栏按钮组交互
|
||||
□ 新结构页(mode / role / stockcheck)功能:筛选、分页、明细面板、日志面板
|
||||
□ 布局层:全局建单悬浮窗
|
||||
□ 移动端/低分辨率:无横向滚动异常(列表页骨架改动易影响)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. 风险与对策
|
||||
|
||||
| 风险 | 触发阶段 | 表现 | 对策 |
|
||||
|---|---|---|---|
|
||||
| `:deep()` 在双选择器下编译异常 | P1 | 布局错乱 | 退化为仅保留 `.order-sub-container`;新类名延后 |
|
||||
| `@use` 位置错误 | P1 | Sass 报 `@use rules must be written before any other rules` | 两条 `@use` 必须置于 `<style>` 最前且相邻 |
|
||||
| 漏引 `status-text.scss` | P1 | 状态文字变黑/无色(因为类名是运行时拼的) | 用 `getStatusTextClass(` 作为判定条件,而非仅 grep 类名 |
|
||||
| 误改注释中的组件名 | P2 | 无运行时影响,但污染 diff | 只替换 `import ... from '...OrderToolbarButtonGroup.vue'` 形式 |
|
||||
| ESLint 规则收紧 | P2/P3/P5 | 新公共目录文件触发 `no-explicit-any` 等告警/错误 | 二选一:① 在 `eslint.config.js` 为新目录补同样的例外块 ② 迁移前先清理该文件告警 |
|
||||
| 类型环未断 | P2 | `combo_stock` 与订单模块互相依赖 | P2.1 必须先完成类型迁出 |
|
||||
| 配置误迁业务字典 | P3 | 公共层出现订单字段(后续难维护) | 严格按 §P3.2 "留在原文件"清单执行 |
|
||||
| 一次改太多难回滚 | 全局 | 出问题定位困难 | 每阶段独立提交;P1 与 P2 之间至少间隔一次完整构建验证 |
|
||||
|
||||
---
|
||||
|
||||
## 6. 工作量估算
|
||||
|
||||
| 阶段 | 涉及文件 | 需改写语句 | 风险 | 建议提交粒度 |
|
||||
|---|---|---|---|---|
|
||||
| P1 样式 | 108(外 99 + 内 9)+ 3 新建 | 108 处 `@use` | 低 | 1 次提交 |
|
||||
| P2 组件 + 类型 | 58 + 2 新建 | 58 处 `import` | 低 | 1 次提交 |
|
||||
| P3 通用工具 | ≈ 113 | ≈ 113 处 `import` | 中 | 可分 3 次(按符号) |
|
||||
| P4 mode 自洽 | 10 页面 × 3–4 文件(与 P1–P3 重叠) | 同上已覆盖 | 低 | 1 次提交(验证里程碑) |
|
||||
| P5 次级资产 | 9 | 13 处 `import` | 中 | 1–2 次提交 |
|
||||
| P6 清理/改名 | ≈ 24 | 24 处 `import` | 中 | 1 次提交 |
|
||||
| P7 副本合并 | 35(可选) | — | 中高 | 随页面替换逐步 |
|
||||
| **合计(P1–P6)** | **≈ 180 个文件** | **≈ 316 处语句** | — | **约 7–9 次提交** |
|
||||
|
||||
---
|
||||
|
||||
## 7. 建议的提交信息(供参考,提交由你手动执行)
|
||||
|
||||
```
|
||||
refactor(styles): 抽离列表页骨架与状态文本样式到 src/styles
|
||||
refactor(component): 抽离 OrderToolbarButtonGroup 到 src/components/ToolbarButtonGroup
|
||||
refactor(config): 抽离通用状态文本/筛选字段/货主选项工具到 src/utils
|
||||
refactor(mode): 新结构模板完全脱离 orderManagement 依赖
|
||||
refactor(order): 次级资产归位到 views/order/shared 与 views/stock/utils
|
||||
refactor(order): order-common-config 更名为 order-business-config 并清理兼容层
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 8. 待确认决策点
|
||||
|
||||
| # | 决策 | 选项 | 推荐 |
|
||||
|---|---|---|---|
|
||||
| 1 | 样式类名是否立刻改名 | A. 保持 `.order-sub-container`;B. 双名并存;C. 全量改名 | **B**(新页面用 `.list-page-container`,旧模板零改动) |
|
||||
| 2 | 配置是否加 re-export shim | A. 不加,一次性改完;B. 加 shim 分步迁移 | **B** |
|
||||
| 3 | `COMMON_TRANSLATIONS` / `COMMON_TAG_TYPES` 归属 | A. 留在订单业务配置;B. 抽成通用状态字典 | **A**(当前内容全为订单字段,无外部通用需求) |
|
||||
| 4 | 是否保留 `order-sub.scss` 兜底 `@forward` | A. 保留 1 个版本;B. 不保留 | **A** |
|
||||
| 5 | ESLint 例外规则 | A. 新目录补例外;B. 清理告警 | **A**(先不阻塞抽离,后续单独清) |
|
||||
489
docs/页面模板抽离-现状分析.md
Normal file
489
docs/页面模板抽离-现状分析.md
Normal file
@ -0,0 +1,489 @@
|
||||
# 页面模板抽离 · 现状分析(order/orderManagement 耦合面)
|
||||
|
||||
> 目标:在把旧页面批量替换为 `views/mode/` 新结构之前,先摸清"旧页面引用了哪些 orderManagement 的模板资产",为后续抽离到公共层做准备。
|
||||
> **本文档只做分析,不含任何代码改动。**
|
||||
|
||||
---
|
||||
|
||||
## 1. 结论速览
|
||||
|
||||
1. **耦合面极大**:`src/views` 下共 **133 个文件**(占 views 下页面/组件相当比例)直接引用 `views/order/orderManagement/` 的 3 个核心资产,涉及 **14 个业务模块**、**50 个页面级 `index.vue`**。
|
||||
2. **已迁移到新结构的页面同样被绑住**:10 个已使用 `config/template-config.ts`(新结构)的页面,**全部**仍在引用 orderManagement 的样式/组件/配置。也就是说新模板目前不是"独立可用的模板",而是"寄生在旧模块里的模板"。
|
||||
3. **真正被复用的只有 3 项 + 少量工具**:`order-common-config.ts`(129 文件)、`order-sub.scss`(99 文件)、`OrderToolbarButtonGroup.vue`(58 文件)三者覆盖了几乎全部引用。
|
||||
4. **配置文件的复用是"假性"的**:2696 行的 `order-common-config.ts` 里,外部实际只用到约 20 个导出符号,其中 5 个(`getStatusTextClass` / `ToolbarButtonConfig` / `extractStoreListFromResponse` / `fillStoreScanFieldOptions` / `mapStoreListToSelectOptions`)占 **188 / 203 处**引用,其余全是订单业务字典(导出列、订单工具栏、订单详情分区、订单筛选字段)。
|
||||
5. **存在反向依赖**:`orderManagement/utils/stock-picker-helpers.ts` → `stock/combo_stock/combo-stock-config.ts` → `orderManagement/config/order-common-config.ts`(类型环),抽离时需要顺带解掉。
|
||||
6. **改动量**:仅这 3 个核心资产,需改写 **307 处 `import` / `@use` 语句**。
|
||||
|
||||
---
|
||||
|
||||
## 2. 被外部引用的资产清单(按复用度排序)
|
||||
|
||||
| # | 资产 | 外部引用文件数 | 规模 | 性质 |
|
||||
|---|---|---|---|---|
|
||||
| 1 | `config/order-common-config.ts` | **129**(150 处 import) | 2696 行 / 123 KB | 通用 UI 工具 + 订单业务字典 **混杂** |
|
||||
| 2 | `styles/order-sub.scss` | **99**(@use) | 249 行 / 5.7 KB | 纯布局 + 状态文本样式,**完全通用** |
|
||||
| 3 | `component/OrderToolbarButtonGroup.vue` | **58**(显式 import) | 通用工具栏按钮组 | 仅依赖 1 个类型,**完全通用** |
|
||||
| — | (以上三者去重合计) | **133 个 views 文件** | — | — |
|
||||
|
||||
### 2.1 次级资产(少量但跨模块)
|
||||
|
||||
| 资产 | 外部使用方数量 | 使用方 |
|
||||
|---|---|---|
|
||||
| `utils/order-index-helpers.ts` | 6 | `order/waveOrder/{config,PendingOrderListPanel}`、`order/orderreview`、`order/orderWeighing/{index,ExpressWeighingForm}`、`express/returnUnpackwork` |
|
||||
| `utils/stock-picker-helpers.ts` | 5 | `express/returnUnpack/StockPickerDialog`、`express/returnUnpackwork`、`stock/combo_stock/{ComboGoodsFormDialog,ComboStockPickerDialog}`、`storage/receiving/Product` |
|
||||
| `form/ManualWaybillForm.vue` | 2 | `order/waveOrder/PendingOrderListPanel`、`stock/stock/StockBatchEditDialog` |
|
||||
| `form/SyncOrderIdsForm.vue` | 2 | `order/waveOrder/PendingOrderListPanel`、`views/test` |
|
||||
| `form/StorageAllocateForm.vue` | 2 | `order/waveOrder/PendingOrderListPanel`、`views/test` |
|
||||
| `form/BatchAsyncTaskForm.vue` | 1 | `views/test` |
|
||||
| `form/AllocateExpressForm.vue` | 1 | `order/waveOrder/PendingOrderListPanel` |
|
||||
| `utils/toolbar-actions.ts` | 1 | `order/waveOrder/PendingOrderListPanel` |
|
||||
| `component/OrderExportProgressDialog.vue` | 1 | `views/test` |
|
||||
|
||||
### 2.2 非 views 层的引用(最需要注意)
|
||||
|
||||
| 文件 | 引用内容 | 说明 |
|
||||
|---|---|---|
|
||||
| `layout/component/CreateOrderSessionHost.vue` | `CreateOrderFloatWidget.vue`、`composables/useCreateOrderSession`、`CreatePendingOrderDialog.vue` | **布局层**依赖订单模块 → 抽离后这里必须跟着改,且属于全局常驻组件 |
|
||||
| `router/map.ts` | 路由 → `orderManagement/index.vue` | 仅路由,不属于模板耦合 |
|
||||
| `api/order.index/orderindex.ts`、`styles/tab-area.scss` | 仅注释提及 | 无需处理 |
|
||||
|
||||
---
|
||||
|
||||
## 3. 影响面分布
|
||||
|
||||
### 3.1 按业务模块(views 子目录)
|
||||
|
||||
| 模块 | 受影响文件数 |
|
||||
|---|---|
|
||||
| `storage` | 30 |
|
||||
| `system` | 27 |
|
||||
| `express` | 14 |
|
||||
| `order` | 12 |
|
||||
| `stock` | 9 |
|
||||
| `data` | 9 |
|
||||
| `video` | 8 |
|
||||
| `inbox` | 5 |
|
||||
| `afterSale` | 5 |
|
||||
| `material` | 4 |
|
||||
| `mode` | 4 |
|
||||
| `store` | 3 |
|
||||
| `message` | 2 |
|
||||
| `warehouses` | 1 |
|
||||
|
||||
### 3.2 新旧结构分布(页面级 `index.vue`)
|
||||
|
||||
**已有新结构(含 `config/template-config.ts`)但仍依赖 orderManagement —— 10 个**
|
||||
|
||||
```
|
||||
mode ← 模板本身!
|
||||
afterSale/typelist
|
||||
data/ordersummary
|
||||
express/waybill
|
||||
storage/generalreport
|
||||
storage/stockcheck
|
||||
system/setting/basicManagement/newview
|
||||
system/setting/printcomputer
|
||||
system/setting/role
|
||||
system/setting/workbench2
|
||||
```
|
||||
|
||||
**旧结构且依赖 orderManagement —— 40 个**
|
||||
|
||||
```
|
||||
afterSale/list data/packingflow
|
||||
express/returnReceived express/returnUnpack
|
||||
express/returnwaybill inbox/autoReply
|
||||
inbox/group inbox/message
|
||||
message order/orderreview
|
||||
order/orderWeighing stock/combo_stock
|
||||
stock/external_stock stock/pickingShortage
|
||||
stock/stock storage/entry
|
||||
storage/entry_owner storage/inventory
|
||||
storage/log storage/management/replenishmentDemand
|
||||
storage/productflow storage/productflow/store
|
||||
storage/receiving storage/receiving_owner
|
||||
storage/report storage/stockout
|
||||
store/shipperSigning store/stores
|
||||
system/setting/account system/setting/expressinterface
|
||||
system/setting/permission system/setting/pickcart
|
||||
system/setting/printStation system/setting/shops
|
||||
system/setting/storeExpressBindingPolicy
|
||||
video/newcamara video/newcamaraserver
|
||||
warehouses
|
||||
```
|
||||
|
||||
> 结论:**抽离是"替换旧页面"的前置条件**——否则每替换一个页面,都还要再改一次 import。
|
||||
|
||||
---
|
||||
|
||||
## 4. `order-common-config.ts` 外部符号使用分布
|
||||
|
||||
按 import 语句统计(含多行 import,已解析):
|
||||
|
||||
| 符号 | 引用次数 | 归类 |
|
||||
|---|---|---|
|
||||
| `getStatusTextClass` | 84 | ✅ 通用(返回 `ut-status-text` class 名) |
|
||||
| `ToolbarButtonConfig`(type) | 78 | ✅ 通用 |
|
||||
| `extractStoreListFromResponse` | 12 | ✅ 通用(货主列表解析) |
|
||||
| `fillStoreScanFieldOptions` | 7 | ✅ 通用(向 ScanBox 字段注入货主选项) |
|
||||
| `mapStoreListToSelectOptions` | 7 | ✅ 通用 |
|
||||
| `getTagType` | 2 | ⚠️ 依赖 `COMMON_TAG_TYPES` 业务字典 |
|
||||
| `scanWorkflowField` | 2 | ✅ 通用工厂 |
|
||||
| `translateOrderField` | 2 | ❌ 订单业务 |
|
||||
| `pickToolbarButtons` | 1 | ⚠️ 依赖 `ORDER_TOOLBAR_BUTTONS` 订单字典 |
|
||||
| `scanBasicField` | 1 | ✅ 通用工厂 |
|
||||
| `buyerMessageHasFilterOptions` | 1 | ❌ 订单业务 |
|
||||
| `pickStatusFilterOptions` | 1 | ❌ 订单业务 |
|
||||
| `recheckStatusFilterOptions` | 1 | ❌ 订单业务 |
|
||||
| `stockQueryScanField` | 1 | ❌ 订单业务 |
|
||||
| `translateInterceptStatus` | 1 | ❌ 订单业务 |
|
||||
| `getInterceptStatusTagType` | 1 | ❌ 订单业务 |
|
||||
| `pendingAvailableFields` | 1 | ❌ 订单业务 |
|
||||
| `buildPendingStyleColumns` | 1 | ❌ 订单业务 |
|
||||
| `fillExpressCompanyScanFieldOptions` | 1 | ✅ 通用(快递公司选项注入) |
|
||||
|
||||
**关键判断**:前 5 个符号覆盖 188 处引用,且**全部是"列表页通用 UI 工具"**,与订单业务无关。`order-common-config.ts` 之所以成为"万能垃圾桶",是因为这些工具没有独立归属。
|
||||
|
||||
### 4.1 文件内部分层(按行号)
|
||||
|
||||
| 行范围 | 内容 | 归属建议 |
|
||||
|---|---|---|
|
||||
| 1–10 | `ORDER_PAGE_CONFIG` | 订单业务(留在原地) |
|
||||
| 11–295 | `COMMON_TRANSLATIONS` / `COMMON_TAG_TYPES` | ⚠️ 半通用(状态字典),可独立成 `status-dictionary.ts` |
|
||||
| 296–345 | `ToolbarButtonConfig` / `ToolbarApiActionConfig` | ✅ 通用 → 按钮组组件同目录 `types.ts` |
|
||||
| 346–462 | 订单导出列 `ORDER_EXPORT_ALL_COLUMNS` 等 | 订单业务 |
|
||||
| 463–609 | `ORDER_TOOLBAR_BUTTONS` / `pickToolbarButtons` | 订单业务(`pickToolbarButtons` 可转为通用工具函数) |
|
||||
| 610–772 | 各类订单工具栏 API 动作 | 订单业务 |
|
||||
| 773–870 | `getStatusTextClass` / `getTagType` / `translateOrderField` | `getStatusTextClass` 通用,其余业务 |
|
||||
| 868–1232 | 订单详情分区 / 明细列配置 | 订单业务 |
|
||||
| 1233–1427 | 各类筛选项常量 | 混合(部分通用) |
|
||||
| 1428–1620 | ScanBox 字段工厂 `scanBasicField` / `scanWorkflowField` + 大量 `*ScanField` | 工厂通用,字段业务 |
|
||||
| 1616–1680 | 货主 / 快递公司选项映射工具 | ✅ 通用 |
|
||||
|
||||
---
|
||||
|
||||
## 5. `order-sub.scss` 使用细分
|
||||
|
||||
99 个引用文件中:
|
||||
|
||||
| 用途 | 文件数 | 说明 |
|
||||
|---|---|---|
|
||||
| 使用 `.order-sub-container` 布局(左 ScanBox + 右表格/分栏) | 53 | 需要完整文件 |
|
||||
| 仅使用 `.ut-status-text--*` 状态文本类 | 46 | 只需 6 行状态样式,却引入了整个容器布局 |
|
||||
|
||||
> `.ut-status-text` / `.ut-status-text--primary|success|warning|info|danger` 是唯一被"非布局页面"用到的部分,与 `getStatusTextClass` 强绑定,应作为一个整体抽成 `status-text.scss`。
|
||||
|
||||
文件本身内容极简(249 行,只有 2 个顶层选择器族):
|
||||
- `.order-sub-container`(含 `:deep()` 对 `ScanBox` 内部的改写)
|
||||
- `.ut-status-text` + 5 个修饰类
|
||||
|
||||
---
|
||||
|
||||
## 6. 依赖关系图
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
subgraph 公共层["理想公共层(尚不存在)"]
|
||||
S["样式: order-sub.scss"]
|
||||
T["组件: OrderToolbarButtonGroup"]
|
||||
C["配置: order-common-config.ts"]
|
||||
end
|
||||
|
||||
subgraph 旧模块["views/order/orderManagement"]
|
||||
S
|
||||
T
|
||||
C
|
||||
U1["utils/order-index-helpers"]
|
||||
U2["utils/stock-picker-helpers"]
|
||||
F["form/ManualWaybillForm 等"]
|
||||
W["component/CreateOrderFloatWidget 等"]
|
||||
D["组件副本: ColumnCellRenderer / DetailPanel / LogPanel"]
|
||||
end
|
||||
|
||||
P1["133 个外部 views 文件"] --> S
|
||||
P1 --> T
|
||||
P1 --> C
|
||||
L["layout/CreateOrderSessionHost"] --> W
|
||||
U2 -.反向依赖.-> ST["stock/combo_stock/combo-stock-config"]
|
||||
ST --> C
|
||||
D --> S
|
||||
D --> C
|
||||
```
|
||||
|
||||
> 图中"公共层"框内文件当前物理位置仍在 orderManagement 目录下,这是本次要解决的问题。
|
||||
|
||||
---
|
||||
|
||||
## 7. 风险点与约束
|
||||
|
||||
| # | 风险 | 说明 | 应对建议 |
|
||||
|---|---|---|---|
|
||||
| 1 | **组件与配置互相绑定** | `OrderToolbarButtonGroup.vue` 第 101 行 `import type { ToolbarButtonConfig } from '../config/order-common-config'`,只移组件不移类型会留下悬空依赖 | 类型随组件一起抽离到 `components/ToolbarButtonGroup/types.ts` |
|
||||
| 2 | **反向依赖 / 类型环** | `orderManagement/utils/stock-picker-helpers` → `stock/combo_stock/combo-stock-config` → `orderManagement/config`(type-only) | 把 `ToolbarButtonConfig` 移出后,环自动断开 |
|
||||
| 3 | **ESLint 规则收紧** | `eslint.config.js` 对 `src/views/order/orderManagement/**` 单独关闭了 `no-explicit-any`、`no-unused-vars`、`vue/attributes-order` 等 10+ 条规则;文件移到公共目录后会按全局规则校验,可能一次性冒出大量告警 | 抽离要么同步迁移规则配置(按新目录再放宽),要么先跑 lint 清账 |
|
||||
| 4 | **命名语义** | `order-sub.scss` / `OrderToolbarButtonGroup` / `order-common-config` 名字都带订单语义,但使用方遍及仓储、系统设置、视频等模块 | 抽离时同步改名(`list-page.scss` / `ToolbarButtonGroup` / `toolbar.ts`),避免"为什么仓储页面引用订单组件"的困惑 |
|
||||
| 5 | **配置整体搬迁会把业务带进公共层** | `order-common-config.ts` 有 2600+ 行是订单专属字典 | 按第 4.1 节分层拆分,业务字典留在 `views/order/` 下 |
|
||||
| 6 | **`order-sub.scss` 使用 `:deep()`** | 它要求父级是 `scoped` 样式块,抽取位置变化不影响行为,但要保持文件内容原样 | 直接搬运,不改写嵌套 |
|
||||
| 7 | **布局层常驻组件** | `layout/component/CreateOrderSessionHost.vue` 依赖订单建单悬浮窗(模块级单例 composable),这是全站常驻逻辑,不能简单当页面模板处理 | 单独作为"订单建单会话"能力评估,不并入本次通用模板抽离 |
|
||||
| 8 | **副本组件高度分散** | `ColumnCellRenderer.vue` 有 13 份(仅 2 对完全相同)、`DetailPanel.vue` 11 份(1 对相同)、`LogPanel.vue` 11 份(3 组相同),且每份都各自 `@use order-sub.scss` + 引 `getStatusTextClass` | 本次先抽"底层依赖",副本合并建议放到"页面替换"阶段一并处理 |
|
||||
|
||||
---
|
||||
|
||||
## 8. 建议的抽离方案(分层,供后续决策)
|
||||
|
||||
### 8.1 目标目录结构(建议)
|
||||
|
||||
```
|
||||
src/
|
||||
├── styles/
|
||||
│ ├── list-page.scss ← 原 order-sub.scss 的 .order-sub-container(改名)
|
||||
│ └── status-text.scss ← 原 .ut-status-text*(6 行)
|
||||
├── components/
|
||||
│ └── ToolbarButtonGroup/
|
||||
│ ├── index.vue ← 原 OrderToolbarButtonGroup.vue
|
||||
│ └── types.ts ← ToolbarButtonConfig / ToolbarApiActionConfig
|
||||
├── utils/
|
||||
│ ├── store-options.ts ← extractStoreListFromResponse / mapStoreListToSelectOptions / fillStoreScanFieldOptions
|
||||
│ ├── status-text.ts ← getStatusTextClass(配套 status-text.scss)
|
||||
│ └── scan-fields.ts ← scanBasicField / scanWorkflowField / fillExpressCompanyScanFieldOptions
|
||||
└── views/order/
|
||||
├── config/order-business-config.ts ← 订单专属字典(原 order-common-config 的主体)
|
||||
└── orderManagement/ ← 只保留订单页面自身
|
||||
```
|
||||
|
||||
> 兼容做法:抽离时在原路径保留 `export * from '...'` 的转发文件(re-export shim),可让 307 处 import 分批迁移、随时可回滚。**但注意**:`@use`(SCSS)没有等价转发能力,样式文件必须一次性全量替换。
|
||||
|
||||
### 8.2 建议执行顺序
|
||||
|
||||
1. **样式先行(无逻辑风险)**:`order-sub.scss` → `src/styles/`,一次性替换 99 处 `@use`(含内部 12 处)。
|
||||
- 顺手按 46/53 的分布拆成 `list-page.scss` + `status-text.scss`。
|
||||
2. **组件 + 类型**:`OrderToolbarButtonGroup.vue` → `src/components/ToolbarButtonGroup/`,`ToolbarButtonConfig` 一并抽出,58 处 import 替换。
|
||||
3. **通用工具函数**:`getStatusTextClass`、货主/快递选项映射、`scanBasicField/scanWorkflowField` 抽到 `src/utils/`,约 110 处引用改为新路径;`order-common-config.ts` 用 re-export 保持向后兼容。
|
||||
4. **业务字典归位**:把订单专属内容整理为 `views/order/config/order-business-config.ts`,`order-common-config.ts` 逐步削薄。
|
||||
5. **次级资产**(可选,视页面替换节奏):`order-index-helpers`、`stock-picker-helpers`、`form/ManualWaybillForm` 等,建议在替换对应页面时"就近迁移",不必提前集中。
|
||||
6. **最后**:删掉 re-export shim,`views/order/orderManagement` 回归纯业务页面。
|
||||
|
||||
### 8.3 工作量估算
|
||||
|
||||
| 阶段 | 需改动文件 | 需改写语句 | 风险 |
|
||||
|---|---|---|---|
|
||||
| ① 样式 | 99(外)+ 12(内) | 111 处 `@use` | 低(纯路径替换,可编译验证) |
|
||||
| ② 组件 + 类型 | 58 | 58 处 `import` | 低 |
|
||||
| ③ 通用工具 | ~110 | ~110 处 `import` | 中(涉及 re-export 与 ESLint 规则) |
|
||||
| ④ 业务字典归位 | 内部 ~20 | — | 中(需逐个甄别业务/通用) |
|
||||
| 合计(①②③) | ≈180 个文件 | ≈307 处语句 | — |
|
||||
|
||||
---
|
||||
|
||||
## 9. 需要特别确认的问题(留给后续)
|
||||
|
||||
1. `COMMON_TRANSLATIONS` / `COMMON_TAG_TYPES` 算"通用状态字典"还是"订单业务字典"?它被 `getTagType` 依赖,但内容明显是订单字段。
|
||||
2. `mode` 模板本身依赖 `orderManagement`,抽离后**是否同步更新 `mode`**(推荐是)?否则新复制出来的页面仍然指向旧模块。
|
||||
3. 抽离的同时是否要"改名去 Order 化"(`order-sub.scss` → `list-page.scss`、`OrderToolbarButtonGroup` → `ToolbarButtonGroup`)?改名会让 diff 变大,但能一次性解决语义错位。
|
||||
4. 是否保留 re-export 兼容层?保留则分批安全,但公共层会短暂存在两套入口。
|
||||
|
||||
---
|
||||
|
||||
## 附录 A:133 个受影响文件完整清单(按目录)
|
||||
|
||||
> 判定标准:文件内出现以下任一引用
|
||||
> `orderManagement/config/order-common-config` · `orderManagement/styles/order-sub.scss` · `orderManagement/component/OrderToolbarButtonGroup.vue`
|
||||
|
||||
### afterSale(5)
|
||||
```
|
||||
views/afterSale/list/afterSale-config.ts
|
||||
views/afterSale/list/index.vue
|
||||
views/afterSale/typelist/components/ColumnCellRenderer.vue
|
||||
views/afterSale/typelist/config/components/DetailPanel.vue
|
||||
views/afterSale/typelist/index.vue
|
||||
```
|
||||
|
||||
### data(9)
|
||||
```
|
||||
views/data/ordersummary/components/ColumnCellRenderer.vue
|
||||
views/data/ordersummary/config/components/DetailPanel.vue
|
||||
views/data/ordersummary/config/components/LogPanel.vue
|
||||
views/data/ordersummary/index.vue
|
||||
views/data/packingflow/index.vue
|
||||
views/data/packingflow/packingflow-config.ts
|
||||
views/data/returnrecord/components/ReceiveRegisterPanel.vue
|
||||
views/data/returnrecord/components/ReturnReceivedTaskPanel.vue
|
||||
views/data/returnrecord/returnReceivedTask-config.ts
|
||||
```
|
||||
|
||||
### express(14)
|
||||
```
|
||||
views/express/returnReceived/index.vue
|
||||
views/express/returnReceived/returnReceived-config.ts
|
||||
views/express/returnUnpack/components/ExportDialog.vue
|
||||
views/express/returnUnpack/components/UnpackDetailTable.vue
|
||||
views/express/returnUnpack/components/VideoListDialog.vue
|
||||
views/express/returnUnpack/index.vue
|
||||
views/express/returnUnpack/returnUnpack-config.ts
|
||||
views/express/returnwaybill/index.vue
|
||||
views/express/returnwaybill/returnwaybill-config.ts
|
||||
views/express/waybill/components/ColumnCellRenderer.vue
|
||||
views/express/waybill/components/TransferByWaybillsDialog.vue
|
||||
views/express/waybill/config/components/DetailPanel.vue
|
||||
views/express/waybill/config/components/LogPanel.vue
|
||||
views/express/waybill/index.vue
|
||||
```
|
||||
|
||||
### inbox / message / material / store / warehouses(13)
|
||||
```
|
||||
views/inbox/autoReply/index.vue
|
||||
views/inbox/group/group-config.ts
|
||||
views/inbox/group/index.vue
|
||||
views/inbox/message/index.vue
|
||||
views/inbox/message/message-config.ts
|
||||
views/message/components/CreateAfterSaleDialog.vue
|
||||
views/message/index.vue
|
||||
views/material/packageMaterial/index.vue
|
||||
views/material/packageMaterial/package-material-config.ts
|
||||
views/material/packageSupplier/index.vue
|
||||
views/material/packageSupplier/package-supplier-config.ts
|
||||
views/store/shipperSigning/index.vue
|
||||
views/store/stores/index.vue
|
||||
views/store/stores/store-config.ts
|
||||
views/warehouses/index.vue
|
||||
```
|
||||
|
||||
### mode(4,模板自身)
|
||||
```
|
||||
views/mode/components/ColumnCellRenderer.vue
|
||||
views/mode/config/components/DetailPanel.vue
|
||||
views/mode/config/components/LogPanel.vue
|
||||
views/mode/index.vue
|
||||
```
|
||||
|
||||
### order(12,旧订单页)
|
||||
```
|
||||
views/order/orderreview/index.vue
|
||||
views/order/orderreview/recheck-config.ts
|
||||
views/order/orderWeighing/config/weighing-config.ts
|
||||
views/order/orderWeighing/index.vue
|
||||
views/order/waveOrder/component/PendingOrderListPanel.vue
|
||||
views/order/waveOrder/component/WaveBatchDetailPanel.vue
|
||||
views/order/waveOrder/config/wave-config.ts
|
||||
views/order/waveOrder/FallbackOrderListPanel.vue
|
||||
views/order/waveOrder/GroupWaveBatchListPanel.vue
|
||||
views/order/waveOrder/SandanWaveBatchListPanel.vue
|
||||
views/order/waveOrder/WavePickTaskListPanel.vue
|
||||
views/order/waveOrder/WaveStrategyListPanel.vue
|
||||
```
|
||||
|
||||
### stock(9)
|
||||
```
|
||||
views/stock/combo_stock/combo-stock-config.ts
|
||||
views/stock/combo_stock/component/ComboGoodsFormDialog.vue
|
||||
views/stock/combo_stock/component/ComboGoodsSearchDialog.vue
|
||||
views/stock/combo_stock/index.vue
|
||||
views/stock/external_stock/index.vue
|
||||
views/stock/pickingShortage/components/ColumnCellRenderer.vue
|
||||
views/stock/pickingShortage/index.vue
|
||||
views/stock/stock/index.vue
|
||||
views/stock/stock/stock-config.ts
|
||||
```
|
||||
|
||||
### storage(30)
|
||||
```
|
||||
views/storage/entry/component/EntryBindingRelations.vue
|
||||
views/storage/entry/component/entrydetail.vue
|
||||
views/storage/entry/entry-config.ts
|
||||
views/storage/entry/index.vue
|
||||
views/storage/entry_owner/index.vue
|
||||
views/storage/generalreport/index.vue
|
||||
views/storage/inventory/index.vue
|
||||
views/storage/inventory/inventory-config.ts
|
||||
views/storage/log/component/TransactionDetail.vue
|
||||
views/storage/log/index.vue
|
||||
views/storage/log/log-config.ts
|
||||
views/storage/management/replenishmentDemand/index.vue
|
||||
views/storage/productflow/component/ProductflowDetail.vue
|
||||
views/storage/productflow/index.vue
|
||||
views/storage/productflow/productflow-config.ts
|
||||
views/storage/productflow/store/index.vue
|
||||
views/storage/receiving/component/Product.vue
|
||||
views/storage/receiving/index.vue
|
||||
views/storage/receiving/receiving-config.ts
|
||||
views/storage/receiving_owner/index.vue
|
||||
views/storage/report/index.vue
|
||||
views/storage/report/store.vue
|
||||
views/storage/stockcheck/components/ColumnCellRenderer.vue
|
||||
views/storage/stockcheck/config/components/CheckItemsPanel.vue
|
||||
views/storage/stockcheck/config/components/CheckRecordsPanel.vue
|
||||
views/storage/stockcheck/config/components/DetailPanel.vue
|
||||
views/storage/stockcheck/config/components/LogPanel.vue
|
||||
views/storage/stockcheck/index.vue
|
||||
views/storage/stockout/index.vue
|
||||
views/storage/stockout/stockout-config.ts
|
||||
```
|
||||
|
||||
### system(27)
|
||||
```
|
||||
views/system/setting/account/index.vue
|
||||
views/system/setting/basicManagement/newview/components/ColumnCellRenderer.vue
|
||||
views/system/setting/basicManagement/newview/config/components/DetailPanel.vue
|
||||
views/system/setting/basicManagement/newview/config/components/LogPanel.vue
|
||||
views/system/setting/basicManagement/newview/index.vue
|
||||
views/system/setting/encoding/components/CourierCodeManagement.vue
|
||||
views/system/setting/encoding/components/PlatformCodeManagement.vue
|
||||
views/system/setting/expressinterface/index.vue
|
||||
views/system/setting/permission/index.vue
|
||||
views/system/setting/pickcart/components/InfoPanel.vue
|
||||
views/system/setting/pickcart/index.vue
|
||||
views/system/setting/printcomputer/components/ColumnCellRenderer.vue
|
||||
views/system/setting/printcomputer/config/components/DetailPanel.vue
|
||||
views/system/setting/printcomputer/config/components/LogPanel.vue
|
||||
views/system/setting/printcomputer/index.vue
|
||||
views/system/setting/printStation/components/printComputer.vue
|
||||
views/system/setting/printStation/components/Printer.vue
|
||||
views/system/setting/printStation/index.vue
|
||||
views/system/setting/role/components/ColumnCellRenderer.vue
|
||||
views/system/setting/role/index.vue
|
||||
views/system/setting/role/pages/RolePermissionDialog.vue
|
||||
views/system/setting/shops/index.vue
|
||||
views/system/setting/storeExpressBindingPolicy/index.vue
|
||||
views/system/setting/workbench2/components/ColumnCellRenderer.vue
|
||||
views/system/setting/workbench2/config/components/DetailPanel.vue
|
||||
views/system/setting/workbench2/config/components/LogPanel.vue
|
||||
views/system/setting/workbench2/index.vue
|
||||
```
|
||||
|
||||
### video(8)
|
||||
```
|
||||
views/video/newcamara/components/ColumnCellRenderer.vue
|
||||
views/video/newcamara/config/components/DetailPanel.vue
|
||||
views/video/newcamara/config/components/LogPanel.vue
|
||||
views/video/newcamara/index.vue
|
||||
views/video/newcamaraserver/components/ColumnCellRenderer.vue
|
||||
views/video/newcamaraserver/config/components/DetailPanel.vue
|
||||
views/video/newcamaraserver/config/components/LogPanel.vue
|
||||
views/video/newcamaraserver/index.vue
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 附录 B:`orderManagement` 内部需同步改写的引用
|
||||
|
||||
| 项 | 数量 |
|
||||
|---|---|
|
||||
| 目录内文件总数 | 55 |
|
||||
| 内部引用 `styles/order-sub.scss` | 12 |
|
||||
| 内部引用 `config/order-common-config` | 20 |
|
||||
|
||||
引用 `order-sub.scss` 的内部文件:
|
||||
```
|
||||
component/CreatePendingOrderDialog.vue
|
||||
component/PendingOrderDetailPanel.vue
|
||||
component/TransferByOrdersDialog.vue
|
||||
form/BatchQuickRecheckForm.vue
|
||||
archiveOrder.vue
|
||||
deliveryException.vue
|
||||
deliveryOrder.vue
|
||||
entrustWarehouse.vue
|
||||
exceptionOrder.vue
|
||||
outboundOrder.vue
|
||||
pendingOrder.vue
|
||||
reviewOrder.vue
|
||||
```
|
||||
414
src/components/ToolbarButtonGroup/index.vue
Normal file
414
src/components/ToolbarButtonGroup/index.vue
Normal file
@ -0,0 +1,414 @@
|
||||
<template>
|
||||
<div ref="containerRef" class="order-toolbar-button-group" :class="{ 'order-toolbar-button-group--tile': isTileMode }">
|
||||
<div ref="mainRef" class="order-toolbar-button-group__main">
|
||||
<template v-for="button in displayButtons" :key="button.key">
|
||||
<el-dropdown
|
||||
v-if="button.buttonType === 'dropdown' && button.dropdownOptions?.length"
|
||||
trigger="click"
|
||||
split-button
|
||||
:size="button.size || 'small'"
|
||||
:type="resolveButtonStyle(button).type"
|
||||
:plain="resolveButtonStyle(button).plain"
|
||||
:disabled="resolveDisabled(button.disabledKey) || resolveLoading(button.loadingKey)"
|
||||
@click="emitAction(button.action)"
|
||||
@command="emitAction"
|
||||
>
|
||||
{{ resolveLabel(button.label, button.dynamicLabelKey) }}
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="option in button.dropdownOptions"
|
||||
:key="option.action"
|
||||
:command="option.action"
|
||||
:divided="option.divided"
|
||||
>
|
||||
{{ option.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
||||
<el-button
|
||||
v-else
|
||||
:size="button.size || 'small'"
|
||||
:type="resolveButtonStyle(button).type"
|
||||
:plain="resolveButtonStyle(button).plain"
|
||||
:disabled="resolveDisabled(button.disabledKey)"
|
||||
:loading="resolveLoading(button.loadingKey)"
|
||||
@click="emitAction(button.action)"
|
||||
>
|
||||
{{ resolveLabel(button.label, button.dynamicLabelKey) }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<el-popover
|
||||
v-if="!isTileMode && overflowButtons.length"
|
||||
v-model:visible="expandVisible"
|
||||
placement="bottom-start"
|
||||
:width="172"
|
||||
trigger="click"
|
||||
popper-class="order-toolbar-button-group__popover"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button size="small" :type="expandVisible ? 'primary' : 'default'" plain>
|
||||
展开{{ overflowButtons.length ? `(${overflowButtons.length})` : '' }}
|
||||
</el-button>
|
||||
</template>
|
||||
<div class="order-toolbar-button-group__overflow-list">
|
||||
<template v-for="button in overflowButtons" :key="`overflow-${button.key}`">
|
||||
<template v-if="button.buttonType === 'dropdown' && button.dropdownOptions?.length">
|
||||
<el-button
|
||||
v-for="option in button.dropdownOptions"
|
||||
:key="`overflow-${button.key}-${option.action}`"
|
||||
:size="button.size || 'small'"
|
||||
:type="resolveButtonStyle(button).type"
|
||||
:plain="resolveButtonStyle(button).plain"
|
||||
:disabled="resolveDisabled(button.disabledKey)"
|
||||
:loading="resolveLoading(button.loadingKey)"
|
||||
class="order-toolbar-button-group__overflow-item"
|
||||
@click="handleOverflowClick(option.action)"
|
||||
>
|
||||
{{ resolveLabel(button.label, button.dynamicLabelKey) }} · {{ option.label }}
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button
|
||||
v-else
|
||||
:size="button.size || 'small'"
|
||||
:type="resolveButtonStyle(button).type"
|
||||
:plain="resolveButtonStyle(button).plain"
|
||||
:disabled="resolveDisabled(button.disabledKey)"
|
||||
:loading="resolveLoading(button.loadingKey)"
|
||||
class="order-toolbar-button-group__overflow-item"
|
||||
@click="handleOverflowClick(button.action)"
|
||||
>
|
||||
{{ resolveLabel(button.label, button.dynamicLabelKey) }}
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
|
||||
<div class="order-toolbar-button-group__mode-toggle" @click="toggleToolbarMode">
|
||||
<el-tooltip :content="isTileMode ? '切换到折叠模式' : '切换到平铺模式'" placement="bottom">
|
||||
<el-icon :size="14"><Grid v-if="isTileMode" /><Fold v-else /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import type { ToolbarButtonConfig } from './types'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { Grid, Fold } from '@element-plus/icons-vue'
|
||||
|
||||
const props = defineProps<{
|
||||
buttons: ToolbarButtonConfig[]
|
||||
resolveDisabled: (disabledKey?: string) => boolean
|
||||
resolveLoading: (loadingKey?: string) => boolean
|
||||
resolveLabel: (defaultLabel: string, dynamicLabelKey?: string) => string
|
||||
layoutKey?: string | number
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'action', action: ToolbarButtonConfig['action']): void
|
||||
}>()
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const isTileMode = computed(() => settingsStore.toolbarMode !== 'collapse')
|
||||
const displayButtons = computed(() => isTileMode.value ? props.buttons : visibleButtons.value)
|
||||
|
||||
const toggleToolbarMode = () => {
|
||||
settingsStore.changeSetting({
|
||||
key: 'toolbarMode',
|
||||
value: isTileMode.value ? 'collapse' : 'tile'
|
||||
})
|
||||
}
|
||||
|
||||
const containerRef = ref<HTMLElement | null>(null)
|
||||
const mainRef = ref<HTMLElement | null>(null)
|
||||
const visibleButtons = ref<ToolbarButtonConfig[]>([])
|
||||
const overflowButtons = ref<ToolbarButtonConfig[]>([])
|
||||
const expandVisible = ref(false)
|
||||
|
||||
let resizeObserver: ResizeObserver | null = null
|
||||
let layoutFrame = 0
|
||||
|
||||
function emitAction(action: ToolbarButtonConfig['action']) {
|
||||
emit('action', action)
|
||||
}
|
||||
|
||||
/** 按钮 key → 强制样式覆盖,仅用于跨视图统一特定按钮样式 */
|
||||
const BUTTON_STYLE_OVERRIDE: Record<string, { type: string; plain: boolean }> = {
|
||||
// 各视图通过 category + type 自行控制样式
|
||||
}
|
||||
|
||||
/** 根据 category 或 type/plain 解析按钮样式 */
|
||||
function resolveButtonStyle(button: ToolbarButtonConfig): { type: string; plain: boolean } {
|
||||
// 优先检查强制覆盖
|
||||
const override = BUTTON_STYLE_OVERRIDE[button.key]
|
||||
if (override) return override
|
||||
|
||||
switch (button.category) {
|
||||
case 'refresh': return { type: 'primary', plain: false }
|
||||
case 'setting': return { type: 'default', plain: false }
|
||||
case 'action':
|
||||
if (button.type) return { type: button.type, plain: false }
|
||||
return { type: 'primary', plain: true }
|
||||
case 'cancel': return { type: 'danger', plain: true }
|
||||
default: return { type: button.type || 'default', plain: !!button.plain }
|
||||
}
|
||||
}
|
||||
|
||||
function handleOverflowClick(action: ToolbarButtonConfig['action']) {
|
||||
expandVisible.value = false
|
||||
emitAction(action)
|
||||
}
|
||||
|
||||
function isMainOverflowing() {
|
||||
const mainEl = mainRef.value
|
||||
if (!mainEl) return false
|
||||
return mainEl.scrollWidth > mainEl.clientWidth + 1
|
||||
}
|
||||
|
||||
async function trimVisibleUntilFits() {
|
||||
const buttons = props.buttons
|
||||
if (!buttons.length) {
|
||||
visibleButtons.value = []
|
||||
overflowButtons.value = []
|
||||
return
|
||||
}
|
||||
|
||||
visibleButtons.value = [...buttons]
|
||||
overflowButtons.value = []
|
||||
|
||||
await nextTick()
|
||||
|
||||
let guard = 0
|
||||
while (isMainOverflowing() && visibleButtons.value.length > 0 && guard < buttons.length + 1) {
|
||||
guard += 1
|
||||
const removed = visibleButtons.value.pop()
|
||||
if (!removed) break
|
||||
overflowButtons.value.unshift(removed)
|
||||
await nextTick()
|
||||
}
|
||||
|
||||
if (!visibleButtons.value.length && overflowButtons.value.length) {
|
||||
const first = overflowButtons.value[0]
|
||||
if (!first) return
|
||||
visibleButtons.value = [first]
|
||||
overflowButtons.value = overflowButtons.value.slice(1)
|
||||
await nextTick()
|
||||
while (isMainOverflowing() && visibleButtons.value.length > 0 && overflowButtons.value.length > 0 && guard < buttons.length + 2) {
|
||||
guard += 1
|
||||
const removed = visibleButtons.value.pop()
|
||||
if (!removed) break
|
||||
overflowButtons.value.unshift(removed)
|
||||
await nextTick()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function scheduleLayout() {
|
||||
// 平铺模式不需要溢出检测
|
||||
if (isTileMode.value) return
|
||||
const frame = ++layoutFrame
|
||||
await nextTick()
|
||||
if (frame !== layoutFrame) return
|
||||
await trimVisibleUntilFits()
|
||||
}
|
||||
|
||||
function setupResizeObserver() {
|
||||
resizeObserver?.disconnect()
|
||||
resizeObserver = new ResizeObserver(() => {
|
||||
void scheduleLayout()
|
||||
})
|
||||
|
||||
const parent = containerRef.value?.parentElement
|
||||
if (parent) resizeObserver.observe(parent)
|
||||
if (containerRef.value) resizeObserver.observe(containerRef.value)
|
||||
if (mainRef.value) resizeObserver.observe(mainRef.value)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
visibleButtons.value = [...props.buttons]
|
||||
setupResizeObserver()
|
||||
void scheduleLayout()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
resizeObserver?.disconnect()
|
||||
resizeObserver = null
|
||||
})
|
||||
|
||||
watch(
|
||||
() => [props.buttons, props.layoutKey],
|
||||
() => {
|
||||
void scheduleLayout()
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
// 模式切换时重新布局
|
||||
watch(isTileMode, () => {
|
||||
if (!isTileMode.value) {
|
||||
visibleButtons.value = [...props.buttons]
|
||||
void scheduleLayout()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.order-toolbar-button-group {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group--tile {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group__main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group--tile .order-toolbar-button-group__main {
|
||||
overflow: visible;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
/* 平铺模式下切换按钮绝对定位到右上角,不参与按钮流 */
|
||||
.order-toolbar-button-group--tile .order-toolbar-button-group__mode-toggle {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group__main :deep(.el-dropdown) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 清除 Element Plus 默认 .el-button + .el-button 左边距,
|
||||
换行时每行首个按钮不会多出间隙,统一由 gap 控制等间距 */
|
||||
.order-toolbar-button-group__main :deep(.el-button),
|
||||
.order-toolbar-button-group__main :deep(.el-dropdown) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group__overflow-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group__overflow-item {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group__mode-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
min-width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 4px;
|
||||
background: #e8e8e8;
|
||||
cursor: pointer;
|
||||
color: #909399;
|
||||
transition: all 0.3s;
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
|
||||
&:hover {
|
||||
background: #d0d0d0;
|
||||
color: #409EFF;
|
||||
}
|
||||
}
|
||||
|
||||
/* 禁用按钮样式优化:保持字体颜色可读,背景极浅区分状态 */
|
||||
.order-toolbar-button-group__main :deep(.el-button.is-disabled),
|
||||
.order-toolbar-button-group__main :deep(.el-button.is-disabled:hover),
|
||||
.order-toolbar-button-group__main :deep(.el-button.is-disabled:focus),
|
||||
.order-toolbar-button-group__main :deep(.el-button.is-disabled:active) {
|
||||
color: #606266;
|
||||
background-color: #fafbfc;
|
||||
border-color: #ebeef5;
|
||||
}
|
||||
|
||||
/* primary 禁用:保持蓝字可见,极浅蓝背景 */
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-disabled),
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-disabled:hover),
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-disabled:focus),
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-disabled:active) {
|
||||
color: #409eff;
|
||||
background-color: #f5faff;
|
||||
border-color: #e4efff;
|
||||
}
|
||||
|
||||
/* primary + plain 禁用:白底蓝字 */
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-plain.is-disabled),
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-plain.is-disabled:hover),
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-plain.is-disabled:focus),
|
||||
.order-toolbar-button-group__main :deep(.el-button--primary.is-plain.is-disabled:active) {
|
||||
color: #409eff;
|
||||
background-color: #fff;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
/* danger 禁用:白底红字 */
|
||||
.order-toolbar-button-group__main :deep(.el-button--danger.is-disabled),
|
||||
.order-toolbar-button-group__main :deep(.el-button--danger.is-disabled:hover),
|
||||
.order-toolbar-button-group__main :deep(.el-button--danger.is-disabled:focus),
|
||||
.order-toolbar-button-group__main :deep(.el-button--danger.is-disabled:active) {
|
||||
color: #f56c6c;
|
||||
background-color: #fff;
|
||||
border-color: #f56c6c;
|
||||
}
|
||||
|
||||
/* 溢出列表中的 disabled 按钮同样适用 */
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--primary.is-plain.is-disabled),
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--primary.is-plain.is-disabled:hover),
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--primary.is-plain.is-disabled:focus),
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--primary.is-plain.is-disabled:active) {
|
||||
color: #409eff;
|
||||
background-color: #fff;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--danger.is-disabled),
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--danger.is-disabled:hover),
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--danger.is-disabled:focus),
|
||||
.order-toolbar-button-group__overflow-list :deep(.el-button--danger.is-disabled:active) {
|
||||
color: #f56c6c;
|
||||
background-color: #fff;
|
||||
border-color: #f56c6c;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
.order-toolbar-button-group__popover {
|
||||
padding: 10px !important;
|
||||
}
|
||||
</style>
|
||||
38
src/components/ToolbarButtonGroup/types.ts
Normal file
38
src/components/ToolbarButtonGroup/types.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 工具栏按钮组配置类型
|
||||
*
|
||||
* 从 `views/order/orderManagement/config/order-common-config.ts` 抽离,
|
||||
* 供 `@/components/ToolbarButtonGroup` 与各页面 `*-config.ts` 共用。
|
||||
*/
|
||||
|
||||
export interface ToolbarButtonConfig {
|
||||
key: string
|
||||
label: string
|
||||
dynamicLabelKey?: string
|
||||
size?: '' | 'default' | 'small' | 'large'
|
||||
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
||||
plain?: boolean
|
||||
loadingKey?: string
|
||||
disabledKey?: string
|
||||
action: string
|
||||
/** 按钮样式分类(优先级高于 type/plain):
|
||||
* 'refresh' - 蓝底白字(primary)
|
||||
* 'setting' - 白底黑字(default)
|
||||
* 'action' - 白底蓝边框蓝字(primary + plain)
|
||||
* 'cancel' - 红底白字(danger)
|
||||
* 不设置则沿用 type/plain */
|
||||
category?: 'refresh' | 'setting' | 'action' | 'cancel'
|
||||
/** 下拉按钮:主按钮点击 action,菜单项使用 dropdownOptions[].action */
|
||||
buttonType?: 'default' | 'dropdown'
|
||||
dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }>
|
||||
}
|
||||
|
||||
export interface ToolbarApiActionConfig {
|
||||
action: string
|
||||
apiMethod: string
|
||||
payloadKey?: string
|
||||
confirmText?: string
|
||||
confirmType?: 'warning' | 'error' | 'info' | 'success'
|
||||
successText: string
|
||||
failText: string
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="upper-table-container" :class="tableSize">
|
||||
<div class="upper-table-container" :class="[tableSize, { 'is-fixed-row-height': virtualOscillating }]">
|
||||
<!-- 表格区域 -->
|
||||
<div class="table-container" ref="tableContainer">
|
||||
<el-table
|
||||
@ -658,6 +658,36 @@ let scrollRaf: number | null = null
|
||||
const columnConfigListRef = ref<HTMLElement | null>(null)
|
||||
const virtualScrollTop = ref(0)
|
||||
const virtualViewportHeight = ref(0)
|
||||
/** 实测数据行行高(可视区数据行高度中位数),0 = 尚未测到;用于修正 spacer 占位高度 */
|
||||
const measuredRowHeight = ref(0)
|
||||
/** 已生效到虚拟窗口的滚动方向(滚动中变化不立即改缓冲区,避免窗口行数闪变触发整表重建) */
|
||||
const windowScrollDirection = ref<'up' | 'down'>('down')
|
||||
/** tableRenderData 数组复用缓存(窗口内容未变时返回同一引用,跳过 el-table 全量重算) */
|
||||
let renderRowsCache: {
|
||||
source: unknown
|
||||
start: number
|
||||
end: number
|
||||
top: number
|
||||
bottom: number
|
||||
firstRow: unknown
|
||||
lastRow: unknown
|
||||
rows: any[]
|
||||
} | null = null
|
||||
/** 行 key 缓存(多列单元格重复取 key,避免每次调用 rowKey 函数) */
|
||||
const rowKeyCache = new WeakMap<object, unknown>()
|
||||
/** 多值单号解析缓存(copyAction 列每单元格会被多次求值) */
|
||||
const copyCodesCache = new WeakMap<object, Map<string, string[]>>()
|
||||
/** 超长文本收起结果的完整文本缓存(避免重复 formatter + 去标签正则) */
|
||||
const textCollapseCache = new WeakMap<object, Map<string, string>>()
|
||||
/** 虚拟滚动高度抖动兜底(见 enableFixedRowHeightFallback) */
|
||||
const virtualOscillating = ref(false)
|
||||
/** 滚动窗口更新后校正 scrollTop 的 rAF 句柄 */
|
||||
let reconcileRaf: number | null = null
|
||||
/** 连续被浏览器改写 scrollTop 的次数(用于识别死循环) */
|
||||
let reconcilePasses = 0
|
||||
let reconcileResetTimer: ReturnType<typeof setTimeout> | null = null
|
||||
/** 观察滚动区域尺寸变化,窗口缩放/详情区拖拽时同步视口高度 */
|
||||
let tableResizeObserver: ResizeObserver | null = null
|
||||
/** 当前滚动方向(方案⑥:方向感知 buffer,减少向上滚动"真空期") */
|
||||
const scrollDirection = ref<'up' | 'down'>('down')
|
||||
/** 方案⑦:滚动停止后统一更新窗口的防抖定时器 */
|
||||
@ -800,32 +830,47 @@ const columnConfigDialogSections = computed(() => {
|
||||
})
|
||||
|
||||
// Computed
|
||||
const virtualRowHeight = computed(() => {
|
||||
/**
|
||||
* 各尺寸下 el-table 的理论单行高度(含 1px 分隔线),仅作兜底。
|
||||
* 真实行高会在渲染后实测(measuredRowHeight):行高与 spacer 占位不一致会让
|
||||
* 表格内容总高度随虚拟窗口变化,表现为滚动时行位置跳动、滚动条来回弹。
|
||||
*/
|
||||
const assumedRowHeight = computed(() => {
|
||||
if (props.tableSize === 'large') return 49
|
||||
if (props.tableSize === 'default') return 41
|
||||
return 33
|
||||
return 32
|
||||
})
|
||||
|
||||
/** 虚拟滚动计算用行高:优先实测值,兜底理论值 */
|
||||
const virtualRowHeight = computed(() => {
|
||||
return measuredRowHeight.value > 0 ? measuredRowHeight.value : assumedRowHeight.value
|
||||
})
|
||||
|
||||
const shouldUseVirtual = computed(() => {
|
||||
return props.data.length >= props.virtualThreshold
|
||||
})
|
||||
|
||||
/** 模式驱动的 buffer 基数(方案⑨+性能优化):performance=12(对称),resource=8(方向×2 省资源) */
|
||||
/** 模式驱动的 buffer 基数:performance=10(配合方向侧加倍 → 单侧 20 行滚动余量),resource=8 */
|
||||
const effectiveBufferRows = computed(() => {
|
||||
return activeTableMode.value === 'performance'
|
||||
? Math.max(8, Math.floor(props.virtualBufferRows * 0.75))
|
||||
? Math.max(8, Math.floor(props.virtualBufferRows * 0.625))
|
||||
: Math.max(4, Math.floor(props.virtualBufferRows / 2))
|
||||
})
|
||||
|
||||
/** 方向感知缓冲行数(方案⑥):resource 模式方向侧加倍省资源;performance 模式对称,避免方向切换 buffer 突变的偶发大重渲染 */
|
||||
/**
|
||||
* 方向感知缓冲行数(方案⑥):滚动方向一侧加倍。
|
||||
* 缓冲只在下一次窗口更新时生效(windowScrollDirection),避免滚动中 buffer 闪变触发整表重建。
|
||||
*/
|
||||
const virtualTopBufferRows = computed(() => {
|
||||
if (activeTableMode.value === 'performance') return effectiveBufferRows.value
|
||||
return scrollDirection.value === 'up' ? effectiveBufferRows.value * 2 : effectiveBufferRows.value
|
||||
return windowScrollDirection.value === 'up'
|
||||
? effectiveBufferRows.value * 2
|
||||
: effectiveBufferRows.value
|
||||
})
|
||||
|
||||
const virtualBottomBufferRows = computed(() => {
|
||||
if (activeTableMode.value === 'performance') return effectiveBufferRows.value
|
||||
return scrollDirection.value === 'down' ? effectiveBufferRows.value * 2 : effectiveBufferRows.value
|
||||
return windowScrollDirection.value === 'down'
|
||||
? effectiveBufferRows.value * 2
|
||||
: effectiveBufferRows.value
|
||||
})
|
||||
|
||||
const virtualVisibleCount = computed(() => {
|
||||
@ -835,7 +880,8 @@ const virtualVisibleCount = computed(() => {
|
||||
if (props.virtualMaxVisibleRows > 0) {
|
||||
return Math.min(props.virtualMaxVisibleRows, viewportCount)
|
||||
}
|
||||
return viewportCount
|
||||
// 量化到 4 行:滚动条出现/消失造成的 1-2 行波动不再触发整表重建
|
||||
return Math.ceil(viewportCount / 4) * 4
|
||||
})
|
||||
|
||||
const virtualStartIndex = computed(() => {
|
||||
@ -850,12 +896,13 @@ const virtualEndIndex = computed(() => {
|
||||
|
||||
const virtualTopPadding = computed(() => {
|
||||
if (!shouldUseVirtual.value) return 0
|
||||
return virtualStartIndex.value * virtualRowHeight.value
|
||||
// 取整避免亚像素累积:spacer 与真实行高的小数差会被浏览器逐行取整放大
|
||||
return Math.round(virtualStartIndex.value * virtualRowHeight.value)
|
||||
})
|
||||
|
||||
const virtualBottomPadding = computed(() => {
|
||||
if (!shouldUseVirtual.value) return 0
|
||||
return Math.max(0, (props.data.length - virtualEndIndex.value) * virtualRowHeight.value)
|
||||
return Math.max(0, Math.round((props.data.length - virtualEndIndex.value) * virtualRowHeight.value))
|
||||
})
|
||||
|
||||
const virtualVisibleRows = computed(() => {
|
||||
@ -865,13 +912,35 @@ const virtualVisibleRows = computed(() => {
|
||||
|
||||
const tableRenderData = computed(() => {
|
||||
if (!shouldUseVirtual.value) return props.data
|
||||
const start = virtualStartIndex.value
|
||||
const end = virtualEndIndex.value
|
||||
const top = virtualTopPadding.value
|
||||
const bottom = virtualBottomPadding.value
|
||||
// 窗口内容没变时复用同一数组引用:Vue 的 computed 不会把"引用没变"通知给 el-table,
|
||||
// 从而避免一次耗时数百毫秒的 :data 全量重算(滚动方向/视口几像素变化经常命中)
|
||||
const cache = renderRowsCache
|
||||
if (cache && cache.source === props.data && cache.start === start && cache.end === end
|
||||
&& cache.top === top && cache.bottom === bottom
|
||||
&& cache.firstRow === props.data[start] && cache.lastRow === props.data[end - 1]) {
|
||||
return cache.rows
|
||||
}
|
||||
const rows: any[] = []
|
||||
if (virtualTopPadding.value > 0) {
|
||||
rows.push(createVirtualSpacerRow('top', virtualTopPadding.value))
|
||||
if (top > 0) {
|
||||
rows.push(createVirtualSpacerRow('top', top))
|
||||
}
|
||||
rows.push(...virtualVisibleRows.value)
|
||||
if (virtualBottomPadding.value > 0) {
|
||||
rows.push(createVirtualSpacerRow('bottom', virtualBottomPadding.value))
|
||||
if (bottom > 0) {
|
||||
rows.push(createVirtualSpacerRow('bottom', bottom))
|
||||
}
|
||||
renderRowsCache = {
|
||||
source: props.data,
|
||||
start,
|
||||
end,
|
||||
top,
|
||||
bottom,
|
||||
firstRow: props.data[start],
|
||||
lastRow: props.data[end - 1],
|
||||
rows
|
||||
}
|
||||
return rows
|
||||
})
|
||||
@ -952,6 +1021,10 @@ onMounted(() => {
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
unbindBodyScroll()
|
||||
if (tableResizeObserver) {
|
||||
tableResizeObserver.disconnect()
|
||||
tableResizeObserver = null
|
||||
}
|
||||
stopColumnConfigAutoScroll()
|
||||
})
|
||||
|
||||
@ -991,6 +1064,7 @@ function handleTableModeChange(mode: 'performance' | 'resource') {
|
||||
function resetVirtualScrollState() {
|
||||
virtualScrollTop.value = 0
|
||||
scrollDirection.value = 'down'
|
||||
windowScrollDirection.value = 'down'
|
||||
lastWindowSyncTime = 0
|
||||
if (scrollSettleTimer !== null) {
|
||||
clearTimeout(scrollSettleTimer)
|
||||
@ -1136,20 +1210,40 @@ function resolveCopyRawValue(row: any, column: ColumnItem): unknown {
|
||||
}
|
||||
|
||||
function getCopyActionCodes(row: any, column: ColumnItem): string[] {
|
||||
const prop = String(column.prop || '')
|
||||
const cacheable = !!row && typeof row === 'object'
|
||||
if (cacheable) {
|
||||
const rowCache = copyCodesCache.get(row)
|
||||
const cached = rowCache?.get(prop)
|
||||
if (cached) return cached
|
||||
}
|
||||
let codes: string[]
|
||||
if (typeof column.copyValue === 'function') {
|
||||
const result = column.copyValue(row)
|
||||
if (Array.isArray(result)) {
|
||||
return result.map((item) => String(item ?? '').trim()).filter(Boolean)
|
||||
codes = result.map((item) => String(item ?? '').trim()).filter(Boolean)
|
||||
} else {
|
||||
const text = getCopyableCellText(result)
|
||||
codes = text ? [text] : []
|
||||
}
|
||||
} else {
|
||||
const raw = resolveCopyRawValue(row, column)
|
||||
if (column.copyAction === 'copy') {
|
||||
const text = getCopyableCellText(raw)
|
||||
codes = text ? [text] : []
|
||||
} else {
|
||||
codes = parseMultiValueCodes(raw)
|
||||
}
|
||||
const text = getCopyableCellText(result)
|
||||
return text ? [text] : []
|
||||
}
|
||||
const raw = resolveCopyRawValue(row, column)
|
||||
if (column.copyAction === 'copy') {
|
||||
const text = getCopyableCellText(raw)
|
||||
return text ? [text] : []
|
||||
if (cacheable) {
|
||||
let rowCache = copyCodesCache.get(row)
|
||||
if (!rowCache) {
|
||||
rowCache = new Map()
|
||||
copyCodesCache.set(row, rowCache)
|
||||
}
|
||||
rowCache.set(prop, codes)
|
||||
}
|
||||
return parseMultiValueCodes(raw)
|
||||
return codes
|
||||
}
|
||||
|
||||
function getCopyActionTitle(column: ColumnItem) {
|
||||
@ -1254,19 +1348,35 @@ function getTextCollapseLimit(column: ColumnItem): number {
|
||||
|
||||
/** 收起列用于判断长度的完整文本:优先 textCollapseValue,其次 formatter(去 HTML 标签),最后行字段原值 */
|
||||
function getTextCollapseFullText(row: any, column: ColumnItem, index: number): string {
|
||||
const prop = String(column.prop || '')
|
||||
const cacheable = !!row && typeof row === 'object'
|
||||
if (cacheable) {
|
||||
const cached = textCollapseCache.get(row)?.get(prop)
|
||||
if (cached !== undefined) return cached
|
||||
}
|
||||
let text = ''
|
||||
if (typeof column.textCollapseValue === 'function') {
|
||||
const value = column.textCollapseValue(row, column, index)
|
||||
return value === undefined || value === null ? '' : String(value)
|
||||
text = value === undefined || value === null ? '' : String(value)
|
||||
} else if (typeof column.formatter === 'function') {
|
||||
text = getFormattedCell(row, column, row?.[column.prop || ''], index).replace(/<[^>]*>/g, '')
|
||||
} else {
|
||||
const value = row?.[column.prop || '']
|
||||
if (value !== undefined && value !== null) {
|
||||
text = Array.isArray(value)
|
||||
? value.map((item) => String(item ?? '').trim()).filter(Boolean).join('|')
|
||||
: String(value)
|
||||
}
|
||||
}
|
||||
if (typeof column.formatter === 'function') {
|
||||
return getFormattedCell(row, column, row?.[column.prop || ''], index).replace(/<[^>]*>/g, '')
|
||||
if (cacheable) {
|
||||
let rowCache = textCollapseCache.get(row)
|
||||
if (!rowCache) {
|
||||
rowCache = new Map()
|
||||
textCollapseCache.set(row, rowCache)
|
||||
}
|
||||
rowCache.set(prop, text)
|
||||
}
|
||||
const value = row?.[column.prop || '']
|
||||
if (value === undefined || value === null) return ''
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((item) => String(item ?? '').trim()).filter(Boolean).join('|')
|
||||
}
|
||||
return String(value)
|
||||
return text
|
||||
}
|
||||
|
||||
function getTextCellKey(row: any, column: ColumnItem) {
|
||||
@ -1814,10 +1924,14 @@ function getRowKey(row: any) {
|
||||
if (isVirtualSpacerRow(row)) {
|
||||
return `virtual-${row.__virtualSpacerType}`
|
||||
}
|
||||
if (typeof props.rowKey === 'function') {
|
||||
return props.rowKey(row)
|
||||
if (row && typeof row === 'object') {
|
||||
const cached = rowKeyCache.get(row)
|
||||
if (cached !== undefined) return cached
|
||||
const key = typeof props.rowKey === 'function' ? props.rowKey(row) : row[props.rowKey]
|
||||
rowKeyCache.set(row, key)
|
||||
return key
|
||||
}
|
||||
return row[props.rowKey]
|
||||
return typeof props.rowKey === 'function' ? props.rowKey(row) : row?.[props.rowKey]
|
||||
}
|
||||
|
||||
function createVirtualSpacerRow(type: 'top' | 'bottom', height: number): VirtualSpacerRow {
|
||||
@ -1832,6 +1946,8 @@ function isVirtualSpacerRow(row: any): row is VirtualSpacerRow {
|
||||
return !!row && row.__virtualSpacer === true
|
||||
}
|
||||
|
||||
const EMPTY_ROW_STYLE: Record<string, string> = {}
|
||||
|
||||
function getRowClassName({ row }: { row: any }) {
|
||||
if (isVirtualSpacerRow(row)) return 'virtual-spacer-row'
|
||||
if (typeof props.rowClassName === 'function') {
|
||||
@ -1842,32 +1958,150 @@ function getRowClassName({ row }: { row: any }) {
|
||||
}
|
||||
|
||||
function getRowStyle({ row }: { row: any }) {
|
||||
if (!isVirtualSpacerRow(row)) return {}
|
||||
if (!isVirtualSpacerRow(row)) return EMPTY_ROW_STYLE
|
||||
return {
|
||||
height: `${row.__virtualSpacerHeight}px`
|
||||
}
|
||||
}
|
||||
|
||||
/** 测量可视区数据行的真实行高(中位数),用于修正 spacer 占位高度 */
|
||||
function measureRenderedRowHeight() {
|
||||
if (!shouldUseVirtual.value) return
|
||||
const wrap = bodyScrollEl.value
|
||||
if (!wrap) return
|
||||
const rowEls = wrap.querySelectorAll<HTMLElement>('.el-table__body tbody tr.el-table__row')
|
||||
if (!rowEls.length) return
|
||||
const heights: number[] = []
|
||||
rowEls.forEach((tr) => {
|
||||
if (tr.classList.contains('virtual-spacer-row')) return
|
||||
const h = tr.getBoundingClientRect().height
|
||||
if (h > 0) heights.push(h)
|
||||
})
|
||||
if (!heights.length) return
|
||||
heights.sort((a, b) => a - b)
|
||||
const median = heights[Math.floor(heights.length / 2)] || 0
|
||||
if (!median) return
|
||||
// 只吸收 > 1px 的偏差:亚像素差异不值得再触发一次全量重算
|
||||
if (measuredRowHeight.value === 0 || Math.abs(median - measuredRowHeight.value) > 1) {
|
||||
measuredRowHeight.value = Math.round(median * 100) / 100
|
||||
}
|
||||
}
|
||||
|
||||
/** 兜底:实际行高与占位高度始终对不上时,强制固定行高(CSS)打断滚动抖动循环 */
|
||||
function enableFixedRowHeightFallback() {
|
||||
if (virtualOscillating.value) return
|
||||
virtualOscillating.value = true
|
||||
measuredRowHeight.value = assumedRowHeight.value
|
||||
console.warn('[UpperTable] 检测到虚拟滚动高度抖动,已启用固定行高兜底渲染(长文本改为单行省略)')
|
||||
// CSS 固定行高生效后会改变内容总高度,立即再对齐一次 scrollTop
|
||||
nextTick(() => {
|
||||
scheduleScrollReconcile()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染后校正滚动位置。
|
||||
* el-table 的 :data 被替换后若内容总高度变化,浏览器会改写 scrollTop,
|
||||
* 进而触发 scroll 事件 → 再次更新窗口 → 再次改写,形成"滚动条上下弹、内容不更新"的死循环。
|
||||
* 这里以浏览器最终位置为准对齐窗口,使下一轮 scroll 事件不再触发重渲染;连续 3 次仍被改写则兜底。
|
||||
*/
|
||||
function scheduleScrollReconcile() {
|
||||
nextTick(() => {
|
||||
if (reconcileRaf !== null) cancelAnimationFrame(reconcileRaf)
|
||||
reconcileRaf = requestAnimationFrame(() => {
|
||||
reconcileRaf = null
|
||||
const wrap = bodyScrollEl.value
|
||||
if (!wrap || !shouldUseVirtual.value) return
|
||||
const actual = wrap.scrollTop || 0
|
||||
if (Math.abs(actual - virtualScrollTop.value) <= 1) {
|
||||
reconcilePasses = 0
|
||||
return
|
||||
}
|
||||
reconcilePasses += 1
|
||||
if (reconcilePasses >= 3) {
|
||||
reconcilePasses = 0
|
||||
enableFixedRowHeightFallback()
|
||||
return
|
||||
}
|
||||
virtualScrollTop.value = actual
|
||||
if (reconcileResetTimer !== null) clearTimeout(reconcileResetTimer)
|
||||
reconcileResetTimer = setTimeout(() => {
|
||||
reconcileResetTimer = null
|
||||
reconcilePasses = 0
|
||||
}, 800)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** 渲染结束后测量行高(测量结果会反过来影响 spacer,故只在偏差 > 1px 时更新) */
|
||||
function scheduleRowHeightMeasure() {
|
||||
nextTick(() => {
|
||||
requestAnimationFrame(() => {
|
||||
measureRenderedRowHeight()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** 视口高度只在 ResizeObserver / 首次绑定时读取,滚动中不再读取 clientHeight(避免每帧强制 reflow) */
|
||||
function updateViewportHeight() {
|
||||
const height = bodyScrollEl.value?.clientHeight || 0
|
||||
if (Math.abs(height - virtualViewportHeight.value) > 1) virtualViewportHeight.value = height
|
||||
}
|
||||
|
||||
/** 上次滚动中预取的时间戳(节流用,避免连续重建把主线程占满) */
|
||||
let lastPrefetchAt = 0
|
||||
|
||||
/**
|
||||
* 滚动中预取:视口一旦脱离"已渲染窗口",立即(节流)补一次窗口,
|
||||
* 避免快速向上/向下滚动时出现整片白屏、要等停止后才加载数据。
|
||||
* 只有真正越界才触发,正常小步滚动仍在 buffer 内,不会增加重建次数。
|
||||
*/
|
||||
function maybePrefetchWindow(top: number) {
|
||||
if (!shouldUseVirtual.value) return
|
||||
const rowHeight = virtualRowHeight.value
|
||||
const viewportHeight = virtualViewportHeight.value
|
||||
if (!rowHeight || !viewportHeight) return
|
||||
const start = virtualStartIndex.value
|
||||
const end = virtualEndIndex.value
|
||||
const firstVisible = Math.floor(top / rowHeight)
|
||||
const lastVisible = Math.ceil((top + viewportHeight) / rowHeight)
|
||||
// 视口仍完整落在已渲染窗口内(预留 1 行余量)→ 无需预取
|
||||
if (firstVisible >= start + 1 && lastVisible <= end - 1) return
|
||||
const now = Date.now()
|
||||
const minInterval = activeTableMode.value === 'performance' ? 150 : 300
|
||||
if (now - lastPrefetchAt < minInterval) return
|
||||
lastPrefetchAt = now
|
||||
windowScrollDirection.value = scrollDirection.value
|
||||
virtualScrollTop.value = top
|
||||
}
|
||||
|
||||
function handleBodyScroll() {
|
||||
if (scrollRaf !== null) return
|
||||
scrollRaf = requestAnimationFrame(() => {
|
||||
scrollRaf = null
|
||||
if (!bodyScrollEl.value) return
|
||||
const top = bodyScrollEl.value.scrollTop || 0
|
||||
const height = bodyScrollEl.value.clientHeight || 0
|
||||
// 检测滚动方向:向上滚动时顶部 buffer 加倍,减少向上滚动"真空期"(方案⑥)
|
||||
if (top > virtualScrollTop.value) scrollDirection.value = 'down'
|
||||
else if (top < virtualScrollTop.value) scrollDirection.value = 'up'
|
||||
if (height !== virtualViewportHeight.value) virtualViewportHeight.value = height
|
||||
if (top === virtualScrollTop.value) return
|
||||
// 抖动校正后 scrollTop 与窗口一致,直接跳过,避免"渲染 → 改写 scrollTop → 再渲染"死循环
|
||||
if (Math.abs(top - virtualScrollTop.value) < 1) return
|
||||
// 滚动中越界预取(否则快速滚动时会白屏,直到停止后才补数据)
|
||||
maybePrefetchWindow(top)
|
||||
// 方案⑨+优化:两种模式滚动中都冻结窗口(避免每次滚动触发 el-table :data 全量重算 ~300ms 卡顿),
|
||||
// 停止滚动后统一更新。performance 用更短 debounce(60ms)+ 大 buffer 更快到位、真空期更小。
|
||||
// 停止滚动后统一更新。performance 用更短 debounce(60ms)+ 大 buffer 更快到位。
|
||||
const settleDelay = activeTableMode.value === 'performance' ? 60 : 120
|
||||
if (scrollSettleTimer !== null) clearTimeout(scrollSettleTimer)
|
||||
scrollSettleTimer = setTimeout(() => {
|
||||
scrollSettleTimer = null
|
||||
if (!bodyScrollEl.value) return
|
||||
// 方向缓冲区只在窗口真正更新时生效:滚动中翻转方向不会闪变渲染行数,避免整表重建
|
||||
windowScrollDirection.value = scrollDirection.value
|
||||
virtualScrollTop.value = bodyScrollEl.value.scrollTop || 0
|
||||
// 停止后重置预取节流,下一次滚动可以立即补窗
|
||||
lastPrefetchAt = 0
|
||||
// 行高已在绑定/数据变化/尺寸变化时实测,这里不再测量(getBoundingClientRect 会强制 layout)
|
||||
scheduleScrollReconcile()
|
||||
}, settleDelay)
|
||||
})
|
||||
}
|
||||
@ -1877,6 +2111,14 @@ function unbindBodyScroll() {
|
||||
cancelAnimationFrame(scrollRaf)
|
||||
scrollRaf = null
|
||||
}
|
||||
if (reconcileRaf !== null) {
|
||||
cancelAnimationFrame(reconcileRaf)
|
||||
reconcileRaf = null
|
||||
}
|
||||
if (reconcileResetTimer !== null) {
|
||||
clearTimeout(reconcileResetTimer)
|
||||
reconcileResetTimer = null
|
||||
}
|
||||
if (scrollSettleTimer !== null) {
|
||||
clearTimeout(scrollSettleTimer)
|
||||
scrollSettleTimer = null
|
||||
@ -1885,16 +2127,36 @@ function unbindBodyScroll() {
|
||||
bodyScrollEl.value.removeEventListener('scroll', handleBodyScroll)
|
||||
}
|
||||
|
||||
/** 监听表格滚动区尺寸:窗口缩放 / 上下分栏拖拽时同步视口高度并重测行高 */
|
||||
function bindResizeObserver(tableEl: HTMLElement) {
|
||||
if (typeof ResizeObserver === 'undefined') return
|
||||
const target = tableEl.querySelector('.el-table__body-wrapper') as HTMLElement | null
|
||||
if (!target) return
|
||||
if (!tableResizeObserver) {
|
||||
tableResizeObserver = new ResizeObserver(() => {
|
||||
updateViewportHeight()
|
||||
scheduleRowHeightMeasure()
|
||||
})
|
||||
}
|
||||
tableResizeObserver.disconnect()
|
||||
tableResizeObserver.observe(target)
|
||||
}
|
||||
|
||||
function bindBodyScroll() {
|
||||
nextTick(() => {
|
||||
unbindBodyScroll()
|
||||
if (!tableRef.value?.$el) return
|
||||
const tableEl = tableRef.value.$el as HTMLElement
|
||||
const scrollWrap = tableEl.querySelector('.el-scrollbar__wrap') as HTMLElement | null
|
||||
const scrollWrap = (tableEl.querySelector('.el-table__body-wrapper .el-scrollbar__wrap')
|
||||
|| tableEl.querySelector('.el-scrollbar__wrap')) as HTMLElement | null
|
||||
bodyScrollEl.value = scrollWrap
|
||||
if (!bodyScrollEl.value) return
|
||||
bodyScrollEl.value.addEventListener('scroll', handleBodyScroll, { passive: true })
|
||||
bindResizeObserver(tableEl)
|
||||
updateViewportHeight()
|
||||
handleBodyScroll()
|
||||
scheduleRowHeightMeasure()
|
||||
scheduleScrollReconcile()
|
||||
})
|
||||
}
|
||||
|
||||
@ -1909,6 +2171,13 @@ function syncVirtualViewport() {
|
||||
})
|
||||
}
|
||||
|
||||
/** 仅重新绑定滚动容器(loading / 列显示变化等),不重置滚动位置 */
|
||||
function rebindVirtualViewport() {
|
||||
nextTick(() => {
|
||||
bindBodyScroll()
|
||||
})
|
||||
}
|
||||
|
||||
function isRowSelected(row: any) {
|
||||
const rowKey = getRowKey(row)
|
||||
return selectedRowKeys.value.has(rowKey)
|
||||
@ -2126,12 +2395,25 @@ defineExpose({
|
||||
})
|
||||
|
||||
watch(
|
||||
() => [props.tableSize, props.showHeader, props.showPagination, props.loading],
|
||||
() => [props.tableSize, props.showHeader, props.showPagination],
|
||||
() => {
|
||||
syncVirtualViewport()
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
// loading 只代表数据请求状态,不应把用户已滚动到的位置重置回顶部
|
||||
watch(
|
||||
() => props.loading,
|
||||
() => {
|
||||
rebindVirtualViewport()
|
||||
}
|
||||
)
|
||||
|
||||
// 虚拟窗口变化后校正 scrollTop,打断"渲染 → 浏览器改写 scrollTop → 再渲染"的死循环
|
||||
watch([virtualScrollTop, measuredRowHeight], () => {
|
||||
scheduleScrollReconcile()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -2163,6 +2445,35 @@ watch(
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
/* 禁止浏览器的滚动锦定:虚拟滚动会不断增删 spacer 行,
|
||||
锚定机制会在 DOM 变更后自动改写 scrollTop,与窗口计算相互打架导致滚动条来回弹 */
|
||||
.upper-table-container :deep(.el-table__body-wrapper .el-scrollbar__wrap) {
|
||||
overflow-anchor: none;
|
||||
}
|
||||
|
||||
/* 虚拟滚动高度抖动兜底:强制行高与 spacer 占位一致,并单行省略避免内容撑高 */
|
||||
.upper-table-container.is-fixed-row-height {
|
||||
--ut-fixed-row-height: 32px;
|
||||
}
|
||||
|
||||
.upper-table-container.is-fixed-row-height.default {
|
||||
--ut-fixed-row-height: 41px;
|
||||
}
|
||||
|
||||
.upper-table-container.is-fixed-row-height.large {
|
||||
--ut-fixed-row-height: 49px;
|
||||
}
|
||||
|
||||
.upper-table-container.is-fixed-row-height :deep(.el-table__body-wrapper .el-table__row) {
|
||||
height: var(--ut-fixed-row-height);
|
||||
}
|
||||
|
||||
.upper-table-container.is-fixed-row-height :deep(.el-table__body-wrapper .el-table__row .cell) {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
padding: 5px 10px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
import CreateOrderFloatWidget from '@/views/order/orderManagement/component/CreateOrderFloatWidget.vue'
|
||||
import { useCreateOrderSession } from '@/views/order/orderManagement/composables/useCreateOrderSession'
|
||||
import CreateOrderFloatWidget from '@/views/order/shared/createOrderSession/CreateOrderFloatWidget.vue'
|
||||
import { useCreateOrderSession } from '@/views/order/shared/createOrderSession/useCreateOrderSession'
|
||||
|
||||
// 该弹窗静态引入了 xlsx / china-division(合计 ~550kB),而本组件位于布局首屏链路上;
|
||||
// 改为异步组件按需加载,仅真正打开“新建订单”时才拉取对应 chunk。
|
||||
const CreatePendingOrderDialog = defineAsyncComponent(
|
||||
() => import('@/views/order/orderManagement/component/CreatePendingOrderDialog.vue')
|
||||
() => import('@/views/order/shared/createOrderSession/CreatePendingOrderDialog.vue')
|
||||
)
|
||||
|
||||
const { dialogVisible, sessionActive } = useCreateOrderSession()
|
||||
|
||||
@ -4,8 +4,10 @@ import { useUserStore } from './user'
|
||||
|
||||
export type TableMode = 'performance' | 'resource'
|
||||
|
||||
/** tab 缓存默认最大数量(超出后按 LRU 淘汰最久未使用) */
|
||||
export const DEFAULT_TAB_CACHE_MAX = 3
|
||||
/** tab 缓存默认最大数量(超出后按 LRU 淘汰最久未使用)
|
||||
* 说明:orderManagement 有 8 个页签、waveOrder 有 5 个;默认值小于页签数会导致
|
||||
* 来回切换时不断淘汰重建(实测比不缓存更慢),故默认对齐最大页签数。 */
|
||||
export const DEFAULT_TAB_CACHE_MAX = 8
|
||||
|
||||
/** 页面缓存默认最大数量(路由级 keep-alive,超出后按 LRU 淘汰最久未使用) */
|
||||
export const DEFAULT_PAGE_CACHE_MAX = 8
|
||||
|
||||
244
src/styles/list-page.scss
Normal file
244
src/styles/list-page.scss
Normal file
@ -0,0 +1,244 @@
|
||||
/* 列表页骨架布局:左侧 ScanBox 筛选面板 + 右侧工具栏 / 表格 / 明细面板
|
||||
*
|
||||
* 说明:
|
||||
* - `.order-sub-container` 为历史页面模板使用的类名,保留兼容,不做删除;
|
||||
* - 新结构页面(见 views/mode)请使用 `.list-page-container`。
|
||||
*/
|
||||
.order-sub-container,
|
||||
.list-page-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #f0f2f5;
|
||||
|
||||
:deep(.scan-box-container) {
|
||||
flex: 0 0 220px;
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs) {
|
||||
flex-shrink: 0;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__nav-wrap::after) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__active-bar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__item) {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 13px;
|
||||
padding: 0 12px;
|
||||
color: #606266;
|
||||
border: 1px solid transparent;
|
||||
border-bottom: none;
|
||||
border-radius: 4px 4px 0 0;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__item:hover) {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__item.is-active) {
|
||||
color: var(--el-color-primary);
|
||||
background-color: #fff;
|
||||
border-color: #ebeef5;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
|
||||
.toolbar {
|
||||
margin-bottom: 3px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
background-color: #fff;
|
||||
min-width: 0;
|
||||
|
||||
.toolbar-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
flex: 0 0 auto;
|
||||
margin-left: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.split-stack {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
.pane-resizer {
|
||||
flex: 0 0 6px;
|
||||
min-height: 6px;
|
||||
background: #e4e7ed;
|
||||
cursor: row-resize;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
&:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 详情面板禁用时,表格占满全高 */
|
||||
.upper-wrapper--full {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.table-container) {
|
||||
height: auto !important;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.el-table__body-wrapper) {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.lower-level {
|
||||
flex: 0 0 38%;
|
||||
height: 38%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-top: 1px solid #ebeef5;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
|
||||
.detail-header {
|
||||
background-color: #fafafa;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding: 0 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
height: 42px;
|
||||
min-height: 42px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.detail-tab {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-bottom: -1px;
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap::after) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__active-bar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item) {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 13px;
|
||||
padding: 0 16px;
|
||||
color: #606266;
|
||||
border: 1px solid transparent;
|
||||
border-bottom: none;
|
||||
border-radius: 4px 4px 0 0;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item:hover) {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item.is-active) {
|
||||
color: var(--el-color-primary);
|
||||
background-color: #fff;
|
||||
border-color: #ebeef5;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-header-actions {
|
||||
flex: 0 0 auto;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
||||
> .detail-page {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-selection {
|
||||
flex: 0 0 38%;
|
||||
height: 38%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #ebeef5;
|
||||
.empty-tip { text-align: center; }
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/styles/status-text.scss
Normal file
15
src/styles/status-text.scss
Normal file
@ -0,0 +1,15 @@
|
||||
/* 轻量状态文本(替代 el-tag,方案②:减少组件数,提升大列表滚动性能)
|
||||
*
|
||||
* 与 `@/utils/statusText` 的 getStatusTextClass() 配套使用:
|
||||
* const cls = getStatusTextClass('success') // => 'ut-status-text ut-status-text--success'
|
||||
*/
|
||||
.ut-status-text {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ut-status-text--primary { color: var(--el-color-primary); }
|
||||
.ut-status-text--success { color: var(--el-color-success); }
|
||||
.ut-status-text--warning { color: var(--el-color-warning); }
|
||||
.ut-status-text--info { color: var(--el-color-info); }
|
||||
.ut-status-text--danger { color: var(--el-color-danger); }
|
||||
19
src/utils/scanFields.ts
Normal file
19
src/utils/scanFields.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* ScanBox 筛选字段工厂:为基础信息 / 工作流程字段附加分组标签
|
||||
*
|
||||
* 从 `views/order/orderManagement/config/order-common-config.ts` 抽离,
|
||||
* 与订单业务无关,任何使用 ScanBox 的页面均可复用。
|
||||
*/
|
||||
|
||||
/** ScanBox 筛选字段分组:基础信息 + 工作流程(工作流程字段以 label 为分组名) */
|
||||
export const SCAN_BASIC_INFO_GROUP = '基础信息'
|
||||
|
||||
/** 为 ScanBox 基础信息字段附加分组标签 */
|
||||
export function scanBasicField(field: Record<string, any>) {
|
||||
return { ...field, group: SCAN_BASIC_INFO_GROUP }
|
||||
}
|
||||
|
||||
/** 为 ScanBox 工作流程字段附加分组标签(按字段 label 独立分组) */
|
||||
export function scanWorkflowField(field: Record<string, any>) {
|
||||
return { ...field, group: field.label }
|
||||
}
|
||||
28
src/utils/statusText.ts
Normal file
28
src/utils/statusText.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* el-tag type → 轻量状态文本颜色 class(方案②:减少 el-tag 组件,提升大列表滚动性能)
|
||||
*
|
||||
* 映射表与结果串都放到模块级缓存:表格每个单元格、每次渲染都会调它,
|
||||
* 原始实现每次调用都新建 map 对象并拼串,属于纯浪费。
|
||||
*
|
||||
* 配套样式:`@/styles/status-text.scss`(.ut-status-text / .ut-status-text--*)
|
||||
*/
|
||||
|
||||
const STATUS_TEXT_CLASS_MAP: Record<string, string> = {
|
||||
primary: 'ut-status-text--primary',
|
||||
success: 'ut-status-text--success',
|
||||
warning: 'ut-status-text--warning',
|
||||
info: 'ut-status-text--info',
|
||||
danger: 'ut-status-text--danger',
|
||||
error: 'ut-status-text--danger'
|
||||
}
|
||||
|
||||
const STATUS_TEXT_CLASS_CACHE = new Map<string, string>()
|
||||
|
||||
export function getStatusTextClass(tagType?: string) {
|
||||
const t = String(tagType || 'info')
|
||||
const cached = STATUS_TEXT_CLASS_CACHE.get(t)
|
||||
if (cached) return cached
|
||||
const className = `ut-status-text ${STATUS_TEXT_CLASS_MAP[t] || 'ut-status-text--info'}`
|
||||
STATUS_TEXT_CLASS_CACHE.set(t, className)
|
||||
return className
|
||||
}
|
||||
73
src/utils/storeScanOptions.ts
Normal file
73
src/utils/storeScanOptions.ts
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* ScanBox 下拉选项工具:货主(store)与快递公司(express)
|
||||
*
|
||||
* 从 `views/order/orderManagement/config/order-common-config.ts` 抽离,
|
||||
* 与订单业务无关,仓储 / 售后 / 系统设置等页面均可复用。
|
||||
*/
|
||||
|
||||
/** ScanBox:快递公司(快递编码),选项由页面 getExpressList + fillExpressCompanyScanFieldOptions 注入 */
|
||||
export function mapExpressListToCompanySelectOptions(rawList: any[]): Array<{ label: string; value: string }> {
|
||||
const result: Array<{ label: string; value: string }> = []
|
||||
const seen = new Set<string>()
|
||||
for (const item of rawList || []) {
|
||||
const codeRaw = ['code', 'logistics_code', 'express_code']
|
||||
.map((k) => item?.[k])
|
||||
.find((v) => v !== undefined && v !== null && v !== '')
|
||||
const code = String(codeRaw ?? '').trim()
|
||||
if (!code || seen.has(code)) continue
|
||||
const nameRaw = ['name', 'logistics_name', 'express_name']
|
||||
.map((k) => item?.[k])
|
||||
.find((v) => v !== undefined && v !== null && v !== '')
|
||||
const name = String(nameRaw ?? '').trim()
|
||||
result.push({ value: code, label: name ? `${code} - ${name}` : code })
|
||||
seen.add(code)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function fillExpressCompanyScanFieldOptions(availableFields: any[], expressRaw: any[]) {
|
||||
const field = availableFields.find((f: any) => f.value === 'logistics_code')
|
||||
if (field) field.options = mapExpressListToCompanySelectOptions(expressRaw)
|
||||
}
|
||||
|
||||
/** ScanBox:货主,选项由页面 loadStores + fillStoreScanFieldOptions 注入 */
|
||||
export function resolveStoreOptionLabel(item: any, fallbackValue?: string | number): string {
|
||||
const fallback = String(fallbackValue ?? '').trim()
|
||||
const candidates = [
|
||||
item?.label,
|
||||
item?.store_remask,
|
||||
item?.store_name,
|
||||
item?.name,
|
||||
item?.storeName
|
||||
]
|
||||
for (const candidate of candidates) {
|
||||
const text = String(candidate ?? '').trim()
|
||||
if (text) return text
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
export function mapStoreListToSelectOptions(rawStores: any[]): Array<{ label: string; value: number | string }> {
|
||||
const result: Array<{ label: string; value: number | string }> = []
|
||||
const seen = new Set<string>()
|
||||
for (const item of rawStores || []) {
|
||||
const rawValue = item?.value ?? item?.store_id ?? item?.id ?? item?.storeId
|
||||
if (rawValue === undefined || rawValue === null || rawValue === '') continue
|
||||
const value = Number.isNaN(Number(rawValue)) ? String(rawValue) : Number(rawValue)
|
||||
const key = String(value)
|
||||
if (seen.has(key)) continue
|
||||
const label = resolveStoreOptionLabel(item, key)
|
||||
result.push({ label, value })
|
||||
seen.add(key)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function extractStoreListFromResponse(storesRes: any): any[] {
|
||||
return storesRes?.stores || storesRes?.data?.stores || storesRes?.data || []
|
||||
}
|
||||
|
||||
export function fillStoreScanFieldOptions(availableFields: any[], rawStores: any[]) {
|
||||
const field = availableFields.find((f: any) => f.value === 'store_id')
|
||||
if (field) field.options = mapStoreListToSelectOptions(rawStores)
|
||||
}
|
||||
@ -311,7 +311,7 @@ import { loadStores } from '@/api/index/index'
|
||||
import { extractStoreListFromResponse, fillStoreScanFieldOptions, getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import AfterSaleDetailDialog from '@/views/afterSale/detail/AfterSaleDetailDialog.vue'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
@ -871,7 +871,8 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.wave-operation-actions {
|
||||
display: flex;
|
||||
|
||||
@ -68,7 +68,7 @@ const tagTextClass = computed(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 轻量状态文本(与 order/orderManagement/styles/order-sub.scss 的 .ut-status-text 一致) */
|
||||
/* 轻量状态文本(与 @/styles/status-text.scss 的 .ut-status-text 一致) */
|
||||
.ut-status-text {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
|
||||
@ -186,7 +186,7 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
/* 轻量状态文本(与 order/orderManagement/styles/order-sub.scss 的 .ut-status-text 一致) */
|
||||
/* 轻量状态文本(与 @/styles/status-text.scss 的 .ut-status-text 一致) */
|
||||
.ut-status-text {
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
|
||||
@ -258,8 +258,8 @@ import TabArea from '@/components/TabArea/index.vue'
|
||||
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import TypeFormDialog from './pages/TypeFormDialog.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
import {
|
||||
afterSaleTypeList,
|
||||
afterSaleTypeDelete,
|
||||
@ -719,12 +719,12 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 布局样式对齐 order/orderManagement(order-sub.scss) */
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
/* 布局样式对齐 @/styles/list-page.scss */
|
||||
@use "@/styles/list-page.scss";
|
||||
|
||||
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(明细面板自带
|
||||
padding: 6px 10px 8px),只留左右 10px。
|
||||
⚠️ 必须用完整路径选择器:共享 order-sub.scss 的同名规则权重更高,
|
||||
⚠️ 必须用完整路径选择器:共享 @/styles/list-page.scss 的同名规则权重更高,
|
||||
写成 `.lower-level .detail-container` 会被它覆盖成 padding: 0。 */
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 0 10px;
|
||||
@ -777,7 +777,7 @@ onMounted(() => {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 分栏区域:布局样式由 order/orderManagement/styles/order-sub.scss 提供,此处仅补充模板特有规则 */
|
||||
/* 分栏区域:布局样式由 @/styles/list-page.scss 提供,此处仅补充模板特有规则 */
|
||||
.split-stack {
|
||||
:deep(.el-card__header) {
|
||||
padding: 2px 12px;
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
import { computed } from 'vue'
|
||||
import type { ColumnSlotConfig } from '../config/template-config'
|
||||
import { TAG_RESOLVERS, translate, formatTime } from '../config/template-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'ColumnCellRenderer' })
|
||||
|
||||
@ -65,8 +65,7 @@ const resolvedTagType = computed(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入)
|
||||
路径:src/views/data/ordersummary/components → src/views/order/orderManagement/styles */
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
/* ut-status-text 系列状态文字颜色类定义在 @/styles/status-text.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "@/styles/status-text.scss";
|
||||
</style>
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { TAG_RESOLVERS, translate } from '../template-config'
|
||||
import type { DetailSectionConfig, DetailFieldConfig } from '../template-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'DetailPanel' })
|
||||
|
||||
@ -126,9 +126,8 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入)
|
||||
路径:src/views/data/ordersummary/config/components → src/views/order/orderManagement/styles */
|
||||
@use "../../../../order/orderManagement/styles/order-sub.scss";
|
||||
/* ut-status-text 系列状态文字颜色类定义在 @/styles/status-text.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 面板自带内边距 8px 0(左右由宿主 .detail-container 的 padding: 0 10px 提供),
|
||||
合计内容缩进 10px,对齐 express/waybill 的 DetailPanel / stock/external_stock「基本信息」 */
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -213,9 +213,8 @@ watch(logs, (list) => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入)
|
||||
路径:src/views/data/ordersummary/config/components → src/views/order/orderManagement/styles */
|
||||
@use "../../../../order/orderManagement/styles/order-sub.scss";
|
||||
/* ut-status-text 系列状态文字颜色类定义在 @/styles/status-text.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 日志面板:按钮行 + 自适应高度表格 + 右对齐分页(对齐 stock/external_stock 面板列表新样式) */
|
||||
.log-panel {
|
||||
|
||||
@ -253,8 +253,8 @@ import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import TabArea from '@/components/TabArea/index.vue'
|
||||
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
import {
|
||||
PAGE_CONFIG,
|
||||
tabPages,
|
||||
@ -635,9 +635,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 布局样式对齐 order/orderManagement(order-sub.scss)
|
||||
路径:src/views/data/ordersummary → src/views/order/orderManagement/styles */
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
/* 布局样式对齐 @/styles/list-page.scss */
|
||||
@use "@/styles/list-page.scss";
|
||||
|
||||
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
|
||||
由各详情面板自身 padding 控制上下留白 */
|
||||
@ -691,7 +690,7 @@ onMounted(() => {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 分栏区域:布局样式由 order/orderManagement/styles/order-sub.scss 提供,此处仅补充模板特有规则 */
|
||||
/* 分栏区域:布局样式由 @/styles/list-page.scss 提供,此处仅补充模板特有规则 */
|
||||
.split-stack {
|
||||
:deep(.el-card__header) {
|
||||
padding: 2px 12px;
|
||||
|
||||
@ -398,7 +398,7 @@ import {
|
||||
} from './packingflow-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
||||
@ -897,7 +897,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳与 order/waveOrder「团购波次」一致:不留上/下间距(任务详情面板自带
|
||||
padding: 6px 10px 8px),只留左右 10px,避免与面板内边距叠加 */
|
||||
|
||||
@ -136,7 +136,7 @@ import { returnReceivedCreate, returnReceivedList } from '@/api/returnreceived'
|
||||
import { returnReceivedColumns } from '@/views/express/returnReceived/returnReceived-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { useBarcodeScan } from '@/composables/useBarcodeScan'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
@ -442,9 +442,10 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 窄屏时允许工具栏换行,避免登记控件溢出(覆盖共享 order-sub.scss 的不换行) */
|
||||
/* 窄屏时允许工具栏换行,避免登记控件溢出(覆盖共享 @/styles/list-page.scss 的不换行) */
|
||||
.toolbar-left {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ import {
|
||||
} from '../returnReceivedTask-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
// ==================== 配置 ====================
|
||||
@ -593,7 +593,7 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
|
||||
.toolbar-keyword {
|
||||
display: flex;
|
||||
|
||||
@ -186,7 +186,7 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
|
||||
import { returnReceivedAvailableFields, returnReceivedColumns, returnReceivedToolbarButtons } from './returnReceived-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
@ -686,7 +686,8 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.wave-operation-actions {
|
||||
display: flex;
|
||||
|
||||
@ -78,7 +78,7 @@ import {
|
||||
parseStockWarehouseSearch,
|
||||
mapStockPickerItem,
|
||||
getStockStoreId,
|
||||
} from '@/views/order/orderManagement/utils/stock-picker-helpers'
|
||||
} from '@/views/stock/utils/stockPickerHelpers'
|
||||
import { parseStockWarehouseListResponse } from '@/views/stock/combo_stock/combo-stock-config'
|
||||
|
||||
export type StockPickerItem = {
|
||||
|
||||
@ -368,7 +368,7 @@ function formatDetailTime(v: any): string {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.detail-table {
|
||||
width: 100%;
|
||||
|
||||
@ -67,7 +67,7 @@ defineEmits<{
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.video-list {
|
||||
display: flex;
|
||||
|
||||
@ -364,7 +364,7 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
|
||||
import { returnUnpackAvailableFields, returnUnpackColumns, returnUnpackToolbarButtons } from './returnUnpack-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import UnpackDetailTable from './components/UnpackDetailTable.vue'
|
||||
import UnpackOrderItemsTable from './components/UnpackOrderItemsTable.vue'
|
||||
@ -1049,7 +1049,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.scan-create {
|
||||
display: flex;
|
||||
|
||||
@ -669,9 +669,9 @@ import CameraLivePreview, { type CameraLiveItem } from './CameraLivePreview.vue'
|
||||
import JsBarcode from 'jsbarcode'
|
||||
import { CMD, CMD_LABEL, CMD_TAG_TYPE, SCAN_COMMANDS, resolveScanCommand, type ScanCommand } from './scan-commands'
|
||||
import StockPickerDialog from '@/views/express/returnUnpack/components/StockPickerDialog.vue'
|
||||
import { queryStockProducts, mapStockPickerItem, getStockStoreId } from '@/views/order/orderManagement/utils/stock-picker-helpers'
|
||||
import { queryStockProducts, mapStockPickerItem, getStockStoreId } from '@/views/stock/utils/stockPickerHelpers'
|
||||
import { orderDetail, orderList } from '@/api/order.index/orderindex'
|
||||
import { parseOrderDetailPayload, normalizeOrderDetailItems } from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
import { parseOrderDetailPayload, normalizeOrderDetailItems } from '@/views/order/shared/orderListExport'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
|
||||
// ==================== Emits ====================
|
||||
|
||||
@ -312,7 +312,7 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
|
||||
import { returnWaybillAvailableFields, returnWaybillColumns, returnWaybillToolbarButtons } from './returnwaybill-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
|
||||
// ==================== 常量 / 工具 ====================
|
||||
|
||||
@ -740,7 +740,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.scan-register {
|
||||
display: flex;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
import { computed } from 'vue'
|
||||
import type { ColumnSlotConfig } from '../config/template-config'
|
||||
import { TAG_RESOLVERS, translate, formatTime } from '../config/template-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'ColumnCellRenderer' })
|
||||
|
||||
@ -66,6 +66,6 @@ const statusTextClass = computed(() => getStatusTextClass(resolvedTagType.value)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
</style>
|
||||
|
||||
|
||||
@ -375,7 +375,7 @@ async function copyFailedCodes() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 面板结构 / 尺寸对齐「批量发货」(BatchQuickRecheckForm) */
|
||||
.task-panel {
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { TAG_RESOLVERS, translate } from '../template-config'
|
||||
import type { DetailSectionConfig, DetailFieldConfig } from '../template-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'DetailPanel' })
|
||||
|
||||
@ -112,7 +112,7 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "../../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 面板自带内边距(宿主 .detail-container 为 padding: 0 10px),
|
||||
与 order/waveOrder「团购波次」波次明细面板(WaveBatchDetailPanel)完全一致 */
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -134,7 +134,7 @@ const logs = computed<LogItem[]>(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "../../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.log-panel {
|
||||
padding: 8px 0;
|
||||
|
||||
@ -269,10 +269,10 @@ import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import TransferByWaybillsDialog from './components/TransferByWaybillsDialog.vue'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { waybillWarehouseDetail } from '@/api/waybill.warehouse'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
import {
|
||||
PAGE_CONFIG,
|
||||
tabPages,
|
||||
@ -789,7 +789,7 @@ onMounted(() => {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ================================================================
|
||||
整体布局(对齐 storage/entry 的 order-sub.scss)
|
||||
整体布局(对齐 storage/entry 的列表页骨架)
|
||||
================================================================ */
|
||||
.page-wrapper {
|
||||
position: relative;
|
||||
@ -872,7 +872,7 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- 分栏区域(对齐 storage/entry 的 order-sub.scss) ---- */
|
||||
/* ---- 分栏区域(对齐 storage/entry 的列表页骨架) ---- */
|
||||
.split-stack {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
|
||||
@ -929,7 +929,8 @@ loadTreeData()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
@use "./components/panel.scss";
|
||||
|
||||
.auto-reply-page {
|
||||
|
||||
@ -481,7 +481,7 @@ import { expressIndexGetExpressList } from '@/api/setting.express/express'
|
||||
import { groupAvailableFields, groupColumns, groupToolbarButtons } from './group-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
@ -867,7 +867,8 @@ onMounted(() => { loadStoreList(); fetchData() })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.wave-operation-actions {
|
||||
display: flex;
|
||||
|
||||
@ -374,7 +374,7 @@ import { extractStoreListFromResponse, fillStoreScanFieldOptions, getStatusTextC
|
||||
import { messageAvailableFields, messageColumns } from './message-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
@ -734,7 +734,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 工具栏右侧统计标签:与左侧按钮组垂直居中(toolbar-left 默认 align-items:flex-start) */
|
||||
.toolbar-stats {
|
||||
|
||||
@ -277,7 +277,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
@ -700,7 +700,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 新增/编辑包材:面板结构 / 双列栅格对齐「新建波次策略」 */
|
||||
.task-panel {
|
||||
|
||||
@ -181,7 +181,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
@ -548,7 +548,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
|
||||
@ -285,7 +285,7 @@ import { extractStoreListFromResponse, fillStoreScanFieldOptions, getStatusTextC
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import CreateAfterSaleDialog from './components/CreateAfterSaleDialog.vue'
|
||||
import AfterSaleDetailDialog from '@/views/afterSale/detail/AfterSaleDetailDialog.vue'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
@ -655,7 +655,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
|
||||
面板自身 padding: 6px 10px 8px(合计内容缩进 20px) */
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
import { computed } from 'vue'
|
||||
import type { ColumnSlotConfig } from '../config/template-config'
|
||||
import { TAG_RESOLVERS, translate, formatTime } from '../config/template-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'ColumnCellRenderer' })
|
||||
|
||||
@ -65,7 +65,7 @@ const resolvedTagType = computed(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
/* ut-status-text 系列状态文字颜色类定义在 @/styles/status-text.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "@/styles/status-text.scss";
|
||||
</style>
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { TAG_RESOLVERS, translate } from '../template-config'
|
||||
import type { DetailSectionConfig, DetailFieldConfig } from '../template-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'DetailPanel' })
|
||||
|
||||
@ -126,8 +126,8 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
/* ut-status-text 系列状态文字颜色类定义在 @/styles/status-text.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 面板自带内边距 8px 0(左右由宿主 .detail-container 的 padding: 0 10px 提供),
|
||||
合计内容缩进 10px,对齐 express/waybill 的 DetailPanel / stock/external_stock「基本信息」 */
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
|
||||
defineOptions({ name: 'LogPanel' })
|
||||
|
||||
@ -213,8 +213,8 @@ watch(logs, (list) => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ut-status-text 系列状态文字颜色类定义在 order-sub.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
/* ut-status-text 系列状态文字颜色类定义在 @/styles/status-text.scss 里(scoped 样式需要本组件自行引入) */
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 日志面板:按钮行 + 自适应高度表格 + 右对齐分页(对齐 stock/external_stock 面板列表新样式) */
|
||||
.log-panel {
|
||||
|
||||
@ -253,8 +253,8 @@ import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import TabArea from '@/components/TabArea/index.vue'
|
||||
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
import {
|
||||
PAGE_CONFIG,
|
||||
tabPages,
|
||||
@ -629,8 +629,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 布局样式对齐 order/orderManagement(order-sub.scss) */
|
||||
@use "../order/orderManagement/styles/order-sub.scss";
|
||||
/* 布局样式对齐 @/styles/list-page.scss */
|
||||
@use "@/styles/list-page.scss";
|
||||
|
||||
/* 详情区外壳与 stock/external_stock 一致:不留上/下间距,左右 10px,
|
||||
由各详情面板自身 padding 控制上下留白 */
|
||||
@ -684,7 +684,7 @@ onMounted(() => {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* 分栏区域:布局样式由 order/orderManagement/styles/order-sub.scss 提供,此处仅补充模板特有规则 */
|
||||
/* 分栏区域:布局样式由 @/styles/list-page.scss 提供,此处仅补充模板特有规则 */
|
||||
.split-stack {
|
||||
:deep(.el-card__header) {
|
||||
padding: 2px 12px;
|
||||
@ -697,7 +697,8 @@ onMounted(() => {
|
||||
================================================================ */
|
||||
.tab-fade-enter-active,
|
||||
.tab-fade-leave-active {
|
||||
transition: opacity 0.2s ease;
|
||||
/* 与 orderManagement / waveOrder 统一:0.12s */
|
||||
transition: opacity 0.12s ease;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +141,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderArchiveOrder } from '@/api/order.archiveorder/orderarchiveorder'
|
||||
|
||||
import {
|
||||
@ -160,14 +160,14 @@ import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createSimpleListToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
@ -431,7 +431,8 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳只保留左右 10px(订单明细/商品明细/订单日志面板自带 padding: 6px 10px 8px),
|
||||
与 stock/external_stock 各面板保持一致 */
|
||||
|
||||
@ -102,7 +102,7 @@ import {
|
||||
isPackageMaterialApiSuccess,
|
||||
parsePackageMaterialSearchResponse
|
||||
} from '@/views/material/packageMaterial/package-material-config'
|
||||
import { isOrderIndexApiSuccess } from '../utils/order-index-helpers'
|
||||
import { isOrderIndexApiSuccess } from '@/views/order/shared/orderListExport'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
|
||||
@ -115,7 +115,7 @@ import { computed, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { orderDetail, orderUpdateExpressWeighingWeight } from '@/api/order.index/orderindex'
|
||||
import { interceptScan } from '@/api/order.recheckorder/recheckOrder'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '../utils/order-index-helpers'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '@/views/order/shared/orderListExport'
|
||||
import BindPackageMaterialByWaybillDialog from './BindPackageMaterialByWaybillDialog.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -89,7 +89,7 @@ import {
|
||||
orderItemFullColumns,
|
||||
type OrderItemColumnConfig
|
||||
} from '../config/order-common-config'
|
||||
import { normalizeOrderDetailItems, parseOrderDetailPayload } from '../utils/order-index-helpers'
|
||||
import { normalizeOrderDetailItems, parseOrderDetailPayload } from '@/views/order/shared/orderListExport'
|
||||
import type { OrderDetailDisplayMode } from './OrderDetailDisplayToggle.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
|
||||
@ -75,7 +75,7 @@ import {
|
||||
buildOrderWhereConditions,
|
||||
parseOrderListResponse,
|
||||
sanitizeOrderListWhere
|
||||
} from '../utils/order-index-helpers'
|
||||
} from '@/views/order/shared/orderListExport'
|
||||
|
||||
const dialogVisible = defineModel<boolean>({ default: false })
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ import {
|
||||
type OrderDetailFieldConfig,
|
||||
type OrderDetailSectionConfig
|
||||
} from '../config/order-common-config'
|
||||
import { parseOrderDetailPayload, resolveOrderRecheckStatus } from '../utils/order-index-helpers'
|
||||
import { parseOrderDetailPayload, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import type { OrderDetailDisplayMode } from './OrderDetailDisplayToggle.vue'
|
||||
|
||||
const props = withDefaults(
|
||||
@ -259,7 +259,7 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 新设计(对齐 stock/external_stock「基本信息」):面板自带内边距 + 分区标题左侧蓝竖条 + label 浅灰底 */
|
||||
.pending-order-detail {
|
||||
|
||||
@ -413,7 +413,7 @@ async function copyIds(list: Array<{ order_id?: number | string }>, label: strin
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 状态文字颜色:与待处理订单「同步状态」同一套轻量样式(定义同 styles/order-sub.scss) */
|
||||
/* 状态文字颜色:与待处理订单「同步状态」同一套轻量样式(定义同 @/styles/status-text.scss) */
|
||||
.ut-status-text {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { orderDetail } from '@/api/order.index/orderindex'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderDetailItems, normalizeOrderExpressList, normalizeOrderWaybillCodes } from '../utils/order-index-helpers'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderDetailItems, normalizeOrderExpressList, normalizeOrderWaybillCodes } from '@/views/order/shared/orderListExport'
|
||||
|
||||
const props = defineProps<{
|
||||
row: Record<string, any> | null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import * as orderApi from '@/api/order.index/orderindex'
|
||||
import { isOrderIndexApiSuccess, normalizeOrderDetailItems, parseOrderDetailPayload } from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
import { isOrderIndexApiSuccess, normalizeOrderDetailItems, parseOrderDetailPayload } from '@/views/order/shared/orderListExport'
|
||||
|
||||
const props = defineProps<{
|
||||
orderId?: number | string
|
||||
|
||||
@ -1,10 +1,38 @@
|
||||
import type { ToolbarButtonConfig, ToolbarApiActionConfig } from '@/components/ToolbarButtonGroup/types'
|
||||
import { scanBasicField, scanWorkflowField } from '@/utils/scanFields'
|
||||
|
||||
/**
|
||||
* 已抽离到公共层的类型与工具,此处保留转发以兼容存量 import
|
||||
* - ToolbarButtonConfig / ToolbarApiActionConfig → @/components/ToolbarButtonGroup/types
|
||||
* - getStatusTextClass → @/utils/statusText
|
||||
* - 货主 / 快递公司选项映射 → @/utils/storeScanOptions
|
||||
* - ScanBox 字段工厂 → @/utils/scanFields
|
||||
*/
|
||||
export type { ToolbarButtonConfig, ToolbarApiActionConfig }
|
||||
export { getStatusTextClass } from '@/utils/statusText'
|
||||
export {
|
||||
extractStoreListFromResponse,
|
||||
fillExpressCompanyScanFieldOptions,
|
||||
fillStoreScanFieldOptions,
|
||||
mapExpressListToCompanySelectOptions,
|
||||
mapStoreListToSelectOptions,
|
||||
resolveStoreOptionLabel
|
||||
} from '@/utils/storeScanOptions'
|
||||
export { SCAN_BASIC_INFO_GROUP } from '@/utils/scanFields'
|
||||
export { scanBasicField, scanWorkflowField }
|
||||
|
||||
/** 订单管理页面配置 */
|
||||
export const ORDER_PAGE_CONFIG = {
|
||||
/**
|
||||
* 单页模式:开启后不显示标签切换区域,
|
||||
* 直接展示默认页签(待处理订单)的内容
|
||||
*/
|
||||
singlePage: false
|
||||
singlePage: false,
|
||||
/**
|
||||
* 本页 tab 缓存上限:本页共 8 个页签,需全量缓存;
|
||||
* 小于页签数会触发 KeepAlive LRU 抖动(切回时重建,比首次还慢)
|
||||
*/
|
||||
tabCacheMax: 8
|
||||
}
|
||||
|
||||
// 通用翻译映射
|
||||
@ -293,38 +321,6 @@ export const COMMON_TAG_TYPES: Record<string, Record<string, string>> = {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ToolbarButtonConfig {
|
||||
key: string
|
||||
label: string
|
||||
dynamicLabelKey?: string
|
||||
size?: '' | 'default' | 'small' | 'large'
|
||||
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
||||
plain?: boolean
|
||||
loadingKey?: string
|
||||
disabledKey?: string
|
||||
action: string
|
||||
/** 按钮样式分类(优先级高于 type/plain):
|
||||
* 'refresh' - 蓝底白字(primary)
|
||||
* 'setting' - 白底黑字(default)
|
||||
* 'action' - 白底蓝边框蓝字(primary + plain)
|
||||
* 'cancel' - 红底白字(danger)
|
||||
* 不设置则沿用 type/plain */
|
||||
category?: 'refresh' | 'setting' | 'action' | 'cancel'
|
||||
/** 下拉按钮:主按钮点击 action,菜单项使用 dropdownOptions[].action */
|
||||
buttonType?: 'default' | 'dropdown'
|
||||
dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }>
|
||||
}
|
||||
|
||||
export interface ToolbarApiActionConfig {
|
||||
action: string
|
||||
apiMethod: string
|
||||
payloadKey?: string
|
||||
confirmText?: string
|
||||
confirmType?: 'warning' | 'error' | 'info' | 'success'
|
||||
successText: string
|
||||
failText: string
|
||||
}
|
||||
|
||||
export type PendingBatchAsyncTaskType = 'intercept' | 'unintercept' | 'lock' | 'unlock'
|
||||
|
||||
export interface PendingBatchAsyncTaskConfig {
|
||||
@ -754,31 +750,6 @@ function lookupTranslationTable(table: Record<string, string> | undefined, field
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* el-tag type → 轻量状态文本颜色 class(方案②:减少 el-tag 组件,提升大列表滚动性能)
|
||||
* 映射表与结果串都放到模块级缓存:表格每个单元格、每次渲染都会调它,
|
||||
* 原实现每次调用都新建 map 对象并拼串,属于纯浪费。
|
||||
*/
|
||||
const STATUS_TEXT_CLASS_MAP: Record<string, string> = {
|
||||
primary: 'ut-status-text--primary',
|
||||
success: 'ut-status-text--success',
|
||||
warning: 'ut-status-text--warning',
|
||||
info: 'ut-status-text--info',
|
||||
danger: 'ut-status-text--danger',
|
||||
error: 'ut-status-text--danger'
|
||||
}
|
||||
|
||||
const STATUS_TEXT_CLASS_CACHE = new Map<string, string>()
|
||||
|
||||
export function getStatusTextClass(tagType?: string) {
|
||||
const t = String(tagType || 'info')
|
||||
const cached = STATUS_TEXT_CLASS_CACHE.get(t)
|
||||
if (cached) return cached
|
||||
const className = `ut-status-text ${STATUS_TEXT_CLASS_MAP[t] || 'ut-status-text--info'}`
|
||||
STATUS_TEXT_CLASS_CACHE.set(t, className)
|
||||
return className
|
||||
}
|
||||
|
||||
export function getTagType(field: string, value: any) {
|
||||
if (field === 'is_urgency') {
|
||||
const y = normalizeUrgencyValue(value)
|
||||
@ -1247,19 +1218,6 @@ export const simpleListToolbarButtons = pickToolbarButtons(simpleListToolbarButt
|
||||
|
||||
|
||||
|
||||
/** ScanBox 筛选字段分组:基础信息 + 工作流程(工作流程字段以 label 为分组名) */
|
||||
export const SCAN_BASIC_INFO_GROUP = '基础信息'
|
||||
|
||||
/** 为 ScanBox 基础信息字段附加分组标签 */
|
||||
export function scanBasicField(field: Record<string, any>) {
|
||||
return { ...field, group: SCAN_BASIC_INFO_GROUP }
|
||||
}
|
||||
|
||||
/** 为 ScanBox 工作流程字段附加分组标签(按字段 label 独立分组) */
|
||||
export function scanWorkflowField(field: Record<string, any>) {
|
||||
return { ...field, group: field.label }
|
||||
}
|
||||
|
||||
/** 通用下拉选项 */
|
||||
export const isUrgencyFilterOptions = [
|
||||
{ label: '是', value: 'Y' },
|
||||
@ -1613,71 +1571,7 @@ export const expressCompanyScanField = scanBasicField({
|
||||
options: [] as Array<{ label: string; value: string }>
|
||||
})
|
||||
|
||||
export function mapExpressListToCompanySelectOptions(rawList: any[]): Array<{ label: string; value: string }> {
|
||||
const result: Array<{ label: string; value: string }> = []
|
||||
const seen = new Set<string>()
|
||||
for (const item of rawList || []) {
|
||||
const codeRaw = ['code', 'logistics_code', 'express_code']
|
||||
.map((k) => item?.[k])
|
||||
.find((v) => v !== undefined && v !== null && v !== '')
|
||||
const code = String(codeRaw ?? '').trim()
|
||||
if (!code || seen.has(code)) continue
|
||||
const nameRaw = ['name', 'logistics_name', 'express_name']
|
||||
.map((k) => item?.[k])
|
||||
.find((v) => v !== undefined && v !== null && v !== '')
|
||||
const name = String(nameRaw ?? '').trim()
|
||||
result.push({ value: code, label: name ? `${code} - ${name}` : code })
|
||||
seen.add(code)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function fillExpressCompanyScanFieldOptions(availableFields: any[], expressRaw: any[]) {
|
||||
const field = availableFields.find((f: any) => f.value === 'logistics_code')
|
||||
if (field) field.options = mapExpressListToCompanySelectOptions(expressRaw)
|
||||
}
|
||||
|
||||
/** ScanBox:货主,选项由 index.loadStores + fillStoreScanFieldOptions 注入 */
|
||||
export function resolveStoreOptionLabel(item: any, fallbackValue?: string | number): string {
|
||||
const fallback = String(fallbackValue ?? '').trim()
|
||||
const candidates = [
|
||||
item?.label,
|
||||
item?.store_remask,
|
||||
item?.store_name,
|
||||
item?.name,
|
||||
item?.storeName
|
||||
]
|
||||
for (const candidate of candidates) {
|
||||
const text = String(candidate ?? '').trim()
|
||||
if (text) return text
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
export function mapStoreListToSelectOptions(rawStores: any[]): Array<{ label: string; value: number | string }> {
|
||||
const result: Array<{ label: string; value: number | string }> = []
|
||||
const seen = new Set<string>()
|
||||
for (const item of rawStores || []) {
|
||||
const rawValue = item?.value ?? item?.store_id ?? item?.id ?? item?.storeId
|
||||
if (rawValue === undefined || rawValue === null || rawValue === '') continue
|
||||
const value = Number.isNaN(Number(rawValue)) ? String(rawValue) : Number(rawValue)
|
||||
const key = String(value)
|
||||
if (seen.has(key)) continue
|
||||
const label = resolveStoreOptionLabel(item, key)
|
||||
result.push({ label, value })
|
||||
seen.add(key)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
export function extractStoreListFromResponse(storesRes: any): any[] {
|
||||
return storesRes?.stores || storesRes?.data?.stores || storesRes?.data || []
|
||||
}
|
||||
|
||||
export function fillStoreScanFieldOptions(availableFields: any[], rawStores: any[]) {
|
||||
const field = availableFields.find((f: any) => f.value === 'store_id')
|
||||
if (field) field.options = mapStoreListToSelectOptions(rawStores)
|
||||
}
|
||||
/* 货主 / 快递公司选项映射已抽离到 @/utils/storeScanOptions */
|
||||
|
||||
// === ScanBox 筛选分组常量 ===
|
||||
const SCAN_QUICK_FILTER_GROUP = '快速筛选'
|
||||
|
||||
@ -137,7 +137,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderDeliveryExpectionOrder } from '@/api/order.deliveryexpectionorder/orderdeliveryexpectionorder'
|
||||
|
||||
import {
|
||||
@ -155,14 +155,14 @@ import {
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createSimpleListToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
@ -426,7 +426,8 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳只保留左右 10px(订单明细/商品明细/订单日志面板自带 padding: 6px 10px 8px),
|
||||
与 stock/external_stock 各面板保持一致 */
|
||||
|
||||
@ -349,7 +349,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderDeliveryOrder } from '@/api/order.deliveryorder/orderdeliveryOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
@ -371,19 +371,19 @@ import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useOrderBatchPrint } from './utils/use-order-batch-print'
|
||||
import { useDeliveryOrderSubWaybillPrint } from './utils/use-delivery-sub-waybill-print'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import TransferByOrdersDialog from './component/TransferByOrdersDialog.vue'
|
||||
import { createSimpleListToolbarController } from './utils/toolbar-actions'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
const scanBox = ref<any>(null)
|
||||
const upperTable = ref<any>(null)
|
||||
@ -804,7 +804,8 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳只保留左右 10px(订单明细/商品明细/订单日志面板自带 padding: 6px 10px 8px),
|
||||
与 stock/external_stock 各面板保持一致 */
|
||||
|
||||
@ -137,7 +137,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderEntrustOrder } from '@/api/order.entrustorder/orderentrustorder'
|
||||
|
||||
import {
|
||||
@ -155,14 +155,14 @@ import {
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createSimpleListToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
@ -426,7 +426,8 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳只保留左右 10px(订单明细/商品明细/订单日志面板自带 padding: 6px 10px 8px),
|
||||
与 stock/external_stock 各面板保持一致 */
|
||||
|
||||
@ -419,12 +419,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, onActivated, onDeactivated, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
@ -447,26 +447,26 @@ import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import log from './component/log.vue'
|
||||
import { useCreateOrderSession } from './composables/useCreateOrderSession'
|
||||
import AllocateExpressForm from './form/AllocateExpressForm.vue'
|
||||
import StorageAllocateForm from './form/StorageAllocateForm.vue'
|
||||
import { useCreateOrderSession } from '@/views/order/shared/createOrderSession/useCreateOrderSession'
|
||||
import AllocateExpressForm from '@/views/order/shared/form/AllocateExpressForm.vue'
|
||||
import StorageAllocateForm from '@/views/order/shared/form/StorageAllocateForm.vue'
|
||||
import UpdateOrderMetaForm from './form/UpdateOrderMetaForm.vue'
|
||||
import CloneOrderForm from './form/CloneOrderForm.vue'
|
||||
import ManualWaybillForm from './form/ManualWaybillForm.vue'
|
||||
import SyncOrderIdsForm from './form/SyncOrderIdsForm.vue'
|
||||
import ManualWaybillForm from '@/views/order/shared/form/ManualWaybillForm.vue'
|
||||
import SyncOrderIdsForm from '@/views/order/shared/form/SyncOrderIdsForm.vue'
|
||||
import BatchQuickRecheckForm from './form/BatchQuickRecheckForm.vue'
|
||||
import UpdateAddressForm from './form/UpdateAddressForm.vue'
|
||||
import UpdateAddressForm from '@/views/order/shared/form/UpdateAddressForm.vue'
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
import BatchAsyncTaskForm from './form/BatchAsyncTaskForm.vue'
|
||||
import BatchAsyncTaskForm from '@/views/order/shared/form/BatchAsyncTaskForm.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createPendingToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createPendingToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||
import { getOrderPrintData } from '@/api/order.print/orderprint'
|
||||
@ -645,15 +645,49 @@ function getSelectedIds(): number[] {
|
||||
return ids
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存激活后的刷新策略(KeepAlive 下切走不会卸载,onUnmounted 不再触发):
|
||||
* - 其它页签建单成功:当前激活页签立即刷新,非激活页签只标记 dirty,回到本页签时再刷
|
||||
* - 回到本页签:dirty 优先;否则超过 STALE 阈值才刷新
|
||||
*/
|
||||
const ORDER_TAB_STALE_MS = 60 * 1000
|
||||
const tabActive = ref(true)
|
||||
const tabDirty = ref(false)
|
||||
let lastLoadedAt = 0
|
||||
|
||||
function handleCreateOrderSuccess() {
|
||||
if (tabActive.value) {
|
||||
void loadData()
|
||||
} else {
|
||||
tabDirty.value = true
|
||||
}
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
tabActive.value = true
|
||||
if (tabDirty.value) {
|
||||
tabDirty.value = false
|
||||
void loadData()
|
||||
return
|
||||
}
|
||||
if (lastLoadedAt && Date.now() - lastLoadedAt > ORDER_TAB_STALE_MS) {
|
||||
void loadData()
|
||||
}
|
||||
})
|
||||
|
||||
onDeactivated(() => {
|
||||
tabActive.value = false
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
registerCreateOrderSuccess(loadData)
|
||||
registerCreateOrderSuccess(handleCreateOrderSuccess)
|
||||
loadData()
|
||||
loadFilterData()
|
||||
loadOrderMetaOptions()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
unregisterCreateOrderSuccess(loadData)
|
||||
unregisterCreateOrderSuccess(handleCreateOrderSuccess)
|
||||
})
|
||||
|
||||
useOrderListPageCleanup({ list, selectionRows, selectedOrderId })
|
||||
@ -661,6 +695,7 @@ useOrderListPageCleanup({ list, selectionRows, selectedOrderId })
|
||||
async function loadData() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
lastLoadedAt = Date.now()
|
||||
const start = Date.now()
|
||||
try {
|
||||
const params = {
|
||||
@ -1143,7 +1178,8 @@ function onBatchPrintSuccess() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.order-flag-cell {
|
||||
display: inline-block;
|
||||
|
||||
@ -113,7 +113,7 @@ import {
|
||||
type BatchQuickRecheckResponse
|
||||
} from '@/api/order.recheckorder/recheckOrder'
|
||||
import { getStatusTextClass, getTagType, translateOrderField } from '../config/order-common-config'
|
||||
import { resolveOrderRecheckStatus } from '../utils/order-index-helpers'
|
||||
import { resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
|
||||
export type BatchQuickRecheckPreviewRow = {
|
||||
id?: number | string
|
||||
@ -293,7 +293,7 @@ async function handleSubmit() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 状态文字颜色:与待处理订单「同步状态」同一套轻量样式(定义同 styles/order-sub.scss) */
|
||||
/* 状态文字颜色:与待处理订单「同步状态」同一套轻量样式(定义同 @/styles/status-text.scss) */
|
||||
.ut-status-text {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
|
||||
@ -73,19 +73,20 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted, computed, markRaw } from 'vue'
|
||||
import { ref, watch, onMounted, computed, markRaw, defineAsyncComponent } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { useExperimentalStore } from '@/stores/modules/experimental'
|
||||
import { orderBadgeCount } from '@/api/order.index/orderindex'
|
||||
import ReviewOrder from './reviewOrder.vue'
|
||||
// 默认页签(待处理订单)保持同步加载,避免首屏多一次 chunk 等待;其余页签按需加载
|
||||
import PendingOrder from './pendingOrder.vue'
|
||||
import OutboundOrder from './outboundOrder.vue'
|
||||
import ExceptionOrder from './exceptionOrder.vue'
|
||||
import DeliveryOrder from './deliveryOrder.vue'
|
||||
import EntrustWarehouse from './entrustWarehouse.vue'
|
||||
import DeliveryException from './deliveryException.vue'
|
||||
import ArchiveOrder from './archiveOrder.vue'
|
||||
const ReviewOrder = defineAsyncComponent(() => import('./reviewOrder.vue'))
|
||||
const OutboundOrder = defineAsyncComponent(() => import('./outboundOrder.vue'))
|
||||
const ExceptionOrder = defineAsyncComponent(() => import('./exceptionOrder.vue'))
|
||||
const DeliveryOrder = defineAsyncComponent(() => import('./deliveryOrder.vue'))
|
||||
const EntrustWarehouse = defineAsyncComponent(() => import('./entrustWarehouse.vue'))
|
||||
const DeliveryException = defineAsyncComponent(() => import('./deliveryException.vue'))
|
||||
const ArchiveOrder = defineAsyncComponent(() => import('./archiveOrder.vue'))
|
||||
import OrderWorkbenchListDialog from './component/OrderWorkbenchListDialog.vue'
|
||||
import BindPackageMaterialByWaybillDialog from './component/BindPackageMaterialByWaybillDialog.vue'
|
||||
import SortSettingDialog from '@/components/SortSettingDialog.vue'
|
||||
@ -99,8 +100,8 @@ const settingsStore = useSettingsStore()
|
||||
const experimentalStore = useExperimentalStore()
|
||||
/** tab 缓存开关(实验性设置,默认开) */
|
||||
const tabCacheEnabled = computed(() => experimentalStore.tabCacheEnabled)
|
||||
/** tab 缓存最大数量(实验性设置,默认 2,超出 LRU 淘汰最久未用) */
|
||||
const tabCacheMax = computed(() => experimentalStore.tabCacheMax)
|
||||
/** tab 缓存最大数量:优先本页配置(8 个页签全量缓存),回退全局实验性设置 */
|
||||
const tabCacheMax = computed(() => ORDER_PAGE_CONFIG.tabCacheMax ?? experimentalStore.tabCacheMax)
|
||||
const singlePage = ORDER_PAGE_CONFIG.singlePage
|
||||
const badgeLoading = ref(false)
|
||||
const workbenchDialogVisible = ref(false)
|
||||
@ -497,7 +498,8 @@ const handleTabChange = (tabName: string | number) => {
|
||||
/* ===== 页签切换淡入淡出(对齐 storage/generalreport 的 tab-fade) ===== */
|
||||
.tab-fade-enter-active,
|
||||
.tab-fade-leave-active {
|
||||
transition: opacity 0.2s ease;
|
||||
/* 页签切换是高频操作:0.2s 在 out-in 下叠加成 ~0.4s 的"等一下",缩到 0.12s */
|
||||
transition: opacity 0.12s ease;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderOutboundOrder } from '@/api/order.outboundorder/orderoutboundOrder'
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
@ -224,14 +224,14 @@ import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import OutboundManualOutboundForm from './component/OutboundManualOutboundForm.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createSimpleListToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
@ -544,7 +544,8 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.manual-result {
|
||||
margin-bottom: 12px;
|
||||
|
||||
@ -191,12 +191,14 @@
|
||||
</div>
|
||||
|
||||
<allocate-express-form
|
||||
v-if="allocateDialogVisible"
|
||||
v-model="allocateDialogVisible"
|
||||
:loading="allocateLoading"
|
||||
@closed="resetAllocateDialog"
|
||||
@submit="submitAllocateExpress"
|
||||
/>
|
||||
<task-progress-dialog
|
||||
v-if="allocateExpressProgressVisible"
|
||||
:visible="allocateExpressProgressVisible"
|
||||
title="分配快递号"
|
||||
:polling="allocateExpressProgressPolling"
|
||||
@ -207,6 +209,7 @@
|
||||
@close="closeAllocateExpressProgress"
|
||||
/>
|
||||
<storage-allocate-form
|
||||
v-if="storageDialogVisible"
|
||||
v-model="storageDialogVisible"
|
||||
v-model:allow-storage-location="storageForm.allowStorageLocation"
|
||||
:mode="storageDialogMode"
|
||||
@ -223,6 +226,7 @@
|
||||
@submit="submitStorageAllocate"
|
||||
/>
|
||||
<update-order-meta-form
|
||||
v-if="updateOrderMetaDialogVisible"
|
||||
v-model="updateOrderMetaDialogVisible"
|
||||
v-model:code="updateOrderMetaForm.code"
|
||||
:mode="updateOrderMetaDialogMode"
|
||||
@ -233,6 +237,7 @@
|
||||
@submit="submitUpdateOrderMeta"
|
||||
/>
|
||||
<clone-order-form
|
||||
v-if="cloneOrderDialogVisible"
|
||||
v-model="cloneOrderDialogVisible"
|
||||
:loading="cloneOrderLoading"
|
||||
:source-order-id="cloneSourceOrderId"
|
||||
@ -241,6 +246,7 @@
|
||||
@submit="submitCloneOrder"
|
||||
/>
|
||||
<manual-waybill-form
|
||||
v-if="manualWaybillDialogVisible"
|
||||
v-model="manualWaybillDialogVisible"
|
||||
v-model:waybill-code="manualWaybillForm.waybill_code"
|
||||
:loading="manualWaybillLoading"
|
||||
@ -250,6 +256,7 @@
|
||||
@submit="submitManualWaybill"
|
||||
/>
|
||||
<sync-order-ids-form
|
||||
v-if="syncOrderIdsDialogVisible"
|
||||
v-model="syncOrderIdsDialogVisible"
|
||||
:order-count="selectionRows.length"
|
||||
:order-ids="selectedOrderIds"
|
||||
@ -266,6 +273,7 @@
|
||||
@submit="submitSyncOrderIds"
|
||||
/>
|
||||
<batch-quick-recheck-form
|
||||
v-if="batchQuickRecheckDialogVisible"
|
||||
v-model="batchQuickRecheckDialogVisible"
|
||||
:suggested-ids="batchQuickRecheckSuggestedIds"
|
||||
:selected-rows="batchQuickRecheckSelectedRows"
|
||||
@ -273,6 +281,7 @@
|
||||
@success="handleBatchQuickRecheckSuccess"
|
||||
/>
|
||||
<update-address-form
|
||||
v-if="updateAddressDialogVisible"
|
||||
v-model="updateAddressDialogVisible"
|
||||
v-model:form="updateAddressForm"
|
||||
:order-count="updateAddressOrderIds.length"
|
||||
@ -281,6 +290,7 @@
|
||||
@submit="submitUpdateAddress"
|
||||
/>
|
||||
<update-remark-form
|
||||
v-if="updateRemarkDialogVisible"
|
||||
v-model="updateRemarkDialogVisible"
|
||||
v-model:form="updateRemarkForm"
|
||||
:order-count="updateRemarkOrderIds.length"
|
||||
@ -289,7 +299,7 @@
|
||||
@submit="submitUpdateRemark"
|
||||
/>
|
||||
<batch-async-task-form
|
||||
v-if="batchAsyncTaskConfig"
|
||||
v-if="batchAsyncTaskConfig && batchAsyncTaskDialogVisible"
|
||||
v-model="batchAsyncTaskDialogVisible"
|
||||
:title="batchAsyncTaskConfig.title"
|
||||
:description="batchAsyncTaskConfig.description"
|
||||
@ -373,6 +383,7 @@
|
||||
</el-dialog>
|
||||
|
||||
<allocate-sub-order-number-form
|
||||
v-if="allocateSubOrderNumberDialogVisible"
|
||||
v-model="allocateSubOrderNumberDialogVisible"
|
||||
:loading="allocateSubOrderNumberLoading"
|
||||
:order-id="allocateSubOrderNumberOrderId"
|
||||
@ -382,6 +393,7 @@
|
||||
/>
|
||||
|
||||
<wave-platform-print-preview-dialog
|
||||
v-if="batchPrintDialogVisible"
|
||||
v-model="batchPrintDialogVisible"
|
||||
:error-message="batchPrintErrorMessage"
|
||||
:payload="batchPrintPayload"
|
||||
@ -390,6 +402,7 @@
|
||||
@print-success="onBatchPrintSuccess"
|
||||
/>
|
||||
<wave-platform-print-preview-dialog
|
||||
v-if="subWaybillPrintDialogVisible"
|
||||
v-model="subWaybillPrintDialogVisible"
|
||||
:error-message="subWaybillPrintErrorMessage"
|
||||
:payload="subWaybillPrintPayload"
|
||||
@ -400,6 +413,7 @@
|
||||
</div>
|
||||
|
||||
<order-export-columns-dialog
|
||||
v-if="exportColumnsDialogVisible"
|
||||
v-model:visible="exportColumnsDialogVisible"
|
||||
:mode="exportColumnsMode"
|
||||
:loading="exportColumnsLoading"
|
||||
@ -409,6 +423,7 @@
|
||||
/>
|
||||
|
||||
<order-export-progress-dialog
|
||||
v-if="exportDialogVisible"
|
||||
v-model:visible="exportDialogVisible"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
@ -423,16 +438,16 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, onActivated, onDeactivated, computed, defineAsyncComponent } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import TaskProgressDialog from '@/components/TaskProgressDialog.vue'
|
||||
const TaskProgressDialog = defineAsyncComponent(() => import('@/components/TaskProgressDialog.vue'))
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderExpectionOrder } from '@/api/order.expectionorder/orderexpectionorder'
|
||||
import { confirmIntercept } from '@/api/order.recheckorder/recheckOrder'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
@ -448,36 +463,37 @@ import {
|
||||
fillStoreScanFieldOptions,
|
||||
extractStoreListFromResponse
|
||||
} from './config/order-common-config'
|
||||
import ArchiveOrderPanel from './component/ArchiveOrderPanel.vue'
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import log from './component/log.vue'
|
||||
import { useCreateOrderSession } from './composables/useCreateOrderSession'
|
||||
import AllocateExpressForm from './form/AllocateExpressForm.vue'
|
||||
import StorageAllocateForm from './form/StorageAllocateForm.vue'
|
||||
import UpdateOrderMetaForm from './form/UpdateOrderMetaForm.vue'
|
||||
import CloneOrderForm from './form/CloneOrderForm.vue'
|
||||
import ManualWaybillForm from './form/ManualWaybillForm.vue'
|
||||
import SyncOrderIdsForm from './form/SyncOrderIdsForm.vue'
|
||||
import BatchQuickRecheckForm from './form/BatchQuickRecheckForm.vue'
|
||||
import UpdateAddressForm from './form/UpdateAddressForm.vue'
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
import BatchAsyncTaskForm from './form/BatchAsyncTaskForm.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
const ArchiveOrderPanel = defineAsyncComponent(() => import('./component/ArchiveOrderPanel.vue'))
|
||||
const PendingOrderDetailPanel = defineAsyncComponent(() => import('./component/PendingOrderDetailPanel.vue'))
|
||||
const OrderItemsDetailPanel = defineAsyncComponent(() => import('./component/OrderItemsDetailPanel.vue'))
|
||||
import OrderDetailDisplayToggle from './component/OrderDetailDisplayToggle.vue'
|
||||
import type { OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
const log = defineAsyncComponent(() => import('./component/log.vue'))
|
||||
import { useCreateOrderSession } from '@/views/order/shared/createOrderSession/useCreateOrderSession'
|
||||
const AllocateExpressForm = defineAsyncComponent(() => import('@/views/order/shared/form/AllocateExpressForm.vue'))
|
||||
const StorageAllocateForm = defineAsyncComponent(() => import('@/views/order/shared/form/StorageAllocateForm.vue'))
|
||||
const UpdateOrderMetaForm = defineAsyncComponent(() => import('./form/UpdateOrderMetaForm.vue'))
|
||||
const CloneOrderForm = defineAsyncComponent(() => import('./form/CloneOrderForm.vue'))
|
||||
const ManualWaybillForm = defineAsyncComponent(() => import('@/views/order/shared/form/ManualWaybillForm.vue'))
|
||||
const SyncOrderIdsForm = defineAsyncComponent(() => import('@/views/order/shared/form/SyncOrderIdsForm.vue'))
|
||||
const BatchQuickRecheckForm = defineAsyncComponent(() => import('./form/BatchQuickRecheckForm.vue'))
|
||||
const UpdateAddressForm = defineAsyncComponent(() => import('@/views/order/shared/form/UpdateAddressForm.vue'))
|
||||
const UpdateRemarkForm = defineAsyncComponent(() => import('./form/UpdateRemarkForm.vue'))
|
||||
const BatchAsyncTaskForm = defineAsyncComponent(() => import('@/views/order/shared/form/BatchAsyncTaskForm.vue'))
|
||||
const AllocateSubOrderNumberForm = defineAsyncComponent(() => import('./form/AllocateSubOrderNumberForm.vue'))
|
||||
const ExpressWaybillPanel = defineAsyncComponent(() => import('./component/ExpressWaybillPanel.vue'))
|
||||
const OrderExportProgressDialog = defineAsyncComponent(() => import('@/views/order/shared/component/OrderExportProgressDialog.vue'))
|
||||
const OrderExportColumnsDialog = defineAsyncComponent(() => import('./component/OrderExportColumnsDialog.vue'))
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderInterceptStatus, resolveOrderRecheckStatus, isActiveInterceptStatus } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderInterceptStatus, resolveOrderRecheckStatus, isActiveInterceptStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useOrderBatchPrint } from './utils/use-order-batch-print'
|
||||
import { useSubWaybillPrint } from './utils/use-sub-waybill-print'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createPendingToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createPendingToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import WavePlatformPrintPreviewDialog from '@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'
|
||||
const WavePlatformPrintPreviewDialog = defineAsyncComponent(() => import('@/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue'))
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
const upperTable = ref<any>(null)
|
||||
@ -564,15 +580,49 @@ function normalizePositiveIntId(raw: unknown): number | null {
|
||||
return n
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存激活后的刷新策略(KeepAlive 下切走不会卸载,onUnmounted 不再触发):
|
||||
* - 其它页签建单成功:当前激活页签立即刷新,非激活页签只标记 dirty,回到本页签时再刷
|
||||
* - 回到本页签:dirty 优先;否则超过 STALE 阈值才刷新,避免每次切换都发请求
|
||||
*/
|
||||
const ORDER_TAB_STALE_MS = 60 * 1000
|
||||
const tabActive = ref(true)
|
||||
const tabDirty = ref(false)
|
||||
let lastLoadedAt = 0
|
||||
|
||||
function handleCreateOrderSuccess() {
|
||||
if (tabActive.value) {
|
||||
void loadData()
|
||||
} else {
|
||||
tabDirty.value = true
|
||||
}
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
tabActive.value = true
|
||||
if (tabDirty.value) {
|
||||
tabDirty.value = false
|
||||
void loadData()
|
||||
return
|
||||
}
|
||||
if (lastLoadedAt && Date.now() - lastLoadedAt > ORDER_TAB_STALE_MS) {
|
||||
void loadData()
|
||||
}
|
||||
})
|
||||
|
||||
onDeactivated(() => {
|
||||
tabActive.value = false
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
registerCreateOrderSuccess(loadData)
|
||||
registerCreateOrderSuccess(handleCreateOrderSuccess)
|
||||
loadData()
|
||||
loadOrderMetaOptions()
|
||||
loadStoreOptions()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
unregisterCreateOrderSuccess(loadData)
|
||||
unregisterCreateOrderSuccess(handleCreateOrderSuccess)
|
||||
})
|
||||
|
||||
const {
|
||||
@ -618,6 +668,7 @@ useOrderListPageCleanup({
|
||||
async function loadData() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
lastLoadedAt = Date.now()
|
||||
const start = Date.now()
|
||||
|
||||
const queryParams = {
|
||||
@ -1157,7 +1208,8 @@ async function handleConfirmInterceptBatch() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳只保留左右 10px(订单明细/商品明细/订单日志面板自带 padding: 6px 10px 8px),
|
||||
与 stock/external_stock 各面板保持一致 */
|
||||
|
||||
@ -181,11 +181,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, onUnmounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, onUnmounted, onActivated, onDeactivated, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from './utils/order-meta-cache'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { orderReviewOrder } from '@/api/order.revieworder/orderreviewOrder'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
|
||||
@ -204,17 +204,17 @@ import {
|
||||
import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
|
||||
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||
import { useCreateOrderSession } from './composables/useCreateOrderSession'
|
||||
import { useCreateOrderSession } from '@/views/order/shared/createOrderSession/useCreateOrderSession'
|
||||
import log from './component/log.vue'
|
||||
import OrderExportProgressDialog from './component/OrderExportProgressDialog.vue'
|
||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||
import UpdateRemarkForm from './form/UpdateRemarkForm.vue'
|
||||
import { createOrderPageExport } from './utils/order-page-export'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from './utils/order-index-helpers'
|
||||
import { buildOrderWhereConditions, parseOrderListResponse, resolveOrderRecheckStatus } from '@/views/order/shared/orderListExport'
|
||||
import { useOrderListPageCleanup } from './utils/use-order-list-page-cleanup'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from './component/OrderToolbarButtonGroup.vue'
|
||||
import { createReviewToolbarController } from './utils/toolbar-actions'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createReviewToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
@ -274,14 +274,48 @@ function fetchReviewOrderDetail(data: Record<string, any>) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存激活后的刷新策略(KeepAlive 下切走不会卸载,onUnmounted 不再触发):
|
||||
* - 其它页签建单成功:当前激活页签立即刷新,非激活页签只标记 dirty,回到本页签时再刷
|
||||
* - 回到本页签:dirty 优先;否则超过 STALE 阈值才刷新
|
||||
*/
|
||||
const ORDER_TAB_STALE_MS = 60 * 1000
|
||||
const tabActive = ref(true)
|
||||
const tabDirty = ref(false)
|
||||
let lastLoadedAt = 0
|
||||
|
||||
function handleCreateOrderSuccess() {
|
||||
if (tabActive.value) {
|
||||
void loadData()
|
||||
} else {
|
||||
tabDirty.value = true
|
||||
}
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
tabActive.value = true
|
||||
if (tabDirty.value) {
|
||||
tabDirty.value = false
|
||||
void loadData()
|
||||
return
|
||||
}
|
||||
if (lastLoadedAt && Date.now() - lastLoadedAt > ORDER_TAB_STALE_MS) {
|
||||
void loadData()
|
||||
}
|
||||
})
|
||||
|
||||
onDeactivated(() => {
|
||||
tabActive.value = false
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
registerCreateOrderSuccess(loadData)
|
||||
registerCreateOrderSuccess(handleCreateOrderSuccess)
|
||||
loadData()
|
||||
loadOrderMetaOptions()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
unregisterCreateOrderSuccess(loadData)
|
||||
unregisterCreateOrderSuccess(handleCreateOrderSuccess)
|
||||
})
|
||||
|
||||
useOrderListPageCleanup({ list, selectionRows, selectedOrderId })
|
||||
@ -333,6 +367,7 @@ async function loadOrderMetaOptions() {
|
||||
async function loadData() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
lastLoadedAt = Date.now()
|
||||
const start = Date.now()
|
||||
|
||||
let where = buildExportWhere()
|
||||
@ -546,7 +581,8 @@ async function handleSingleReview() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 详情区外壳只保留左右 10px(订单明细/商品明细/订单日志面板自带 padding: 6px 10px 8px),
|
||||
与 stock/external_stock 各面板保持一致 */
|
||||
|
||||
@ -1,249 +1,10 @@
|
||||
.order-sub-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: #f0f2f5;
|
||||
|
||||
:deep(.scan-box-container) {
|
||||
flex: 0 0 220px;
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs) {
|
||||
flex-shrink: 0;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__nav-wrap::after) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__active-bar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__item) {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 13px;
|
||||
padding: 0 12px;
|
||||
color: #606266;
|
||||
border: 1px solid transparent;
|
||||
border-bottom: none;
|
||||
border-radius: 4px 4px 0 0;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__item:hover) {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
:deep(.scan-box-container .scan-tabs .el-tabs__item.is-active) {
|
||||
color: var(--el-color-primary);
|
||||
background-color: #fff;
|
||||
border-color: #ebeef5;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
|
||||
.toolbar {
|
||||
margin-bottom: 3px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
background-color: #fff;
|
||||
min-width: 0;
|
||||
|
||||
.toolbar-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
flex: 0 0 auto;
|
||||
margin-left: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.split-stack {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
.pane-resizer {
|
||||
flex: 0 0 6px;
|
||||
min-height: 6px;
|
||||
background: #e4e7ed;
|
||||
cursor: row-resize;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
&:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 详情面板禁用时,表格占满全高 */
|
||||
.upper-wrapper--full {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.table-container) {
|
||||
height: auto !important;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.el-table__body-wrapper) {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.lower-level {
|
||||
flex: 0 0 38%;
|
||||
height: 38%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-top: 1px solid #ebeef5;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
|
||||
.detail-header {
|
||||
background-color: #fafafa;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding: 0 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
height: 42px;
|
||||
min-height: 42px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.detail-tab {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-bottom: -1px;
|
||||
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap::after) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__active-bar) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item) {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 13px;
|
||||
padding: 0 16px;
|
||||
color: #606266;
|
||||
border: 1px solid transparent;
|
||||
border-bottom: none;
|
||||
border-radius: 4px 4px 0 0;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item:hover) {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
:deep(.el-tabs__item.is-active) {
|
||||
color: var(--el-color-primary);
|
||||
background-color: #fff;
|
||||
border-color: #ebeef5;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-header-actions {
|
||||
flex: 0 0 auto;
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
||||
> .detail-page {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-selection {
|
||||
flex: 0 0 38%;
|
||||
height: 38%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #ebeef5;
|
||||
.empty-tip { text-align: center; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 轻量状态文本(替代 el-tag,方案②:减少组件数,提升大列表滚动性能) */
|
||||
.ut-status-text {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ut-status-text--primary { color: var(--el-color-primary); }
|
||||
.ut-status-text--success { color: var(--el-color-success); }
|
||||
.ut-status-text--warning { color: var(--el-color-warning); }
|
||||
.ut-status-text--info { color: var(--el-color-info); }
|
||||
.ut-status-text--danger { color: var(--el-color-danger); }
|
||||
/* 兼容转发层(保留 1 个版本周期)
|
||||
*
|
||||
* 原内容已于 2026-11 抽离为:
|
||||
* - `src/styles/list-page.scss` 列表页骨架布局(.order-sub-container / .list-page-container)
|
||||
* - `src/styles/status-text.scss` 状态文本(.ut-status-text*)
|
||||
*
|
||||
* 新代码请直接 @use 上述两个文件,不要再引用本文件。
|
||||
*/
|
||||
@forward "@/styles/list-page.scss";
|
||||
@forward "@/styles/status-text.scss";
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import * as XLSX from 'xlsx'
|
||||
|
||||
type ColumnItem = {
|
||||
prop?: string
|
||||
label?: string
|
||||
@ -20,7 +18,9 @@ function normalizeCell(value: any) {
|
||||
return value
|
||||
}
|
||||
|
||||
export function exportUpperTableRows(options: ExportOptions) {
|
||||
export async function exportUpperTableRows(options: ExportOptions) {
|
||||
// xlsx 体积较大(约 850KB),只在真正导出时加载,避免进入首屏依赖图
|
||||
const XLSX = await import('xlsx')
|
||||
const { rows, columns, fileName = `export-${Date.now()}.xlsx`, transformCell } = options
|
||||
const exportColumns = (columns || []).filter((column) => !!column.prop)
|
||||
const exportData = (rows || []).map((row, index) => {
|
||||
|
||||
@ -3,7 +3,7 @@ import { ElMessage } from 'element-plus'
|
||||
import type { OrderExportMode } from '@/api/order.index/orderindex'
|
||||
import { useOrderAsyncExport } from '@/composables/useOrderAsyncExport'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { ORDER_INDEX_EXPORT_SCOPES, sanitizeOrderListWhere } from './order-index-helpers'
|
||||
import { ORDER_INDEX_EXPORT_SCOPES, sanitizeOrderListWhere } from '@/views/order/shared/orderListExport'
|
||||
import { exportUpperTableRows } from './export'
|
||||
import { translateOrderField } from '../config/order-common-config'
|
||||
|
||||
@ -77,7 +77,7 @@ export function createOrderPageExport(options: {
|
||||
}
|
||||
exportSelectionLoading.value = true
|
||||
try {
|
||||
exportUpperTableRows({
|
||||
await exportUpperTableRows({
|
||||
rows: options.selectionRows.value,
|
||||
columns: options.columns.value,
|
||||
fileName: `${options.fileNamePrefix}-${Date.now()}.xlsx`,
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
isOrderIndexApiSuccess,
|
||||
parseOrderDetailPayload,
|
||||
normalizeOrderExpressList
|
||||
} from '../utils/order-index-helpers'
|
||||
} from '@/views/order/shared/orderListExport'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
|
||||
type DeliverySubWaybillPrintRequestMeta = {
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
} from '@/api/order.print/orderprint'
|
||||
import { unwrapWavePlatformPrintPayload } from '@/views/order/waveOrder/config/wave-config'
|
||||
import { orderDetail } from '@/api/order.index/orderindex'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '../utils/order-index-helpers'
|
||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '@/views/order/shared/orderListExport'
|
||||
|
||||
type SubWaybillPrintRequestMeta = {
|
||||
waybill_codes: string[]
|
||||
|
||||
@ -95,7 +95,7 @@ import type { UpdateExpressWeighingWeightParams } from '@/api/order.index/orderi
|
||||
import {
|
||||
isOrderIndexApiSuccess,
|
||||
parseUpdateExpressWeighingWeightResponse
|
||||
} from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
} from '@/views/order/shared/orderListExport'
|
||||
|
||||
export type ExpressWeighingFormResult = ReturnType<typeof parseUpdateExpressWeighingWeightResponse> & {
|
||||
waybill?: string
|
||||
|
||||
@ -144,7 +144,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
@ -153,7 +153,7 @@ import {
|
||||
buildOrderWhereConditions,
|
||||
isOrderIndexApiSuccess,
|
||||
parseOrderListResponse
|
||||
} from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
} from '@/views/order/shared/orderListExport'
|
||||
import type { UpdateExpressWeighingWeightResponse } from '@/api/order.index/orderindex'
|
||||
import ExpressWeighingForm, { type ExpressWeighingFormResult } from './ExpressWeighingForm.vue'
|
||||
import {
|
||||
@ -343,7 +343,8 @@ onMounted(() => { loadList() })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 左侧:ScanBox(上)+ 最近称重(下)上下分区 */
|
||||
.side-panel {
|
||||
@ -356,7 +357,7 @@ onMounted(() => { loadList() })
|
||||
border-right: 1px solid #e8e8e8;
|
||||
box-shadow: 1px 0 2px rgba(0, 0, 0, 0.05);
|
||||
|
||||
/* 覆盖 order-sub.scss 中「ScanBox 直接作为左右分栏」的固定宽度/高度规则 */
|
||||
/* 覆盖 @/styles/list-page.scss 中「ScanBox 直接作为左右分栏」的固定宽度/高度规则 */
|
||||
:deep(.scan-box-container) {
|
||||
flex: 1 1 auto;
|
||||
height: auto;
|
||||
|
||||
@ -297,7 +297,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance, FormRules, InputInstance } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
@ -324,7 +324,7 @@ import {
|
||||
type ScanOrderResultShape
|
||||
} from '@/api/order.recheckorder/recheckOrder'
|
||||
import { orderUpdateExpressWeighingWeight } from '@/api/order.index/orderindex'
|
||||
import { isOrderIndexApiSuccess } from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
import { isOrderIndexApiSuccess } from '@/views/order/shared/orderListExport'
|
||||
import { normalizeBarcodeList, pickBarcodeText } from '@/utils/barcode'
|
||||
|
||||
const SCAN_PARAM_KEYS: (keyof RecheckScanOrderParams)[] = [
|
||||
@ -2149,7 +2149,8 @@ async function submitWeighing() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 工具栏:左侧按钮组 + 扫码输入,右侧设置与状态标签 */
|
||||
.main-content .toolbar {
|
||||
|
||||
@ -130,7 +130,7 @@ import {
|
||||
toOrderSelectedProductItem,
|
||||
type OrderSelectedProductItem,
|
||||
type WarehouseSearchMode
|
||||
} from '../utils/stock-picker-helpers'
|
||||
} from '@/views/stock/utils/stockPickerHelpers'
|
||||
|
||||
export type SelectProductItem = OrderSelectedProductItem
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { useCreateOrderSession } from '../composables/useCreateOrderSession'
|
||||
import { useCreateOrderSession } from './useCreateOrderSession'
|
||||
|
||||
const {
|
||||
minimized,
|
||||
@ -498,17 +498,17 @@
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { DialogBeforeCloseFn } from 'element-plus'
|
||||
import { useCreateOrderSession, type CreateOrderDraftSnapshot } from '../composables/useCreateOrderSession'
|
||||
import { useCreateOrderSession, type CreateOrderDraftSnapshot } from './useCreateOrderSession'
|
||||
import * as XLSX from 'xlsx'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import SelectProductDialog from './SelectProductDialog.vue'
|
||||
import type { SelectProductItem } from './SelectProductDialog.vue'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '../utils/order-meta-cache'
|
||||
import SelectProductDialog from '@/views/order/shared/component/SelectProductDialog.vue'
|
||||
import type { SelectProductItem } from '@/views/order/shared/component/SelectProductDialog.vue'
|
||||
import { loadExpressListCached, loadPlatformListCached, loadStoresCached } from '@/views/order/shared/orderMetaCache'
|
||||
import { settingPlatformList } from '@/api/setting.platform/platform'
|
||||
import {
|
||||
lookupAndExpandProductByKeyword,
|
||||
type OrderSelectedProductItem
|
||||
} from '../utils/stock-picker-helpers'
|
||||
} from '@/views/stock/utils/stockPickerHelpers'
|
||||
import { orderList } from '@/api/order.index/orderindex'
|
||||
import {
|
||||
extractPendingOrderParseAddressData,
|
||||
@ -517,7 +517,7 @@ import {
|
||||
orderPendingOrderParseAddress,
|
||||
type PendingOrderParseAddressData
|
||||
} from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { parseOrderListResponse } from '../utils/order-index-helpers'
|
||||
import { parseOrderListResponse } from '@/views/order/shared/orderListExport'
|
||||
import type { PendingOrderCreateOrderParams } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import {
|
||||
buildCityOptions,
|
||||
@ -533,7 +533,7 @@ import {
|
||||
extractStoreListFromResponse,
|
||||
getStatusTextClass,
|
||||
mapStoreListToSelectOptions
|
||||
} from '../config/order-common-config'
|
||||
} from '@/views/order/orderManagement/config/order-common-config'
|
||||
|
||||
const visible = defineModel<boolean>({ default: false })
|
||||
|
||||
@ -2703,7 +2703,7 @@ async function handleParseAddress() {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 状态文字:与待处理订单「同步状态」同一套轻量样式(同 styles/order-sub.scss) */
|
||||
/* 状态文字:与待处理订单「同步状态」同一套轻量样式(同 @/styles/status-text.scss) */
|
||||
.ut-status-text {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
@ -9,8 +9,8 @@ import {
|
||||
REVIEW_TOOLBAR_API_ACTIONS,
|
||||
type PendingBatchAsyncTaskConfig,
|
||||
type ToolbarApiActionConfig
|
||||
} from '../config/order-common-config'
|
||||
import type { UpdateAddressFormModel } from '../form/UpdateAddressForm.vue'
|
||||
} from '@/views/order/orderManagement/config/order-common-config'
|
||||
import type { UpdateAddressFormModel } from './form/UpdateAddressForm.vue'
|
||||
import { orderWaveSingleFetchByIds } from '@/api/order.wave/orderwave'
|
||||
import { navigateToSandanWaveTab } from '@/utils/wave-order-nav'
|
||||
|
||||
@ -100,7 +100,7 @@ import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import {
|
||||
waveScanBoxConfig,
|
||||
@ -745,7 +745,7 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
|
||||
@ -919,7 +919,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import {
|
||||
@ -4163,7 +4163,8 @@ async function submitFallbackOrderFetchByIds() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 弹窗底部按钮间距:对齐工具栏按钮组(OrderToolbarButtonGroup)gap 6px */
|
||||
.dialog-footer-actions {
|
||||
|
||||
@ -507,7 +507,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import {
|
||||
@ -2817,7 +2817,8 @@ async function submitGroupOrderDialog() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 弹窗底部按钮间距:对齐工具栏按钮组(OrderToolbarButtonGroup)gap 6px */
|
||||
.dialog-footer-actions {
|
||||
|
||||
@ -278,7 +278,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
@ -1246,7 +1246,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
|
||||
@ -546,7 +546,7 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import {
|
||||
@ -1252,7 +1252,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 新建/编辑波次策略:面板结构对齐「手工录入运单号」(ManualWaybillForm),
|
||||
表单主体改用双列栅格,避免一行一个字段导致表单过高 */
|
||||
|
||||
@ -169,19 +169,19 @@ import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { orderPendingOrder } from '@/api/order.pendingorder/orderpendingOrder'
|
||||
import { orderWaveBatchRemoveOrders } from '@/api/order.wave/orderwave'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import AllocateExpressForm from '@/views/order/orderManagement/form/AllocateExpressForm.vue'
|
||||
import StorageAllocateForm from '@/views/order/orderManagement/form/StorageAllocateForm.vue'
|
||||
import SyncOrderIdsForm from '@/views/order/orderManagement/form/SyncOrderIdsForm.vue'
|
||||
import ManualWaybillForm from '@/views/order/orderManagement/form/ManualWaybillForm.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import { createPendingToolbarController } from '@/views/order/orderManagement/utils/toolbar-actions'
|
||||
import AllocateExpressForm from '@/views/order/shared/form/AllocateExpressForm.vue'
|
||||
import StorageAllocateForm from '@/views/order/shared/form/StorageAllocateForm.vue'
|
||||
import SyncOrderIdsForm from '@/views/order/shared/form/SyncOrderIdsForm.vue'
|
||||
import ManualWaybillForm from '@/views/order/shared/form/ManualWaybillForm.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import { createPendingToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import {
|
||||
buildOrderWhereConditions,
|
||||
parseOrderListResponse,
|
||||
resolveOrderInterceptStatus,
|
||||
resolveOrderRecheckStatus,
|
||||
sanitizeOrderListWhere
|
||||
} from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
} from '@/views/order/shared/orderListExport'
|
||||
import {
|
||||
buildPendingStyleColumns,
|
||||
pendingAvailableFields,
|
||||
@ -625,7 +625,7 @@ async function loadStoreOptions() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.pending-order-panel {
|
||||
display: flex;
|
||||
|
||||
@ -228,7 +228,7 @@ function formatDateTime(value: string | number | null | undefined) {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 面板自带内边距(宿主 .detail-container 已改为 padding: 0 10px),
|
||||
分区标题 / label 样式对齐 stock/external_stock「基本信息」新设计 */
|
||||
|
||||
@ -4,7 +4,9 @@ export const WAVE_PAGE_CONFIG = {
|
||||
* 单页模式:开启后不显示「团购波次」「散单波次」等标签切换区域,
|
||||
* 直接展示默认页签(团购波次)的内容
|
||||
*/
|
||||
singlePage: false
|
||||
singlePage: false,
|
||||
/** 本页 tab 缓存上限:本页共 5 个页签,需全量缓存以避免 LRU 抖动 */
|
||||
tabCacheMax: 5
|
||||
}
|
||||
|
||||
import {
|
||||
@ -22,7 +24,7 @@ import {
|
||||
normalizeOrderDetailItems,
|
||||
parseOrderDetailPayload,
|
||||
parseOrderListResponse
|
||||
} from '@/views/order/orderManagement/utils/order-index-helpers'
|
||||
} from '@/views/order/shared/orderListExport'
|
||||
import { resolveRowBarcode } from '@/utils/barcode'
|
||||
|
||||
/** ScanBox 筛选字段分组(波次模块专用,策略/散单候选等页仍可使用) */
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
<!-- 单页模式:直接渲染默认页签组件,复用 .tab-container 样式结构 -->
|
||||
<div v-else class="tab-container single-page-container">
|
||||
<keep-alive>
|
||||
<keep-alive :max="tabCacheMax">
|
||||
<component
|
||||
:is="defaultTab.component"
|
||||
:key="defaultTab.name"
|
||||
@ -109,7 +109,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed, markRaw, onMounted, onUnmounted, onActivated, onDeactivated } from 'vue'
|
||||
import { ref, watch, computed, markRaw, defineAsyncComponent, onMounted, onUnmounted, onActivated, onDeactivated } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
@ -117,11 +117,12 @@ import { useExperimentalStore } from '@/stores/modules/experimental'
|
||||
import { Sort } from '@element-plus/icons-vue'
|
||||
import SortSettingDialog from '@/components/SortSettingDialog.vue'
|
||||
import { useUserPreferenceStore } from '@/stores/modules/userPreference'
|
||||
// 默认页签(团购波次)保持同步加载,其余页签按需加载
|
||||
import GroupWaveBatchListPanel from './GroupWaveBatchListPanel.vue'
|
||||
import SandanWaveBatchListPanel from './SandanWaveBatchListPanel.vue'
|
||||
import FallbackOrderListPanel from './FallbackOrderListPanel.vue'
|
||||
import WaveStrategyListPanel from './WaveStrategyListPanel.vue'
|
||||
import WavePickTaskListPanel from './WavePickTaskListPanel.vue'
|
||||
const SandanWaveBatchListPanel = defineAsyncComponent(() => import('./SandanWaveBatchListPanel.vue'))
|
||||
const FallbackOrderListPanel = defineAsyncComponent(() => import('./FallbackOrderListPanel.vue'))
|
||||
const WaveStrategyListPanel = defineAsyncComponent(() => import('./WaveStrategyListPanel.vue'))
|
||||
const WavePickTaskListPanel = defineAsyncComponent(() => import('./WavePickTaskListPanel.vue'))
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import { orderWaveConfirmPrintScan, orderWaveConfirmPrintUnclaimedWaveCount } from '@/api/order/order'
|
||||
import { orderWaveFetchableOrderCount, type WaveFetchableOrderCountResponse } from '@/api/order.wave/orderwave'
|
||||
@ -134,8 +135,8 @@ const settingsStore = useSettingsStore()
|
||||
const experimentalStore = useExperimentalStore()
|
||||
/** tab 缓存开关(实验性设置,默认开) */
|
||||
const tabCacheEnabled = computed(() => experimentalStore.tabCacheEnabled)
|
||||
/** tab 缓存最大数量(实验性设置,默认 2,超出 LRU 淘汰最久未用) */
|
||||
const tabCacheMax = computed(() => experimentalStore.tabCacheMax)
|
||||
/** tab 缓存最大数量:优先本页配置(5 个页签全量缓存),回退全局实验性设置 */
|
||||
const tabCacheMax = computed(() => WAVE_PAGE_CONFIG.tabCacheMax ?? experimentalStore.tabCacheMax)
|
||||
|
||||
const singlePage = WAVE_PAGE_CONFIG.singlePage
|
||||
|
||||
@ -717,7 +718,8 @@ watch(activeTab, (name) => {
|
||||
/* ===== 页签切换淡入淡出(对齐 storage/generalreport 的 tab-fade) ===== */
|
||||
.tab-fade-enter-active,
|
||||
.tab-fade-leave-active {
|
||||
transition: opacity 0.2s ease;
|
||||
/* 与 orderManagement 统一:0.12s,避免 out-in 叠加出 ~0.4s 延迟 */
|
||||
transition: opacity 0.12s ease;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ import {
|
||||
import {
|
||||
parseComboNameNotation,
|
||||
parseComboSimpleNotation
|
||||
} from '@/views/order/orderManagement/utils/stock-picker-helpers'
|
||||
} from '@/views/stock/utils/stockPickerHelpers'
|
||||
import {
|
||||
extractStoreListFromResponse,
|
||||
mapStoreListToSelectOptions
|
||||
|
||||
@ -140,7 +140,7 @@ function handleReset() {
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.search-form {
|
||||
margin-bottom: 4px;
|
||||
|
||||
@ -82,7 +82,7 @@ import {
|
||||
isStockApiSuccess,
|
||||
mapStockPickerItem,
|
||||
parseStockWarehouseSearch
|
||||
} from '@/views/order/orderManagement/utils/stock-picker-helpers'
|
||||
} from '@/views/stock/utils/stockPickerHelpers'
|
||||
|
||||
export type ComboStockPickerItem = {
|
||||
item_goods_sku_id: number
|
||||
|
||||
@ -101,7 +101,7 @@ import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { comboGoodsDelete, comboGoodsList } from '@/api/combogoods/combogoods'
|
||||
import ComboGoodsFormDialog from './component/ComboGoodsFormDialog.vue'
|
||||
@ -299,7 +299,8 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user