refactor(layout): 统一页签组件与菜单图标体系,优化顶部区域高度与渲染性能

- 新增全局 TabArea 组件及 tab-area.scss,替换 11 处页面内重复实现,
  统一标签样式、排序入口与本地排序偏好
- 新增 51 个业务 SVG 图标,侧边栏/顶栏菜单支持图标展示,
  调整收藏星标与展开箭头的间距、配色,避免图标重叠
- 顶部区域高度改为 ResizeObserver 实测,并输出 --app-header-height 变量,
  移除 97/134 魔法数字与各页面 calc(100vh - N) 的高度计算
- TaskView 快捷区与标签行重构:Map 索引定位当前标签、v-memo 减少重渲染、
  仅监听 route.fullPath 触发更新
- 打印组件连接初始化改为会话内只执行一次;路由树调试日志仅在开发环境输出
- 引入 unplugin-auto-import / unplugin-vue-components 依赖,
  补充布局性能分析、菜单图标体系、顶部区域优化三份设计文档
This commit is contained in:
yin 2026-11-05 18:00:17 +08:00
parent 093053391a
commit b201363ad2
133 changed files with 2545 additions and 1932 deletions

View File

@ -0,0 +1,405 @@
# Layout 框架性能分析与优化建议
> 状态:**阶段 1、2 已实施;阶段 3 部分待定;阶段 4 评估后回滚**
> 范围:首屏加载 + 路由切换响应
> 基线:`npm run build` 产物实测
---
## 〇、实施进展
| 阶段 | 项 | 状态 |
|---|---|---|
| 1 | 生产环境关闭路由树 `console.log` | ✅ 已完成 |
| 1 | `document.title` 去重 | ✅ 已完成 |
| 1 | `beforeEach` 打印连接加一次性标记 | ✅ 已完成 |
| 2 | 切页过渡去掉离开动画(0.2s → 0,进入 0.12s) | ✅ 已完成 |
| 2 | `TaskView` 标签定位改 `Map`(O(1)) | ✅ 已完成 |
| 2 | 打印运行时移到 mount 之后 | ⏭ 跳过(`startConnections` 依赖已初始化的 runtime,后置会漏连接) |
| 3 | `keep-alive` max 降到 4 | ⏸ 暂缓(会改变业务缓存行为) |
| 3 | `TopMenu` 测量缓存 / `Sidebar` 延迟渲染 | ⏸ 暂缓(收益中低、风险中) |
| 4 | Element Plus 按需引入 | ↩️ **已回滚**,详见下方 |
### 阶段 4 回滚原因
启用 `unplugin-auto-import` + `unplugin-vue-components` 后,类型检查暴露出一批**既有的无效用法**(这些代码在全量注册下一直静默失效):
- `el-list` / `el-list-item`:Element Plus 不存在该组件(Element UI 2 遗留)
- `type="link"`:Element Plus 的 Button 用 `link` 属性,`type="link"` 非法
- 若干 `TreeNodeData` / `string | null` 类型不匹配
修复这些用法**会改变页面视觉**,超出「性能优化不影响样式」的范围,因此回滚,建议作为独立任务排期。
> 依赖 `unplugin-auto-import` / `unplugin-vue-components` 已安装,可留作后续实施。
---
## 一、现状基线
### 1.1 首屏加载资源(index.html 实际引用)
| 资源 | 体积 | gzip |
|---|---|---|
| `vendor-element-plus.js` | **809 kB** | 256 kB |
| `vendor-VdJDF3fp.js`(其他第三方) | **416 kB** | 140 kB |
| `index.js`(入口 + 应用代码) | **228 kB** | 65 kB |
| `vendor-vue.js` | **210 kB** | 78 kB |
| **JS 合计** | **≈ 1.66 MB** | **≈ 539 kB** |
| `vendor-element-plus.css` | **347.6 kB** | ≈ 40 kB |
| `index.css` + `vendor*.css` | ≈ 60 kB | — |
| **CSS 合计** | **≈ 400 kB** | — |
✅ 好消息:`vendor-echarts`(1.12 MB)和 `vendor-xlsx`(424 kB)**不在首屏预加载列表**,已是按需加载。
### 1.2 渲染与切换链路
```
main.ts
├─ import ElementPlus(全量)+ 全量 CSS ← 首屏最大负担
├─ import 'virtual:svg-icons-register' (67 个图标内联进入口)
├─ loadServerMessages() (异步 i18n)
├─ initPrinterRuntime() + bindRuntimeEvents() (mount 前同步执行)
└─ app.mount('#app')
permission.ts(beforeEach)
├─ NProgress.start()
├─ hasGetUserInfo 判断
│ └─ 否则:getInfo() → generateRoutes() → addRoute() × N
│ + console.log(formatRoutesForLog(...)) × 3 ← 生产环境也执行
└─ ensurePrinterConnectionsAfterLogin() ← 每次导航都调用
AppMain.vue
└─ keep-alive(:include=cachedViews, :max=8)
+ transition(mode="out-in", 0.2s) ← 感知延迟
TaskView/index.vue
├─ ResizeObserver → 写 --app-header-height
├─ visitedViews v-for + v-memo
├─ moveToCurrentTag():遍历全部标签定位
└─ onBeforeUpdate 清空 tagsRef
TopMenu.vue(top-bottom 布局)
└─ 渲染两份菜单 DOM:真实层 + 隐藏测量层
```
### 1.3 已有的良好实践(无需再改)
- ✅ 路由组件全部 `() => import()` 懒加载(`componentMap`)
- ✅ `keep-alive` 的 `wrapRouteComponent` 修复了 include 匹配失效问题
- ✅ `router-view :key` 收窄为 `route.name ?? route.path`,同页 query 变化不再重建
- ✅ 第三方库按库拆分 chunk,升级应用代码时第三方哈希不变,可长期缓存
- ✅ `tags-view` 已加 `v-memo`
- ✅ `ResizeObserver` 替代轮询式高度同步
- ✅ echarts / xlsx 不在首屏
---
## 二、性能瓶颈清单
### P0 · Element Plus 全量引入
**位置**:`main.ts`
```ts
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
app.use(ElementPlus)
```
**代价**:首屏 JS **809 kB**(gzip 256 kB)+ CSS **347.6 kB**,占首屏 JS 的 **48%**、CSS 的 **87%**。
**实际使用情况**:项目里大量组件是 `<el-*>` 模板标签,全量注册会让所有组件(含几乎不用的 Table/Tree/Cascader/Transfer…)都进入产物。
**建议**:改为按需自动引入
```ts
// vite.config.ts
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
plugins: [
AutoImport({ resolvers: [ElementPlusResolver()] }),
Components({ resolvers: [ElementPlusResolver()] })
]
```
同时 `main.ts` 移除 `app.use(ElementPlus)` 与全量 CSS import(样式由 resolver 按需注入)。
> 注意:`ElMessage` / `ElMessageBox` 这类**函数式调用**不会被模板扫描到,需要 `import { ElMessage } from 'element-plus'` 保持显式导入(项目里已经是这样用的,兼容)。
**预期收益**:首屏 JS **≈ -350~-450 kB**(gzip -100~-130 kB),CSS **≈ -250 kB**。
**风险**:中。需要全量回归一次(尤其是动态渲染的 `h(...)` 用法、`el-config-provider`、`ElLoading` 等指令式组件)。
---
### P0 · 生产环境仍在格式化整棵路由树
**位置**:`permission.ts`
```ts
console.log('[Router] 动态路由 (后端菜单转换):', formatRoutesForLog(accessRoutes))
console.log('[Router] 合并后完整路由 (constantRoutes + 动态):', formatRoutesForLog(permissionStore.routes))
console.log('[Router] Vue Router 实例路由:', formatRoutesForLog(router.getRoutes()))
```
`formatRoutesForLog` 会**递归遍历整棵路由树并为每个节点创建新对象**,且执行了 3 次(其中一次还是合并后的全量路由)。
**代价**:菜单多时(当前 web_pages 89 + api 264 + 其他端),每次登录 / 整页刷新都要构造 3 份完整对象树,同时产生大量对象占用内存。
**建议**:
```ts
if (import.meta.env.DEV) {
console.log(...)
}
```
**预期收益**:登录后首次进入 **-50~150 ms**,并释放可观内存。
**风险**:极低。
---
### P0 · `beforeEach` 每次导航都触发打印连接逻辑
**位置**:`permission.ts`
```ts
if (hasGetUserInfo) {
ensurePrinterConnectionsAfterLogin() // 每次导航都执行
maybeRetryPrintConnectionsAfterRefresh()
return true
}
```
`ensurePrinterConnectionsAfterLogin()` 内部会取 store、检查 `isLoaded`、调用 `startConnections()`(内部虽有幂等标记,但仍有数次函数调用与状态判断)。
**建议**:加一次性标记,仅在本会话首次通过守卫时执行:
```ts
let bootstrapped = false
if (hasGetUserInfo) {
if (!bootstrapped) { bootstrapped = true; ensurePrinterConnectionsAfterLogin() }
...
}
```
**预期收益**:每次切页 **-1~3 ms**(单次不大,但导航频率高)。
**风险**:低(需保留 `/redirect` 软刷新后的重连分支)。
---
### P1 · 切页动画造成的感知延迟
**位置**:`AppMain.vue`
```vue
<transition name="fade-transform" mode="out-in">
```
```scss
.tab-fade-enter-active, .tab-fade-leave-active { transition: opacity .2s; }
```
`mode="out-in"` 表示**旧页面先淡出 200ms,新页面再淡入 200ms**,用户感知的切换延迟累计约 **400ms**。而 keep-alive 命中时页面其实已经缓存好了,这 200ms 完全是等待。
**建议**(按保守程度排序):
1. 只保留进入动画,去掉离开动画:
```scss
.fade-transform-leave-active { transition: opacity 0s; }
```
2. 或缩短到 100~120ms
3. 进阶:keep-alive 命中时跳过动画(按 `route.meta.noCache` 或首次访问判断)
**预期收益**:切页感知 **-200~-300 ms**。
**风险**:低(纯视觉调整)。
---
### P1 · `TaskView` 每次切页线性遍历标签
**位置**:`TaskView/index.vue`
```ts
const moveToCurrentTag = () => {
nextTick(() => {
for (const [i, tag] of visitedViews.value.entries()) { ... tagsRef.value[i] ... }
})
}
```
- 每次 `route.fullPath` 变化都线性遍历全部已打开标签
- `onBeforeUpdate` 会清空 `tagsRef`,随后 Vue 重建 ref 数组
**建议**:
- 维护 `Map<path, HTMLElement>`,`moveToCurrentTag` 变成 O(1)
- 用函数式 `:ref="el => tagEls.set(tag.path, el)"` 替代数组 ref + 清空逻辑
**预期收益**:标签 20+ 时每次切页 **-3~10 ms**。
**风险**:低。
---
### P1 · `TopMenu` 渲染两份菜单 DOM
**位置**:`TopMenu.vue`
```vue
<el-menu class="top-menu">…真实菜单…</el-menu>
<div ref="measureRef" class="top-menu-measure">
<el-menu class="top-menu">…再渲染一份相同菜单…</el-menu>
</div>
```
测量层把**所有一级菜单再挂载一遍**(含 el-menu / el-sub-menu 全套组件实例),只为量取宽度。
**建议**:
1. 短中期:菜单结构(routes)不变时缓存测量结果,避免 `resize` / `locale` / `fonts.ready` 反复触发 `measureItems` 全量重测
2. 长期:直接用真实层的 `scrollWidth` 与 `clientWidth` 判断溢出,去掉测量层
3. 至少把测量层降级为**纯 DOM 文本宽度测量**(`canvas.measureText`),不挂载组件
**预期收益**:首屏挂载 **-20~40 ms**,内存减少一份菜单实例。
**风险**:中(收纳数量计算的准确性依赖测量结果)。
---
### P1 · `Sidebar` 一次性挂载全部菜单
**位置**:`Sidebar/SidebarItem.vue` 递归
当前 `web_pages` 有 89 条(含子项),全部一次性渲染成 `el-menu-item` / `el-sub-menu`。
**建议**:
- 折叠状态的子菜单**延迟渲染**:只有父级展开过(`is-opened`)才 `v-if` 渲染 children
- 菜单层级深的页面,首屏 DOM 节点数可减少 40%+
**预期收益**:首屏 DOM 挂载 **-30~60 ms**(取决于菜单量)。
**风险**:中低(需处理“展开瞬间”的首次渲染)。
---
### P2 · `document.title` 每次导航写两次
**位置**:`main.ts`
```ts
watch([...frontBrandStore.loaded, siteTitle, router.currentRoute.value.path], () => applyDocumentTitle())
router.afterEach((to) => applyDocumentTitle(to))
```
`path` 变化时 `watch` 触发一次,`afterEach` 再触发一次,造成重复的 `tMenu` 翻译查找 + DOM 写入。
**建议**:只保留 `afterEach`(品牌加载完成的场景另加一次 watch 即可)。
**预期收益**:每次导航 **-1~2 ms**。
**风险**:低。
---
### P2 · 启动期同步初始化打印运行时
**位置**:`main.ts`
```ts
initPrinterRuntime()
usePrinterComponentStore(pinia).bindRuntimeEvents()
app.mount('#app')
```
在 `mount` 之前同步执行,会推迟首帧。
**建议**:移到 `mount` 之后,或用 `requestIdleCallback` 包裹,让首屏优先渲染。
**预期收益**:首屏 FCP **-10~30 ms**。
**风险**:低(注意事件绑定时序)。
---
### P2 · `keep-alive` 最大缓存 8 个页面
`pageCacheMax` 默认 8。缓存的页面实例持有完整 DOM、表格数据、定时器。
**建议**:
- 把默认值降到 4
- 对重页面(含大表格/视频/图表的)在路由 `meta` 上标 `noCache`
**预期收益**:内存占用下降,长时间使用后切换更稳。
**风险**:低(业务上会牺牲少量返回体验)。
---
### P3 · 首屏 CSS 未拆分/未压缩到极致
当前 `vendor-element-plus.css` 347.6 kB 是**全量样式**。按 P0 的按需引入解决后,这部分会降到约 80~100 kB。
另外建议确认部署侧已开启:
- gzip / brotli
- `Cache-Control: immutable`(vendor chunk 带哈希,可长期缓存)
- HTTP/2 或 CDN
---
## 三、建议实施顺序
| 阶段 | 内容 | 风险 | 预期收益 |
|---|---|---|---|
| **1** | 生产环境关闭路由树 `console.log` | 极低 | 首次进入 -50~150ms |
| **1** | `document.title` 去重 | 极低 | 每次导航 -1~2ms |
| **1** | `beforeEach` 打印连接加一次性标记 | 低 | 每次导航 -1~3ms |
| **2** | 切页动画去掉离开过渡 / 缩短时长 | 低 | 切页感知 -200~300ms |
| **2** | `TaskView` 标签定位改 Map | 低 | 每次切页 -3~10ms |
| **2** | 打印运行时移到 mount 之后 | 低 | FCP -10~30ms |
| **3** | `TopMenu` 测量结果缓存 / 去测量层 | 中 | 首屏 -20~40ms |
| **3** | `Sidebar` 子菜单延迟渲染 | 中 | 首屏 -30~60ms |
| **3** | `keep-alive` max 降到 4 + 重页面 noCache | 低 | 内存下降 |
| **4** | **Element Plus 按需引入** | 中 | 首屏 JS **-350~450kB**、CSS **-250kB** |
> 阶段 1、2 几乎零风险,可以先做,**不改任何业务逻辑**。
> 阶段 4 收益最大但需要全量回归,建议单独排期。
---
## 四、可选:先加观测再优化
当前没有任何性能埋点,优化效果无法量化。建议先加最小埋点:
```ts
// 切页耗时
router.beforeEach(() => { performance.mark('route-start') })
router.afterEach((to) => {
performance.mark('route-end')
performance.measure(`route:${String(to.name)}`, 'route-start', 'route-end')
})
```
配合 Chrome Performance 面板,可以直接确认「切页慢」到底是:
- 路由守卫耗时(P0-2 / P0-3)
- 组件渲染耗时(P1-1 / P1-3)
- 还是首屏资源太大(P0-1)
---
## 五、结论
- **首屏慢的主因是 Element Plus 全量引入**(1.66MB 首屏 JS 里占 809kB),这是唯一能带来「量级变化」的优化点
- **切页慢的主因是 200ms 的 `out-in` 过渡动画 + 每次导航的重复守卫逻辑**,这两项改动小、收益直接
- 菜单相关的渲染开销(TopMenu 双份 DOM、Sidebar 全量挂载)属于「菜单条目多时才会显现」的次要因素,可作为第三阶段
如果只能做三件事:**关掉路由树日志 → 去掉离开过渡动画 → Element Plus 按需引入**。

View File

@ -0,0 +1,302 @@
# 菜单图标体系 · 实施方案
> 范围:web 端左侧菜单 / 顶部菜单的图标(`wms_permission.meta_icon`)
> 状态:**方案稿,未改代码**
> 目标:命名统一、可维护、失效可见、存量可迁移
---
## 一、图标库选型
### 1.1 现状
| 环节 | 实现 |
|---|---|
| 构建 | `vite-plugin-svg-icons`,扫描 `src/icons/svg/*.svg`,生成 sprite,id = `icon-{文件名}` |
| 注册 | `main.ts` → `virtual:svg-icons-register` + `app.component('svg-icon', SvgIcon)` |
| 渲染 | `<svg-icon icon-class="xxx" />` → `<use xlink:href="#icon-xxx" />` |
| 尺寸/颜色 | `1em × 1em`,`fill: currentColor` |
| 现有图标 | 16 个通用图标(dashboard / form / table / user …),**无业务图标** |
另一套:`@element-plus/icons-vue`(`ArrowDown`、`ChatDotRound` 等),以 **Vue 组件**形式零散使用,不参与菜单图标。
### 1.2 候选方案对比
| 方案 | 优点 | 缺点 | 结论 |
|---|---|---|---|
| **A. 沿用 svg sprite + 自建业务图标集** | 零新增依赖;渲染链路不变;40+ 现有使用点无需改动;体积可控(按需打包);`fill: currentColor` 天然适配主题色 | 需要人工沉淀图标文件 | ✅ **推荐** |
| B. `@element-plus/icons-vue` 作为菜单图标源 | 依赖已存在,约 290 个通用图标 | 组件形式,无法用 `meta_icon` 字符串直接驱动;**缺少订单/库存/仓储类业务语义图标** | ❌ 不作为菜单图标源,继续用于按钮内图标 |
| C. Iconify 离线集合(`@iconify/vue`) | 图标海量(20 万+),字符串直用,可离线 | 新增运行时依赖;命名带集合前缀;需改造 `SvgIcon`;首屏体积需额外控制 | ⚠️ 进阶可选 |
| D. iconfont 字体/symbol | 设计可维护,可自定义 | 依赖外部项目与更新流程;字体图标单色 | ⚠️ 团队有设计资源时可选 |
### 1.3 结论
**继续使用现有的 `vite-plugin-svg-icons` + `svg-icon` 机制**,只补齐「业务图标资源 + 命名规范 + 兜底校验」。
图标素材来源建议使用 MIT 协议的开源集合(可直接商用、可落地成 svg 文件):
- **Tabler Icons**(MIT,线条风格,与当前 UI 风格接近)
- **Material Design Icons**(Apache-2.0)
- **Carbon Icons**(Apache-2.0)
> 落地方式:下载为 `.svg` 放入 `src/icons/svg/`,文件名即 `meta_icon` 的值,**不引入任何新依赖**。
命名规范:
```
全小写 kebab-case,语义优先,不带前缀
✔ order、goods、storage、express-truck、after-sale
✘ el-icon-s-goods、Icon_Order、orderIcon
```
---
## 二、图标清单
### 2.1 需要新增的 svg 文件(19 个)
| # | 文件名 | 语义 | 建议来源 |
|---|---|---|---|
| 1 | `order.svg` | 订单 | 单据/清单 |
| 2 | `goods.svg` | 商品 | 包裹/盒子 |
| 3 | `storage.svg` | 库存 | 货架/箱子堆叠 |
| 4 | `material.svg` | 物料 | 耗材/组件 |
| 5 | `warehouse-grid.svg` | 仓位 | 网格/库位 |
| 6 | `warehouse.svg` | 仓库 | 仓库/厂房 |
| 7 | `data-chart.svg` | 数据 | 柱状/折线图 |
| 8 | `store-owner.svg` | 货主 | 商户/店铺 |
| 9 | `express-truck.svg` | 物流 | 货车 |
| 10 | `finance.svg` | 财务 | 钱币/钱包 |
| 11 | `video-camera.svg` | 视频监控 | 摄像头 |
| 12 | `settings.svg` | 设置 | 齿轮 |
| 13 | `system.svg` | 系统 | 服务器/终端 |
| 14 | `after-sale.svg` | 售后 | 客服/售后 |
| 15 | `inbox-message.svg` | 消息 | 收件箱/消息 |
| 16 | `user-check.svg` | 成员加入审核 | 用户+对勾 |
| 17 | `permission.svg` | 权限管理 | 盾牌/钥匙 |
| 18 | `role.svg` | 角色管理 | 用户组 |
| 19 | `material-info.svg` | 物料资料 | 文档+信息 |
已存在、无需新增:`user.svg`(账号管理沿用)
### 2.2 菜单 → 图标映射表
| id | path | 菜单标题 | 现 meta_icon | 新 meta_icon |
|---|---|---|---|---|
| 1 | `/order` | 订单 | `''` | `order` |
| 13 | `/stock` | 商品 | `el-icon-s-goods` | `goods` |
| 18 | `/storage` | 库存 | `el-icon-s-data` | `storage` |
| 15 | `/material` | 物料 | `el-icon-s-cooperation` | `material` |
| 14 | `/warehouse` | 仓位 | `el-icon-s-grid` | `warehouse-grid` |
| 16 | `/data` | 数据 | `el-icon-s-marketing` | `data-chart` |
| 17 | `/store` | 货主 | `el-icon-s-custom` | `store-owner` |
| 393 | `/warehouses` | 仓库 | `el-icon-s-custom` | `warehouse` |
| 19 | `/express` | 物流 | `el-icon-truck` | `express-truck` |
| 28 | `/finance` | 财务 | `el-icon-s-finance` | `finance` |
| 47 | `video` | 视频监控 | `el-icon-video-camera-solid` | `video-camera` |
| 4 | `/setting` | 设置 | `el-icon-s-tools` | `settings` |
| 73 | `/system` | 系统 | `el-icon-s-tools` | `system` |
| 519 | `afterSale` | 售后 | `null` | `after-sale` |
| 492 | `/inbox` | 消息 | `null` | `inbox-message` |
| 50 | `/auth/approve` | 成员加入审核 | `null` | `user-check` |
| 6 | `account` | 账号管理 | `user` | `user`(不变) |
| 5 | `permission` | 权限管理 | `setting` | `permission` |
| 7 | `role` | 角色管理 | `role` | `role`(补文件) |
| 29 | `materialInfo` | 物料资料 | `el-icon-info` | `material-info` |
> `720` 行之外的其他 `web_pages` 子菜单当前无图标,可按需逐步补充,不影响本方案实施。
---
## 三、迁移 SQL
### 3.1 前置检查
```sql
-- 迁移前快照(便于回滚比对)
SELECT id, path, meta_title, meta_icon
FROM wms_permission
WHERE type = 'web_pages' AND meta_icon IS NOT NULL AND meta_icon <> ''
ORDER BY id;
```
### 3.2 正向迁移
```sql
UPDATE wms_permission SET meta_icon = 'order' WHERE id = 1 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'goods' WHERE id = 13 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'storage' WHERE id = 18 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'material' WHERE id = 15 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'warehouse-grid' WHERE id = 14 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'data-chart' WHERE id = 16 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'store-owner' WHERE id = 17 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'warehouse' WHERE id = 393 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'express-truck' WHERE id = 19 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'finance' WHERE id = 28 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'video-camera' WHERE id = 47 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'settings' WHERE id = 4 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'system' WHERE id = 73 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'after-sale' WHERE id = 519 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'inbox-message' WHERE id = 492 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'user-check' WHERE id = 50 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'permission' WHERE id = 5 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'role' WHERE id = 7 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'material-info' WHERE id = 29 AND type = 'web_pages';
-- 账号管理 id = 6 保持 'user' 不变
```
> 全部带 `id + type` 双重条件,避免误伤其他端(`pda_pages` / `miniprogram_pages`)。
### 3.3 回滚
```sql
UPDATE wms_permission SET meta_icon = '' WHERE id = 1 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-goods' WHERE id = 13 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-data' WHERE id = 18 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-cooperation' WHERE id = 15 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-grid' WHERE id = 14 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-marketing' WHERE id = 16 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-custom' WHERE id = 17 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-custom' WHERE id = 393 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-truck' WHERE id = 19 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-finance' WHERE id = 28 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-video-camera-solid' WHERE id = 47 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-tools' WHERE id = 4 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-s-tools' WHERE id = 73 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = NULL WHERE id = 519 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = NULL WHERE id = 492 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = NULL WHERE id = 50 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'setting' WHERE id = 5 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'role' WHERE id = 7 AND type = 'web_pages';
UPDATE wms_permission SET meta_icon = 'el-icon-info' WHERE id = 29 AND type = 'web_pages';
```
### 3.4 迁移后校验
```sql
-- 应无 el-icon-* 残留(web_pages)
SELECT id, path, meta_icon FROM wms_permission
WHERE type = 'web_pages' AND meta_icon LIKE 'el-icon-%';
-- 列出所有在用的图标名,逐个核对 svg 文件是否齐全
SELECT meta_icon, COUNT(*) AS used_by
FROM wms_permission
WHERE type = 'web_pages' AND meta_icon IS NOT NULL AND meta_icon <> ''
GROUP BY meta_icon ORDER BY meta_icon;
```
---
## 四、组件改造方案
### 4.1 `SvgIcon` 增加兜底与告警
`src/components/SvgIcon/index.vue`
现状:icon 不存在时静默渲染空白,**无法发现问题**。
改造要点:
| 项 | 做法 |
|---|---|
| 兜底图标 | 新增 `fallback` prop,默认 `unknown`;symbol 不存在时显示它 |
| 存在性检测 | 检测 `#icon-{name}` 是否存在于 sprite(结果按名字缓存,避免重复查询 DOM) |
| 开发期告警 | `import.meta.env.DEV` 下 `console.warn('[svg-icon] 图标不存在: xxx')` |
| 保持兼容 | `iconClass` 为空或外部链接时行为不变 |
伪代码:
```ts
const iconExists = computed(() => {
if (!props.iconClass || isExternal.value) return true
if (cache.has(props.iconClass)) return cache.get(props.iconClass)!
const ok = !!document.getElementById(`icon-${props.iconClass}`)
cache.set(props.iconClass, ok)
if (!ok && import.meta.env.DEV) console.warn(`[svg-icon] 图标不存在: ${props.iconClass}`)
return ok
})
const finalIcon = computed(() => (iconExists.value ? props.iconClass : props.fallback))
```
> 注意:缓存要在 sprite 注册完成后才有意义,首次调用前需确保 `virtual:svg-icons-register` 已执行(入口已保证)。
### 4.2 权限页图标列表改为动态生成
`src/views/system/setting/permission/index.vue`
现状:`iconList` 硬编码 16 个字符串,其中 `shopping-cart`、`skill`、`star`、`zip` **文件不存在**,`user` 重复两次。
改造:
```ts
const svgModules = import.meta.glob('@/icons/svg/*.svg')
const iconList = Object.keys(svgModules)
.map((p) => p.split('/').pop()!.replace(/\.svg$/, ''))
.sort()
```
收益:
- 新增图标文件后**自动出现在下拉里**,无需改代码
- 彻底消除「列表与实际资源漂移」
- 重复项自动去重
### 4.3 图标选择器开放到 `web_pages`
现状:`meta_icon` 输入块被 `v-if="tempCreate.type === 'pda_pages'"` 限制,**web 菜单在界面上无法配置图标**。
改造:条件放宽为
```vue
v-if="tempCreate.type === 'web_pages' || tempCreate.type === 'pda_pages'"
```
同步修改编辑弹窗(`tempUpdate`)中的同一处。
### 4.4 可选:抽 `IconPicker` 组件
如果后续多个页面都要选图标,把「下拉 + 预览 + 搜索」抽成 `src/components/IconPicker/index.vue`:
| prop | 说明 |
|---|---|
| `modelValue` | 图标名 |
| `clearable` | 是否可清空 |
| `placeholder` | 占位文案 |
内部复用动态生成的 `iconList`,下拉项左侧渲染 `svg-icon` 预览。
---
## 五、实施步骤
| 步骤 | 内容 | 影响面 | 可独立上线 |
|---|---|---|---|
| 1 | 落地 19 个 svg 文件到 `src/icons/svg/` | 仅新增资源 | ✅ |
| 2 | `SvgIcon` 加兜底 + DEV 告警 | 全局组件 | ✅ |
| 3 | `iconList` 改为 `import.meta.glob` 动态生成 | 权限页 | ✅ |
| 4 | 图标选择器开放 `web_pages` | 权限页 | ✅ |
| 5 | 执行迁移 SQL | 数据 | ✅(建议与 1 同批) |
| 6 | 校验:菜单逐项检查 + 无 `el-icon-*` 残留 | — | — |
> 步骤 1 与 5 必须同批发布,否则会出现「数据改了但图标文件没有」的空白期。
---
## 六、风险与注意事项
| 风险 | 说明 | 应对 |
|---|---|---|
| 图标文件缺失 | 数据先改、文件未发 → 菜单空白 | 步骤 1 先于 5,或同批 |
| 首页首屏体积 | 每个 svg 会被打进 sprite(内联) | 单个 svg 控制在 2KB 内,统一 `viewBox="0 0 24 24"` |
| 颜色失效 | 图标自带 `fill` 会覆盖 `currentColor` | svg 内**不要写死 `fill`**,统一用 `fill="currentColor"` 或不写 |
| 线宽不一致 | 不同来源图标混用视觉杂乱 | 统一同一图标集(建议全用 Tabler 或全用 MDI) |
| 其他端受影响 | `pda_pages` / `miniprogram_pages` 同字段 | 迁移 SQL 全部限定 `type='web_pages'` |
| 权限数据多环境 | 各环境 `id` 可能不同 | 优先按 `id + path` 双条件,或按 `path` 匹配后再核对 |
---
## 七、待确认
1. 图标风格选哪套?(建议全量统一 Tabler,线条风格与现有 UI 最协调)
2. 是否需要我一并生成 19 个 svg 文件?
3. `pda_pages` / `miniprogram_pages` 的图标是否也纳入统一命名(本次只动 web)?

View File

@ -0,0 +1,407 @@
# 顶部区域结构分析与优化方案
> 状态:**仅分析,未改代码**
> 范围:`layout`(框架层)+ 各业务页面的「顶部标签区 / 页面容器高度」
> 目标:**不改变最终视觉**,优化结构、提升响应速度、消除样式遗留问题
---
## 一、现状结构
### 1.1 渲染层级
```
layout/index.vue (.app-wrapper)
├─ Sidebar
└─ .main-container
├─ .fixed-header ← position: fixed,高度由内容撑开
│ └─ TaskView/index.vue
│ ├─ .navbar-wrapper Navbar.vue
│ ├─ .shortcut-panel 快捷入口(仅展开时渲染)
│ │ ├─ .shortcut-toggle--expanded 20×10 浮层按钮
│ │ └─ .shortcut-key 入口按钮行
│ ├─ .shortcut-toggle--collapsed 收起态小条
│ ├─ ScrollPane .tags-view-wrapper 已打开页面标签
│ └─ .contextmenu
├─ .fixed-header-spacer ← 高度 = 实测 headerHeight
└─ .main-box
├─ AppMain.vue ← padding: 20px
│ └─ .app-main__body → router-view + keep-alive
└─ .ai-container
```
### 1.2 三种「标签」必须区分清楚
这是大量沟通成本和样式冲突的根源:
| 概念 | 所在层 | 实现 | 驱动 |
|---|---|---|---|
| **A. 已打开页面标签** | 框架层(全局) | TaskView 的 `.tags-view-wrapper` | route / tagsView store |
| **B. 快捷入口** | 框架层(全局) | TaskView 的 `.shortcut-key` | shortcuts store |
| **C. 页面内业务标签** | 页面层 | 各页 `el-tabs.tab-container` | 页面本地状态 |
「页面标签和底下页面之间有条细线」中的「页面标签」实际指 **C**(页内标签),
而「打开页面的标签」是 **A**。两者样式相近但归属完全不同,改动时极易混淆。
### 1.3 高度链路(当前)
```
真实高度 = Navbar(≈45) + 快捷区(0 或 ≈36) + 标签行(≈38)
= 收起 ≈93 / 展开 ≈119
app-main 可用高度 = 100vh - headerHeight - 40 (上下 padding 20×2)
= 100vh - 133(收起) / 100vh - 159(展开)
```
而业务页面里普遍写的是:
```ts
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
```
**差值为 33px / 9px**,这组魔法数已经与真实布局脱节。
---
## 二、已定位的问题清单
### P0-1 · `containerHeight` 在 30+ 页面重复硬编码
出现位置(部分):
```
order/waveOrder、order/orderManagement、warehouses、afterSale/list、
afterSale/typelist、express/waybill、data/returnrecord、data/ordersummary、
message、mode、material/packageSupplier、material/packageMaterial、
storage/inventory、storage/stockout、storage/entry、storage/log、
storage/receiving、storage/receiving_owner、storage/report、
storage/report/store、storage/generalreport、storage/stockcheck、
storage/productflow、storage/productflow/store、
system/setting/workbench2、system/setting/miniprogram、
system/setting/storeExpressBindingPolicy、video/newcamara、
video/newcamaraserver …
```
影响:
- **一改顶部,30+ 页面全部错位**。本轮快捷区高度从 46px → 36px,这批页面的可用高度就全错了 10px。
- 数值本身不统一,且与真实布局不符。
- 每个页面都依赖 `settingsStore.shortcutExpanded`,展开/收起会触发所有已挂载页面(含 keep-alive 缓存页)重新计算与重渲染。
### P0-2 · dashboard 高度声明自相矛盾
`src/views/dashboard/index.vue`
```css
.dashboard-container {
padding: 20px;
background-color: #f5f7fa;
min-height: calc(100vh - 84px);
height: 100px; /* ← 遗留:与 min-height / flex: 1 冲突 */
flex: 1;
overflow-y: auto;
}
```
`height: 100px` 与 `min-height: calc(100vh - 84px)`、`flex: 1` 三者互相打架。
其中 `84px` 也是旧版 header 高度(当前为 ≈93),属于同一批遗留魔法数。
### P0-3 · `TabArea` 组件被复制 8 份
已存在同名组件副本:
```
views/afterSale/typelist/components/TabArea.vue
views/express/waybill/components/TabArea.vue
views/mode/components/TabArea.vue
views/data/ordersummary/components/TabArea.vue
views/storage/generalreport/components/TabArea.vue
views/storage/stockcheck/components/TabArea.vue
views/video/newcamaraserver/components/TabArea.vue
views/system/setting/workbench2/components/TabArea.vue
```
每份都带一套 `.tab-container` 的 `:deep()` 覆盖样式。
改一次样式要改 8 处,且已经出现版本漂移风险。
### P0-4 · `type="border-card"` 自带外壳
所有页内 `el-tabs` 都用了 `type="border-card"`,Element Plus 默认为它加上:
```css
.el-tabs--border-card {
border: 1px solid var(--el-border-color-light);
box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
background: #fff;
}
```
而外层 `.tab-section` **自己也画了 border + box-shadow**。
两层外壳叠加 → 标签区下方投影出一条淡灰色细线。
(控制台页面没有 `el-tabs`,所以看不到该现象。)
### P1-5 · 「标签↔内容」分隔线来源不唯一
同一条视觉分界线,可能来自四处的任意组合:
1. `.tab-section` 的 `border`
2. `.el-tabs--border-card` 的 `border` / `box-shadow`
3. `.el-tabs__header.is-top` 的 `border-bottom`
4. `.main-container` 的 `border-top`
**没有唯一定义方**,所以每修一次都可能从别处冒出第二条线。
### P1-6 · `.tab-section` / `.main-container` 样式重复定义
除 `TabArea.vue` 外,页面主文件里还有多份 `.tab-section` 定义
(waveOrder、orderManagement、afterSale/typelist、data/returnrecord、mode、
data/ordersummary、video/newcamara、video/newcamaraserver、storage/generalreport、
storage/stockcheck、system/setting/workbench2 …),且细节不完全一致。
### P1-7 · tags-view 每次路由变化全量重建
`TaskView/index.vue`:
- `v-for="tag in visitedViews"`,`:key="tag.path"`
- `onBeforeUpdate` 清空 `tagsRef`
- `moveToCurrentTag()` 在 `nextTick` 中遍历全部标签定位
标签较多时(20+),每次切页都走一遍全量 diff + 全量遍历。
另外 `visitedViews` 是普通数组,任一标签增删都会让整个列表重新求值。
### P2-8 · 顶部高度曾有硬编码(本轮已修)
已改为 `ResizeObserver` 实测 + `--app-header-height` CSS 变量,
不再是 `134 / 97`。但**消费端尚未跟进**(见 P0-1)。
---
## 三、优化方案(不改最终视觉)
### 方案 A · 顶部高度单一事实源(根本解,优先级最高)
已具备条件:`layout/index.vue` 已把实测高度写入:
```css
:root { --app-header-height: 93px; } /* 由 ResizeObserver 实时更新 */
```
两条落地路径,任选其一:
**A-1(推荐)· 页面不再算高度**
让 `app-main` 用 flex 撑满,页面根容器写 `height: 100%`:
```css
.app-main__body :deep(.app-router-page) { flex: 1; min-height: 0; }
```
页面根容器删掉 `:style="{ height: containerHeight }"`,改 `height: 100%`。
好处:**页面不再需要知道顶部多高**,顶部怎么改都不影响业务页。
**A-2 · 保留显式高度,但统一口径**
提供 composable:
```ts
// src/composables/usePageHeight.ts
export function usePageHeight(bottomPadding = 40) {
return computed(() => `calc(100vh - var(--app-header-height) - ${bottomPadding}px)`)
}
```
30+ 页面逐个替换为 `usePageHeight()`。
> A-1 更彻底(去掉契约),A-2 改动更小(保留契约)。
> 建议先做 A-1 的公共容器改造,再逐步删页面里的 `containerHeight`。
### 方案 B · `TabArea` 收敛为全局组件
目标:`src/components/TabArea/index.vue`,props:
| prop | 说明 |
|---|---|
| `tabs` | `{ name, label }[]` |
| `defaultActive` | 初始标签 |
| `sortable` | 是否显示排序入口 |
| `actions` | 右侧操作区插槽 |
内置正确的样式(不依赖 `border-card` 自带外壳),8 份副本删除,页面改为引用。
### 方案 C · 分隔线职责唯一化
立约定,只保留一处:
- `.tab-section` → **只负责左右和顶部边框 + 圆角**
- `.el-tabs--border-card` → `border: none; box-shadow: none; background: transparent`
- `.el-tabs__header.is-top` → **唯一负责** `border-bottom`(标签与内容的分界线)
- `.main-container` → `border-top: none`
激活标签通过 `box-shadow: 0 1px 0 #fff` 遮住这条线,实现「标签与内容连通」。
### 方案 D · tags-view 渲染优化(收益中等)
1. 把单个标签抽成 `TagItem` 子组件,配 `v-memo="[tag.path, isActive]"`,避免无关标签重渲染。
2. `moveToCurrentTag` 只在 `route.path` 变化时执行(现在 `watch(route)` 是全量对象)。
3. `visitedViews` 增删用 `findIndex` 替代 `some + push` 的两次遍历(次要)。
### 方案 E · 清理遗留魔法数
- `dashboard`:删 `height: 100px`,`min-height` 改用 `var(--app-header-height)` 或直接交给 flex。
- 其余页面里的 `84 / 97 / 100 / 134 / 150` 一并纳入 A 方案统一处理。
---
## 四、建议实施顺序
| 阶段 | 内容 | 风险 | 预期收益 |
|---|---|---|---|
| 1 | 方案 C(分隔线唯一化)+ P0-4 | 低 | 消除细线类问题 |
| 2 | 方案 B(TabArea 收敛) | 中 | 8 处样式→1 处 |
| 3 | 方案 A-1(app-main 撑满,页面 `height: 100%`) | 中高 | 根除高度错位 |
| 4 | 方案 A-2 兜底(`usePageHeight`)+ 清理 30+ 处 | 中 | 兼容暂不改造的页面 |
| 5 | 方案 D(tags-view 渲染优化) | 低 | 切页更顺 |
| 6 | 方案 E(遗留魔法数清理) | 低 | 减少技术债 |
> 阶段 1 可以立刻做,改动小、视觉无变化、直接解决当前细线问题。
---
## 五、需要确认的决策点
1. **页面高度契约**:选 A-1(页面 `height: 100%`,去掉 vh 计算)还是 A-2(统一 `usePageHeight`)?
2. **TabArea 是否统一带排序入口**?当前只有 order / waveOrder 有,其余页面没有。
3. **`type="border-card"` 是否保留**?保留则需要全局覆盖其外壳;去掉则要确认视觉无变化。
4. **是否接受 `app-main` 的 `padding: 20px` 改为可选**(dashboard 需要灰底铺满,其他页面需要留白)?
---
# 六、实施记录(已完成)
> 结论先行:**页面高度不再由页面自己算,标签视觉统一到 order 卡片式,8+ 份重复组件收敛为 1 份。**
## 6.1 顶部表头高度:从「猜」改为「测」
**`src/layout/index.vue`**
| 改动 | 说明 |
|---|---|
| 新增 `headerRef` + `ResizeObserver` | 实测 `.fixed-header` 的 `offsetHeight` |
| `headerHeight` 由 `ref` 提供 | 删除原来的 `134 / 97` 两个魔法数 |
| `.fixed-header-spacer` 高度 = 实测值 | 占位块永远等于真实表头高度 |
| `.ai-container` 的 `top` / `height` = 实测值 | AI 浮层不再自己猜顶部高度 |
| 写入 `--app-header-height` | 实测值同步到 `document.documentElement`,供任意页面复用 |
| 删除未使用的 `shortcutExpanded` | 布局层不再需要知道快捷区状态 |
效果:快捷区展开/收起、切换语言导致导航换行、调整导航高度,占位与浮层都自动跟随,**不会再出现缝隙或遮挡**。
**`src/layout/component/AppMain.vue`**
- 删除 `.fixed-header + .app-main { padding-top: 90px }`
(中间隔着 spacer,该选择器从未命中,属于历史死规则)
## 6.2 快捷入口区结构
**`src/layout/component/TaskView/index.vue`**
展开态:
```
.shortcut-panel
├─ .shortcut-toggle--expanded ← 20×10 浮层按钮(absolute)
└─ .shortcut-key ← 入口按钮行
```
收起态:`.shortcut-toggle--collapsed`(缩进小条,视觉不变)
| 改动 | 说明 |
|---|---|
| 展开按钮改为 `position: absolute; top: 0; left: 50%` | **不参与布局**,不撑高容器 |
| 按钮尺寸固定 20×10 | 不再铺满整条 |
| 删除重复的一份 `.shortcut-toggle` / `.shortcut-key` 定义 | 原来有两套样式同时存在 |
| `shortcut-panel` 的 padding 改为 `10px 12px 6px` | 上方 10px 正好容纳按钮,按钮下沿与入口行上沿相接 |
## 6.3 页面内标签:分隔线唯一化 + 视觉统一
**新增 `src/styles/tab-area.scss`**,在 `src/styles/index.scss` 引入。
职责约定(解决「一条线四个来源」的问题):
| 元素 | 职责 |
|---|---|
| `.tab-section` | 只负责左右 + 顶部边框、圆角 |
| `.el-tabs--border-card` | **不画**边框、阴影、背景 |
| `.el-tabs__header.is-top` | **唯一**负责 `border-bottom` |
| `.main-container` | 不再重复画 `border-top` |
| 激活标签 | `box-shadow: 0 1px 0 #fff` 盖住分隔线,实现「标签与内容连通」 |
同时把「下划线式」统一为 order 卡片式:
| 属性 | 统一前 | 统一后 |
|---|---|---|
| 标签高度 | 38px | **34px** |
| 标签字号 | 14px | **13px** |
| 左右内边距 | 20px | **16px** |
| 标签圆角 | 6px | **8px** |
| 标签底色/边框 | 透明边框 | **`#edf3fb` + `#e6edf8`** |
| 激活色 | `#409eff` | **`#2f80ed`** |
| 激活态 | 白色 2px 下边 + 上移 | **白底卡片 + 8px 圆点** |
| 底部活动条 | 2px 蓝条 | **隐藏** |
> 不覆盖 `padding-left`:各页面按「是否显示排序入口」自行保留 12px / 46px 左留白。
## 6.4 TabArea 组件收敛
**新增 `src/components/TabArea/index.vue`**
- 视觉基准 = `order/orderManagement`、`order/waveOrder`
- 排序入口:`v-if="tabs.length > 1"`,**单页签页面不显示**
- 排序结果按账号存本地,**组件内部自行重排**,父组件无需感知顺序
- scope 未传时按 `tab-order:${route.path}` 自动生成,避免页面间串数据
**收敛结果**
| 项 | 数量 |
|---|---|
| 删除的本地 `TabArea.vue` 副本 | **11 份** |
| 改指向全局组件的页面 | **11 个** |
| 顺带修复 | `express/waybill` 用了 `<TabArea>` 却从未 import(该页标签区此前渲染不出来) |
## 6.5 页面高度契约改造
| 原写法 | 处理 | 数量 |
|---|---|---|
| `containerHeight = calc(100vh - 150px/100px)` | 改为 `'100%'`,由布局层提供高度 | **43 处** |
| `height: calc(100vh - 130px)` | 改为 `height: 100%` | 2 处 |
| `min-height: calc(100vh - 84px)` | 改为 `min-height: 0` | 1 处 |
| `height: calc(100vh - 84px)` | 改为 `height: 100%` | 1 处 |
| dashboard `height: 100px` + `min-height: calc(...)` | 删除,改为 `flex: 1; min-height: 0` | 1 处 |
| 已无用的 `shortcutExpanded` 声明 | 删除 | 43 处 |
> 过程中批量正则误伤了 `TaskView` 里仍在使用的 `shortcutExpanded`,已恢复并重新构建验证。
## 6.6 打开页面的标签(tags-view)渲染优化
- 每个标签加 `v-memo="[tag.path, tag.fullPath, isActive(tag)]"`,无关标签跳过重渲染
- `watch(route)` 收窄为 `watch(() => route.fullPath)`,减少无谓触发
- `ScrollPane` 隐藏横向滚动条(`el-scrollbar__bar` + 原生滚动条)
## 6.7 验证
| 检查 | 结果 |
|---|---|
| `npm run build` | 通过,退出码 0 |
| `get_errors` 全量 | 无错误 |
| `calc(100vh - 150/100/130/84px)` 残留 | 0(仅剩注释) |
| 本地 `TabArea.vue` 副本 | 0 |
## 6.8 遗留事项
| 项 | 状态 | 说明 |
|---|---|---|
| `storage/generalreport` | 待定 | 有页面文件与 router 映射,但后台无菜单;确认不用可整体删除 |
| `data/returnrecord` / `stock/stockManagement` / `system/setting/encoding` | 未迁移 | 仍内联 `el-tabs`(有 `before-leave`、自定义排序 scope 等差异),目前靠全局样式统一外观 |
| 各页面 scoped 里的重复 tab 样式 | 未删除 | 已被全局规则覆盖,可后续清理 |
| 未使用的 `useSettingsStore` import | 未清理 | 构建无影响,属 lint 级冗余 |

407
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,8 @@
"sass": "^1.97.3",
"typescript": "~5.9.3",
"typescript-eslint": "^8.58.2",
"unplugin-auto-import": "^21.1.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^7.3.1",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-devtools": "^8.0.6",

View File

@ -0,0 +1,274 @@
<!--
TabArea — 页面内多标签页(全局统一组件)
视觉基准:order/orderManagement、order/waveOrder 的卡片式标签
· header 渐变底 #f7fafd → #eef4fb,底部 1px 分隔线
· 标签 34px / 13px / 圆角 8px / 淡蓝卡片底
· 激活态白底 + #2f80ed + 左侧 8px 圆点,并用 1px 白色阴影盖住 header 分隔线
约定:
· 边框/阴影的清除由 src/styles/tab-area.scss 统一负责(border-card 自带外壳)
· 排序入口只在「页签数量 > 1」时渲染,单页签页面不显示
· 排序结果按账号保存在浏览器本地(useUserPreferenceStore),组件内部自行重排,
父组件无需感知顺序变化(用 name 映射内容组件,顺序无关)
用法:
<div class="tab-section">
<TabArea :tabs="tabs" :default-active="activeTab" @tab-change="handleTabChange" />
</div>
-->
<template>
<div class="tab-area-wrapper" :class="{ 'has-sort': showSortEntry }">
<div v-if="showSortEntry" class="tab-sort-entry">
<el-tooltip content="标签排序" placement="bottom">
<el-button class="sort-entry-btn" size="small" link @click="sortDialogVisible = true">
<el-icon><Sort /></el-icon>
</el-button>
</el-tooltip>
</div>
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-change="handleTabChange"
>
<el-tab-pane
v-for="tab in orderedTabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
<SortSettingDialog
v-if="showSortEntry"
v-model:visible="sortDialogVisible"
:tabs="tabs"
:scope="resolvedScope"
@saved="handleSortSaved"
/>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { Sort } from '@element-plus/icons-vue'
import SortSettingDialog from '@/components/SortSettingDialog.vue'
import { useUserPreferenceStore } from '@/stores/modules/userPreference'
defineOptions({ name: 'TabArea' })
export interface TabAreaItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabAreaItem[]
defaultActive?: string
/** 排序存储 scope;不传则按当前路由路径自动生成 */
sortScope?: string
}>(),
{
tabs: () => [],
defaultActive: '',
sortScope: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const route = useRoute()
const preferenceStore = useUserPreferenceStore()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
/** 排序入口:只有多标签页面才出现 */
const showSortEntry = computed(() => props.tabs.length > 1)
/** 排序存储 scope:未显式传入时按路由区分,避免不同页面互相覆盖 */
const resolvedScope = computed(() => props.sortScope || `tab-order:${route.path}`)
const sortDialogVisible = ref(false)
/** 已保存的标签顺序(name 数组);空数组表示使用传入顺序 */
const sortOrder = ref<string[]>([])
/** 按保存顺序重排 tabs;缺失项按原顺序补在末尾 */
const orderedTabs = computed<TabAreaItem[]>(() => {
if (!sortOrder.value.length) return props.tabs
const byName = new Map(props.tabs.map((t) => [t.name, t]))
const ordered: TabAreaItem[] = []
for (const name of sortOrder.value) {
const hit = byName.get(name)
if (hit) {
ordered.push(hit)
byName.delete(name)
}
}
for (const t of props.tabs) {
if (byName.has(t.name)) ordered.push(t)
}
return ordered
})
/** 读取本地保存的标签顺序 */
function applySavedOrder() {
const saved = preferenceStore.get(resolvedScope.value)
if (Array.isArray(saved) && saved.length) sortOrder.value = saved as string[]
}
function handleTabChange(name: string | number) {
const next = String(name)
if (activeTab.value !== next) activeTab.value = next
emit('tab-change', next)
}
function handleSortSaved(order: string[]) {
sortOrder.value = Array.isArray(order) ? order : []
}
// 页签集合变化(如权限变化)时,丢弃已失效的顺序并重新读取
watch(
() => props.tabs.map((t) => t.name).join(','),
() => {
sortOrder.value = []
applySavedOrder()
}
)
onMounted(applySavedOrder)
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
position: relative;
flex-shrink: 0;
}
/* 标签排序入口(tab 区域左侧) */
.tab-sort-entry {
position: absolute;
top: 4px;
left: 12px;
height: 38px;
display: flex;
align-items: center;
z-index: 2;
.sort-entry-btn {
color: #606266;
font-size: 15px;
padding: 4px 6px;
border-radius: 4px;
transition: all 0.2s;
&:hover {
color: #409eff;
background-color: rgba(64, 158, 255, 0.08);
}
}
}
.tab-container {
display: flex;
flex-direction: column;
/* border-card 自带外壳的清除统一由 src/styles/tab-area.scss 负责 */
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 8px 12px 0;
background: linear-gradient(180deg, #f7fafd 0%, #eef4fb 100%);
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 34px;
line-height: 34px;
padding: 0 16px;
border-radius: 8px 8px 0 0;
color: #606266;
font-size: 13px;
font-weight: 500;
transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid #e6edf8;
border-bottom: none;
background: #edf3fb;
margin-right: 6px;
box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.03);
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.06);
border-color: rgba(64, 158, 255, 0.12);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #2f80ed;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
/*
第二层阴影向下 1px 纯白,盖住 header 底部的 1px 分隔线,
让激活标签与下方内容区连通(box-shadow 不受标签 overflow:hidden 裁剪)。
*/
box-shadow: 0 -1px 8px rgba(47, 128, 237, 0.08), 0 1px 0 0 #ffffff;
z-index: 1;
position: relative;
&::before {
content: "";
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #2f80ed;
margin-right: 6px;
vertical-align: middle;
flex-shrink: 0;
}
}
:deep(.el-tabs__active-bar) {
display: none;
}
/* 仅展示标签头,内容由页面自己渲染 */
:deep(.el-tabs__content) {
display: none;
}
}
/* 有排序入口时,标签从排序按钮右侧开始 */
.tab-area-wrapper.has-sort {
:deep(.el-tabs__header.is-top) {
padding-left: 46px;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='6' width='18' height='12' rx='2'/><path d='M3 10h18'/><path d='M7 15h4'/></svg>

After

Width:  |  Height:  |  Size: 260 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 14v-2a8 8 0 0 1 16 0v2'/><rect x='3' y='14' width='4' height='6' rx='1.5'/><rect x='17' y='14' width='4' height='6' rx='1.5'/><path d='M19 20a3 3 0 0 1-3 3h-2'/></svg>

After

Width:  |  Height:  |  Size: 345 B

1
src/icons/svg/api.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M9 8 5 12l4 4'/><path d='M15 8l4 4-4 4'/><path d='M13 6l-2 12'/></svg>

After

Width:  |  Height:  |  Size: 245 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 5v14'/><path d='M7 5v14'/><path d='M10.5 5v14'/><path d='M13.5 5v14'/><path d='M17 5v14'/><path d='M20 5v14'/></svg>

After

Width:  |  Height:  |  Size: 294 B

1
src/icons/svg/bill.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M6 3h12v18l-3-2-3 2-3-2-3 2z'/><path d='M9 8h6M9 12h6'/></svg>

After

Width:  |  Height:  |  Size: 237 B

1
src/icons/svg/cart.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 4h2l2.5 11h10L20 7H6'/><circle cx='9' cy='19' r='1.5'/><circle cx='17' cy='19' r='1.5'/></svg>

After

Width:  |  Height:  |  Size: 272 B

1
src/icons/svg/combo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='3' width='8' height='8' rx='1.5'/><rect x='13' y='13' width='8' height='8' rx='1.5'/><path d='M13 7h6M16 4v6'/></svg>

After

Width:  |  Height:  |  Size: 298 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 4v16h16'/><path d='M8 16v-4'/><path d='M12 16v-8'/><path d='M16 16v-6'/></svg>

After

Width:  |  Height:  |  Size: 256 B

1
src/icons/svg/erp.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><ellipse cx='12' cy='6' rx='7' ry='3'/><path d='M5 6v12c0 1.7 3.1 3 7 3s7-1.3 7-3V6'/><path d='M5 12c0 1.7 3.1 3 7 3s7-1.3 7-3'/></svg>

After

Width:  |  Height:  |  Size: 301 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M12 3 2.5 20h19z'/><path d='M12 9v5'/><path d='M12 17v.01'/></svg>

After

Width:  |  Height:  |  Size: 241 B

1
src/icons/svg/expiry.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M7 3h10'/><path d='M7 21h10'/><path d='M7 3c0 5 5 5 5 9s-5 4-5 9'/><path d='M17 3c0 5-5 5-5 9s5 4 5 9'/></svg>

After

Width:  |  Height:  |  Size: 285 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 7h11v9H3z'/><path d='M14 10h4l3 3v3h-7'/><circle cx='7' cy='18' r='1.8'/><circle cx='17.5' cy='18' r='1.8'/><path d='M3 16h1.2'/><path d='M9 18h6.7'/></svg>

After

Width:  |  Height:  |  Size: 334 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 20V11l6-3.5L15 11v9'/><path d='M3 20h12'/><path d='M18 5h4M20 3v4'/></svg>

After

Width:  |  Height:  |  Size: 252 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 7h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/><path d='M4 7V6a2 2 0 0 1 2-2h10'/><circle cx='16.5' cy='13.5' r='1.2'/></svg>

After

Width:  |  Height:  |  Size: 310 B

1
src/icons/svg/flow.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 7h13l-3-3'/><path d='M4 12h16'/><path d='M4 17h13l-3 3'/></svg>

After

Width:  |  Height:  |  Size: 241 B

1
src/icons/svg/goods.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M12 3 3 7.5v9L12 21l9-4.5v-9z'/><path d='M3 7.5 12 12l9-4.5'/><path d='M12 12v9'/></svg>

After

Width:  |  Height:  |  Size: 263 B

1
src/icons/svg/group.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx='9' cy='8' r='3'/><path d='M3 19a6 6 0 0 1 12 0'/><circle cx='17' cy='9' r='2.5'/><path d='M15.5 19a5 5 0 0 1 5.5-4.5'/></svg>

After

Width:  |  Height:  |  Size: 303 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 11h16v7a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z'/><path d='M12 3v8'/><path d='M9 8l3 3 3-3'/></svg>

After

Width:  |  Height:  |  Size: 268 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 13V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v7'/><path d='M3 13h5l2 3h4l2-3h5v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/></svg>

After

Width:  |  Height:  |  Size: 288 B

1
src/icons/svg/list.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M8 6h13M8 12h13M8 18h13'/><path d='M3.5 6h.01M3.5 12h.01M3.5 18h.01'/></svg>

After

Width:  |  Height:  |  Size: 251 B

1
src/icons/svg/log.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M5 4h11l3 3v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1z'/><path d='M8 9h8M8 13h8M8 17h5'/></svg>

After

Width:  |  Height:  |  Size: 277 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/><path d='M14 3v5h5'/><path d='M12 11v.01'/><path d='M12 14v4'/></svg>

After

Width:  |  Height:  |  Size: 305 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='13' width='8' height='8' rx='1.5'/><rect x='13' y='3' width='8' height='8' rx='1.5'/><path d='M13 17h4'/><path d='M15 15v4'/></svg>

After

Width:  |  Height:  |  Size: 312 B

1
src/icons/svg/order.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/><path d='M14 3v5h5'/><path d='M9 13h6'/><path d='M9 17h4'/></svg>

After

Width:  |  Height:  |  Size: 301 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 11h16v7a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z'/><path d='M12 13V5'/><path d='M9 8l3-3 3 3'/></svg>

After

Width:  |  Height:  |  Size: 269 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='4' y='6' width='16' height='14' rx='2'/><path d='M4 10h16'/><path d='M12 6v14'/></svg>

After

Width:  |  Height:  |  Size: 261 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M12 3l7 3v6c0 4.5-3 7.7-7 9-4-1.3-7-4.5-7-9V6z'/><path d='M9 12l2.2 2.2L15.5 10'/></svg>

After

Width:  |  Height:  |  Size: 263 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 12V4h8l9 9-8 8z'/><circle cx='7.5' cy='8.5' r='1.5'/></svg>

After

Width:  |  Height:  |  Size: 237 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M7 9V4h10v5'/><rect x='4' y='9' width='16' height='7' rx='2'/><path d='M7 14h10v6H7z'/></svg>

After

Width:  |  Height:  |  Size: 268 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='5' y='3' width='14' height='18' rx='2'/><path d='M9 8h6M9 12h6M9 16h3'/></svg>

After

Width:  |  Height:  |  Size: 253 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx='10.5' cy='13' r='6.5'/><path d='M10.5 9.5v7'/><path d='M8.5 11.5h4'/><path d='M16.5 5.5 20 9l-3.5 3.5'/></svg>

After

Width:  |  Height:  |  Size: 288 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/><path d='M14 3v5h5'/><path d='M8.5 14l2 2 4.5-4.5'/></svg>

After

Width:  |  Height:  |  Size: 294 B

1
src/icons/svg/reply.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 5h16v10H9l-5 4z'/><path d='M13.5 8l-2 3h3l-2 3'/></svg>

After

Width:  |  Height:  |  Size: 233 B

1
src/icons/svg/return.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M9 14 4 9l5-5'/><path d='M4 9h10a6 6 0 0 1 0 12h-3'/></svg>

After

Width:  |  Height:  |  Size: 234 B

1
src/icons/svg/role.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx='9' cy='8' r='3.2'/><path d='M3 19.5a6 6 0 0 1 12 0'/><path d='M16 6.2a3.2 3.2 0 0 1 0 6.1'/><path d='M17.5 14.2A5.2 5.2 0 0 1 21 19.5'/></svg>

After

Width:  |  Height:  |  Size: 320 B

1
src/icons/svg/scale.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M12 4v15'/><path d='M7 19h10'/><path d='M5 8h14'/><path d='M5 8 3 13h4z'/><path d='M19 8l-2 5h4z'/><circle cx='12' cy='6' r='1.6'/></svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx='12' cy='12' r='3.2'/><path d='M12 2.5v3'/><path d='M12 18.5v3'/><path d='M2.5 12h3'/><path d='M18.5 12h3'/><path d='M5.3 5.3l2.1 2.1'/><path d='M16.6 16.6l2.1 2.1'/><path d='M18.7 5.3l-2.1 2.1'/><path d='M7.4 16.6l-2.1 2.1'/></svg>

After

Width:  |  Height:  |  Size: 409 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 8 12 4l8 4v8l-8 4-8-4z'/><path d='M4 8l8 4 8-4'/><path d='M12 12v3'/><path d='M12 18v.01'/></svg>

After

Width:  |  Height:  |  Size: 275 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='4' y='3' width='16' height='18' rx='2'/><path d='M8 9l1.5 1.5L12 8'/><path d='M8 16l1.5 1.5L12 15'/><path d='M14 9h3M14 16h3'/></svg>

After

Width:  |  Height:  |  Size: 308 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 20h18'/><path d='M5 20v-7h6v7'/><path d='M13 20V9h6v11'/><path d='M5 16.5h6'/><path d='M13 14.5h6'/></svg>

After

Width:  |  Height:  |  Size: 284 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 9h16'/><path d='M3 9 5 4h14l2 5'/><path d='M5 9v11h14V9'/><path d='M10 20v-5h4v5'/></svg>

After

Width:  |  Height:  |  Size: 267 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 4h16l-6 8v6l-4 2v-8z'/></svg>

After

Width:  |  Height:  |  Size: 207 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 20V11l5 3V11l5 3V9l8 4v7z'/><path d='M3 20h18'/></svg>

After

Width:  |  Height:  |  Size: 232 B

1
src/icons/svg/system.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='4' width='18' height='7' rx='2'/><rect x='3' y='13' width='18' height='7' rx='2'/><path d='M7 7.5h.01'/><path d='M7 16.5h.01'/></svg>

After

Width:  |  Height:  |  Size: 314 B

1
src/icons/svg/unpack.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M4 10v8l8 4 8-4v-8'/><path d='M4 10l8-4 8 4'/><path d='M9 6 12 2l3 4'/></svg>

After

Width:  |  Height:  |  Size: 252 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx='9' cy='8' r='3.5'/><path d='M3 20a6 6 0 0 1 12 0'/><path d='M16 12.5l2.2 2.2L22 11'/></svg>

After

Width:  |  Height:  |  Size: 269 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='6' width='12' height='12' rx='2'/><path d='M15 10.5 21 8v8l-6-2.5z'/></svg>

After

Width:  |  Height:  |  Size: 256 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='3' width='18' height='18' rx='2'/><path d='M9 3v18'/><path d='M15 3v18'/><path d='M3 9h18'/><path d='M3 15h18'/></svg>

After

Width:  |  Height:  |  Size: 299 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M3 21V9l9-5 9 5v12'/><path d='M3 21h18'/><path d='M8 21v-6h8v6'/><path d='M8 12h8'/></svg>

After

Width:  |  Height:  |  Size: 265 B

1
src/icons/svg/wave.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d='M2 11c2.5-3.5 5-3.5 7.5 0s5 3.5 7.5 0 3.5-2.5 5-2'/><path d='M2 17c2.5-3.5 5-3.5 7.5 0s5 3.5 7.5 0 3.5-2.5 5-2'/></svg>

After

Width:  |  Height:  |  Size: 294 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="fill:none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x='3' y='4' width='18' height='12' rx='2'/><path d='M12 16v4'/><path d='M8 20h8'/><path d='M7 12l3-3 2.5 2.5L17 8'/></svg>

After

Width:  |  Height:  |  Size: 294 B

View File

@ -93,9 +93,9 @@ function wrapRouteComponent(Component: any, routeName: string | symbol | undefin
width: 100%;
}
.fixed-header + .app-main {
padding-top: 90px;
}
/* 注:原 `.fixed-header + .app-main { padding-top: 90px }` 已移除。
顶部占位现在由 layout/index.vue 的 .fixed-header-spacer(实测高度)负责,
该选择器因中间隔着 spacer 从未命中,属于遗留死代码。 */
</style>
<style lang="scss">

View File

@ -8,12 +8,19 @@
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
:title="onlyOneChild.name?.replace(/_Child$/, '')"
:path="resolvePath(onlyOneChild.path)"
v-bind="isNest ? { showStar } : {}"
/>
</el-menu-item>
</app-link>
</template>
<el-sub-menu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<el-sub-menu
v-else
ref="subMenu"
:index="resolvePath(item.path)"
popper-append-to-body
:popper-class="isHorizontal ? 'top-menu-popup' : ''"
>
<template #title>
<component
:is="isNest ? SubItem : Item"
@ -21,12 +28,14 @@
:icon="item.meta.icon"
:title="item.name?.replace(/_Child$/, '')"
:path="resolvePath(item.path)"
v-bind="isNest ? { showStar } : {}"
/>
</template>
<sidebar-item
v-for="child in item.children"
:key="child.path"
:is-nest="true"
:show-star="true"
:item="child"
:base-path="resolvePath(child.path)"
:is-horizontal="isHorizontal"
@ -64,6 +73,14 @@ const props = defineProps({
isHorizontal: {
type: Boolean,
default: false
},
/**
* 当前层是否显示星标(收藏)按钮。
* 递归子项时固定传 true,只有顶部「更多」下拉的一级选项会传 false。
*/
showStar: {
type: Boolean,
default: true
}
})
@ -132,5 +149,27 @@ const resolvePath = (routePath: string) => {
flex-direction: row !important;
height: 40px !important;
}
/* 叶子项:星标靠最右,与展开箭头同一列 */
:deep(.el-menu-item) {
padding-right: 12px !important;
}
/* 带子项:星标(若有)+ 展开箭头,右侧留足 34px */
:deep(.el-sub-menu__title) {
padding-right: 34px !important;
}
/* 展开箭头:与项目蓝色强调色一致,hover 时高亮 */
:deep(.el-sub-menu__icon-arrow) {
right: 12px;
font-size: 12px;
color: #909399;
transition: transform 0.25s ease, color 0.2s ease;
}
:deep(.el-sub-menu__title:hover .el-sub-menu__icon-arrow) {
color: #2f80ed;
}
}
</style>

View File

@ -6,7 +6,7 @@
</div>
<span v-if="title" class="menu-title">{{ tMenu(title) }}</span>
</div>
<div class="shortcut-toggle" @click.stop.prevent="toggleShortcut">
<div v-if="showStar" class="shortcut-toggle" @click.stop.prevent="toggleShortcut">
<el-icon :class="{ 'is-active': isShortcut }">
<Star v-if="!isShortcut" />
<StarFilled v-else />
@ -33,6 +33,14 @@ const props = defineProps({
path: {
type: String,
default: ''
},
/**
* 是否显示右侧星标(收藏)按钮。
* 顶部「更多」下拉里的一级选项关闭该项,其子项仍保留。
*/
showStar: {
type: Boolean,
default: true
}
})
@ -58,6 +66,7 @@ const toggleShortcut = () => {
align-items: center;
justify-content: space-between;
width: 100%;
min-width: 0;
}
.menu-info {
@ -65,6 +74,8 @@ const toggleShortcut = () => {
flex-direction: row;
align-items: center;
flex: 1;
/* 标题过长时先截断,不挤压右侧星标 */
min-width: 0;
}
.menu-icon-wrapper {
@ -73,6 +84,7 @@ const toggleShortcut = () => {
align-items: center;
justify-content: center;
margin-right: 12px;
flex-shrink: 0;
}
.menu-icon {
@ -83,22 +95,36 @@ const toggleShortcut = () => {
.menu-title {
font-size: 14px;
line-height: 1.2;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 收藏(星标):独立点击区,不参与标题排版,避免与展开箭头抢位 */
.shortcut-toggle {
padding: 4px;
cursor: pointer;
flex: 0 0 auto;
width: 22px;
height: 22px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
color: #909399;
transition: color 0.3s;
cursor: pointer;
transition: color 0.2s ease, background-color 0.2s ease;
:deep(.el-icon) {
font-size: 14px;
}
}
.shortcut-toggle:hover {
color: #f7ba2a;
color: #2f80ed;
background-color: rgba(47, 128, 237, 0.08);
}
/* 已收藏:使用项目主色蓝,与整体配色统一 */
.shortcut-toggle .is-active {
color: #f7ba2a;
color: #2f80ed;
}
</style>

View File

@ -48,20 +48,26 @@ defineExpose({
height: 100%;
:deep(.el-scrollbar__bar) {
bottom: 0px;
height: 4px;
display: none;
}
:deep(.el-scrollbar__wrap) {
height: 30px;
height: 32px;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none;
-ms-overflow-style: none;
&::-webkit-scrollbar {
display: none;
}
}
:deep(.el-scrollbar__view) {
height: 30px;
height: 32px;
display: flex;
align-items: center;
/* 标签底边贴住容器底部,与上方按钮下沿对齐 */
align-items: flex-end;
}
}
</style>

View File

@ -3,42 +3,63 @@
<div class="navbar-wrapper">
<navbar />
</div>
<div class="shortcut-key" v-show="shortcutExpanded">
<component
:is="isExternal(shortcut.path) ? 'a' : 'router-link'"
v-for="shortcut in shortcuts"
:key="shortcut.path"
v-bind="isExternal(shortcut.path) ? { href: shortcut.path, target: '_blank' } : { to: shortcut.path }"
class="shortcut-item"
>
<el-tooltip :content="generateTitle(shortcut.title)" placement="bottom" :show-after="500">
<svg-icon v-if="shortcut.icon" :icon-class="shortcut.icon" />
<span :style="{ marginLeft: shortcut.icon ? '5px' : '0' }">{{ generateTitle(shortcut.title) }}</span>
</el-tooltip>
</component>
<!--
展开态:快捷区 = 居中收起按钮 + 上下 10px 间距 + 快捷入口行,
三者共用同一块底色,按钮下沿到入口行顶沿都属于快捷区。
-->
<div v-show="shortcutExpanded" class="shortcut-panel">
<div class="shortcut-toggle shortcut-toggle--expanded" @click="toggleShortcut">
<el-icon><ArrowUp /></el-icon>
</div>
<div class="shortcut-key">
<component
:is="isExternal(shortcut.path) ? 'a' : 'router-link'"
v-for="shortcut in shortcuts"
:key="shortcut.path"
v-bind="isExternal(shortcut.path) ? { href: shortcut.path, target: '_blank' } : { to: shortcut.path }"
class="shortcut-item"
>
<el-tooltip :content="generateTitle(shortcut.title)" placement="bottom" :show-after="500">
<!-- el-tooltip 只接受单一根节点,图标与文字必须包在同一个元素里 -->
<span class="shortcut-item__content">
<svg-icon v-if="shortcut.icon" :icon-class="shortcut.icon" />
<span class="shortcut-item__text">{{ generateTitle(shortcut.title) }}</span>
</span>
</el-tooltip>
</component>
</div>
</div>
<div class="shortcut-toggle" @click="toggleShortcut">
<el-icon><ArrowUp v-if="shortcutExpanded" /><ArrowDown v-else /></el-icon>
</div>
<scroll-pane ref="scrollPane" class="tags-view-wrapper">
<router-link
v-for="tag in visitedViews"
ref="tagsRef"
:key="tag.path"
:class="isActive(tag) ? 'active' : ''"
:to="{ path: tag.path, query: tag.query }"
class="tags-view-item"
@click.middle="!isAffix(tag) && closeSelectedTag(tag)"
@contextmenu.prevent="openMenu(tag, $event)"
<!-- 标签行 + 收起按钮浮层 -->
<div class="tags-view-row">
<scroll-pane ref="scrollPane" class="tags-view-wrapper">
<router-link
v-for="tag in visitedViews"
:ref="(el: any) => setTagRef(el, tag.path)"
:key="tag.path"
v-memo="[tag.path, tag.fullPath, isActive(tag)]"
:class="isActive(tag) ? 'active' : ''"
:to="{ path: tag.path, query: tag.query }"
class="tags-view-item"
@click.middle="!isAffix(tag) && closeSelectedTag(tag)"
@contextmenu.prevent="openMenu(tag, $event)"
>
{{ generateTitle(tag.name || tag.meta?.title) }}
<span
v-if="!isAffix(tag)"
class="close-icon"
@click.prevent.stop="closeSelectedTag(tag)"
>x</span>
</router-link>
</scroll-pane>
<!-- 居中悬浮在标签行上方的小距离里,不参与布局、不把间距撑大 -->
<div
v-show="!shortcutExpanded"
class="shortcut-toggle shortcut-toggle--collapsed"
@click="toggleShortcut"
>
{{ generateTitle(tag.name || tag.meta?.title) }}
<span
v-if="!isAffix(tag)"
class="close-icon"
@click.prevent.stop="closeSelectedTag(tag)"
>x</span>
</router-link>
</scroll-pane>
<el-icon><ArrowDown /></el-icon>
</div>
</div>
<ul v-show="visible" :style="{ left: left + 'px', top: top + 'px' }" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)">{{ $t('common.refresh') || '刷新' }}</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">{{ $t('common.Close') || '关闭' }}</li>
@ -49,7 +70,7 @@
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted, nextTick, onBeforeUpdate } from 'vue'
import { ref, computed, watch, onMounted, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useTagsViewStore } from '@/stores/modules/tagsView'
import { usePermissionStore } from '@/stores/modules/permission'
@ -68,7 +89,8 @@ const top = ref(0)
const left = ref(0)
const selectedTag = ref<any>({})
const affixTags = ref<any[]>([])
const tagsRef = ref<any[]>([])
/** 标签 path → 组件实例(用 Map 索引,避免每次更新清空并重建 ref 数组) */
const tagEls = new Map<string, any>()
const tagsViewStore = useTagsViewStore()
const permissionStore = usePermissionStore()
@ -88,9 +110,12 @@ const toggleShortcut = () => {
settingsStore.changeSetting({ key: 'shortcutExpanded', value: !shortcutExpanded.value })
}
onBeforeUpdate(() => {
tagsRef.value = []
})
/** 函数式 ref:挂载时写入、卸载时移除,始终保持 tag.path → 元素的最新映射 */
function setTagRef(el: any, path?: string) {
if (!path) return
if (el) tagEls.set(path, el)
else tagEls.delete(path)
}
const isActive = (tag: any) => {
return tag.path === route.path
@ -145,21 +170,16 @@ const addTags = () => {
const moveToCurrentTag = () => {
nextTick(() => {
for (const [i, tag] of visitedViews.value.entries()) {
if (tag.path === route.path) {
const tagRef = tagsRef.value[i]
if (tagRef) {
// When using router-link with scoped slot or component, ref might be component instance
// router-link renders an 'a' tag by default, but in Vue 3 it's a component.
// Accessing $el gives the DOM element.
scrollPane.value?.moveToTarget(tagRef.$el)
}
if (tag.fullPath !== route.fullPath) {
tagsViewStore.updateVisitedView(route)
}
break
}
// O(1) 取当前标签元素,滚动到可见区域
const target = tagEls.get(route.path)
if (target?.$el) {
scrollPane.value?.moveToTarget(target.$el)
}
// query 变化时同步已打开标签的 fullPath
const current = visitedViews.value.find(v => v.path === route.path)
if (current && current.fullPath !== route.fullPath) {
tagsViewStore.updateVisitedView(route)
}
})
}
@ -236,10 +256,14 @@ const closeMenu = () => {
visible.value = false
}
watch(route, () => {
addTags()
moveToCurrentTag()
})
// 只监听地址变化(fullPath 含 query),避免 route 对象任一属性变化都触发全量重算
watch(
() => route.fullPath,
() => {
addTags()
moveToCurrentTag()
}
)
watch(visible, (value) => {
if (value) {
@ -261,93 +285,158 @@ onMounted(() => {
height: auto;
width: 100%;
background: #fff;
// border-bottom: 1px solid #d8dce5;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
box-shadow: none;
border: none;
overflow: hidden;
/* 收起态按钮的定位基准 */
position: relative;
.shortcut-toggle {
height: 7px;
/* 标签行包裹层:顶部留一点与导航栏的距离,按钮悬浮在这段距离上 */
.tags-view-row {
position: relative;
padding-top: 4px;
}
/* ========== 收起态:同款 20×10 胶囊,居中悬浮 ========== */
.shortcut-toggle--collapsed {
position: absolute;
/* top: 0 保证按钮整体落在标签行容器内,不会向上压到导航栏 */
top: 0;
left: 50%;
transform: translateX(-50%);
z-index: 2;
width: 20px;
height: 10px;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
background: #d8d7d7;
border-bottom: 1px solid #f0f2f5;
justify-content: center;
border-radius: 999px;
background: #e3ecf9;
color: #7c879b;
font-size: 9px;
line-height: 1;
cursor: pointer;
font-size: 14px;
color: #909399;
transition: all 0.3s;
transition: background 0.2s ease, color 0.2s ease;
&:hover {
background: #f5f7fa;
color: #409EFF;
background: #2f80ed;
color: #fff;
}
}
/*
展开态快捷区:高度只由入口行 + 按钮所占的一条窄带决定。
按钮绝对定位在快捷区内部上沿,不越界到 Navbar、也不撑高容器。
*/
.shortcut-panel {
position: relative;
margin: 0;
padding: 10px 12px 6px;
background: #f2f6fc;
border-bottom: 1px solid #e8eef7;
}
/* 收起按钮:20×10 浮层,贴快捷区上边缘内侧居中(不参与布局) */
.shortcut-toggle--expanded {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
z-index: 2;
width: 20px;
height: 10px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 999px;
background: #e3ecf9;
color: #7c879b;
font-size: 9px;
line-height: 1;
cursor: pointer;
transition: background 0.2s ease, color 0.2s ease;
&:hover {
background: #2f80ed;
color: #fff;
}
}
.tags-view-wrapper {
height: 35px;
position: relative;
display: flex;
align-items: flex-end;
gap: 6px;
width: 100%;
background: #f0f2f5;
padding-top: 2px;
// border-bottom: 1px solid #d8dce5;
/* 高度收紧到单行标签,顶部距离由 .tags-view-row 的 padding-top 提供 */
min-height: 36px;
padding: 0 16px;
background: #fff;
border-top: none;
border-bottom: 1px solid #e8eef7;
margin-top: 0;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
scrollbar-width: none;
margin-bottom: 0;
&::-webkit-scrollbar {
display: none;
}
.tags-view-item {
display: inline-block;
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
cursor: pointer;
height: 26px;
line-height: 26px;
border: 1px solid #d8dce5;
color: #495060;
background: #fff;
padding: 0 12px;
height: 31px;
line-height: 31px;
border: 1px solid #e6edf8;
border-bottom: none;
color: #606266;
background: #edf3fb;
padding: 0 14px;
font-size: 12px;
margin-left: 6px;
// margin-top: 5px; // 移除 margin-top,改用 flex 居中
border-radius: 3px;
font-weight: 500;
border-radius: 8px 8px 0 0;
text-decoration: none;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all 0.2s ease;
box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.03);
margin-bottom: -1px;
&:first-of-type {
margin-left: 15px;
margin-left: 0;
}
&:last-of-type {
margin-right: 15px;
margin-right: 0;
}
&:hover {
background-color: #f6f6f6;
border-color: #b4bccc;
color: #409eff;
background-color: rgba(64, 158, 255, 0.06);
border-color: rgba(64, 158, 255, 0.12);
}
&.active {
background-color: #42b983;
color: #fff;
border-color: #42b983;
background: #fff;
color: #2f80ed;
border-color: #e8eef7;
box-shadow: 0 -1px 8px rgba(47, 128, 237, 0.08);
z-index: 1;
&::before {
content: "";
background: #fff;
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
position: relative;
margin-right: 4px;
}
}
.close-icon {
width: 16px;
height: 16px;
line-height: 14px;
vertical-align: middle;
// border-radius: 50%;
text-align: center;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transform-origin: 100% 50%;
// margin-left: 5px;
font-size: 12px;
&:hover {
background-color: #b4bccc;
color: #fff;
background: #2f80ed;
margin-right: 6px;
flex-shrink: 0;
}
}
@ -359,14 +448,15 @@ onMounted(() => {
height: 16px;
line-height: 16px;
vertical-align: middle;
// border-radius: 50%;
text-align: center;
transition: all 0.18s ease;
transform-origin: 100% 50%;
// margin-left: 5px;
font-size: 12px;
cursor: pointer;
box-sizing: border-box;
color: inherit;
margin-left: 6px;
border-radius: 50%;
&:hover {
background-color: #c7cedb;
@ -381,8 +471,6 @@ onMounted(() => {
height: auto;
}
.contextmenu {
margin: 0;
background: #fff;
@ -405,36 +493,67 @@ onMounted(() => {
}
}
}
.shortcut-key {
height: 30px;
margin: 0 15px;
.tags-view-container .shortcut-key {
/* 高度全部由入口行决定,内边距交由 .shortcut-panel 控制 */
padding: 0;
display: flex;
align-items: center;
// padding-top: 7px;
gap: 8px;
background-color: #ffffff;
overflow-x: auto;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.shortcut-item {
min-width: 70px;
padding: 0px 10px;
height: 24px;
display: flex;
min-width: 72px;
padding: 0 10px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 4px;
background-color: #dbdada;
border-radius: 6px;
/* 对齐项目标签语言:白底卡片 + 淡蓝边框,激活态用 #2f80ed 强调 */
border: 1px solid #e6edf8;
background: #ffffff;
color: #606266;
font-size: 13px;
transition: all 0.3s;
font-size: 12px;
font-weight: 500;
line-height: 18px;
transition: all 0.2s ease;
text-decoration: none;
&:hover {
background-color: #e6e8eb;
color: #409EFF;
color: #2f80ed;
border-color: rgba(47, 128, 237, 0.35);
box-shadow: 0 1px 4px rgba(47, 128, 237, 0.08);
}
&.router-link-active {
color: #409EFF;
background-color: #ecf5ff;
color: #2f80ed;
background: rgba(47, 128, 237, 0.06);
border-color: rgba(47, 128, 237, 0.35);
}
/* el-tooltip 的唯一根节点:图标与文字横向排布 */
.shortcut-item__content {
display: inline-flex;
align-items: center;
min-width: 0;
}
.shortcut-item__text {
margin-left: 5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 没有图标时文字不额外留白 */
.shortcut-item__content > .shortcut-item__text:first-child {
margin-left: 0;
}
}
}

View File

@ -16,7 +16,12 @@
:base-path="menuRoute.path"
:is-horizontal="true"
/>
<el-sub-menu v-if="overflowRoutes.length" index="__top_menu_more__" class="top-menu-more">
<el-sub-menu
v-if="overflowRoutes.length"
index="__top_menu_more__"
class="top-menu-more"
popper-class="top-menu-popup"
>
<template #title>
<span class="more-title">{{ moreText }}</span>
<el-icon class="more-arrow"><ArrowDown /></el-icon>
@ -28,6 +33,8 @@
:base-path="menuRoute.path"
:is-horizontal="true"
:is-nest="true"
:show-star="false"
class="nest-menu"
/>
</el-sub-menu>
</el-menu>
@ -197,7 +204,10 @@ watch(locale, refresh)
:deep(.el-menu-item), :deep(.el-sub-menu__title) {
height: 40px !important;
line-height: 40px !important;
margin: 0px 4px;
/* 间距统一交给外层 .top-menu > div / .top-menu-more 控制,
否则普通项(li 自带 margin)与下拉项(title 自带 margin)
在 flex 下的盒子宽度计算不一致,会出现忽大忽小的间距 */
margin: 0 !important;
border-radius: 4px;
/* 统一去掉下边框,避免下拉项与普通菜单项出现 2px 的高差 */
border-bottom: none !important;
@ -221,6 +231,8 @@ watch(locale, refresh)
flex: 0 0 auto;
display: flex;
align-items: center;
/* 一级项间距的唯一来源:普通项与下拉项共用(相邻项合计 12px) */
margin: 0 8px;
/* 链接层也用 flex,去掉 inline-flex 菜单项带来的行盒下沉(约 3px) */
> a {
@ -237,6 +249,8 @@ watch(locale, refresh)
.top-menu-more {
flex: 0 0 auto;
/* 与一级菜单项保持同一间距来源(相邻项合计 12px) */
margin: 0 6px;
:deep(.el-sub-menu__title) {
display: inline-flex;
@ -280,4 +294,66 @@ watch(locale, refresh)
}
}
}
</style>
<style lang="scss">
/**
* 顶部横向菜单的所有下拉浮层(一级菜单下拉 + 「更多」)统一使用 .top-menu-popup。
*
* 注意:浮层挂在 body 下,不在 .top-menu 内部,
* 所以 .top-menu 里的 `.el-sub-menu__icon-arrow { display: none }` 不会作用于它,
* 下拉里的二级子菜单依旧会显示展开箭头,与右侧星标收藏按钮抢位而重叠。
*
* 右侧间距约定(关键):
* · 叶子项 与 带子项 都留 34px —— 保证两组星标纵向对齐
* · 展开箭头固定 right:12px,位于星标右侧,两者不再重叠
*/
.top-menu-popup {
.el-menu--popup {
min-width: 200px;
padding: 6px;
border-radius: 8px;
box-shadow: 0 6px 24px rgba(15, 23, 42, 0.12);
}
.el-menu-item,
.el-sub-menu__title {
height: 38px;
line-height: 38px;
border-radius: 6px;
margin: 2px 0;
font-size: 14px;
color: #606266;
transition: background-color 0.2s ease, color 0.2s ease;
}
/* 叶子项:星标靠最右,与展开箭头同一列 */
.el-menu-item {
padding-right: 12px !important;
}
/* 带子项:右侧同时有星标(若有)与展开箭头 */
.el-sub-menu__title {
padding-right: 34px !important;
}
.el-sub-menu__icon-arrow {
right: 12px;
font-size: 12px;
color: #909399;
transition: transform 0.2s ease, color 0.2s ease;
}
.el-menu-item:hover,
.el-sub-menu__title:hover {
background-color: rgba(47, 128, 237, 0.08) !important;
color: #2f80ed;
}
.el-menu-item.is-active {
color: #2f80ed;
font-weight: 600;
background-color: rgba(47, 128, 237, 0.1) !important;
}
}
</style>

View File

@ -6,16 +6,31 @@
<sidebar v-if="layoutMode !== 'top-bottom'" class="sidebar-container" />
<div class="main-container" :class="{ 'no-sidebar': layoutMode === 'top-bottom' }">
<div :class="{ 'fixed-header': fixedHeader, 'fixed-header-top': layoutMode === 'top-bottom' }" :style="{ minHeight: shortcutExpanded ? '134px' : '97px' }">
<!--
表头高度不再硬编码:由 ResizeObserver 实测 task-view 内容高度,
spacer / AI 浮层 / 页面 --app-header-height 全部复用同一个实测值,
因此快捷入口展开收起、换语言、切换布局都不会再产生缝隙或遮挡。
-->
<div
ref="headerRef"
:class="{ 'fixed-header': fixedHeader, 'fixed-header-top': layoutMode === 'top-bottom' }"
>
<task-view />
</div>
<!-- spacer 高度与 header minHeight 对齐(97/134),避免固定表头遮挡内容顶部(原 84 比 97 矮 13px) -->
<div v-if="fixedHeader" :style="{ height: shortcutExpanded ? '134px' : '84px', minHeight: shortcutExpanded ? '134px' : '84px' }"></div>
<div
v-if="fixedHeader"
class="fixed-header-spacer"
:style="{ height: `${headerHeight}px` }"
></div>
<div class="main-box">
<app-main />
<create-order-session-host />
<transition name="ai-slide">
<div class="ai-container" v-show="aiStore.isVisible" :style="{ top: shortcutExpanded ? '134px' : '97px', height: `calc(100vh - ${shortcutExpanded ? 134 : 97}px)` }">
<div
class="ai-container"
v-show="aiStore.isVisible"
:style="{ top: `${headerHeight}px`, height: `calc(100vh - ${headerHeight}px)` }"
>
<ai-chat />
</div>
</transition>
@ -25,7 +40,7 @@
</template>
<script setup lang="ts">
import { computed, watch, onBeforeMount, onMounted, onBeforeUnmount } from 'vue'
import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
import { useAppStore } from '@/stores/modules/app'
import { useSettingsStore } from '@/stores/modules/settings'
import { useAiStore } from '@/stores/modules/ai'
@ -47,7 +62,27 @@ const sidebar = computed(() => appStore.sidebar)
const device = computed(() => appStore.device)
const fixedHeader = computed(() => settingsStore.fixedHeader)
const layoutMode = computed(() => settingsStore.layoutMode)
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
/** 表头 DOM 引用(测量源) */
const headerRef = ref<HTMLElement | null>(null)
/** 表头实测高度:唯一的高度来源,替代原来的 134 / 97 两个魔法数 */
const headerHeight = ref(0)
let headerObserver: ResizeObserver | null = null
/**
* 同步表头真实高度。
* fixed-header 高度完全由内容决定(min-height: 0),所以实测值永远等于
* navbar + 快捷入口面板 + 收起开关 + 标签行 的实际占用,
* 内容一变(展开快捷区、切换语言导致换行等) spacer 自动跟随。
*/
function syncHeaderHeight() {
const el = headerRef.value
if (!el) return
const next = el.offsetHeight
if (next !== headerHeight.value) headerHeight.value = next
// 供页面复用的全局变量:height: calc(100vh - var(--app-header-height) - ...)
document.documentElement.style.setProperty('--app-header-height', `${next}px`)
}
const classObj = computed(() => {
return {
@ -72,6 +107,19 @@ const handleClickOutside = () => {
appStore.closeSideBar(false)
}
onMounted(() => {
syncHeaderHeight()
if (typeof ResizeObserver === 'undefined' || !headerRef.value) return
// 观察表头自身尺寸:快捷入口展开收起、字体/语言变化都会触发重新测量
headerObserver = new ResizeObserver(() => syncHeaderHeight())
headerObserver.observe(headerRef.value)
})
onBeforeUnmount(() => {
headerObserver?.disconnect()
headerObserver = null
})
</script>
<style lang="scss" scoped>
@ -114,7 +162,8 @@ const handleClickOutside = () => {
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
min-height: 97px;
min-height: 0;
box-shadow: none;
&.fixed-header-top {
width: 100% !important;

View File

@ -87,8 +87,10 @@ function applyDocumentTitle(route?: typeof router.currentRoute.value): void {
document.title = getPageTitle(page, site)
}
applyDocumentTitle()
// 品牌信息变化(loaded / siteTitle)时重算标题;
// 路由变化统一由 afterEach 处理,避免每次导航重复写两次 document.title。
watch(
[() => frontBrandStore.loaded, () => frontBrandStore.siteTitle, () => router.currentRoute.value.path],
[() => frontBrandStore.loaded, () => frontBrandStore.siteTitle],
() => applyDocumentTitle()
)
router.afterEach((to) => applyDocumentTitle(to))

View File

@ -43,6 +43,13 @@ function ensurePrinterConnectionsAfterLogin() {
/** 页签“刷新”经 /redirect 软刷新(非整页重载),标记为回到目标页后执行一次打印组件重连 */
let pendingRefreshReconnect = false
/**
* 打印组件连接是否已在本会话完成首次初始化。
* 打印连接绑定的是“用户 + 仓库”维度,切换身份会整页刷新(location.reload),
* 因此会话内做一次即可,不必每次路由导航都走一遍。
*/
let printerBootstrapped = false
/** 软刷新回到目标路由后:执行一次打印组件重连(登录守卫路径外的补充触发点) */
function maybeRetryPrintConnectionsAfterRefresh() {
if (!pendingRefreshReconnect) return
@ -71,7 +78,11 @@ router.beforeEach(async (to, from) => {
const hasGetUserInfo = userStore.user && userStore.user.employees_name
if (hasGetUserInfo) {
ensurePrinterConnectionsAfterLogin()
// 首次导航才做打印连接初始化;后续导航只处理 /redirect 软刷新的重连
if (!printerBootstrapped) {
printerBootstrapped = true
ensurePrinterConnectionsAfterLogin()
}
maybeRetryPrintConnectionsAfterRefresh()
return true
} else {
@ -82,6 +93,7 @@ router.beforeEach(async (to, from) => {
// 加载用户偏好配置(浏览器本地保存:登录 + 整页刷新均在此触发),再触发登录后自动连接(按用户+仓库配置执行一次)
useUserPreferenceStore().load()
ensurePrinterConnectionsAfterLogin()
printerBootstrapped = true
maybeRetryPrintConnectionsAfterRefresh()
const permissionStore = usePermissionStore()
@ -93,9 +105,13 @@ router.beforeEach(async (to, from) => {
router.addRoute(route)
})
console.log('[Router] 动态路由 (后端菜单转换):', formatRoutesForLog(accessRoutes))
console.log('[Router] 合并后完整路由 (constantRoutes + 动态):', formatRoutesForLog(permissionStore.routes))
console.log('[Router] Vue Router 实例路由:', formatRoutesForLog(router.getRoutes()))
// 路由树日志仅开发环境输出:formatRoutesForLog 会递归重建整棵树,
// 生产环境执行 3 次会带来 50~150ms 的额外开销与大量临时对象
if (import.meta.env.DEV) {
console.log('[Router] 动态路由 (后端菜单转换):', formatRoutesForLog(accessRoutes))
console.log('[Router] 合并后完整路由 (constantRoutes + 动态):', formatRoutesForLog(permissionStore.routes))
console.log('[Router] Vue Router 实例路由:', formatRoutesForLog(router.getRoutes()))
}
// hack method to ensure that addRoutes is complete
// set the replace: true, so the navigation will not leave a history record

View File

@ -3,6 +3,7 @@
@use './transition.scss' as *;
@use './element-ui.scss' as *;
@use './sidebar.scss' as *;
@use './tab-area.scss' as *;
body {
height: 100%;

101
src/styles/tab-area.scss Normal file
View File

@ -0,0 +1,101 @@
/**
* 页面内业务标签区统一约定(页面层 el-tabs)
*
* 背景:页面内标签与内容之间的分界线曾经有 4 个可能的来源,任一改动都会叠出第二条线:
* 1. .tab-section 的 border
* 2. .el-tabs--border-card 自带的 border + box-shadow
* 3. .el-tabs__header.is-top 的 border-bottom
* 4. .main-container 的 border-top
*
* 现在约定唯一来源:
* - .tab-section → 负责左右 + 顶部边框、圆角(不画底边)
* - el-tabs--border-card → 不画边框、不画阴影、背景透明(本文件负责)
* - .el-tabs__header.is-top→ 唯一负责标签与内容之间的 border-bottom
* - .main-container → 只负责左右和底部边框(不画顶边)
*
* 说明:Element Plus 的 border-card 默认带
* border: 1px solid var(--el-border-color-light);
* box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
* 与 .tab-section 自绘的边框/阴影叠加后,会在标签区下方投影成一条淡灰色细线。
* 选择器特意加重到 (0,4,0),保证能覆盖各页面 scoped 里的 :deep() 覆盖样式。
*/
.tab-section .tab-container.el-tabs.el-tabs--border-card,
.tab-area-wrapper .tab-container.el-tabs.el-tabs--border-card {
border: none;
box-shadow: none;
background: transparent;
}
/**
* 统一页面内标签视觉为 order/orderManagement、order/waveOrder 的卡片式。
*
* 这里主要兜底「仍在页面内联 el-tabs」的实现(data/returnrecord、
* stock/stockManagement、system/setting/encoding),以及任何未走 TabArea 组件的页面。
* 选择器特异性刻意加重到 (0,5,0) 以上,确保能覆盖各页面 scoped 里的 :deep() 定义。
*
* 说明:不覆盖 padding-left —— 各页面按是否显示「排序入口」自行保留 12px / 46px 左留白。
*/
.tab-section .tab-container.el-tabs .el-tabs__header.is-top {
padding-top: 8px;
padding-right: 12px;
padding-bottom: 0;
background: linear-gradient(180deg, #f7fafd 0%, #eef4fb 100%);
border-bottom: 1px solid #e8eef7;
margin: 0;
}
.tab-section .tab-container.el-tabs .el-tabs__nav-wrap::after {
display: none;
}
.tab-section .tab-container.el-tabs .el-tabs__nav-wrap .el-tabs__item.is-top {
height: 34px;
line-height: 34px;
padding: 0 16px;
border-radius: 8px 8px 0 0;
color: #606266;
font-size: 13px;
font-weight: 500;
border: 1px solid #e6edf8;
border-bottom: none;
background: #edf3fb;
margin-right: 6px;
margin-bottom: 0;
box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.03);
}
.tab-section .tab-container.el-tabs .el-tabs__nav-wrap .el-tabs__item.is-top:hover {
color: #409eff;
background-color: rgba(64, 158, 255, 0.06);
border-color: rgba(64, 158, 255, 0.12);
}
.tab-section .tab-container.el-tabs .el-tabs__nav-wrap .el-tabs__item.is-top.is-active {
color: #2f80ed;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: none;
margin-bottom: 0;
box-shadow: 0 -1px 8px rgba(47, 128, 237, 0.08), 0 1px 0 0 #ffffff;
position: relative;
z-index: 1;
}
/* 激活态左侧强调圆点(与 order 页一致) */
.tab-section .tab-container.el-tabs .el-tabs__nav-wrap .el-tabs__item.is-top.is-active::before {
content: "";
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #2f80ed;
margin-right: 6px;
vertical-align: middle;
flex-shrink: 0;
}
.tab-section .tab-container.el-tabs .el-tabs__active-bar {
display: none;
}

View File

@ -12,14 +12,24 @@
}
/* fade-transform */
/* 方案P0:收敛为纯淡入淡出(配合 AppMain mode="out-in"),去掉 translateX 位移与 0.5s 全属性过渡,
避免切换时新旧两页叠加、横向位移、主线程峰值过高 */
.fade-transform-leave-active,
/*
切页过渡(配合 AppMain 的 mode="out-in"):
· 离开 80ms 淡出:既有过渡感,单次也不会像原来的 200ms 那样让用户干等
· 进入 150ms 淡入:纯透明度过渡,无位移
总感知约 230ms(原 400ms)
*/
.fade-transform-enter-active {
transition: opacity .2s;
transition: opacity 0.15s ease;
}
.fade-transform-leave-active {
transition: opacity 0.08s ease;
}
.fade-transform-enter-from {
opacity: 0;
}
.fade-transform-enter-from,
.fade-transform-leave-to {
opacity: 0;
}

12
src/types/auto-imports.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
/* eslint-disable */
/* prettier-ignore */
/* oxlint-disable */
/* oxfmt-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
}

0
src/types/components.d.ts vendored Normal file
View File

View File

@ -152,11 +152,9 @@
<div class="tool-area" style="margin-top:12px; display:flex; gap:12px;">
<div class="fields-list" style="flex:1; max-height:420px; overflow:auto;">
<h4>字段列表</h4>
<el-list v-if="fieldsList.length">
<el-list-item v-for="(f, idx) in fieldsList" :key="f">
<div class="field-row">{{ f }}</div>
</el-list-item>
</el-list>
<ul v-if="fieldsList.length" class="field-list">
<li v-for="f in fieldsList" :key="f" class="field-row">{{ f }}</li>
</ul>
<div v-else class="empty-tip">尚未获取字段,点击“获取字段”以提取模板字段</div>
</div>

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -355,8 +355,7 @@ const typeOptions = AFTER_SALE_TYPE_MAP
// ==================== 布局 ====================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
const containerHeight = computed(() => '100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */)
const router = useRouter()

View File

@ -1,132 +0,0 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabItem[]
defaultActive?: string
}>(),
{
tabs: () => [],
defaultActive: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -1,4 +1,4 @@
<!--
<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
@ -254,7 +254,7 @@ import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.vue'
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'
@ -282,9 +282,8 @@ import {
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// ============================================================

View File

@ -215,10 +215,14 @@ onMounted(() => {
.dashboard-container {
padding: 20px;
background-color: #f5f7fa;
min-height: calc(100vh - 84px);
width: 100%;
height: 100px;
/*
高度完全交给布局层:app-main 已是 flex 容器,这里只需 flex: 1 + min-height: 0。
原写法 min-height: calc(100vh - 84px) 与 height: 100px 三个值互相打架,
且 84px 是旧版顶栏高度(现由 --app-header-height 实时维护)。
*/
flex: 1;
min-height: 0;
width: 100%;
overflow-y: auto;
}

View File

@ -1,132 +0,0 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabItem[]
defaultActive?: string
}>(),
{
tabs: () => [],
defaultActive: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -1,4 +1,4 @@
<!--
<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
@ -250,7 +250,7 @@ import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.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'
@ -269,9 +269,8 @@ import {
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// ============================================================

View File

@ -66,7 +66,7 @@ const tabCacheMax = computed(() => experimentalStore.tabCacheMax)
/** 容器高度对齐 order/orderManagement(随顶部快捷栏展开状态调整) */
const containerHeight = computed(() =>
settingsStore.shortcutExpanded ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
type ReturnRecordTabItem = {

View File

@ -1,132 +0,0 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabItem[]
defaultActive?: string
}>(),
{
tabs: () => [],
defaultActive: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -1,4 +1,4 @@
<!--
<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
@ -262,6 +262,7 @@ import { ElMessage } from 'element-plus'
import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { getExpressList, getPlatformList, loadStores } from '@/api/index/index'
import TabArea from '@/components/TabArea/index.vue'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
@ -287,9 +288,8 @@ import {
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// ============================================================

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -313,9 +313,8 @@ const initialConditions = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(packageMaterialScanFields)))
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
const columns = packageMaterialColumns

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -213,9 +213,8 @@ const initialConditions = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(packageSupplierScanFields)))
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
const columns = packageSupplierColumns

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -305,8 +305,7 @@ function claimStatusTagType(c: string) { return CLAIM_STATUS_TAG_MAP[c] ?? 'info
// ==================== 布局 ====================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
const containerHeight = computed(() => '100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */)
const {
splitStackRef,

View File

@ -1,132 +0,0 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabItem[]
defaultActive?: string
}>(),
{
tabs: () => [],
defaultActive: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -1,4 +1,4 @@
<!--
<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
@ -250,7 +250,7 @@ import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.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'
@ -269,9 +269,8 @@ import {
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// ============================================================

View File

@ -1,5 +1,5 @@
<template>
<div class="order-management-wrapper" :style="{ height: containerHeight }">
<div class="order-management-wrapper">
<!-- 多标签模式 -->
<template v-if="!singlePage">
<!-- 顶部多标签页区域(对齐 stock/stockManagement 的 tab-section) -->
@ -139,9 +139,6 @@ function applyTabOrder(order: string[]) {
tabs.value = ordered
}
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
/** 单页模式下使用的默认标签(始终为 tabs 第一项) */
const defaultTab = computed(() => tabs.value[0]!)
@ -303,6 +300,9 @@ const handleTabChange = (tabName: string | number) => {
.order-management-wrapper {
position: relative;
width: 100%;
/* 高度由布局层的 .app-router-page(flex:1) 提供,页面不再自己算 100vh */
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
@ -358,14 +358,17 @@ const handleTabChange = (tabName: string | number) => {
display: flex;
flex-direction: column;
/* border-card 自带外壳的清除统一由 src/styles/tab-area.scss 负责
(scoped 下写成 :deep(.el-tabs--border-card) 会变成后代选择器,永远匹配不到自身) */
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0 46px;
background: #f8fbff;
padding: 8px 12px 0 46px;
background: linear-gradient(180deg, #f7fafd 0%, #eef4fb 100%);
border-bottom: 1px solid #e8eef7;
margin: 0;
}
@ -375,40 +378,55 @@ const handleTabChange = (tabName: string | number) => {
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
height: 34px;
line-height: 34px;
padding: 0 16px;
border-radius: 8px 8px 0 0;
color: #606266;
font-size: 14px;
font-size: 13px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid #e6edf8;
border-bottom: none;
margin-right: 4px;
background: #edf3fb;
margin-right: 6px;
box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.03);
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
background-color: rgba(64, 158, 255, 0.06);
border-color: rgba(64, 158, 255, 0.12);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
color: #2f80ed;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
/*
第二层阴影向下 1px 纯白,盖住 header 底部的 1px 分隔线,
让激活标签与下方内容区连通(box-shadow 不受标签 overflow:hidden 裁剪)。
*/
box-shadow: 0 -1px 8px rgba(47, 128, 237, 0.08), 0 1px 0 0 #ffffff;
z-index: 1;
position: relative;
&::before {
content: "";
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #2f80ed;
margin-right: 6px;
vertical-align: middle;
flex-shrink: 0;
}
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
display: none;
}
/* 隐藏内容区,仅展示标签头(对齐 stock/stockManagement) */

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<div class="side-panel">
<scan-box
@ -195,9 +195,8 @@ const scanBox = ref<ScanBoxExpose | null>(null)
const presetTree = ref<unknown[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(weighingAvailableFields)))
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
const columns = ref([...weighingTableColumns])

View File

@ -346,9 +346,8 @@ const availableFieldsRef = reactive(JSON.parse(JSON.stringify(recheckAvailableFi
const settingsStore = useSettingsStore()
const userStore = useUserStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// 上下分栏(待复核订单列表 / 商品明细),与 waveOrder 一致可拖动

View File

@ -1,5 +1,5 @@
<template>
<div class="order-management-wrapper" :style="{ height: containerHeight }">
<div class="order-management-wrapper">
<!-- 多标签模式 -->
<template v-if="!singlePage">
<!-- 顶部多标签页区域(对齐 order/orderManagement 的 tab-section) -->
@ -137,12 +137,7 @@ const tabCacheEnabled = computed(() => experimentalStore.tabCacheEnabled)
/** tab 缓存最大数量(实验性设置,默认 2,超出 LRU 淘汰最久未用) */
const tabCacheMax = computed(() => experimentalStore.tabCacheMax)
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const singlePage = WAVE_PAGE_CONFIG.singlePage
const containerHeight = computed(() => {
const baseH = shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
return baseH
})
/** 单页模式下使用的默认标签(始终为 tabs 第一项) */
const defaultTab = computed(() => tabs.value[0]!)
@ -464,6 +459,9 @@ watch(activeTab, (name) => {
.order-management-wrapper {
position: relative;
width: 100%;
/* 高度由布局层的 .app-router-page(flex:1) 提供,页面不再自己算 100vh */
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
@ -601,14 +599,17 @@ watch(activeTab, (name) => {
display: flex;
flex-direction: column;
/* border-card 自带外壳的清除统一由 src/styles/tab-area.scss 负责
(scoped 下写成 :deep(.el-tabs--border-card) 会变成后代选择器,永远匹配不到自身) */
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0 46px;
background: #f8fbff;
padding: 8px 12px 0 46px;
background: linear-gradient(180deg, #f7fafd 0%, #eef4fb 100%);
border-bottom: 1px solid #e8eef7;
margin: 0;
}
@ -618,40 +619,55 @@ watch(activeTab, (name) => {
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
height: 34px;
line-height: 34px;
padding: 0 16px;
border-radius: 8px 8px 0 0;
color: #606266;
font-size: 14px;
font-size: 13px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid #e6edf8;
border-bottom: none;
margin-right: 4px;
background: #edf3fb;
margin-right: 6px;
box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.03);
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
background-color: rgba(64, 158, 255, 0.06);
border-color: rgba(64, 158, 255, 0.12);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
color: #2f80ed;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
/*
第二层阴影向下 1px 纯白,盖住 header 底部的 1px 分隔线,
让激活标签与下方内容区连通(box-shadow 不受标签 overflow:hidden 裁剪)。
*/
box-shadow: 0 -1px 8px rgba(47, 128, 237, 0.08), 0 1px 0 0 #ffffff;
z-index: 1;
position: relative;
&::before {
content: "";
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: #2f80ed;
margin-right: 6px;
vertical-align: middle;
flex-shrink: 0;
}
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
display: none;
}
/* 隐藏内容区,仅展示标签头(对齐 order/orderManagement) */

View File

@ -165,7 +165,8 @@ const handlePasswordChangeSuccess = async () => {
padding: 20px;
width: 100%;
background-color: var(--el-bg-color-page);
min-height: calc(100vh - 84px); // Adjust based on layout header/tags view
/* 顶部高度已由布局层提供,不再用 84px 旧值估算 */
min-height: 0;
.profile-content {
display: flex;

View File

@ -145,9 +145,8 @@ import {
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// ============================================================

View File

@ -66,9 +66,8 @@ const tabCacheEnabled = computed(() => experimentalStore.tabCacheEnabled)
/** tab 缓存最大数量(实验性设置,默认 2,超出 LRU 淘汰最久未用) */
const tabCacheMax = computed(() => experimentalStore.tabCacheMax)
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
type StockTabItem = {

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -445,9 +445,8 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
const scanBox = ref<any>(null)

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -210,9 +210,8 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
const scanBox = ref<any>(null)

View File

@ -1,132 +0,0 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
tabs?: TabItem[]
defaultActive?: string
}>(),
{
tabs: () => [],
defaultActive: ''
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -1,4 +1,4 @@
<!--
<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
@ -252,7 +252,7 @@ import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.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'
@ -275,9 +275,8 @@ import ExportReportDialog from './pages/ExportReportDialog.vue'
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
// ============================================================

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -210,9 +210,8 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useSettingsStore } from '@/stores/modules/settings'
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
'100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */
)
const scanBox = ref<any>(null)

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container" :style="{ height: containerHeight }">
<scan-box
ref="scanBox"
@ -158,8 +158,7 @@ const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
const containerHeight = computed(() => '100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */)
const tableSize = ref('small')
const loading = ref(false)

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="page-wrapper" :style="{ height: containerHeight }">
<div class="main-container">
<div class="order-sub-container">
@ -192,8 +192,7 @@ const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
const containerHeight = computed(() => '100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */)
const {
splitStackRef,

Some files were not shown because too many files have changed in this diff Show More