perf(app): 详情面板统一迁移 UpperTable,路由按需加载并优化跨浏览器性能
- 新增 router/view-glob.ts,动态菜单兜底的全量 glob 表改为按需动态加载, 入口 chunk 由 465KB 降至 393KB;Sidebar / TaskView 用 utils/path 的 resolveRoutePath 替换 path-browserify 静态引用 - 新增 utils/perf-probe 轻量探针(?perf=1 或 localStorage 开启),输出导航耗时、 资源分类统计、长任务与硬件信息;移除 text-rendering: optimizeLegibility, breadcrumb 过渡由 all 改为 opacity/transform,降低弱 CPU 与非 Chrome 内核开销 - Navbar 工单角标轮询在后台标签页跳过,通过 visibilitychange 回到前台补刷一次 - 库存详情、货位、条码、入库日志、出库日志与明细、收货日志、盘点记录等 详情面板由 el-table 迁移到 UpperTable,统一展开行、分页、选择与列插槽 - 11 处模板配置及内嵌表格开启行选择;转储、转退货、批量复核弹窗改用 SelectedTags 展示已选项并支持逐个移除,移除最后一个后自动关闭 - ImagesUpload 重构为「图库 + 上传区」面板,支持多选、最多 20 张、 单张 10MB 校验与数量提示 - 新增《跨浏览器性能-分析与优化清单》文档
This commit is contained in:
parent
0d549b455f
commit
6838d69788
198
docs/跨浏览器性能-分析与优化清单.md
Normal file
198
docs/跨浏览器性能-分析与优化清单.md
Normal file
@ -0,0 +1,198 @@
|
||||
# 跨浏览器性能:实测数据、已做优化与待办清单
|
||||
|
||||
> 背景:同一套前端,在另一台 PC 上用 Edge 打开明显比 Chrome 慢。
|
||||
> 本文记录**实测数据**、**已落地的代码优化**、**部署侧待调整项**和**浏览器侧排查清单**。
|
||||
|
||||
---
|
||||
|
||||
## 1. 结论先说
|
||||
|
||||
1. **Edge 与 Chrome 同属 Chromium**,渲染引擎基本一致,代码层面不会「只为 Chrome 优化」。
|
||||
体感差距通常来自三类原因,按影响从大到小:
|
||||
- **环境**:Edge 的「效率模式 / 睡眠标签页」、硬件加速被组策略关闭、扩展、企业代理 / DoH、版本差异;
|
||||
- **首屏包体偏大**:弱 CPU 上「解析 JS + 应用 382KB CSS」的耗时会被放大;
|
||||
- **资源数量多**:产物有 **493 个 JS + 329 个 CSS** 分片,切页时会产生一串小请求,
|
||||
弱机 / 有安全软件逐个扫描的环境下,差异被放大。
|
||||
2. 所以正确做法是**把首屏关键路径做小 + 减少请求数 + 补齐缓存策略**,
|
||||
而不是针对某个浏览器写分支代码。
|
||||
|
||||
---
|
||||
|
||||
## 2. 实测数据(2026-11-11,本机 Chrome,线上 `wms.wms.gztbyc.com`)
|
||||
|
||||
登录页(首屏):
|
||||
|
||||
| 指标 | 数值 |
|
||||
|---|---|
|
||||
| 协议 | h2(HTTP/2 已启用 ✅) |
|
||||
| 请求数 | 10 |
|
||||
| 传输合计 | 400KB(gzip) |
|
||||
| 解压合计 | 1317KB |
|
||||
| TTFB | 120ms |
|
||||
| DOMContentLoaded | 387ms |
|
||||
| load | 430ms |
|
||||
|
||||
首屏三个关键资源(gzip 后):`index.js` 147KB、`vendor-vue.js` 112KB、`index.css` 54KB。
|
||||
|
||||
构建产物(`npm run build-only`):
|
||||
|
||||
| 项 | 数值 |
|
||||
|---|---|
|
||||
| 文件总数 | 822 |
|
||||
| JS 分片 | 493(合计 6284KB,未压缩) |
|
||||
| CSS 分片 | 329(合计 1723KB,未压缩) |
|
||||
| `index.css`(Element Plus 全量样式 + 全局样式) | **382KB** |
|
||||
| 入口 `index.js` | 465KB → 优化后 **404KB**(gzip 150KB → 137KB) |
|
||||
|
||||
线上响应头现状:
|
||||
|
||||
```
|
||||
Cache-Control: max-age=43200 # 12 小时(带 hash 的资源本可以 1 年 + immutable)
|
||||
Content-Encoding: gzip # 已开启 ✅(无 brotli)
|
||||
HTTP/2 # 已开启 ✅(curl 探测不到不代表没有,浏览器实测 h2)
|
||||
Alt-Svc: h3=":443" # 已通告 HTTP/3
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 已落地的代码优化
|
||||
|
||||
### 3.1 入口 chunk 瘦身:把 400+ 条目的 `import.meta.glob` 拆出首屏
|
||||
|
||||
- 文件:`src/router/index.ts`、新增 `src/router/view-glob.ts`
|
||||
- 原因:`import.meta.glob('@/views/**/*.vue')` 会在构建期展开成一张 400+ 条的映射表
|
||||
以及每条懒加载的依赖表,全部打进**入口 chunk**,而实际只有「后端菜单的 component
|
||||
路径在 `componentMap` 里查不到」时才会用到。
|
||||
- 做法:拆成独立模块 `view-glob.ts`,在 `loadViewModules()` 里**按需 `import()`**;
|
||||
菜单推断分支改为「先同步查 `componentMap`,未命中再走 glob 兜底」。
|
||||
- 效果:入口 465KB → 404KB(gzip −13KB),首屏少解析 ~70KB JS。
|
||||
|
||||
### 3.2 替换 `path-browserify`
|
||||
|
||||
- 文件:新增 `src/utils/path.ts`,改 `layout/component/TaskView/index.vue`、
|
||||
`layout/component/Sidebar/SidebarItem.vue`
|
||||
- 原因:全仓只用到了 `path.resolve(base, sub)`,却把 15.5KB 的 CJS polyfill 静态带进了入口。
|
||||
- 效果:入口再减 ~15KB,并去掉 `process` 垫片依赖。
|
||||
|
||||
### 3.3 去掉逐帧 / 全属性过渡带来的抖动
|
||||
|
||||
- `src/styles/index.scss`:移除 `text-rendering: optimizeLegibility`
|
||||
(CJK 下排版收益≈0,弱 CPU 上有额外字形计算开销)。
|
||||
- `src/styles/transition.scss`:面包屑 `transition: all .5s` →
|
||||
`opacity/transform` + 0.28s,避免 `all` 把 `left/top/width` 纳入过渡触发 layout。
|
||||
|
||||
### 3.4 后台标签页停止轮询
|
||||
|
||||
- `src/layout/component/Navbar.vue`:工单角标 30s 轮询改为 `document.hidden` 时跳过,
|
||||
`visibilitychange` 回到前台补一次。避免 Edge「睡眠标签页 / 效率模式」与 Chrome
|
||||
后台节流策略不同导致的请求堆积。
|
||||
|
||||
### 3.5 增加可对比的性能探针
|
||||
|
||||
- 新增 `src/utils/perf-probe.ts`,`main.ts` 里安装(**默认关闭**)。
|
||||
- 开启:访问地址加 `?perf=1`,或控制台 `localStorage.setItem('__perf_probe','1')` 后刷新。
|
||||
- 输出:协议版本、TTFB / FCP / DCL / load、请求数与各类资源传输量、
|
||||
长任务(卡顿)统计、CPU 核数 / 内存 / DPR / UA。
|
||||
- 用法:在两台机器上分别打开 `?perf=1`,复制控制台 JSON 对比,
|
||||
能直接判断是「网络慢」还是「CPU 卡」。随时可用 `__perfReport()` 重测。
|
||||
|
||||
---
|
||||
|
||||
## 4. 部署侧待调整(收益最大,需要服务器/Nginx 配置权限)
|
||||
|
||||
> 以下都不改动业务代码,但会显著影响「首次打开 / 隔天首次打开」的速度。
|
||||
|
||||
### 4.1 带 hash 的静态资源改长缓存
|
||||
|
||||
现在 `max-age=43200`(12 小时)。带内容 hash 的文件可以安全地长缓存:
|
||||
|
||||
```nginx
|
||||
location ^~ /assets/ {
|
||||
# 文件名含 hash,内容变了文件名就会变 → 可以放心 immutable
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
access_log off;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# 入口 HTML 必须每次校验,否则发版后用户仍加载旧资源
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-cache";
|
||||
try_files $uri =404;
|
||||
}
|
||||
```
|
||||
|
||||
收益:隔天首次打开不再对 30+ 个分片发条件请求(304 也要一次往返),
|
||||
弱网 / 高延迟下有肉眼可见差别。
|
||||
|
||||
### 4.2 开启 Brotli(比 gzip 再小 15~20%)
|
||||
|
||||
```nginx
|
||||
# 需要 ngx_brotli 模块(宝塔/oneinstack 通常自带开关)
|
||||
brotli on;
|
||||
brotli_comp_level 5;
|
||||
brotli_min_length 1024;
|
||||
brotli_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||
```
|
||||
|
||||
若不想装模块,至少开启静态预压缩,减少动态压缩的 CPU 抖动:
|
||||
|
||||
```nginx
|
||||
gzip_static on;
|
||||
```
|
||||
|
||||
### 4.3 HTTP/3 的取舍
|
||||
|
||||
响应头里有 `Alt-Svc: h3=":443"`。如果 QUIC 监听实际不稳定(部分企业网络封 UDP 443),
|
||||
**部分浏览器会先尝试 h3 再回退**,表现为首包变慢。建议二选一:
|
||||
|
||||
- 确认 `listen 443 quic reuseport;` 正常、UDP 443 可达 → 保留;
|
||||
- 不确定 → 去掉 `add_header Alt-Svc ...`,让所有浏览器统一走已验证的 h2。
|
||||
|
||||
---
|
||||
|
||||
## 5. Edge 侧排查清单(在慢的那台 PC 上做)
|
||||
|
||||
1. `edge://version`:确认版本与 Chrome 接近(相差太大会有新 API 降级路径)。
|
||||
2. `edge://gpu`:确认 **硬件加速已开启**(`Graphics Feature Status` 里
|
||||
`Canvas` / `Compositing` 为 `Hardware accelerated`)。被组策略关掉时,
|
||||
大表格滚动、阴影、过渡会明显变卡。
|
||||
3. 设置 → 系统和性能:
|
||||
- 关闭「**效率模式**」(Efficiency mode);
|
||||
- 关闭本站在「**睡眠标签页**」里被挂起的可能(把站点加入「从不休眠」);
|
||||
- 开启「启动加速」。
|
||||
4. 扩展:用「InPrivate 窗口 / 禁用所有扩展」复测一次,排除单个扩展注入脚本。
|
||||
5. 网络:`edge://net-internals/#dns` 清 DNS;确认没有走慢速代理;
|
||||
关闭「使用安全 DNS」后再测(DoH 解析慢会直接拖慢首包)。
|
||||
6. 安全软件:确认 Defender 实时防护 / 第三方安全软件没在逐个扫描每个 `.js` 分片
|
||||
(这也是「分片多」会被放大的典型场景)。
|
||||
7. 复测方法:两台机器都打开 `https://<站点>/?perf=1`,对比控制台报告里的
|
||||
`TTFB`(网络)与 `长任务合计`(CPU)。
|
||||
|
||||
---
|
||||
|
||||
## 6. 后续可选(按性价比排序,需单独评估回归)
|
||||
|
||||
| 优化 | 预期收益 | 风险 / 成本 |
|
||||
|---|---|---|
|
||||
| Element Plus 样式按需(`importStyle: 'css'`,替代 `element-plus/dist/index.css`) | `index.css` 382KB → 约 100KB 级;样式匹配 / 重算成本明显下降 | 需补 message / message-box / notification / loading / overlay 等命令式样式入口,**必须做全站视觉回归** |
|
||||
| `build.cssCodeSplit: false`(329 个 CSS 合并为 1 个) | 切页 CSS 请求数 → 0;弱网 + 分片多时收益明显 | 首屏 CSS 体积上升(约 +30KB gzip),需实测首屏是否变慢 |
|
||||
| 把 Element Plus 用到的组件合并成 1~2 个 `vendor-ep` chunk | 减少重复小请求、提升缓存命中 | 与「按需引入减小体积」需权衡,需实测 chunk 总量 |
|
||||
| 清理剩余 `transition: all`(约 40 处) | 减少 hover / 插入时的 layout 抖动 | 纯样式,逐处验证动画效果 |
|
||||
| 首屏骨架 / 预渲染 `index.html` | 首屏感知更快 | 需与品牌化标题逻辑(frontBrand)协调 |
|
||||
|
||||
---
|
||||
|
||||
## 7. 附:本次改动的文件清单
|
||||
|
||||
```
|
||||
src/router/index.ts glob 改为按需加载 + 推断分支调整
|
||||
src/router/view-glob.ts 新增(glob 兜底表独立 chunk)
|
||||
src/utils/path.ts 新增(替代 path-browserify)
|
||||
src/utils/perf-probe.ts 新增(?perf=1 性能探针)
|
||||
src/layout/component/TaskView/index.vue 改用 resolveRoutePath
|
||||
src/layout/component/Sidebar/SidebarItem.vue 改用 resolveRoutePath
|
||||
src/layout/component/Navbar.vue 后台标签不轮询
|
||||
src/styles/index.scss 移除 text-rendering
|
||||
src/styles/transition.scss 面包屑过渡收窄属性
|
||||
src/main.ts 安装性能探针
|
||||
```
|
||||
@ -1,106 +1,113 @@
|
||||
<template>
|
||||
<div class="image-upload-container">
|
||||
<div class="left-col">
|
||||
<div class="col-left">
|
||||
<div class="image-wall-wrapper">
|
||||
<!-- Element Plus 图片墙上传组件 -->
|
||||
<el-upload
|
||||
ref="elUploadRef"
|
||||
action="#"
|
||||
v-model:file-list="fileList"
|
||||
list-type="picture-card"
|
||||
:auto-upload="false"
|
||||
:multiple="true"
|
||||
:limit="20"
|
||||
:on-change="handleChange"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:disabled="!hasPermission('index.ReferenceFile')"
|
||||
accept="image/*"
|
||||
>
|
||||
<div class="image-upload-container" :class="{ 'is-gallery-only': !canManageImages }">
|
||||
<!-- 图片墙 -->
|
||||
<section class="gallery-panel">
|
||||
<header class="panel-head">
|
||||
<div class="panel-head__main">
|
||||
<h3 class="panel-title">{{ galleryTitle }}</h3>
|
||||
<span class="panel-count">{{ fileList.length }} / 20</span>
|
||||
</div>
|
||||
<span class="panel-tip">支持 JPG / PNG · 单张不超过 10MB</span>
|
||||
</header>
|
||||
|
||||
<div class="upload-area">
|
||||
<el-upload
|
||||
ref="elUploadRef"
|
||||
action="#"
|
||||
v-model:file-list="fileList"
|
||||
list-type="picture-card"
|
||||
:auto-upload="false"
|
||||
:multiple="true"
|
||||
:limit="20"
|
||||
:on-change="handleChange"
|
||||
:on-preview="handlePictureCardPreview"
|
||||
:on-remove="handleRemove"
|
||||
:before-upload="beforeUpload"
|
||||
:on-exceed="handleExceed"
|
||||
:disabled="!canManageImages"
|
||||
accept="image/*"
|
||||
>
|
||||
<div class="upload-trigger">
|
||||
<el-icon><Plus /></el-icon>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">支持jpg/png格式,单张不超过10MB</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-right">
|
||||
<div class="camera-section" v-if="hasPermission('index.ReferenceFile')">
|
||||
<div class="section-title">
|
||||
<el-icon><Camera /></el-icon>
|
||||
<span>摄像头拍照</span>
|
||||
<span>上传图片</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
|
||||
<!-- 摄像头预览区域,仅展示预览与拍摄结果,按钮移至右侧面板 -->
|
||||
<div class="camera-preview">
|
||||
<video
|
||||
ref="videoElement"
|
||||
v-show="isCameraActive && !capturedImage"
|
||||
class="camera-video"
|
||||
autoplay
|
||||
playsinline
|
||||
></video>
|
||||
|
||||
<div v-if="capturedImage" class="captured-result">
|
||||
<img :src="capturedImage" alt="拍摄的照片" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="!isCameraActive" class="camera-placeholder">
|
||||
<el-icon class="placeholder-icon"><CameraFilled /></el-icon>
|
||||
<p>点击右侧按钮启动摄像头</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!fileList.length" class="gallery-empty">
|
||||
<el-icon><Picture /></el-icon>
|
||||
<p>{{ canManageImages ? '暂无图片,点击「上传图片」添加' : '暂无图片' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<aside class="right-col">
|
||||
<div class="right-panel">
|
||||
<div class="panel-actions">
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="toggleCamera"
|
||||
:loading="cameraLoading"
|
||||
:disabled="captureUploading"
|
||||
>
|
||||
{{ isCameraActive ? '关闭摄像头' : '启动摄像头' }}
|
||||
</el-button>
|
||||
<!-- 摄像头拍照 -->
|
||||
<section v-if="canManageImages" class="camera-panel">
|
||||
<header class="panel-head">
|
||||
<div class="panel-head__main">
|
||||
<h3 class="panel-title">摄像头拍照</h3>
|
||||
<span v-if="capturedImage" class="panel-count">待确认</span>
|
||||
</div>
|
||||
<span class="panel-tip">{{ isCameraActive ? '摄像头已开启' : '用于现场补拍商品图片' }}</span>
|
||||
</header>
|
||||
|
||||
<el-button
|
||||
type="success"
|
||||
:disabled="!isCameraActive || capturedImage || captureUploading"
|
||||
@click="capturePhoto"
|
||||
>
|
||||
<el-icon><Camera /></el-icon>
|
||||
拍照
|
||||
</el-button>
|
||||
<div class="camera-preview" :class="{ 'is-empty': !isCameraActive && !capturedImage }">
|
||||
<video
|
||||
ref="videoElement"
|
||||
v-show="isCameraActive && !capturedImage"
|
||||
class="camera-video"
|
||||
autoplay
|
||||
playsinline
|
||||
></video>
|
||||
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
@click="uploadCapturedImage"
|
||||
:loading="captureUploading"
|
||||
:disabled="!capturedImage || !hasPermission('index.ReferenceFile')"
|
||||
>
|
||||
确认上传
|
||||
</el-button>
|
||||
<div v-if="capturedImage" class="captured-result">
|
||||
<img :src="capturedImage" alt="拍摄的照片" />
|
||||
</div>
|
||||
|
||||
<el-button
|
||||
type="info"
|
||||
size="small"
|
||||
@click="retakePhoto"
|
||||
:disabled="!capturedImage"
|
||||
>
|
||||
重新拍摄
|
||||
</el-button>
|
||||
<div v-else-if="!isCameraActive" class="camera-placeholder">
|
||||
<el-icon class="placeholder-icon"><CameraFilled /></el-icon>
|
||||
<p>点击下方「启动摄像头」开始拍摄</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="camera-actions">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="toggleCamera"
|
||||
:loading="cameraLoading"
|
||||
:disabled="captureUploading"
|
||||
>
|
||||
{{ isCameraActive ? '关闭摄像头' : '启动摄像头' }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!isCameraActive || !!capturedImage || captureUploading"
|
||||
@click="capturePhoto"
|
||||
>
|
||||
<el-icon><Camera /></el-icon>
|
||||
拍照
|
||||
</el-button>
|
||||
|
||||
<el-button size="small" :disabled="!capturedImage" @click="retakePhoto">
|
||||
重新拍摄
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="uploadCapturedImage"
|
||||
:loading="captureUploading"
|
||||
:disabled="!capturedImage || !canManageImages"
|
||||
>
|
||||
确认上传
|
||||
</el-button>
|
||||
|
||||
<el-button size="small" @click="handleReset">重置</el-button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 与 UpperTable 一致:使用 el-image 内置预览,而非弹窗 -->
|
||||
<el-image
|
||||
@ -116,9 +123,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
|
||||
import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Plus, Camera, CameraFilled } from '@element-plus/icons-vue'
|
||||
import { Plus, Camera, CameraFilled, Picture } from '@element-plus/icons-vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import SparkMD5 from 'spark-md5'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
@ -136,6 +143,11 @@ const hasPermission = (permission: string) => {
|
||||
return userStore.checkPermission(permission)
|
||||
}
|
||||
|
||||
/** 是否有图片维护权限(上传 / 拍照) */
|
||||
const canManageImages = computed(() => hasPermission('index.ReferenceFile'))
|
||||
/** 面板标题:头像场景与商品场景文案不同 */
|
||||
const galleryTitle = computed(() => (props.type === 'avatar' ? '头像图片' : '商品图片'))
|
||||
|
||||
// Element Upload组件数据
|
||||
const fileList = ref<any[]>([])
|
||||
const dialogImageUrl = ref('')
|
||||
@ -534,68 +546,194 @@ defineExpose({
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
/* 图片:卡片式工作区(左侧图片墙 / 右侧摄像头),对齐详情面板设计语言 */
|
||||
.image-upload-container {
|
||||
padding: 12px;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 320px;
|
||||
gap: 0 16px;
|
||||
align-items: start;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.left-col {
|
||||
grid-column: 1 / 2;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
padding-right: 8px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
|
||||
gap: 12px;
|
||||
align-items: start;
|
||||
background: #fff;
|
||||
|
||||
&.is-gallery-only {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.gallery-panel,
|
||||
.camera-panel {
|
||||
min-width: 0;
|
||||
padding: 12px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.camera-panel {
|
||||
background: #fafbfc;
|
||||
}
|
||||
|
||||
.panel-head {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 4px 12px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
&__main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.col-left {
|
||||
flex: 1;
|
||||
}
|
||||
.col-right {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.image-wall-wrapper {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.camera-section {
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
.panel-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 15px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #606266;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
color: #303133;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 3px;
|
||||
height: 12px;
|
||||
border-radius: 2px;
|
||||
background: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.panel-count {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
padding: 0 8px;
|
||||
border-radius: 10px;
|
||||
background: #f4f4f5;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.panel-tip {
|
||||
flex: none;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
/* ===== 图片墙 ===== */
|
||||
.upload-area {
|
||||
min-height: 108px;
|
||||
|
||||
:deep(.el-upload-list--picture-card) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
:deep(.el-upload-list--picture-card .el-upload-list__item),
|
||||
:deep(.el-upload--picture-card) {
|
||||
width: 108px;
|
||||
height: 108px;
|
||||
margin: 0;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:deep(.el-upload-list--picture-card .el-upload-list__item) {
|
||||
border: 1px solid #e4e7ed;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.18);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-upload-list--picture-card .el-upload-list__item-thumbnail) {
|
||||
object-fit: cover;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
:deep(.el-upload--picture-card) {
|
||||
border: 1px dashed #dcdfe6;
|
||||
background: #fafbfc;
|
||||
color: #909399;
|
||||
transition: border-color 0.2s, color 0.2s, background 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
color: #409eff;
|
||||
background: #f5f9ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.upload-trigger {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
|
||||
.el-icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.gallery-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 24px 0 4px;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
|
||||
.el-icon {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 摄像头 ===== */
|
||||
.camera-preview {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 640px;
|
||||
height: 480px;
|
||||
background-color: #000;
|
||||
margin: 0 auto 15px;
|
||||
aspect-ratio: 4 / 3;
|
||||
max-height: 300px;
|
||||
min-height: 160px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
background-color: #000;
|
||||
|
||||
&.is-empty {
|
||||
background: #f5f7fa;
|
||||
border: 1px dashed #dcdfe6;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.camera-video {
|
||||
@ -608,41 +746,56 @@ defineExpose({
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.captured-result img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
.camera-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0 12px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
font-size: 48px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 32px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.right-col {
|
||||
grid-column: 2 / 3;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
.camera-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.right-panel {
|
||||
position: sticky;
|
||||
top: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
||||
/* el-image 仅作为预览触发器,不参与布局 */
|
||||
.hidden-preview-trigger {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.panel-actions { text-align: right; display:flex; gap:8px; flex-wrap:wrap; align-items:center }
|
||||
|
||||
</style>
|
||||
|
||||
@ -143,7 +143,11 @@ const isExpired = ref(false)
|
||||
const workOrderBadgeCount = ref(0)
|
||||
let badgeTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
async function fetchWorkOrderBadge() {
|
||||
async function fetchWorkOrderBadge(options: { force?: boolean } = {}) {
|
||||
// 后台标签页不轮询:Edge 的「睡眠标签页 / 效率模式」与 Chrome 的后台节流行为不同,
|
||||
// 挂一个无谓的 30s 定时器只会让回前台时多几次并发请求。这里统一跳过,
|
||||
// 由 visibilitychange 在回到前台时补一次。
|
||||
if (!options.force && document.hidden) return
|
||||
try {
|
||||
const res: any = await afterSaleWorkCount()
|
||||
if (res && (res.code === 1 || res.code === 200 || res.code === 20000 || res.flag === 'success')) {
|
||||
@ -164,6 +168,11 @@ async function fetchWorkOrderBadge() {
|
||||
} catch { /* 静默失败 */ }
|
||||
}
|
||||
|
||||
/** 从后台切回前台时补一次角标刷新(对应 fetchWorkOrderBadge 的后台跳过逻辑) */
|
||||
function handleVisibilityChange() {
|
||||
if (!document.hidden) fetchWorkOrderBadge({ force: true })
|
||||
}
|
||||
|
||||
const activeWarehouse = computed(() => {
|
||||
const employees = user.value.employees
|
||||
if (!employees || !Array.isArray(employees)) return null
|
||||
@ -237,12 +246,14 @@ const logout = async () => {
|
||||
|
||||
onMounted(() => {
|
||||
calculateDays()
|
||||
fetchWorkOrderBadge()
|
||||
// 每 30 秒刷新一次工单角标
|
||||
badgeTimer = setInterval(fetchWorkOrderBadge, 30000)
|
||||
fetchWorkOrderBadge({ force: true })
|
||||
// 每 30 秒刷新一次工单角标(后台标签自动跳过,见 fetchWorkOrderBadge)
|
||||
badgeTimer = setInterval(() => fetchWorkOrderBadge(), 30000)
|
||||
document.addEventListener('visibilitychange', handleVisibilityChange)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('visibilitychange', handleVisibilityChange)
|
||||
if (badgeTimer) {
|
||||
clearInterval(badgeTimer)
|
||||
badgeTimer = null
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import path from 'path-browserify'
|
||||
import { resolveRoutePath } from '@/utils/path'
|
||||
import { isExternal } from '@/utils/validate'
|
||||
import Item from './Item.vue'
|
||||
import SubItem from './SubItem.vue'
|
||||
@ -115,7 +115,7 @@ const resolvePath = (routePath: string) => {
|
||||
if (isExternal(props.basePath)) {
|
||||
return props.basePath
|
||||
}
|
||||
return path.resolve(props.basePath, routePath)
|
||||
return resolveRoutePath(props.basePath, routePath)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ import { useShortcutsStore } from '@/stores/modules/shortcuts'
|
||||
import { useScanBoxCacheStore } from '@/stores/modules/scanBoxCache'
|
||||
import ScrollPane from './ScrollPane.vue'
|
||||
import Navbar from '../Navbar.vue'
|
||||
import path from 'path-browserify'
|
||||
import { resolveRoutePath } from '@/utils/path'
|
||||
import { isExternal } from '@/utils/validate'
|
||||
import { ArrowUp, ArrowDown } from '@element-plus/icons-vue'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
@ -133,7 +133,7 @@ const filterAffixTags = (routes: any[], basePath = '/') => {
|
||||
routes.forEach(route => {
|
||||
if (route.meta && route.meta.affix) {
|
||||
// Simple path resolve
|
||||
const tagPath = path.resolve(basePath, route.path)
|
||||
const tagPath = resolveRoutePath(basePath, route.path)
|
||||
tags.push({
|
||||
fullPath: tagPath,
|
||||
path: tagPath,
|
||||
|
||||
@ -14,10 +14,14 @@ import getPageTitle from '@/utils/get-page-title'
|
||||
|
||||
import '@/styles/index.scss' // global css
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { installPerfProbe } from '@/utils/perf-probe'
|
||||
import { initPrinterRuntime } from '@/core/printerRuntime'
|
||||
import { usePrinterComponentStore } from '@/stores/modules/printerComponent'
|
||||
import { useFrontBrandStore } from '@/stores/modules/frontBrand'
|
||||
|
||||
// 轻量性能探针(默认关闭;?perf=1 或 localStorage 开启,见 utils/perf-probe.ts)
|
||||
installPerfProbe()
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
let errorHandlerDepth = 0
|
||||
|
||||
@ -6,26 +6,70 @@ import { usePermissionStore } from '@/stores/modules/permission'
|
||||
import { h } from 'vue'
|
||||
import { componentMap } from './map'
|
||||
|
||||
/** 供动态菜单兜底:Vite 不允许 `import(\`@/views/${多段路径}.vue\`)`,用 glob 在构建期收集全部页面 */
|
||||
const viewModules = import.meta.glob('@/views/**/*.vue') as Record<
|
||||
string,
|
||||
() => Promise<{ default: object }>
|
||||
>
|
||||
type ViewLoader = () => Promise<{ default: object }>
|
||||
type ViewModuleMap = Record<string, ViewLoader>
|
||||
|
||||
function resolveViewFromGlob(componentPath: string) {
|
||||
/**
|
||||
* 供动态菜单兜底:Vite 不允许 `import(\`@/views/${多段路径}.vue\`)`,用 glob 在构建期收集全部页面。
|
||||
*
|
||||
* ⚠️ 性能约束:这张表有 400+ 条目(实测单独成一个 chunk 是 94KB),若静态放在本文件
|
||||
* 会直接进首屏入口 chunk。因此它被拆到 `./view-glob`,这里按需动态加载:
|
||||
* 只有「菜单里的 component 路径在 componentMap 里查不到」时才会去拉这个 chunk。
|
||||
* (实测:入口 chunk 465KB → 393KB,gzip 150KB → 137KB)
|
||||
*/
|
||||
let viewModulesPromise: Promise<ViewModuleMap> | null = null
|
||||
|
||||
function loadViewModules(): Promise<ViewModuleMap> {
|
||||
if (!viewModulesPromise) {
|
||||
viewModulesPromise = import('./view-glob')
|
||||
.then((m) => m.viewModules)
|
||||
.catch((err) => {
|
||||
// 失败不缓存,下次导航可重试
|
||||
viewModulesPromise = null
|
||||
throw err
|
||||
})
|
||||
}
|
||||
return viewModulesPromise
|
||||
}
|
||||
|
||||
function toViewRelPath(componentPath: string) {
|
||||
let rel = componentPath.replace(/\\/g, '/').trim()
|
||||
if (rel.startsWith('@/views/')) rel = rel.slice('@/views/'.length)
|
||||
if (rel.startsWith('/')) rel = rel.slice(1)
|
||||
if (rel.toLowerCase().endsWith('.vue')) rel = rel.slice(0, -4)
|
||||
return rel
|
||||
}
|
||||
|
||||
function findViewKey(modules: ViewModuleMap, componentPath: string): string | undefined {
|
||||
const rel = toViewRelPath(componentPath)
|
||||
const candidates = [`/views/${rel}.vue`, `/views/${rel}/index.vue`]
|
||||
for (const target of candidates) {
|
||||
const key = Object.keys(viewModules).find((k) => k.replace(/\\/g, '/').endsWith(target))
|
||||
if (key) return viewModules[key]
|
||||
const key = Object.keys(modules).find((k) => k.replace(/\\/g, '/').endsWith(target))
|
||||
if (key) return key
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/** 在 glob 表里查找并加载页面;找不到则抛错(由调用方决定回退 404 / ParentView) */
|
||||
async function loadViewFromGlob(componentPath: string): Promise<{ default: object }> {
|
||||
const modules = await loadViewModules()
|
||||
const key = findViewKey(modules, componentPath)
|
||||
const loader = key ? modules[key] : undefined
|
||||
if (!loader) throw new Error(`views glob 中未找到组件: ${componentPath}`)
|
||||
return loader()
|
||||
}
|
||||
|
||||
/** 依次尝试多个候选路径,返回第一个存在的页面(用于「菜单没给 component」的推断场景) */
|
||||
async function loadFirstExistingView(paths: string[]): Promise<{ default: object }> {
|
||||
const modules = await loadViewModules()
|
||||
for (const p of paths) {
|
||||
const key = findViewKey(modules, p)
|
||||
const loader = key ? modules[key] : undefined
|
||||
if (loader) return loader()
|
||||
}
|
||||
throw new Error(`views glob 中未找到组件: ${paths.join(' / ')}`)
|
||||
}
|
||||
|
||||
function buildInferredComponentPaths(menu: any, parentName?: string) {
|
||||
const parentKey = parentName ? String(parentName).replace(/_Child$/, '').toLowerCase() : ''
|
||||
const menuPath = String(menu.path || '').replace(/^\//, '')
|
||||
@ -46,17 +90,13 @@ function findComponentLoader(componentPath: string) {
|
||||
return componentMap[componentPath]
|
||||
}
|
||||
|
||||
const fromGlob = resolveViewFromGlob(componentPath)
|
||||
if (fromGlob) {
|
||||
return fromGlob
|
||||
}
|
||||
|
||||
// 处理常见的目录结构,例如 'warehouse' -> 'warehouse/index.vue'(变量仅一段,Vite 可分析)
|
||||
if (!componentPath.includes('/')) {
|
||||
return () => import(`@/views/${componentPath}/index.vue`).catch(() => import(`@/views/${componentPath}.vue`))
|
||||
}
|
||||
|
||||
return undefined
|
||||
// 多段路径只能走 glob 兜底(glob 表按需加载);查不到时与原逻辑一致落到 404
|
||||
return () => loadViewFromGlob(componentPath).catch(() => import('@/views/404.vue'))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,10 +347,17 @@ export const transformMenusToRoutes = (menus: any[]) => {
|
||||
}
|
||||
} else {
|
||||
if (!menu.children || menu.children.length === 0) {
|
||||
const inferredLoader = buildInferredComponentPaths(menu, parentName)
|
||||
.map((path) => findComponentLoader(path))
|
||||
.find(Boolean)
|
||||
route.component = inferredLoader ?? ParentView
|
||||
const candidates = buildInferredComponentPaths(menu, parentName)
|
||||
// 先同步查 componentMap(绝大多数场景命中,无需加载 glob 表)
|
||||
const fromMap = candidates.map((path) => componentMap[path]).find(Boolean)
|
||||
if (fromMap) {
|
||||
route.component = fromMap
|
||||
} else if (candidates.length) {
|
||||
// 兜底:glob 表按需加载,逐个候选尝试;都找不到则渲染空白父级(与原行为一致)
|
||||
route.component = () => loadFirstExistingView(candidates).catch(() => ParentView)
|
||||
} else {
|
||||
route.component = ParentView
|
||||
}
|
||||
} else {
|
||||
route.component = Layout
|
||||
}
|
||||
|
||||
16
src/router/view-glob.ts
Normal file
16
src/router/view-glob.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 全部页面组件的 glob 映射 —— **仅用于动态菜单兜底**,请勿直接静态 import 到入口。
|
||||
*
|
||||
* 为什么单独一个文件:
|
||||
* `import.meta.glob('@/views/**\/*.vue')` 在构建期会展开成一张 400+ 条目的映射表,
|
||||
* 并为每个懒加载目标生成一份依赖表(其 CSS/共享 chunk 等)。实测它让入口 chunk
|
||||
* 从约 100KB 膨胀到 465KB(gzip 150KB),而绝大多数菜单在 `router/map.ts` 的
|
||||
* `componentMap` 里就能命中,这张表实际几乎用不到。
|
||||
*
|
||||
* 因此这里独立成一个模块,由 `router/index.ts` 在「componentMap 未命中」时
|
||||
* **动态 import**(见 loadViewModules),把这几百 KB 的 JS 解析开销从首屏移走。
|
||||
*/
|
||||
export const viewModules = import.meta.glob('@/views/**/*.vue') as Record<
|
||||
string,
|
||||
() => Promise<{ default: object }>
|
||||
>
|
||||
@ -11,7 +11,9 @@ body {
|
||||
overflow: hidden;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
/* 注意:不要再加 text-rendering: optimizeLegibility。
|
||||
它会让每个文本块都尝试做字距/连字优化(CJK 尤甚),在弱 CPU /
|
||||
非 Chrome 内核浏览器上会明显增加文本排版耗时,视觉收益却几乎为 0。 */
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
|
||||
}
|
||||
|
||||
|
||||
@ -35,9 +35,11 @@
|
||||
}
|
||||
|
||||
/* breadcrumb transition */
|
||||
/* 用具体属性而不是 all:all 会把 left/top/width 等也纳入过渡,hover/插入时触发 layout,
|
||||
在弱 GPU / 非 Chrome 内核环境下更容易掉帧 */
|
||||
.breadcrumb-enter-active,
|
||||
.breadcrumb-leave-active {
|
||||
transition: all .5s;
|
||||
transition: opacity .28s ease, transform .28s ease;
|
||||
}
|
||||
|
||||
.breadcrumb-enter-from,
|
||||
@ -47,7 +49,7 @@
|
||||
}
|
||||
|
||||
.breadcrumb-move {
|
||||
transition: all .5s;
|
||||
transition: transform .28s ease;
|
||||
}
|
||||
|
||||
.breadcrumb-leave-active {
|
||||
|
||||
26
src/utils/path.ts
Normal file
26
src/utils/path.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 极简路由路径拼接(替代 `path-browserify`)。
|
||||
*
|
||||
* 背景:`path-browserify` 单文件约 15KB,而且它是 CommonJS + `process` 垫片,
|
||||
* 被 `layout/component/TaskView`、`Sidebar/SidebarItem` 静态引用后直接进了**首屏入口 chunk**。
|
||||
* 本仓库只用到了 `path.resolve(base, sub)` 一种能力(把 basePath 与 route.path 拼成完整路径),
|
||||
* 用下面这个 20 行的 POSIX 语义实现即可,行为对齐:
|
||||
* resolveRoutePath('/order', 'orderManagement') → '/order/orderManagement'
|
||||
* resolveRoutePath('/order', '/foo') → '/foo'(第二个是绝对路径时忽略 base)
|
||||
* resolveRoutePath('/', 'dashboard') → '/dashboard'
|
||||
* resolveRoutePath('order', 'list') → '/order/list'
|
||||
* 并会折叠 `//`、处理 `.` / `..`、去掉结尾斜杠。
|
||||
*/
|
||||
export function resolveRoutePath(base: string, target: string): string {
|
||||
const raw = target.startsWith('/') ? target : `${base || ''}/${target || ''}`
|
||||
const segments: string[] = []
|
||||
for (const seg of raw.split('/')) {
|
||||
if (!seg || seg === '.') continue
|
||||
if (seg === '..') {
|
||||
segments.pop()
|
||||
continue
|
||||
}
|
||||
segments.push(seg)
|
||||
}
|
||||
return `/${segments.join('/')}`
|
||||
}
|
||||
131
src/utils/perf-probe.ts
Normal file
131
src/utils/perf-probe.ts
Normal file
@ -0,0 +1,131 @@
|
||||
/**
|
||||
* 轻量性能探针(默认关闭,零副作用)。
|
||||
*
|
||||
* 用途:同一套前端在不同浏览器 / 不同 PC 上「快慢差异」需要可对比的数据,
|
||||
* 而不是凭感觉。开启后会在控制台输出一张表:导航耗时、协议版本、各类资源
|
||||
* 的请求数与传输字节、长任务(卡顿)统计、硬件信息。
|
||||
*
|
||||
* 开启方式(二选一):
|
||||
* 1) 地址栏加参数:https://<站点>/?perf=1
|
||||
* 2) 控制台执行:localStorage.setItem('__perf_probe', '1') 然后刷新
|
||||
* 关闭:控制台 localStorage.removeItem('__perf_probe')
|
||||
*
|
||||
* 随时重测(例如切到某个慢页面后再采集一次):控制台执行 `__perfReport()`
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = '__perf_probe'
|
||||
|
||||
/** 长任务(>50ms 的主线程阻塞)累计 */
|
||||
type LongTaskStat = { count: number; total: number; max: number }
|
||||
const longTask: LongTaskStat = { count: 0, total: 0, max: 0 }
|
||||
|
||||
let installed = false
|
||||
|
||||
function isEnabled() {
|
||||
try {
|
||||
if (new URLSearchParams(location.search).get('perf') === '1') return true
|
||||
return localStorage.getItem(STORAGE_KEY) === '1'
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function observeLongTasks() {
|
||||
try {
|
||||
const supported = (PerformanceObserver as unknown as { supportedEntryTypes?: string[] })
|
||||
.supportedEntryTypes
|
||||
if (!supported?.includes('longtask')) return
|
||||
const po = new PerformanceObserver((list) => {
|
||||
for (const entry of list.getEntries()) {
|
||||
longTask.count += 1
|
||||
longTask.total += entry.duration
|
||||
longTask.max = Math.max(longTask.max, entry.duration)
|
||||
}
|
||||
})
|
||||
po.observe({ type: 'longtask', buffered: true })
|
||||
} catch {
|
||||
/* 不支持则忽略 */
|
||||
}
|
||||
}
|
||||
|
||||
function bytesByExt() {
|
||||
const out: Record<string, { count: number; transfer: number; decoded: number }> = {}
|
||||
for (const r of performance.getEntriesByType('resource') as PerformanceResourceTiming[]) {
|
||||
const path = (r.name || '').split('?')[0] ?? ''
|
||||
const ext = (path.split('.').pop() || 'other').toLowerCase()
|
||||
const key = ['js', 'css', 'png', 'jpg', 'jpeg', 'svg', 'woff', 'woff2', 'gif', 'webp'].includes(ext)
|
||||
? ext
|
||||
: 'other'
|
||||
const item = (out[key] ||= { count: 0, transfer: 0, decoded: 0 })
|
||||
item.count += 1
|
||||
item.transfer += r.transferSize || 0
|
||||
item.decoded += r.decodedBodySize || 0
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
function kb(n: number) {
|
||||
return Math.round(n / 1024)
|
||||
}
|
||||
|
||||
export function collectPerfReport() {
|
||||
const nav = performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming | undefined
|
||||
const paints = performance.getEntriesByType('paint')
|
||||
const fcp = paints.find((p) => p.name === 'first-contentful-paint')?.startTime ?? 0
|
||||
const resources = performance.getEntriesByType('resource') as PerformanceResourceTiming[]
|
||||
const byExt = bytesByExt()
|
||||
|
||||
const summary = {
|
||||
时间: new Date().toLocaleString(),
|
||||
导航类型: nav?.type ?? '-',
|
||||
'HTML 传输(KB)': kb(nav?.transferSize || 0),
|
||||
'HTTP 协议': nav?.nextHopProtocol || '-',
|
||||
'TTFB(ms)': Math.round(nav?.responseStart ?? 0),
|
||||
'首次内容绘制(ms)': Math.round(fcp),
|
||||
'DOMContentLoaded(ms)': Math.round(nav?.domContentLoadedEventEnd ?? 0),
|
||||
'load(ms)': Math.round(nav?.loadEventEnd ?? 0),
|
||||
'请求总数': resources.length,
|
||||
'传输合计(KB)': kb(resources.reduce((s, r) => s + (r.transferSize || 0), 0)),
|
||||
'解压合计(KB)': kb(resources.reduce((s, r) => s + (r.decodedBodySize || 0), 0)),
|
||||
'长任务数': longTask.count,
|
||||
'长任务合计(ms)': Math.round(longTask.total),
|
||||
'最长任务(ms)': Math.round(longTask.max),
|
||||
'CPU 核心': navigator.hardwareConcurrency || '-',
|
||||
'内存(GB,粗)': (navigator as Navigator & { deviceMemory?: number }).deviceMemory ?? '-',
|
||||
'DPR': window.devicePixelRatio,
|
||||
'分辨率': `${screen.width}x${screen.height}`,
|
||||
'UA': navigator.userAgent
|
||||
}
|
||||
|
||||
const detail = Object.entries(byExt)
|
||||
.map(([ext, v]) => ({
|
||||
类型: ext,
|
||||
数量: v.count,
|
||||
传输KB: kb(v.transfer),
|
||||
解压KB: kb(v.decoded)
|
||||
}))
|
||||
.sort((a, b) => b.解压KB - a.解压KB)
|
||||
|
||||
console.log('%c[perf-probe] 概览', 'color:#409eff;font-weight:600')
|
||||
console.table(summary)
|
||||
console.table(detail)
|
||||
console.log('[perf-probe] 复制这段 JSON 用于对比两台机器:\n' + JSON.stringify({ summary, detail }, null, 2))
|
||||
return { summary, detail }
|
||||
}
|
||||
|
||||
export function installPerfProbe() {
|
||||
if (installed || typeof window === 'undefined') return
|
||||
installed = true
|
||||
// 即使未开启也挂上,方便用户临时在控制台调用 __perfReport()
|
||||
;(window as Window & { __perfReport?: () => unknown }).__perfReport = collectPerfReport
|
||||
if (!isEnabled()) return
|
||||
|
||||
observeLongTasks()
|
||||
const run = () => collectPerfReport()
|
||||
if (document.readyState === 'complete') {
|
||||
setTimeout(run, 3000)
|
||||
} else {
|
||||
window.addEventListener('load', () => setTimeout(run, 3000), { once: true })
|
||||
}
|
||||
console.log('[perf-probe] 已开启:3 秒后将输出首屏报告,之后可在控制台执行 __perfReport() 重测')
|
||||
}
|
||||
@ -43,6 +43,7 @@
|
||||
default-align="center"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -729,7 +729,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
upperTableDefaults: {
|
||||
title: '售后类型',
|
||||
showIndex: true,
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '暂无售后类型,可点击「新增类型」创建仓库自定义类型'
|
||||
},
|
||||
detailTabs: [
|
||||
@ -804,7 +804,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
upperTableDefaults: {
|
||||
title: '售后子类型',
|
||||
showIndex: true,
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '暂无售后子类型,可点击「新增子类型」创建仓库自定义子类型'
|
||||
},
|
||||
detailTabs: [
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -656,7 +656,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
upperTableDefaults: {
|
||||
title: '订单每日汇总',
|
||||
showIndex: false,
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '所选日期范围内暂无数据'
|
||||
},
|
||||
detailSections: [],
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
:table-size="tableSize"
|
||||
:enable-column-config="true"
|
||||
:pagination="pagination"
|
||||
:show-selection="true"
|
||||
:loading="listLoading"
|
||||
:query-time="queryTime"
|
||||
@page-change="handlePageChange"
|
||||
|
||||
@ -79,6 +79,7 @@
|
||||
:pagination="upperPagination"
|
||||
:show-index="true"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
:enable-column-config="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
|
||||
@ -32,10 +32,12 @@
|
||||
<div class="task-panel__body">
|
||||
<div class="task-panel__form">
|
||||
<!-- 汇总静态行(入参 ids 取自勾选运单的 id,即 wms_order_express.id) -->
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">已勾选运单</span>
|
||||
<strong class="task-panel__field-value">{{ rows.length }} 条</strong>
|
||||
</div>
|
||||
<SelectedTags
|
||||
label="已勾选运单"
|
||||
:items="selectedRowTagItems"
|
||||
empty-text="暂未勾选运单"
|
||||
@remove="emit('remove-row', $event)"
|
||||
/>
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">待处理运单</span>
|
||||
<strong class="task-panel__field-value">{{ submitIds.length }} 条</strong>
|
||||
@ -157,8 +159,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||
import { returnUnpackTransferByWaybills } from '@/api/returnunpack'
|
||||
import type {
|
||||
ReturnUnpackTransferByWaybillsResponse,
|
||||
@ -185,11 +188,32 @@ const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void
|
||||
/** 提交成功(含部分失败)后触发,供父页面刷新列表 */
|
||||
(e: 'success'): void
|
||||
/** 用户移除某个已勾选运单 */
|
||||
(e: 'remove-row', value: string | number): void
|
||||
}>()
|
||||
|
||||
const submitting = ref(false)
|
||||
const result = ref<ReturnUnpackTransferByWaybillsResponse | null>(null)
|
||||
|
||||
/** 已勾选运单标签(运单号) */
|
||||
const selectedRowTagItems = computed(() =>
|
||||
(props.rows || [])
|
||||
.filter((row) => row?.id !== undefined && row?.id !== null && row?.id !== '')
|
||||
.map((row) => ({
|
||||
label: String(row?.waybill_code ?? row?.id ?? ''),
|
||||
value: row.id as number | string
|
||||
}))
|
||||
)
|
||||
|
||||
// 已勾选运单被逐个移除,最后一个移除后自动关闭(结果态不参与)
|
||||
watch(
|
||||
() => (props.rows || []).length,
|
||||
(length, prevLength) => {
|
||||
if (!props.visible || submitting.value || result.value) return
|
||||
if (prevLength > 0 && length === 0) emit('update:visible', false)
|
||||
}
|
||||
)
|
||||
|
||||
/** 运单表主键ID:仅正整数有效 */
|
||||
function toWaybillId(value: unknown): number | null {
|
||||
const id = Number(value)
|
||||
|
||||
@ -892,8 +892,15 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
||||
type: 'success',
|
||||
plain: true,
|
||||
loadingKey: 'receiveLoading',
|
||||
disabledKey: 'noSelection',
|
||||
action: 'handleUpdateReceive'
|
||||
// 两种范围:选中 / 当前筛选全部。
|
||||
// 注意:不能配 disabledKey: 'noSelection',否则下拉里的「更新全部」也会被禁用;
|
||||
// 未勾选时的提示由 handleUpdateReceiveSelected 内部处理。
|
||||
action: 'handleUpdateReceiveSelected',
|
||||
buttonType: 'dropdown',
|
||||
dropdownOptions: [
|
||||
{ label: '更新选中', action: 'handleUpdateReceiveSelected' },
|
||||
{ label: '更新全部(当前筛选)', action: 'handleUpdateReceiveAll', divided: true }
|
||||
]
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
@ -234,6 +234,7 @@
|
||||
<TransferByWaybillsDialog
|
||||
v-model:visible="transferByWaybillsVisible"
|
||||
:rows="selectedRows"
|
||||
@remove-row="removeTransferWaybillRow"
|
||||
@success="handleTransferByWaybillsSuccess"
|
||||
/>
|
||||
|
||||
@ -272,7 +273,7 @@
|
||||
defineOptions({ name: 'WaybillWarehouse' })
|
||||
|
||||
import { ref, computed, onMounted, reactive } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import { getExpressList, getPlatformList, loadStores } from '@/api/index/index'
|
||||
@ -577,7 +578,8 @@ const toolbarActionMap: Record<string, () => void> = {
|
||||
handleExportSelected: () => { void handleExportSelected() },
|
||||
handleExportAll: () => { void handleExportAll() },
|
||||
openTransferByWaybillsDialog: () => { openTransferByWaybillsDialog() },
|
||||
handleUpdateReceive: () => { void handleUpdateReceive() }
|
||||
handleUpdateReceiveSelected: () => { void handleUpdateReceiveSelected() },
|
||||
handleUpdateReceiveAll: () => { void handleUpdateReceiveAll() }
|
||||
}
|
||||
|
||||
function handleToolbarButtonClick(action: string) {
|
||||
@ -732,6 +734,13 @@ function handleTransferByWaybillsSuccess() {
|
||||
void loadData()
|
||||
}
|
||||
|
||||
/** 转退件登记弹窗移除某个已选运单:取消列表对应行勾选 */
|
||||
function removeTransferWaybillRow(value: string | number) {
|
||||
const target = String(value)
|
||||
const row = selectedRows.value.find((item: any) => String(item?.id) === target)
|
||||
if (row) upperTableRef.value?.toggleRowSelection?.(row, false)
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 批量更新揽收状态(waybill.warehouse.updateReceive)
|
||||
// ============================================================
|
||||
@ -739,6 +748,15 @@ function handleTransferByWaybillsSuccess() {
|
||||
/** 提交中(按钮 loading / 防重复提交) */
|
||||
const receiveLoading = ref(false)
|
||||
|
||||
/**
|
||||
* 「更新全部」展开筛选结果时的分页参数。
|
||||
* 接口 updateReceive 只接收运单号数组,所以需要逐页拉取当前筛选命中的所有运单号。
|
||||
* 单次最多 10 万单,超过时直接提示缩小筛选范围,避免只更新了一部分却误以为全部完成。
|
||||
*/
|
||||
const RECEIVE_ALL_PAGE_SIZE = 500
|
||||
const RECEIVE_ALL_MAX_PAGES = 1000
|
||||
const RECEIVE_ALL_MAX_CODES = 100000
|
||||
|
||||
/** 解析异步任务响应体(兼容 data / data.data 嵌套) */
|
||||
function parseReceiveTaskPayload(res: any): Record<string, any> {
|
||||
if (!res || typeof res !== 'object') return {}
|
||||
@ -830,8 +848,26 @@ const receiveProgressStatusLabel = computed(() => {
|
||||
return map[receiveProgressState.status] || receiveProgressState.status || '—'
|
||||
})
|
||||
|
||||
/** 提交揽收状态更新任务(选中 / 全部 共用) */
|
||||
async function submitReceiveTask(waybillCodes: string[]) {
|
||||
const cfg = currentTabConfig.value
|
||||
if (!cfg?.api?.updateReceive) {
|
||||
throw new Error('揽收状态更新接口未配置')
|
||||
}
|
||||
|
||||
const res = await cfg.api.updateReceive({ waybillCodes })
|
||||
const payload = parseReceiveTaskPayload(res)
|
||||
const taskId = String(payload.task_id || payload.taskId || '').trim()
|
||||
if (!taskId) {
|
||||
throw new Error(payload.message || res?.message || '揽收状态更新任务提交失败')
|
||||
}
|
||||
ElMessage.success(`已提交 ${waybillCodes.length} 个运单的揽收状态更新任务`)
|
||||
// 异步任务:不 await,轮询由进度弹窗接管
|
||||
void startReceivePolling(taskId)
|
||||
}
|
||||
|
||||
/** 勾选运单 → 提交揽收状态更新任务 → 轮询进度 */
|
||||
async function handleUpdateReceive() {
|
||||
async function handleUpdateReceiveSelected() {
|
||||
if (receiveLoading.value) return
|
||||
if (!selectedRows.value.length) {
|
||||
ElMessage.warning('请先勾选需要更新揽收状态的运单')
|
||||
@ -847,26 +883,148 @@ async function handleUpdateReceive() {
|
||||
return
|
||||
}
|
||||
|
||||
receiveLoading.value = true
|
||||
try {
|
||||
await submitReceiveTask(waybillCodes)
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '揽收状态更新失败')
|
||||
} finally {
|
||||
receiveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 逐页拉取「当前筛选条件」命中的全部运单号。
|
||||
* 说明:updateReceive 接口只接收 waybillCodes,全部模式需要前端先把筛选结果展开成运单号。
|
||||
*/
|
||||
async function fetchAllFilteredWaybillCodes(
|
||||
conditions: Record<string, any>,
|
||||
onPage?: (page: number) => void
|
||||
): Promise<string[]> {
|
||||
const cfg = currentTabConfig.value
|
||||
if (!cfg?.api?.updateReceive) {
|
||||
ElMessage.error('揽收状态更新接口未配置')
|
||||
if (!cfg?.api?.list) throw new Error('列表接口未配置')
|
||||
|
||||
const codes = new Set<string>()
|
||||
let page = 1
|
||||
// 后端可能限制单页上限(例如最多 100 条),按首页实际返回条数修正分页大小
|
||||
let effectivePageSize = RECEIVE_ALL_PAGE_SIZE
|
||||
|
||||
while (page <= RECEIVE_ALL_MAX_PAGES) {
|
||||
onPage?.(page)
|
||||
|
||||
const params = cfg.api.buildListParams
|
||||
? cfg.api.buildListParams({
|
||||
pagination: { page, pageSize: RECEIVE_ALL_PAGE_SIZE },
|
||||
conditions,
|
||||
sort: currentSort.prop ? { prop: currentSort.prop, order: currentSort.order } : undefined
|
||||
})
|
||||
: {
|
||||
pagination: { page, pageSize: RECEIVE_ALL_PAGE_SIZE },
|
||||
where: buildWhereConditions(conditions)
|
||||
}
|
||||
|
||||
const res = await cfg.api.list(params)
|
||||
if (!res || (res.code !== 1 && res.code !== 200)) {
|
||||
throw new Error(res?.message || '获取筛选结果失败')
|
||||
}
|
||||
|
||||
const parsed = cfg.api.parseListResponse
|
||||
? cfg.api.parseListResponse(res)
|
||||
: {
|
||||
list: res.data?.list ?? res.list ?? [],
|
||||
total: res.data?.pagination?.total ?? res.total ?? 0
|
||||
}
|
||||
const rows: Record<string, any>[] = Array.isArray(parsed.list) ? parsed.list : []
|
||||
const total = Number(parsed.total) || 0
|
||||
|
||||
if (page === 1) {
|
||||
if (total > RECEIVE_ALL_MAX_CODES) {
|
||||
throw new Error(
|
||||
`当前筛选命中 ${total} 条,超过单次更新上限 ${RECEIVE_ALL_MAX_CODES} 条,请缩小筛选范围(如缩小创建时间)`
|
||||
)
|
||||
}
|
||||
if (rows.length > 0 && rows.length < RECEIVE_ALL_PAGE_SIZE) {
|
||||
effectivePageSize = rows.length
|
||||
}
|
||||
}
|
||||
|
||||
if (!rows.length) break
|
||||
|
||||
for (const row of rows) {
|
||||
const code = String(row?.waybill_code ?? row?.waybillCode ?? '').trim()
|
||||
if (code) codes.add(code)
|
||||
}
|
||||
|
||||
const reachedEnd = total > 0
|
||||
? page * effectivePageSize >= total
|
||||
// total 缺失时无法判断总页数:除首页外,只要本页不满一整页即认为到最后一页
|
||||
: page > 1 && rows.length < effectivePageSize
|
||||
if (reachedEnd) break
|
||||
|
||||
page += 1
|
||||
}
|
||||
|
||||
if (page > RECEIVE_ALL_MAX_PAGES) {
|
||||
throw new Error(`翻页超过 ${RECEIVE_ALL_MAX_PAGES} 页仍未取完,请缩小筛选范围后重试`)
|
||||
}
|
||||
|
||||
return Array.from(codes)
|
||||
}
|
||||
|
||||
/** 按当前筛选条件全部更新(先筛时间等条件,再批量更新,完成后刷新列表核对再导出) */
|
||||
async function handleUpdateReceiveAll() {
|
||||
if (receiveLoading.value) return
|
||||
|
||||
const conditions = scanBoxRef.value?.getConditions?.() || {}
|
||||
const where = buildWhereConditions(conditions)
|
||||
// 没有任何筛选条件时,避免误把整表全部更新
|
||||
if (!Object.keys(where).length) {
|
||||
ElMessage.warning('请先在筛选区设置条件(如创建时间)后,再使用「更新全部」')
|
||||
return
|
||||
}
|
||||
|
||||
const totalText = pagination.total > 0
|
||||
? `当前筛选共 ${pagination.total} 条运单`
|
||||
: '当前筛选命中的全部运单'
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`将按当前筛选条件批量更新揽收状态:${totalText}。任务在后台执行,完成后请重新查询确认再导出。`,
|
||||
'更新全部揽收状态',
|
||||
{
|
||||
confirmButtonText: '开始更新',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
buttonSize: 'small'
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
receiveLoading.value = true
|
||||
const loadingInstance = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在获取当前筛选的运单…',
|
||||
background: 'rgba(0, 0, 0, 0.35)'
|
||||
})
|
||||
|
||||
try {
|
||||
const res = await cfg.api.updateReceive({ waybillCodes })
|
||||
const payload = parseReceiveTaskPayload(res)
|
||||
const taskId = String(payload.task_id || payload.taskId || '').trim()
|
||||
if (!taskId) {
|
||||
throw new Error(payload.message || res?.message || '揽收状态更新任务提交失败')
|
||||
const waybillCodes = await fetchAllFilteredWaybillCodes(conditions, (page) => {
|
||||
loadingInstance.setText(`正在获取当前筛选的运单…(第 ${page} 页)`)
|
||||
})
|
||||
|
||||
if (!waybillCodes.length) {
|
||||
ElMessage.warning('当前筛选条件下没有可更新的运单')
|
||||
return
|
||||
}
|
||||
ElMessage.success(`已提交 ${waybillCodes.length} 个运单的揽收状态更新任务`)
|
||||
// 异步任务:不 await,轮询由进度弹窗接管
|
||||
void startReceivePolling(taskId)
|
||||
|
||||
loadingInstance.setText(`正在提交 ${waybillCodes.length} 个运单的揽收状态更新任务…`)
|
||||
await submitReceiveTask(waybillCodes)
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '揽收状态更新失败')
|
||||
ElMessage.error(e?.message || '更新全部揽收状态失败')
|
||||
} finally {
|
||||
loadingInstance.close()
|
||||
receiveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
table-id="inbox-auto-reply-function"
|
||||
:data="rows"
|
||||
:columns="columns"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:show-pagination="false"
|
||||
row-key="function_id"
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
table-id="inbox-auto-reply-group"
|
||||
:data="rows"
|
||||
:columns="columns"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:show-pagination="false"
|
||||
row-key="uid"
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
table-id="inbox-auto-reply-keyword"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:enable-column-config="true"
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
table-id="inbox-auto-reply-number-rule"
|
||||
:data="rows"
|
||||
:columns="columns"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:show-pagination="false"
|
||||
row-key="number_rule_id"
|
||||
|
||||
@ -217,6 +217,7 @@
|
||||
table-id="inbox-auto-reply-sub-type"
|
||||
:data="typeSubTypes"
|
||||
:columns="subTypeTableColumns"
|
||||
:show-selection="true"
|
||||
:show-pagination="false"
|
||||
empty-text="该类型下暂无子类型"
|
||||
>
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
:pagination="upperPagination"
|
||||
:show-index="true"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
:pagination="upperPagination"
|
||||
:show-index="true"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
:enable-column-config="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -35,10 +35,12 @@
|
||||
<!-- 确认态:入参 ids 取自勾选配送订单的 id(wms_order_delivery*.id) -->
|
||||
<template v-if="!result">
|
||||
<div class="task-panel__form">
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">已勾选</span>
|
||||
<strong class="task-panel__field-value">{{ rows.length }} 条</strong>
|
||||
</div>
|
||||
<SelectedTags
|
||||
label="已勾选"
|
||||
:items="selectedRowTagItems"
|
||||
empty-text="暂未勾选订单"
|
||||
@remove="emit('remove-row', $event)"
|
||||
/>
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">去重后可提交</span>
|
||||
<strong class="task-panel__field-value">{{ submitIds.length }} 条 / 上限 {{ MAX_COUNT }} 条</strong>
|
||||
@ -204,8 +206,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||
import { returnUnpackTransferByOrders } from '@/api/returnunpack'
|
||||
import type {
|
||||
ReturnUnpackTransferByOrdersResponse,
|
||||
@ -238,11 +241,32 @@ const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void
|
||||
/** 提交成功(含跳过/部分失败)后触发,供父页面刷新列表 */
|
||||
(e: 'success'): void
|
||||
/** 用户移除某个已勾选订单 */
|
||||
(e: 'remove-row', value: string | number): void
|
||||
}>()
|
||||
|
||||
const submitting = ref(false)
|
||||
const result = ref<ReturnUnpackTransferByOrdersResponse | null>(null)
|
||||
|
||||
/** 已勾选订单标签(发货单号) */
|
||||
const selectedRowTagItems = computed(() =>
|
||||
(props.rows || [])
|
||||
.filter((row) => row?.id !== undefined && row?.id !== null && row?.id !== '')
|
||||
.map((row) => ({
|
||||
label: String(row?.delivery_order_code ?? row?.id ?? ''),
|
||||
value: row.id as number | string
|
||||
}))
|
||||
)
|
||||
|
||||
// 已勾选订单被逐个移除,最后一个移除后自动关闭(结果态不参与)
|
||||
watch(
|
||||
() => (props.rows || []).length,
|
||||
(length, prevLength) => {
|
||||
if (!props.visible || submitting.value || result.value) return
|
||||
if (prevLength > 0 && length === 0) emit('update:visible', false)
|
||||
}
|
||||
)
|
||||
|
||||
/** 订单表主键ID:仅正整数有效 */
|
||||
function toOrderId(value: unknown): number | null {
|
||||
const id = Number(value)
|
||||
|
||||
@ -250,15 +250,18 @@
|
||||
{{ subWaybillSelectErrorMessage }}
|
||||
</p>
|
||||
<div class="task-panel__form">
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">已选运单</span>
|
||||
<strong class="task-panel__field-value">{{ subWaybillSelectedWaybills.length }} 个</strong>
|
||||
</div>
|
||||
<SelectedTags
|
||||
label="已选运单"
|
||||
:items="subWaybillTagItems"
|
||||
empty-text="暂未选择运单"
|
||||
@remove="removeSubWaybillSelection"
|
||||
/>
|
||||
|
||||
<div class="task-panel__section">
|
||||
<span class="task-panel__section-title">运单号列表</span>
|
||||
<div class="task-panel__table-wrap">
|
||||
<el-table
|
||||
ref="subWaybillSelectTableRef"
|
||||
v-loading="subWaybillSelectLoading"
|
||||
:data="subWaybillOptions"
|
||||
border
|
||||
@ -318,6 +321,7 @@
|
||||
<transfer-by-orders-dialog
|
||||
v-model:visible="transferByOrdersVisible"
|
||||
:rows="transferByOrderRows"
|
||||
@remove-row="removeTransferByOrderRow"
|
||||
@success="handleTransferByOrdersSuccess"
|
||||
/>
|
||||
|
||||
@ -345,7 +349,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -383,6 +387,7 @@ import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||
import AllocateSubOrderNumberForm from './form/AllocateSubOrderNumberForm.vue'
|
||||
import TransferByOrdersDialog from './component/TransferByOrdersDialog.vue'
|
||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||
import { createSimpleListToolbarController } from '@/views/order/shared/toolbarActions'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
const scanBox = ref<any>(null)
|
||||
@ -483,6 +488,32 @@ const {
|
||||
emptySelectionMessage: '请先勾选需要打印子单号的订单'
|
||||
})
|
||||
|
||||
/** 子单号打印弹窗:运单选择表格 */
|
||||
const subWaybillSelectTableRef = ref<any>(null)
|
||||
|
||||
/** 子单号打印弹窗:已选运单标签 */
|
||||
const subWaybillTagItems = computed(() =>
|
||||
subWaybillSelectedWaybills.value
|
||||
.filter((item) => Boolean(item?.waybill_code))
|
||||
.map((item) => ({ label: String(item.waybill_code), value: String(item.waybill_code) }))
|
||||
)
|
||||
|
||||
/** 移除已选运单:取消表格对应行的勾选 */
|
||||
function removeSubWaybillSelection(value: string | number) {
|
||||
const code = String(value)
|
||||
const row = subWaybillOptions.value.find((item) => String(item?.waybill_code) === code)
|
||||
if (row) subWaybillSelectTableRef.value?.toggleRowSelection?.(row, false)
|
||||
}
|
||||
|
||||
// 全部运单被移除后自动关闭选择弹窗
|
||||
watch(
|
||||
() => subWaybillSelectedWaybills.value.length,
|
||||
(length, prevLength) => {
|
||||
if (!subWaybillSelectDialogVisible.value) return
|
||||
if (prevLength > 0 && length === 0) closeSubWaybillSelectDialog()
|
||||
}
|
||||
)
|
||||
|
||||
useOrderListPageCleanup({
|
||||
list,
|
||||
selectionRows,
|
||||
@ -775,6 +806,15 @@ function handleTransferByOrdersSuccess() {
|
||||
loadData()
|
||||
}
|
||||
|
||||
/** 转退回拆包弹窗移除某个已选订单:同步快照行并取消列表勾选 */
|
||||
function removeTransferByOrderRow(value: string | number) {
|
||||
const target = String(value)
|
||||
const index = transferByOrderRows.value.findIndex((row: any) => String(row?.id) === target)
|
||||
if (index > -1) transferByOrderRows.value.splice(index, 1)
|
||||
const row = selectionRows.value.find((item: any) => String(item?.id) === target)
|
||||
if (row) upperTable.value?.toggleRowSelection?.(row, false)
|
||||
}
|
||||
|
||||
toolbarActionMap.openTransferByOrdersDialog = openTransferByOrdersDialog
|
||||
|
||||
function resolveButtonLoading(loadingKey?: string) {
|
||||
|
||||
@ -279,6 +279,7 @@
|
||||
v-model="batchQuickRecheckDialogVisible"
|
||||
:suggested-ids="batchQuickRecheckSuggestedIds"
|
||||
:selected-rows="batchQuickRecheckSelectedRows"
|
||||
@remove-order="removeQuickRecheckOrder"
|
||||
@closed="resetBatchQuickRecheckDialog"
|
||||
@success="handleBatchQuickRecheckSuccess"
|
||||
/>
|
||||
@ -1087,6 +1088,18 @@ function removeSelectedOrder(value: string | number, ids?: Array<number | string
|
||||
if (row) upperTable.value?.toggleRowSelection?.(row, false)
|
||||
}
|
||||
|
||||
/** 批量发货弹窗移除已选订单:同步快照行与建议 ID,并取消列表勾选 */
|
||||
function removeQuickRecheckOrder(value: string | number) {
|
||||
const target = String(value)
|
||||
const rowIndex = batchQuickRecheckSelectedRows.value.findIndex(
|
||||
(row: any) => String(row?.id) === target
|
||||
)
|
||||
if (rowIndex > -1) batchQuickRecheckSelectedRows.value.splice(rowIndex, 1)
|
||||
const idIndex = batchQuickRecheckSuggestedIds.value.findIndex((id) => String(id) === target)
|
||||
if (idIndex > -1) batchQuickRecheckSuggestedIds.value.splice(idIndex, 1)
|
||||
removeSelectedOrder(value)
|
||||
}
|
||||
|
||||
const toolbarActionMap: Record<string, () => void | Promise<void>> = {
|
||||
...pendingToolbarActionMap,
|
||||
openResolveExceptionDialog,
|
||||
|
||||
@ -37,10 +37,12 @@
|
||||
class="task-panel__body batch-recheck-form"
|
||||
>
|
||||
<div class="task-panel__form">
|
||||
<div class="task-panel__field">
|
||||
<span class="task-panel__field-label">已选订单</span>
|
||||
<strong class="task-panel__field-value">{{ selectedRows.length }} 条</strong>
|
||||
</div>
|
||||
<SelectedTags
|
||||
label="已选订单"
|
||||
:items="selectedRowTagItems"
|
||||
empty-text="暂无已选订单"
|
||||
@remove="handleRemoveSelectedRow"
|
||||
/>
|
||||
|
||||
<div v-if="selectedRows.length" class="task-panel__section">
|
||||
<span class="task-panel__section-title">订单预览</span>
|
||||
@ -108,6 +110,7 @@
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||
import {
|
||||
batchQuickRecheck,
|
||||
type BatchQuickRecheckResponse
|
||||
@ -132,6 +135,8 @@ const props = defineProps<{
|
||||
const emit = defineEmits<{
|
||||
(e: 'closed'): void
|
||||
(e: 'success', payload: BatchQuickRecheckResponse): void
|
||||
/** 用户移除某个已选订单标签 */
|
||||
(e: 'remove-order', value: string | number): void
|
||||
}>()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
@ -151,6 +156,34 @@ const selectedRows = computed(() => props.selectedRows || [])
|
||||
|
||||
const parsedIds = computed(() => parseOrderIdsInput(form.idsText))
|
||||
|
||||
/** 已选订单标签(发货单号) */
|
||||
const selectedRowTagItems = computed(() =>
|
||||
selectedRows.value
|
||||
.filter((row) => row?.id !== undefined && row?.id !== null && row?.id !== '')
|
||||
.map((row) => ({
|
||||
label: String(row.delivery_order_code ?? row.id ?? ''),
|
||||
value: row.id as number | string
|
||||
}))
|
||||
)
|
||||
|
||||
/** 移除已选订单:同步订单 ID 输入框,并通知父级取消列表勾选 */
|
||||
function handleRemoveSelectedRow(value: string | number) {
|
||||
const id = Number(value)
|
||||
if (Number.isFinite(id)) {
|
||||
form.idsText = parsedIds.value.filter((item) => item !== id).join(', ')
|
||||
}
|
||||
emit('remove-order', value)
|
||||
}
|
||||
|
||||
// 已选订单被逐个移除,最后一个移除后自动关闭弹窗
|
||||
watch(
|
||||
() => selectedRows.value.length,
|
||||
(length, prevLength) => {
|
||||
if (!visible.value || submitting.value) return
|
||||
if (prevLength > 0 && length === 0) visible.value = false
|
||||
}
|
||||
)
|
||||
|
||||
const rules: FormRules = {
|
||||
idsText: [
|
||||
{
|
||||
|
||||
@ -283,6 +283,7 @@
|
||||
v-model="batchQuickRecheckDialogVisible"
|
||||
:suggested-ids="batchQuickRecheckSuggestedIds"
|
||||
:selected-rows="batchQuickRecheckSelectedRows"
|
||||
@remove-order="removeQuickRecheckOrder"
|
||||
@closed="resetBatchQuickRecheckDialog"
|
||||
@success="handleBatchQuickRecheckSuccess"
|
||||
/>
|
||||
@ -1049,6 +1050,18 @@ function removeSelectedOrder(value: string | number, ids?: Array<number | string
|
||||
if (row) upperTable.value?.toggleRowSelection?.(row, false)
|
||||
}
|
||||
|
||||
/** 批量发货弹窗移除已选订单:同步快照行与建议 ID,并取消列表勾选 */
|
||||
function removeQuickRecheckOrder(value: string | number) {
|
||||
const target = String(value)
|
||||
const rowIndex = batchQuickRecheckSelectedRows.value.findIndex(
|
||||
(row: any) => String(row?.id) === target
|
||||
)
|
||||
if (rowIndex > -1) batchQuickRecheckSelectedRows.value.splice(rowIndex, 1)
|
||||
const idIndex = batchQuickRecheckSuggestedIds.value.findIndex((id) => String(id) === target)
|
||||
if (idIndex > -1) batchQuickRecheckSuggestedIds.value.splice(idIndex, 1)
|
||||
removeSelectedOrder(value)
|
||||
}
|
||||
|
||||
toolbarActionMap['openResolveExceptionDialog'] = openResolveExceptionDialog
|
||||
toolbarActionMap['handleBatchPrint'] = handleBatchPrint
|
||||
toolbarActionMap['handleSubWaybillPrint'] = handleSubWaybillPrint
|
||||
|
||||
@ -99,6 +99,7 @@
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
|
||||
@ -138,6 +138,7 @@
|
||||
:column-config-schema-version="1"
|
||||
:data="panelOrders"
|
||||
:columns="orderColumns"
|
||||
:show-selection="true"
|
||||
:row-key="getOrderRowKey"
|
||||
:current-row-key="panelActiveWaybill"
|
||||
:show-pagination="false"
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-selection="false"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:queryTime="queryTime"
|
||||
@page-change="handlePageChange"
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
|
||||
<span v-if="selectedRows.length" class="selection-summary">已选 {{ selectedRows.length }} 项</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -43,13 +43,14 @@
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-selection="false"
|
||||
:show-selection="true"
|
||||
:show-actions="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
@refresh="loadList"
|
||||
>
|
||||
<template #column-status="{ row }">
|
||||
@ -129,6 +130,7 @@ const availableFieldsRef = reactive(JSON.parse(JSON.stringify(comboGoodsScanFiel
|
||||
const columns = comboGoodsColumns
|
||||
const loading = ref(false)
|
||||
const tableData = ref<ComboGoodsRecord[]>([])
|
||||
const selectedRows = ref<ComboGoodsRecord[]>([])
|
||||
const queryTime = ref(0)
|
||||
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
||||
const currentConditionRaw = ref<any>(null)
|
||||
@ -248,6 +250,10 @@ function handleConditionReset() {
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: ComboGoodsRecord[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
@ -308,4 +314,17 @@ onMounted(() => {
|
||||
color: #909399;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
/* 多选状态提示(工具栏右侧) */
|
||||
.selection-summary {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 24px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #ecf5ff;
|
||||
color: #409eff;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,59 +1,59 @@
|
||||
<template>
|
||||
<div class="barcode-container">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-position="top" class="barcode-form" :disabled="loading">
|
||||
<el-form-item prop="barcodeText" class="barcode-item">
|
||||
<template #label>
|
||||
<span>
|
||||
条码
|
||||
<el-tooltip content="条码,一行一个" placement="top">
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<el-input
|
||||
v-model="formData.barcodeText"
|
||||
type="textarea"
|
||||
:rows="15"
|
||||
placeholder="请输入条码,一行一个"
|
||||
clearable
|
||||
resize="none"
|
||||
class="barcode-textarea"
|
||||
:disabled="!hasPermission('stock.warehouse.saveWarehouseStockBarcode')"
|
||||
@blur="handleBlur"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <div class="tip-text">一行一个</div> -->
|
||||
</el-form>
|
||||
<div class="section">
|
||||
<div class="section-header">
|
||||
<div class="section-title">
|
||||
<span>条码</span>
|
||||
<el-tooltip content="条码,一行一个" placement="top">
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<span class="section-count">共 {{ barcodeCount }} 个条码</span>
|
||||
</div>
|
||||
|
||||
<div class="bottom-actions">
|
||||
<el-button-group class="toolbar-btn-group">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Check"
|
||||
:disabled="!hasPermission('stock.warehouse.saveWarehouseStockBarcode')"
|
||||
@click="handleSave"
|
||||
title="保存"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
size="small"
|
||||
class="barcode-form"
|
||||
:disabled="loading"
|
||||
>
|
||||
<el-form-item prop="barcodeText" class="barcode-item">
|
||||
<el-input
|
||||
v-model="formData.barcodeText"
|
||||
type="textarea"
|
||||
:rows="15"
|
||||
placeholder="请输入条码,一行一个"
|
||||
clearable
|
||||
resize="none"
|
||||
class="barcode-textarea"
|
||||
:disabled="!hasPermission('stock.warehouse.saveWarehouseStockBarcode')"
|
||||
@blur="handleBlur"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="Refresh"
|
||||
@click="resetForm"
|
||||
title="重置"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<div class="footer-actions">
|
||||
<el-button size="small" type="danger" plain @click="resetForm">重置</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
:disabled="!hasPermission('stock.warehouse.saveWarehouseStockBarcode')"
|
||||
@click="handleSave"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Check, Refresh, QuestionFilled } from '@element-plus/icons-vue'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
|
||||
@ -75,6 +75,14 @@ const formData = reactive({
|
||||
barcodes: [] as string[]
|
||||
})
|
||||
|
||||
/** 实时统计:按行去空后计算条码数量 */
|
||||
const barcodeCount = computed(() =>
|
||||
formData.barcodeText
|
||||
.split('\n')
|
||||
.map((code) => code.trim())
|
||||
.filter((code) => code.length > 0).length
|
||||
)
|
||||
|
||||
const originalData = reactive({
|
||||
barcodes: [] as string[]
|
||||
})
|
||||
@ -227,63 +235,103 @@ function resetForm() {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 条码:对齐订单详情面板的分区标题 + 底部操作条 */
|
||||
.barcode-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding: 6px 10px 8px;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.section {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding-left: 8px;
|
||||
border-left: 3px solid #409eff;
|
||||
color: #303133;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
|
||||
.el-icon {
|
||||
color: #909399;
|
||||
cursor: help;
|
||||
}
|
||||
}
|
||||
|
||||
.section-count {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.barcode-form {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
|
||||
/* 隐藏滚动条 */
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
.barcode-item {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 0;
|
||||
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
display: block; // 确保内容区域正常展开
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.barcode-textarea {
|
||||
height: 100%;
|
||||
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
|
||||
:deep(.el-textarea__inner) {
|
||||
height: 100%;
|
||||
min-height: 400px;
|
||||
font-family: monospace;
|
||||
min-height: 240px;
|
||||
padding: 8px 10px;
|
||||
font-family: Consolas, Monaco, 'Courier New', monospace;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 5px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.bottom-actions {
|
||||
.footer-actions {
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
padding: 10px 20px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,9 +1,50 @@
|
||||
<template>
|
||||
<div class="stock-info-container">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" :disabled="!hasPermission('stock.warehouse.saveWarehouseStock') || loading">
|
||||
<el-row :gutter="30">
|
||||
<!-- 第一列:基础信息 -->
|
||||
<el-col :span="12">
|
||||
<!-- 概要条:左侧商品身份/管理标识,右侧关键数据(对齐 stock/pickingShortage 工具栏) -->
|
||||
<div class="info-summary">
|
||||
<div class="info-summary__identity">
|
||||
<span class="info-summary__name" :title="formData.item_name">{{ formData.item_name || '未命名商品' }}</span>
|
||||
<span class="info-summary__code">{{ formData.item_code || '未设置编码' }}</span>
|
||||
<span
|
||||
v-for="tag in managementTags"
|
||||
:key="tag.label"
|
||||
class="info-tag"
|
||||
:class="`info-tag--${tag.type}`"
|
||||
>{{ tag.label }}</span>
|
||||
<span v-if="formData.need_recheck === 'N'" class="info-tag info-tag--warning">跳过复核</span>
|
||||
<span
|
||||
v-if="!managementTags.length && formData.need_recheck !== 'N'"
|
||||
class="info-tag info-tag--muted"
|
||||
>无特殊管理</span>
|
||||
</div>
|
||||
<div class="info-summary__metrics">
|
||||
<span class="summary-chip">标价 <strong>¥ {{ formatAmount(formData.tag_price) }}</strong></span>
|
||||
<span class="summary-chip summary-chip--primary">
|
||||
零售价 <strong>¥ {{ formatAmount(formData.retail_price) }}</strong>
|
||||
</span>
|
||||
<span class="summary-chip">
|
||||
体积 <strong>{{ formatAmount(formData.volume, 0) }}<i>cm³</i></strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="loading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="110px"
|
||||
class="stock-info-form"
|
||||
:disabled="!hasPermission('stock.warehouse.saveWarehouseStock') || loading"
|
||||
>
|
||||
<div class="info-grid">
|
||||
<!-- 基础信息 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">基础信息</h3>
|
||||
<span class="info-group__hint">编码、名称、规格与分类</span>
|
||||
</header>
|
||||
<div class="info-fields">
|
||||
<!-- 商品编码 -->
|
||||
<el-form-item label="商品编码" prop="item_code">
|
||||
<template #label>
|
||||
@ -97,40 +138,40 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 价格信息 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="标价(¥)" prop="tag_price">
|
||||
<el-input-number v-model="formData.tag_price" :min="0" :precision="2" :controls="false"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="零售价(¥)" prop="retail_price">
|
||||
<el-input-number v-model="formData.retail_price" :min="0" :precision="2" :controls="false"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 重量信息 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="毛重(g)" prop="gross_weight">
|
||||
<el-input-number v-model="formData.gross_weight" :min="0" :precision="0" :controls="false"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="净重(g)" prop="net_weight">
|
||||
<el-input-number v-model="formData.net_weight" :min="0" :precision="0" :controls="false"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 价格与重量 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">价格与重量</h3>
|
||||
<span class="info-group__hint">金额单位:元 · 重量单位:克</span>
|
||||
</header>
|
||||
<div class="info-fields info-fields--4">
|
||||
<el-form-item label="标价(¥)" prop="tag_price">
|
||||
<el-input-number v-model="formData.tag_price" :min="0" :precision="2" :controls="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="零售价(¥)" prop="retail_price">
|
||||
<el-input-number v-model="formData.retail_price" :min="0" :precision="2" :controls="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="毛重(g)" prop="gross_weight">
|
||||
<el-input-number v-model="formData.gross_weight" :min="0" :precision="0" :controls="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="净重(g)" prop="net_weight">
|
||||
<el-input-number v-model="formData.net_weight" :min="0" :precision="0" :controls="false" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 管理设置 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">管理设置</h3>
|
||||
<span class="info-group__hint">决定入库、出库与复核校验规则</span>
|
||||
</header>
|
||||
<div class="info-fields">
|
||||
<!-- 管理标识 -->
|
||||
<el-form-item label="管理标识">
|
||||
<el-form-item label="管理标识" class="info-field--full">
|
||||
<el-checkbox-group v-model="formData.managementFlags" class="management-flags">
|
||||
<el-checkbox value="is_sn_mgmt" title="开启后商品执行一物一码出库,不能进团购波次,打包需要扫描商品SN码">序列号管理</el-checkbox>
|
||||
<el-checkbox value="is_shelf_life_mgmt">保质期管理</el-checkbox>
|
||||
@ -146,117 +187,67 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-card v-if="hasManagementFlag('is_shelf_life_mgmt')" class="info-card" shadow="never" style="margin-top: 20px;">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>保质期管理</span>
|
||||
<el-tooltip content="开启后按保质期规则进行入库、出库和预警控制" placement="top">
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="保质期天数" prop="shelf_life_days">
|
||||
<el-input-number
|
||||
v-model="formData.shelf_life_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="请输入保质期天数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="入库最小天数" prop="inbound_min_days">
|
||||
<el-input-number
|
||||
v-model="formData.inbound_min_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="请输入入库最小天数要求"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="出库最小天数" prop="outbound_min_days">
|
||||
<el-input-number
|
||||
v-model="formData.outbound_min_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="请输入出库最小天数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="剩余有效期" prop="remaining_threshold_days">
|
||||
<el-input-number
|
||||
v-model="formData.remaining_threshold_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="请输入剩余有效期阈值天数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<!-- 第二列:尺寸信息和箱规信息 -->
|
||||
<el-col :span="12">
|
||||
<!-- 尺寸信息卡片 -->
|
||||
<el-card class="info-card" shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>尺寸信息</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="长度(cm)" prop="length">
|
||||
<el-input-number v-model="formData.length" :min="0" :precision="2" :controls="false"
|
||||
style="width: 100%" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="宽度(cm)" prop="width">
|
||||
<el-input-number v-model="formData.width" :min="0" :precision="2" :controls="false"
|
||||
style="width: 100%" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="高度(cm)" prop="height">
|
||||
<el-input-number v-model="formData.height" :min="0" :precision="2" :controls="false"
|
||||
style="width: 100%" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="体积(cm³)" prop="volume">
|
||||
<el-input-number v-model="formData.volume" :min="0" :precision="0" :controls="false"
|
||||
style="width: 100%" />
|
||||
<!-- 开启「保质期管理」后才需要维护以下参数 -->
|
||||
<template v-if="hasManagementFlag('is_shelf_life_mgmt')">
|
||||
<el-form-item label="保质期天数" prop="shelf_life_days">
|
||||
<el-input-number
|
||||
v-model="formData.shelf_life_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
placeholder="请输入保质期天数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-card>
|
||||
|
||||
<!-- 箱规信息卡片 -->
|
||||
<el-card class="info-card" shadow="never" style="margin-top: 20px;">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>箱规信息</span>
|
||||
<el-tooltip content="箱规信息用于整箱入库、出库和库存管理" placement="top">
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<el-form-item label="入库最小天数" prop="inbound_min_days">
|
||||
<el-input-number
|
||||
v-model="formData.inbound_min_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
placeholder="请输入入库最小天数要求"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="出库最小天数" prop="outbound_min_days">
|
||||
<el-input-number
|
||||
v-model="formData.outbound_min_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
placeholder="请输入出库最小天数"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="剩余有效期" prop="remaining_threshold_days">
|
||||
<el-input-number
|
||||
v-model="formData.remaining_threshold_days"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
placeholder="请输入剩余有效期阈值天数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 尺寸与箱规 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">尺寸与箱规</h3>
|
||||
<span class="info-group__hint">体积由长 × 宽 × 高自动计算,启用箱规后需维护整箱参数</span>
|
||||
</header>
|
||||
<div class="info-fields info-fields--4">
|
||||
<el-form-item label="长度(cm)" prop="length">
|
||||
<el-input-number v-model="formData.length" :min="0" :precision="2" :controls="false" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
<el-form-item label="宽度(cm)" prop="width">
|
||||
<el-input-number v-model="formData.width" :min="0" :precision="2" :controls="false" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
<el-form-item label="高度(cm)" prop="height">
|
||||
<el-input-number v-model="formData.height" :min="0" :precision="2" :controls="false" @change="calculateVolume" />
|
||||
</el-form-item>
|
||||
<el-form-item label="体积(cm³)" prop="volume">
|
||||
<el-input-number v-model="formData.volume" :min="0" :precision="0" :controls="false" />
|
||||
</el-form-item>
|
||||
<!-- 是否启用箱规 -->
|
||||
<el-form-item label="启用箱规" prop="enable_box_spec">
|
||||
<el-switch
|
||||
@ -267,114 +258,80 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="formData.enable_box_spec">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="每箱数量" prop="quantity_per_box">
|
||||
<el-input-number
|
||||
v-model="formData.quantity_per_box"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
placeholder="每箱数量"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 箱规重量 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="箱毛重(g)" prop="box_gross_weight">
|
||||
<el-input-number
|
||||
v-model="formData.box_gross_weight"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="箱净重(g)" prop="box_net_weight">
|
||||
<el-input-number
|
||||
v-model="formData.box_net_weight"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 箱规尺寸 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="箱长(cm)" prop="box_length">
|
||||
<el-input-number
|
||||
v-model="formData.box_length"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
@change="calculateBoxVolume"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="箱宽(cm)" prop="box_width">
|
||||
<el-input-number
|
||||
v-model="formData.box_width"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
@change="calculateBoxVolume"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="箱高(cm)" prop="box_height">
|
||||
<el-input-number
|
||||
v-model="formData.box_height"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
@change="calculateBoxVolume"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 箱体积 -->
|
||||
<template v-if="formData.enable_box_spec">
|
||||
<el-form-item label="每箱数量" prop="quantity_per_box">
|
||||
<el-input-number
|
||||
v-model="formData.quantity_per_box"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
placeholder="每箱数量"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱毛重(g)" prop="box_gross_weight">
|
||||
<el-input-number
|
||||
v-model="formData.box_gross_weight"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱净重(g)" prop="box_net_weight">
|
||||
<el-input-number
|
||||
v-model="formData.box_net_weight"
|
||||
:min="0"
|
||||
:precision="0"
|
||||
:controls="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱长(cm)" prop="box_length">
|
||||
<el-input-number
|
||||
v-model="formData.box_length"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
@change="calculateBoxVolume"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱宽(cm)" prop="box_width">
|
||||
<el-input-number
|
||||
v-model="formData.box_width"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
@change="calculateBoxVolume"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱高(cm)" prop="box_height">
|
||||
<el-input-number
|
||||
v-model="formData.box_height"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
@change="calculateBoxVolume"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="箱体积(m³)" prop="box_volume">
|
||||
<el-input-number
|
||||
v-model="formData.box_volume"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:controls="false"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 作业要求卡片:要求合并=Y 时只填一个「要求」(提交到打包要求),否则三个要求各传各的 -->
|
||||
<el-card class="info-card" shadow="never" style="margin-top: 20px;">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>作业要求</span>
|
||||
<el-tooltip content="拣货、复核、打包流程分别可见对应的作业要求" placement="top">
|
||||
<el-icon><QuestionFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 作业要求:要求合并=Y 时只填一个「要求」(提交到打包要求),否则三个要求各传各的 -->
|
||||
<section class="info-group">
|
||||
<header class="info-group__head">
|
||||
<h3 class="info-group__title">作业要求</h3>
|
||||
<span class="info-group__hint">拣货、复核、打包流程分别可见对应要求,单项最多 255 字</span>
|
||||
</header>
|
||||
<div class="info-fields info-fields--3">
|
||||
<!-- 要求合并:Y=是,N=否;开启后所有接口输出都会输出该商品的打包要求 -->
|
||||
<el-form-item prop="merge_requirements">
|
||||
<el-form-item prop="merge_requirements" class="info-field--full">
|
||||
<template #label>
|
||||
<span>
|
||||
要求合并
|
||||
@ -395,11 +352,14 @@
|
||||
prop="packing_requirements"
|
||||
label="要求"
|
||||
label-position="top"
|
||||
class="info-field--full"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.packing_requirements"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:rows="2"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
placeholder="请输入要求"
|
||||
clearable
|
||||
/>
|
||||
@ -411,7 +371,9 @@
|
||||
<el-input
|
||||
v-model="formData.packing_requirements"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:rows="2"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
placeholder="请输入打包要求"
|
||||
clearable
|
||||
/>
|
||||
@ -421,7 +383,9 @@
|
||||
<el-input
|
||||
v-model="formData.pick_requirements"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:rows="2"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
placeholder="请输入拣货要求"
|
||||
clearable
|
||||
/>
|
||||
@ -431,27 +395,23 @@
|
||||
<el-input
|
||||
v-model="formData.recheck_requirements"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
:rows="2"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
placeholder="请输入复核要求"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<div class="bottom" v-if="hasPermission('stock.warehouse.saveWarehouseStock')">
|
||||
<el-button-group class="toolbar-btn-group">
|
||||
<el-button type="primary" icon="Check" @click="handleSave" title="保存">保存
|
||||
</el-button>
|
||||
|
||||
<el-button type="danger" icon="Refresh" @click="resetForm" title="重置" class="toolbar-btn">
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<div class="footer-actions" v-if="hasPermission('stock.warehouse.saveWarehouseStock')">
|
||||
<el-button size="small" type="danger" plain @click="resetForm">重置</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" @click="handleSave">保存</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 库存单位管理弹窗 -->
|
||||
@ -586,9 +546,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted, nextTick } from 'vue'
|
||||
import { ref, reactive, computed, watch, onMounted, nextTick } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Plus, Check, Refresh, Close, QuestionFilled } from '@element-plus/icons-vue'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { stockDefaultFormData, stockFormRules } from '../stock-config'
|
||||
@ -626,6 +586,21 @@ const baseFormData: StockInfoFormData = {
|
||||
const formData = reactive<StockInfoFormData>({ ...baseFormData })
|
||||
const originalData = ref<any>({})
|
||||
|
||||
/** 概要条上的管理标识标签 */
|
||||
const managementTags = computed(() => {
|
||||
const tags: Array<{ label: string; type: 'primary' | 'success' | 'warning' }> = []
|
||||
if (formData.is_sn_mgmt === 'Y') tags.push({ label: '序列号管理', type: 'primary' })
|
||||
if (formData.is_shelf_life_mgmt === 'Y') tags.push({ label: '保质期管理', type: 'warning' })
|
||||
if (formData.is_batch_mgmt === 'Y') tags.push({ label: '批次管理', type: 'success' })
|
||||
return tags
|
||||
})
|
||||
|
||||
/** 概要条数值展示(金额/体积) */
|
||||
function formatAmount(value: unknown, digits = 2) {
|
||||
const n = Number(value)
|
||||
return Number.isFinite(n) ? n.toFixed(digits) : (0).toFixed(digits)
|
||||
}
|
||||
|
||||
// 列表数据
|
||||
const stockUnits = ref<any[]>([])
|
||||
const prohibitedList = ref<any[]>([])
|
||||
@ -1175,18 +1150,145 @@ async function handleDeleteProhibited(id: number) {
|
||||
<style scoped lang="scss">
|
||||
@use "../../styles/task-panel.scss";
|
||||
|
||||
/* 商品明细:顶部概要条 + 分组卡片 + 三/四列紧凑表单 */
|
||||
.stock-info-container {
|
||||
// padding: 5px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.el-form {
|
||||
/* ===== 概要条:左身份 / 右统计(工具栏式) ===== */
|
||||
.info-summary {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px 12px;
|
||||
min-width: 0;
|
||||
margin: 6px 10px 0;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
|
||||
&__identity {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
&__name {
|
||||
min-width: 0;
|
||||
max-width: 360px;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
line-height: 20px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&__code {
|
||||
flex: none;
|
||||
height: 20px;
|
||||
line-height: 18px;
|
||||
padding: 0 6px;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
background: #fafbfc;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&__metrics {
|
||||
flex: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 统计 chip:与 stock/pickingShortage、库存页工具栏保持一致 */
|
||||
.summary-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #f4f4f5;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
|
||||
strong {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-left: 2px;
|
||||
font-size: 11px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&--primary strong {
|
||||
color: var(--el-color-primary, #409eff);
|
||||
}
|
||||
}
|
||||
|
||||
.info-tag {
|
||||
height: 20px;
|
||||
line-height: 18px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 10px;
|
||||
font-size: 12px;
|
||||
|
||||
&--primary {
|
||||
color: #409eff;
|
||||
background: #ecf5ff;
|
||||
border-color: #d9ecff;
|
||||
}
|
||||
|
||||
&--success {
|
||||
color: #67c23a;
|
||||
background: #f0f9eb;
|
||||
border-color: #e1f3d8;
|
||||
}
|
||||
|
||||
&--warning {
|
||||
color: #e6a23c;
|
||||
background: #fdf6ec;
|
||||
border-color: #faecd8;
|
||||
}
|
||||
|
||||
&--muted {
|
||||
color: #909399;
|
||||
background: #f4f4f5;
|
||||
border-color: #e9e9eb;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 表单 ===== */
|
||||
.stock-info-form {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
padding: 10px 10px 8px;
|
||||
box-sizing: border-box;
|
||||
|
||||
/* 隐藏滚动条 */
|
||||
@ -1195,39 +1297,129 @@ async function handleDeleteProhibited(id: number) {
|
||||
}
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
padding-right: 12px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__content) {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:deep(.el-input-number),
|
||||
:deep(.el-select),
|
||||
:deep(.el-textarea) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.management-flags .el-checkbox) {
|
||||
margin-right: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.info-group {
|
||||
padding: 10px 12px 2px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
|
||||
&__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
color: #303133;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 3px;
|
||||
height: 12px;
|
||||
border-radius: 2px;
|
||||
background: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
&__hint {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
/* 一行两个表单项,标签在左、控件在右 */
|
||||
.info-fields,
|
||||
.info-fields--3,
|
||||
.info-fields--4 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0 20px;
|
||||
}
|
||||
|
||||
.info-field--full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.info-fields,
|
||||
.info-fields--3,
|
||||
.info-fields--4 {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.select-with-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
|
||||
|
||||
.add-button {
|
||||
margin-left: 10px;
|
||||
margin-left: 0;
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
|
||||
.info-card {
|
||||
// margin-bottom: 5px;
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom {
|
||||
.footer-actions {
|
||||
flex-shrink: 0;
|
||||
// margin-top: 5px;
|
||||
// align-items: center;
|
||||
// justify-content: center;
|
||||
text-align: right;
|
||||
padding: 0px 20px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 10px 8px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 单位 / 违禁品类型列表(弹窗内) */
|
||||
|
||||
@ -1,44 +1,50 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- 商品概要信息 -->
|
||||
<div v-if="stockItem" class="stock-summary">
|
||||
<span class="summary-item"><b>商品编码:</b>{{ stockItem.item_code }}</span>
|
||||
<span class="summary-item"><b>商品名称:</b>{{ stockItem.item_name }}</span>
|
||||
<span v-if="stockItem.sku_property" class="summary-item"><b>规格:</b>{{ stockItem.sku_property }}</span>
|
||||
<span class="summary-item"><b>总数量:</b>{{ stockItem.quantity }} {{ stockItem.stock_unit }}</span>
|
||||
<span class="summary-item"><b>锁定数量:</b>{{ stockItem.locked_quantity }}</span>
|
||||
<!-- 工具栏:左侧操作 + 右侧概要统计(对齐 stock/pickingShortage 页面 toolbar) -->
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadData">刷新</el-button>
|
||||
<!-- 「数量」数值默认遮挡,点此切换显示/隐藏(仅影响展示) -->
|
||||
<el-button size="small" type="primary" plain @click="quantityVisible = !quantityVisible">
|
||||
{{ quantityVisible ? '隐藏数量' : '显示数量' }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<span v-if="stockItem" class="summary-chip summary-chip--name" :title="stockItemTitle">
|
||||
<strong>{{ stockItem.item_name || '-' }}</strong>
|
||||
<em>{{ stockItem.item_code || '-' }}</em>
|
||||
</span>
|
||||
<span
|
||||
v-if="stockItem"
|
||||
class="summary-chip summary-chip--spec"
|
||||
:title="stockItem.sku_property || '未设置规格'"
|
||||
>
|
||||
规格 <strong>{{ stockItem.sku_property || '-' }}</strong>
|
||||
</span>
|
||||
<span v-if="stockItem" class="summary-chip summary-chip--primary">
|
||||
总数量
|
||||
<strong>
|
||||
{{ quantityVisible ? (stockItem.quantity ?? 0) : QUANTITY_MASK }}
|
||||
<i v-if="stockItem.stock_unit">{{ stockItem.stock_unit }}</i>
|
||||
</strong>
|
||||
</span>
|
||||
<span v-if="stockItem" class="summary-chip summary-chip--warning">
|
||||
锁定数量 <strong>{{ stockItem.locked_quantity ?? 0 }}</strong>
|
||||
</span>
|
||||
<span class="summary-chip">库存记录 <strong>{{ pagination.total }}</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<el-button-group class="toolbar-btn-group">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:icon="Refresh"
|
||||
@click="loadData"
|
||||
title="刷新"
|
||||
:loading="loading"
|
||||
class="toolbar-btn"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
<!-- 「数量」数值默认遮挡,点此切换显示/隐藏(仅影响展示) -->
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
size="small"
|
||||
@click="quantityVisible = !quantityVisible"
|
||||
>
|
||||
{{ quantityVisible ? '隐藏数量' : '显示数量' }}
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
|
||||
<!-- 明细表格 -->
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
flex="1"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
size="small"
|
||||
>
|
||||
@ -128,26 +134,33 @@
|
||||
>
|
||||
<template #default="{ row }">{{ row.inbound_time ?? '-' }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无库存记录</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
v-if="pagination.total > 0"
|
||||
class="pagination"
|
||||
size="small"
|
||||
background
|
||||
layout="total, prev, pager, next"
|
||||
:total="pagination.total"
|
||||
:page-size="pagination.pageSize"
|
||||
:current-page="pagination.page"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
<div v-if="pagination.total > 0" class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import { ref, reactive, computed, watch, nextTick } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
|
||||
const props = defineProps<{
|
||||
@ -158,11 +171,28 @@ const loading = ref(false)
|
||||
const tableData = ref<any[]>([])
|
||||
const stockItem = ref<any>(null)
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHeight = ref(320)
|
||||
|
||||
useResizeObserver(tableHostRef, () => {
|
||||
const height = tableHostRef.value?.clientHeight ?? 0
|
||||
if (height > 0) tableHeight.value = height
|
||||
})
|
||||
|
||||
/** 「数量」数值是否可见:默认隐藏(只遮挡数值,列仍在;不影响数据与分页/刷新) */
|
||||
const quantityVisible = ref(false)
|
||||
/** 隐藏时的占位符 */
|
||||
const QUANTITY_MASK = '***'
|
||||
|
||||
/** 工具栏名称 chip 的 title:名称 · 编码 */
|
||||
const stockItemTitle = computed(() => {
|
||||
const item = stockItem.value
|
||||
if (!item) return ''
|
||||
return [item.item_name, item.item_code].filter(Boolean).join(' · ')
|
||||
})
|
||||
|
||||
/**
|
||||
* 实物数 = 可用数量 + 锁定数量
|
||||
* 可用数量缺失/为 0 时按「数量 - 锁定数量」兜底(与主列表「可用库存」列口径一致)
|
||||
@ -209,6 +239,14 @@ async function loadData() {
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
loadData()
|
||||
nextTick(() => tableRef.value?.setScrollTop?.(0))
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
nextTick(() => tableRef.value?.setScrollTop?.(0))
|
||||
}
|
||||
|
||||
watch(
|
||||
@ -227,36 +265,124 @@ watch(
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* 库存:对齐 order/orderManagement 商品明细面板(概要条 + 按钮行 + 自适应表格 + 分页) */
|
||||
.container {
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
overflow: auto;
|
||||
padding: 6px 10px 8px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
box-sizing: border-box;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.stock-summary {
|
||||
/* 工具栏:左操作 + 右统计(对齐 stock/pickingShortage) */
|
||||
.toolbar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
padding: 6px 10px;
|
||||
background: #f5f7fa;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
color: #606266;
|
||||
.toolbar-left {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
:deep(.el-button) {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.toolbar-btn-group {
|
||||
flex-shrink: 0;
|
||||
.toolbar-right {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
.summary-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
background: #f4f4f5;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: #909399;
|
||||
white-space: nowrap;
|
||||
|
||||
strong {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-left: 2px;
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&--primary strong {
|
||||
color: var(--el-color-primary, #409eff);
|
||||
}
|
||||
|
||||
&--warning strong {
|
||||
color: var(--el-color-warning, #e6a23c);
|
||||
}
|
||||
|
||||
&--name {
|
||||
min-width: 0;
|
||||
max-width: 340px;
|
||||
|
||||
strong {
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
em {
|
||||
flex-shrink: 0;
|
||||
font-style: normal;
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
|
||||
&--spec {
|
||||
min-width: 0;
|
||||
|
||||
strong {
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.custom-name {
|
||||
@ -264,8 +390,25 @@ watch(
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
.empty-tip {
|
||||
padding: 24px 0;
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -848,8 +848,9 @@ const loadStockUnits = async () => {
|
||||
@use "@/styles/list-page.scss";
|
||||
@use "@/styles/status-text.scss";
|
||||
|
||||
/* 各详情面板(商品明细/图片/条码/库存)自带 6px 10px 8px 内边距,容器只留左右 10px */
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 10px;
|
||||
padding: 0 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
@ -8,58 +8,44 @@
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadBindingData">刷新</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="summary-text selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
<span class="summary-text">已绑定收货单 {{ receivingBindings.length }} 个</span>
|
||||
<span class="summary-text">明细绑定 {{ itemBindingRows.length }} 条</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" v-loading="loading" class="table-host">
|
||||
<el-table
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="storage-entry-binding-receiving"
|
||||
:data="pagedReceivingBindings"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
:columns="receivingBindingColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
row-key="rowKey"
|
||||
empty-text="暂无绑定的收货单"
|
||||
:height="tableHeight"
|
||||
>
|
||||
<el-table-column
|
||||
v-for="col in entryReceivingBindingColumns"
|
||||
:key="col.prop"
|
||||
:prop="col.prop"
|
||||
:label="col.label"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="操作" width="90" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="compareLoading && activeCompareReceivingId === row.receiving_id"
|
||||
@click="loadComparePreview(row.receiving_id)"
|
||||
>
|
||||
对照
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="bindingPagination.currentPage"
|
||||
v-model:page-size="bindingPagination.pageSize"
|
||||
:pagination="bindingPagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="bindingPagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handleBindingPageSizeChange"
|
||||
@current-change="handleBindingPageChange"
|
||||
/>
|
||||
:loading="loading"
|
||||
empty-text="暂无绑定的收货单"
|
||||
@page-change="handleBindingPageChange"
|
||||
@page-size-change="handleBindingPageSizeChange"
|
||||
@refresh="loadBindingData"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="compareLoading && activeCompareReceivingId === row.receiving_id"
|
||||
@click="loadComparePreview(row.receiving_id)"
|
||||
>
|
||||
对照
|
||||
</el-button>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<!-- <section class="binding-section">
|
||||
@ -106,39 +92,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:data="compareRows"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
row-key="rowKey"
|
||||
empty-text="暂无对照数据"
|
||||
max-height="260"
|
||||
>
|
||||
<el-table-column
|
||||
v-for="col in entryBindingCompareColumns"
|
||||
:key="col.prop"
|
||||
:prop="col.prop"
|
||||
:label="col.label"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
:align="col.align"
|
||||
show-overflow-tooltip
|
||||
<div class="compare-table-host">
|
||||
<upper-table
|
||||
table-id="storage-entry-binding-compare"
|
||||
:data="compareRows"
|
||||
:columns="entryBindingCompareColumns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-pagination="false"
|
||||
empty-text="暂无对照数据"
|
||||
>
|
||||
<template v-if="col.prop === 'match_status_label'" #default="{ row }">
|
||||
<template #column-match_status_label="{ row }">
|
||||
<span :class="getStatusTextClass(getReceivingCompareStatusTagType(row.match_status))">
|
||||
{{ row.match_status_label }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</upper-table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch, onActivated, onMounted } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { computed, reactive, ref, watch, onActivated } from 'vue'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
@ -213,33 +189,24 @@ const activeCompareReceivingId = ref<number | null>(null)
|
||||
/** 绑定的收货单:接口一次性返回全部绑定关系,故用前端分页 */
|
||||
const bindingPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
|
||||
/* 表格高度:由容器实际高度驱动(Element Plus 不支持 height="100%") */
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(220)
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
/** 切行 / 切 tab 后用 rAF 兜底测高 */
|
||||
function syncTableHeight() {
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
}
|
||||
/** 表格列(尾部追加操作列,与「商品明细」UpperTable 一致) */
|
||||
const receivingBindingColumns = computed<Record<string, any>[]>(() => [
|
||||
...entryReceivingBindingColumns.map((col) => ({ ...col, showOverflowTooltip: true })),
|
||||
{ prop: 'actions', label: '操作', width: 90, fixed: 'right' },
|
||||
])
|
||||
|
||||
const pagedReceivingBindings = computed(() => {
|
||||
const start = (bindingPagination.currentPage - 1) * bindingPagination.pageSize
|
||||
return receivingBindings.value.slice(start, start + bindingPagination.pageSize)
|
||||
})
|
||||
|
||||
/** 表格勾选行(UpperTable selection-change) */
|
||||
const selectedRows = ref<ReceivingBindingRow[]>([])
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows as ReceivingBindingRow[]
|
||||
}
|
||||
|
||||
function handleBindingPageChange(page: number) {
|
||||
bindingPagination.currentPage = page
|
||||
}
|
||||
@ -283,20 +250,14 @@ watch(
|
||||
itemBindingRows.value = []
|
||||
bindingPagination.total = 0
|
||||
}
|
||||
syncTableHeight()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
syncTableHeight()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
if (props.id) {
|
||||
void loadBindingData()
|
||||
}
|
||||
syncTableHeight()
|
||||
})
|
||||
|
||||
function isApiSuccess(res: { code?: number; flag?: string } | null | undefined): boolean {
|
||||
@ -519,31 +480,72 @@ defineExpose({
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.selection-text {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表格容器:撑满剩余高度(与操作日志一致) */
|
||||
/* 表格容器:撑满剩余高度(与「商品明细」Product.vue 的 UpperTable 一致) */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 分页区:与其它详情面板一致(右对齐、上间距 6px) */
|
||||
.pagination-container {
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
flex-direction: column;
|
||||
|
||||
/* 每页条数下拉框与 UpperTable(入库明细/入库记录)的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:去掉 UpperTable 默认底部分隔线/内边距,右对齐,仅保留 6px 上间距 */
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 对照预览表格:固定高度(UpperTable 内部按 100% 高度滚动) */
|
||||
.compare-table-host {
|
||||
height: 260px;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
:deep(.pagination-container),
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,76 +12,59 @@
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="storage-entry-logs"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column prop="created_at" label="时间" width="175" />
|
||||
<el-table-column label="操作人" width="110">
|
||||
<template #default="{ row }">
|
||||
{{ row.operator_name ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作类型" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatOperationLabel(row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平台" width="100" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.platform_name || row.platform_code || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="外部日志" width="108" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.external_log_type && row.external_log_type !== 'NONE'" size="small" type="info">
|
||||
{{ row.external_log_type }}
|
||||
</el-tag>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.message ?? '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="108" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="hasExternalPayload(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="viewData(scope.row)"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
:loading="loading"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="handleRefresh"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #column-operator_name="{ row }">{{ row.operator_name ?? '—' }}</template>
|
||||
<template #column-operation_label="{ row }">{{ formatOperationLabel(row) }}</template>
|
||||
<template #column-platform_label="{ row }">
|
||||
{{ row.platform_name || row.platform_code || '—' }}
|
||||
</template>
|
||||
<template #column-external_log="{ row }">
|
||||
<el-tag
|
||||
v-if="row.external_log_type && row.external_log_type !== 'NONE'"
|
||||
size="small"
|
||||
type="info"
|
||||
>
|
||||
{{ row.external_log_type }}
|
||||
</el-tag>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
<template #column-message="{ row }">{{ row.message ?? '—' }}</template>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
v-if="hasExternalPayload(row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="viewData(row)"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
@ -99,7 +82,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
import { queryEntryLogs } from '@/api/storage.entry/entry'
|
||||
|
||||
@ -111,25 +93,34 @@ const props = defineProps<{
|
||||
const loading = ref(false)
|
||||
const tableData = ref<any[]>([])
|
||||
|
||||
/** 表格勾选行(UpperTable selection-change) */
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 列配置与「商品明细」UpperTable 一致:small 尺寸、默认居中 */
|
||||
const columns: Record<string, any>[] = [
|
||||
{ prop: 'created_at', label: '时间', width: 175 },
|
||||
{ prop: 'operator_name', label: '操作人', width: 110 },
|
||||
{ prop: 'operation_label', label: '操作类型', minWidth: 160, showOverflowTooltip: true },
|
||||
{ prop: 'platform_label', label: '平台', width: 100, showOverflowTooltip: true },
|
||||
{ prop: 'external_log', label: '外部日志', width: 108 },
|
||||
{ prop: 'message', label: '说明', minWidth: 220, showOverflowTooltip: true },
|
||||
{ prop: 'actions', label: '操作', width: 108, fixed: 'right' }
|
||||
]
|
||||
|
||||
const showRequestData = ref(false)
|
||||
const requestId = ref(0)
|
||||
const requestType = ref('')
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
const entryId = computed(() => {
|
||||
const id = props.id ?? props.row?.id
|
||||
if (id === undefined || id === null || id === '') return ''
|
||||
@ -172,37 +163,29 @@ watch(
|
||||
() => entryId.value,
|
||||
(newId) => {
|
||||
if (newId) {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
loadLogs()
|
||||
} else {
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
async function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
await loadLogs()
|
||||
}
|
||||
|
||||
async function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
await loadLogs()
|
||||
}
|
||||
|
||||
async function handleRefresh() {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
await loadLogs()
|
||||
}
|
||||
|
||||
@ -213,7 +196,7 @@ async function loadLogs() {
|
||||
try {
|
||||
const response: any = await queryEntryLogs({
|
||||
id: entryId.value,
|
||||
page: pagination.page,
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
if (response && ![1, 200].includes(response.code)) {
|
||||
@ -272,6 +255,17 @@ function viewData(row: any) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-host {
|
||||
@ -279,22 +273,33 @@ function viewData(row: any) {
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
flex-direction: column;
|
||||
|
||||
/* 每页条数下拉框与 UpperTable(入库明细/入库记录)的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
:deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
:deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* 分页区:与「商品明细」一致(去掉底部分隔线/内边距,右对齐,仅保留 6px 上间距) */
|
||||
:deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
:deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -942,7 +942,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['store_id', 'name', 'report_definition_id', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'remark', 'created_at', 'updated_at', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: '报表投递计划',
|
||||
showSelection: false
|
||||
showSelection: true
|
||||
},
|
||||
detailTabs: [
|
||||
{ name: 'detail', label: '计划详情', componentKey: 'DetailPanel' }
|
||||
@ -1020,7 +1020,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['id', 'store_id', 'report_code', 'status', 'biz_date', 'created_at', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: '报表投递记录',
|
||||
showSelection: false
|
||||
showSelection: true
|
||||
},
|
||||
detailTabs: [
|
||||
{ name: 'detail', label: '记录详情', componentKey: 'DetailPanel' }
|
||||
@ -1070,7 +1070,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['report_id', 'name', 'type', 'file_name', 'day_count', 'cutover_hour', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: '报表定义(report.meta)',
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '请选择报表查询报表元数据'
|
||||
},
|
||||
detailTabs: [
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:queryTime="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -12,60 +12,51 @@
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column prop="created_at" label="时间" width="250" />
|
||||
<el-table-column prop="operator_name" label="操作人" width="120" />
|
||||
<el-table-column prop="operation_name" label="操作名称" />
|
||||
<el-table-column prop="platform_name" label="操作平台" />
|
||||
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@click="viewData(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.external_log_id"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="storage-receiving-operation-logs"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
v-if="row.external_log_id"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click.stop="viewData(row)"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="backData(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.operation_code === 'UPDATE'"
|
||||
<el-button
|
||||
v-if="row.operation_code === 'UPDATE'"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click.stop="backData(row)"
|
||||
>
|
||||
修改前快照
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
@ -86,10 +77,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import * as receivingApi from '@/api/storage_receiving/receiving'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@ -101,48 +91,48 @@ const tableData = ref<any[]>([])
|
||||
const showRequestData = ref(false)
|
||||
const requestId = ref(0)
|
||||
const requestType = ref('')
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
const queryTime = ref(0)
|
||||
|
||||
/** 表格勾选行(UpperTable selection-change) */
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 列配置与「商品明细」一致:default-align="center"、small 尺寸、操作列固定右侧 */
|
||||
const columns = [
|
||||
{ prop: 'created_at', label: '时间', width: 250 },
|
||||
{ prop: 'operator_name', label: '操作人', width: 120 },
|
||||
{ prop: 'operation_name', label: '操作名称' },
|
||||
{ prop: 'platform_name', label: '操作平台' },
|
||||
{ prop: 'actions', label: '操作', width: 150, fixed: 'right' }
|
||||
]
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.id, (newVal) => {
|
||||
if (newVal) {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
fetchReceivingLogs()
|
||||
} else {
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
}, { immediate: true })
|
||||
|
||||
async function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
pagination.currentPage = page
|
||||
await fetchReceivingLogs()
|
||||
}
|
||||
|
||||
async function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
await fetchReceivingLogs()
|
||||
}
|
||||
|
||||
@ -150,11 +140,12 @@ async function fetchReceivingLogs() {
|
||||
if (!props.id) return
|
||||
|
||||
loading.value = true
|
||||
const start = Date.now()
|
||||
try {
|
||||
const res: any = await receivingApi.queryReceivingLogs({
|
||||
receiving_id: props.id,
|
||||
pagination: {
|
||||
page: pagination.page,
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
}
|
||||
})
|
||||
@ -162,7 +153,7 @@ async function fetchReceivingLogs() {
|
||||
if (res && (res.code === 200 || res.code === 0 || res.code === 1)) {
|
||||
const data = res.data || {}
|
||||
tableData.value = Array.isArray(data.list) ? data.list : []
|
||||
pagination.page = data.pagination?.page ?? pagination.page
|
||||
pagination.currentPage = data.pagination?.page ?? pagination.currentPage
|
||||
pagination.pageSize = data.pagination?.pageSize ?? pagination.pageSize
|
||||
pagination.total = data.pagination?.total ?? 0
|
||||
} else {
|
||||
@ -177,6 +168,7 @@ async function fetchReceivingLogs() {
|
||||
ElMessage.error(error?.message || '获取收货单操作日志失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
queryTime.value = Date.now() - start
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,28 +218,50 @@ function backData(row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
/* 与「商品明细」Product.vue 的 UpperTable 完全一致的容器/分页处理 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
|
||||
@ -20,93 +20,98 @@
|
||||
库存流水
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column
|
||||
fixed
|
||||
prop="zone_name"
|
||||
label="库区"
|
||||
width="150"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="storage-receiving-storage-records"
|
||||
:data="pagedTableData"
|
||||
:columns="columns"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
empty-text="暂无入库记录"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
@selection-change="handleSelectionChange"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="location_code"
|
||||
label="库位"
|
||||
width="120"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="quantity"
|
||||
label="数量"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="batch_no"
|
||||
label="批次"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="production_date"
|
||||
label="生产日期"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="expiration_date"
|
||||
label="过期日期"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="stock_type"
|
||||
label="库存类型"
|
||||
/>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无入库记录</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
// import * as stockApi from '@/api/stock/stock'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const tableData = ref<any[]>([])
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
const queryTime = ref(0)
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
/** 表格勾选行(UpperTable selection-change) */
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 列配置与「商品明细」一致:统一 default-align="center"、small 尺寸 */
|
||||
const columns = [
|
||||
{ prop: 'zone_name', label: '库区', width: 150, fixed: 'left' },
|
||||
{ prop: 'location_code', label: '库位', width: 120 },
|
||||
{ prop: 'quantity', label: '数量' },
|
||||
{ prop: 'batch_no', label: '批次' },
|
||||
{ prop: 'production_date', label: '生产日期' },
|
||||
{ prop: 'expiration_date', label: '过期日期' },
|
||||
{ prop: 'stock_type', label: '库存类型' }
|
||||
]
|
||||
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
/** 前端分页(接口一次性返回全部入库记录时使用) */
|
||||
const pagedTableData = computed(() => {
|
||||
const start = (pagination.currentPage - 1) * pagination.pageSize
|
||||
return tableData.value.slice(start, start + pagination.pageSize)
|
||||
})
|
||||
|
||||
watch(tableData, (rows) => {
|
||||
pagination.total = rows.length
|
||||
const maxPage = Math.max(1, Math.ceil(rows.length / pagination.pageSize))
|
||||
if (pagination.currentPage > maxPage) pagination.currentPage = maxPage
|
||||
})
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
}
|
||||
|
||||
function loadData() {
|
||||
loading.value = true
|
||||
// 暂无库存详情接口,保持与Vue2一致
|
||||
const start = Date.now()
|
||||
// 暂无库存详情接口,保持与 Vue2 一致
|
||||
setTimeout(() => {
|
||||
loading.value = false
|
||||
}, 500)
|
||||
queryTime.value = Date.now() - start
|
||||
}, 300)
|
||||
}
|
||||
|
||||
function goToStorageLog() {
|
||||
@ -150,15 +155,49 @@ function goToStorageLog() {
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
/* 与「商品明细」Product.vue 的 UpperTable 完全一致的容器/分页处理 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -101,7 +101,6 @@
|
||||
:virtual-threshold="100000"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:show-pagination="flatRows.length > pageSize"
|
||||
@selection-change="handleSelectionChange"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@ -1053,12 +1052,40 @@ watch(
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.quantity-input {
|
||||
width: 110px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 与「商品明细」Product.vue 的 UpperTable 一致:容器撑满、分页右对齐、隐藏左侧「已选/查询用时」 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 库位行内的商品已平铺到主表,无需展开区样式 */
|
||||
|
||||
.diff-text {
|
||||
|
||||
@ -105,21 +105,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<div class="table-host">
|
||||
<!-- ===== 库位结构(view=location):一行一个库位,展开看已知/未知商品作业记录 ===== -->
|
||||
<el-table
|
||||
<upper-table
|
||||
v-if="view === 'location'"
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
table-id="stockcheck-work-location"
|
||||
:data="rows"
|
||||
:columns="locationColumns"
|
||||
row-key="detail_id"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
:height="tableHeight"
|
||||
table-size="small"
|
||||
default-align="center"
|
||||
:loading="loading"
|
||||
:show-expand="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column type="expand">
|
||||
<template #default="{ row }">
|
||||
<template #expand="{ row }">
|
||||
<div class="sub-list">
|
||||
<div v-if="!row.goods?.length && !row.unknown?.length" class="hint-text sub-empty">
|
||||
该库位暂无作业记录
|
||||
@ -164,79 +168,67 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="detail_id" label="明细ID" width="90" align="center" />
|
||||
<el-table-column label="库位" min-width="180" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ locationLabel(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="盘点状态" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="getStatusTextClass(itemStatusTag(row.status))">
|
||||
{{ translate('check_item_status', row.status) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="作业记录" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<span>{{ recordCount(row) }}</span>
|
||||
<el-tag v-if="row.has_unknown" type="warning" size="small" class="unknown-tag">含未知</el-tag>
|
||||
<el-tag v-if="row.is_empty" type="info" size="small" class="unknown-tag">空库位</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="盘点人" width="130" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ (row.checkers || []).join('、') || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最近上报" width="160" align="center">
|
||||
<template #default="{ row }">{{ formatTime(row.checked_at) }}</template>
|
||||
</el-table-column>
|
||||
<!--
|
||||
操作列:单行刷新 + 库位维度「重盘清库位」——清除该库位全部作业记录(含空库位标记),库位回到未盘
|
||||
(stock.check.recheckClearLocation;与展开行里的逐条「删除」是同一族操作,这里是整体重来)
|
||||
-->
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="refreshingKey === rowKeyOf(row)"
|
||||
@click="handleRefreshRow(row)"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canClearLocation(row)"
|
||||
link
|
||||
type="danger"
|
||||
size="small"
|
||||
:loading="clearingLocationId === Number(row.location_id)"
|
||||
@click="handleClearLocation(row)"
|
||||
>
|
||||
重盘清库位
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
<template #column-location="{ row }">{{ locationLabel(row) }}</template>
|
||||
<template #column-status="{ row }">
|
||||
<span :class="getStatusTextClass(itemStatusTag(row.status))">
|
||||
{{ translate('check_item_status', row.status) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-record_count="{ row }">
|
||||
<span>{{ recordCount(row) }}</span>
|
||||
<el-tag v-if="row.has_unknown" type="warning" size="small" class="unknown-tag">含未知</el-tag>
|
||||
<el-tag v-if="row.is_empty" type="info" size="small" class="unknown-tag">空库位</el-tag>
|
||||
</template>
|
||||
<template #column-checkers="{ row }">{{ (row.checkers || []).join('、') || '—' }}</template>
|
||||
<template #column-checked_at="{ row }">{{ formatTime(row.checked_at) }}</template>
|
||||
<!-- 操作列:单行刷新 + 库位维度「重盘清库位」(清除该库位全部作业记录,库位回到未盘) -->
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="refreshingKey === rowKeyOf(row)"
|
||||
@click="handleRefreshRow(row)"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canClearLocation(row)"
|
||||
link
|
||||
type="danger"
|
||||
size="small"
|
||||
:loading="clearingLocationId === Number(row.location_id)"
|
||||
@click="handleClearLocation(row)"
|
||||
>
|
||||
重盘清库位
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">{{ emptyText }}</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</upper-table>
|
||||
|
||||
<!-- ===== 商品结构(view=goods):一行一个商品,展开看按库位聚合的作业记录 ===== -->
|
||||
<el-table
|
||||
<upper-table
|
||||
v-else-if="view === 'goods'"
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
table-id="stockcheck-work-goods"
|
||||
:data="rows"
|
||||
:columns="goodsColumns"
|
||||
row-key="detail_id"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
:height="tableHeight"
|
||||
table-size="small"
|
||||
default-align="center"
|
||||
:loading="loading"
|
||||
:show-expand="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column type="expand">
|
||||
<template #default="{ row }">
|
||||
<template #expand="{ row }">
|
||||
<div class="sub-list">
|
||||
<div v-if="!row.locations?.length" class="hint-text sub-empty">该商品暂无作业记录</div>
|
||||
<div
|
||||
@ -253,75 +245,58 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="detail_id" label="明细ID" width="90" align="center" />
|
||||
<el-table-column label="商品编码" min-width="130" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.item_code || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="160" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.item_name || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="110" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.spec || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="货主" min-width="120" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.store_name || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库位" min-width="150" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ locationCodes(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!isBlind" label="账面数量" width="100" align="center">
|
||||
<template #default="{ row }">{{ row.system_quantity ?? '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!isBlind" label="已盘合计" width="100" align="center">
|
||||
<template #default="{ row }">{{ row.checked_quantity ?? '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!isBlind" label="差异" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="diffClass(row.diff_quantity)">{{ formatDiff(row.diff_quantity) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="图片" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<RecordImages :images="row.images" :max="2" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
<template #column-item_code="{ row }">{{ row.item_code || '—' }}</template>
|
||||
<template #column-item_name="{ row }">{{ row.item_name || '—' }}</template>
|
||||
<template #column-spec="{ row }">{{ row.spec || '—' }}</template>
|
||||
<template #column-store_name="{ row }">{{ row.store_name || '—' }}</template>
|
||||
<template #column-locations="{ row }">{{ locationCodes(row) }}</template>
|
||||
<template #column-system_quantity="{ row }">{{ row.system_quantity ?? '—' }}</template>
|
||||
<template #column-checked_quantity="{ row }">{{ row.checked_quantity ?? '—' }}</template>
|
||||
<template #column-diff_quantity="{ row }">
|
||||
<span :class="diffClass(row.diff_quantity)">{{ formatDiff(row.diff_quantity) }}</span>
|
||||
</template>
|
||||
<template #column-images="{ row }">
|
||||
<RecordImages :images="row.images" :max="2" />
|
||||
</template>
|
||||
|
||||
<!-- 操作列:单行刷新(stock.check.workDataDetail,按 detail_id 重取该商品明细行) -->
|
||||
<el-table-column label="操作" width="90" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="refreshingKey === rowKeyOf(row)"
|
||||
@click="handleRefreshRow(row)"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="refreshingKey === rowKeyOf(row)"
|
||||
@click="handleRefreshRow(row)"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">{{ emptyText }}</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</upper-table>
|
||||
|
||||
<!-- ===== 按拣货路径(view=space):一行一个库位,展开看该库位的任务商品 ===== -->
|
||||
<el-table
|
||||
<upper-table
|
||||
v-else
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
table-id="stockcheck-work-space"
|
||||
:data="rows"
|
||||
:columns="spaceColumns"
|
||||
row-key="id"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
:height="tableHeight"
|
||||
table-size="small"
|
||||
default-align="center"
|
||||
:loading="loading"
|
||||
:show-expand="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
>
|
||||
<el-table-column type="expand">
|
||||
<template #default="{ row }">
|
||||
<template #expand="{ row }">
|
||||
<div class="sub-list">
|
||||
<div v-if="!row.goods?.length" class="hint-text sub-empty">该库位无任务商品</div>
|
||||
<div
|
||||
@ -345,55 +320,30 @@
|
||||
<RecordImages :images="item.images" :max="2" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="库位ID" width="90" align="center" />
|
||||
<el-table-column label="库位" min-width="180" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ spaceLocationLabel(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="自定义条码" min-width="130" align="center" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.custom_barcode || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务商品" width="100" align="center">
|
||||
<template #default="{ row }">{{ (row.goods || []).length }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已盘商品" width="100" align="center">
|
||||
<template #default="{ row }">{{ checkedGoodsCount(row) }}</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
|
||||
<template #column-location="{ row }">{{ spaceLocationLabel(row) }}</template>
|
||||
<template #column-custom_barcode="{ row }">{{ row.custom_barcode || '—' }}</template>
|
||||
<template #column-goods_count="{ row }">{{ (row.goods || []).length }}</template>
|
||||
<template #column-checked_goods_count="{ row }">{{ checkedGoodsCount(row) }}</template>
|
||||
|
||||
<!-- 操作列:单行刷新(stock.check.workDataSpaceDetails,传 location_id 只重取该库位行) -->
|
||||
<el-table-column label="操作" width="90" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="refreshingKey === rowKeyOf(row)"
|
||||
@click="handleRefreshRow(row)"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="refreshingKey === rowKeyOf(row)"
|
||||
@click="handleRefreshRow(row)"
|
||||
>
|
||||
刷新
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<div class="empty-tip">{{ emptyText }}</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div v-if="pagination.total > pagination.pageSize" class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@current-change="handlePageChange"
|
||||
@size-change="handlePageSizeChange"
|
||||
/>
|
||||
</upper-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -401,7 +351,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { getStatusTextClass } from '@/utils/statusText'
|
||||
import { formatTime, isCheckApiSuccess, isLocationScopeType, translate } from '../template-config'
|
||||
import RecordImages from './RecordImages.vue'
|
||||
@ -476,7 +425,7 @@ const refreshingKey = ref('')
|
||||
/** 头部统计取自 workData 的 check(删除后随重新拉取同步) */
|
||||
const stats = reactive({ total: 0, checked: 0 })
|
||||
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
|
||||
/** 库位关键词(workData 的 `keyword`,**仅库位任务 / location 视图生效**) */
|
||||
const keyword = ref('')
|
||||
@ -484,13 +433,49 @@ const keyword = ref('')
|
||||
const onlyAbnormal = ref(false)
|
||||
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(260)
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 120) tableHeight.value = Math.floor(h)
|
||||
})
|
||||
// ============================================================
|
||||
// 表格列配置(UpperTable 统一表格样式:与「盘点明细」保持一致)
|
||||
// ============================================================
|
||||
/** 库位结构:一行一个库位 */
|
||||
const locationColumns: Record<string, any>[] = [
|
||||
{ prop: 'detail_id', label: '明细ID', width: 90 },
|
||||
{ prop: 'location', label: '库位', minWidth: 180 },
|
||||
{ prop: 'status', label: '状态', width: 100 },
|
||||
{ prop: 'record_count', label: '作业记录', width: 120 },
|
||||
{ prop: 'checkers', label: '盘点人', width: 130 },
|
||||
{ prop: 'checked_at', label: '最近盘点', width: 160 },
|
||||
{ prop: 'actions', label: '操作', width: 180, fixed: 'right' }
|
||||
]
|
||||
|
||||
/** 商品结构列(盲盘无数量列) */
|
||||
const goodsColumns = computed<Record<string, any>[]>(() => [
|
||||
{ prop: 'detail_id', label: '明细ID', width: 90 },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 130, showOverflowTooltip: true },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 160, showOverflowTooltip: true },
|
||||
{ prop: 'spec', label: '规格', minWidth: 110, showOverflowTooltip: true },
|
||||
{ prop: 'store_name', label: '货主', minWidth: 120, showOverflowTooltip: true },
|
||||
{ prop: 'locations', label: '库位', minWidth: 150, showOverflowTooltip: true },
|
||||
...(isBlind.value
|
||||
? []
|
||||
: [
|
||||
{ prop: 'system_quantity', label: '账面数量', width: 100 },
|
||||
{ prop: 'checked_quantity', label: '已盘合计', width: 100 },
|
||||
{ prop: 'diff_quantity', label: '差异', width: 90 }
|
||||
]),
|
||||
{ prop: 'images', label: '图片', width: 100 },
|
||||
{ prop: 'actions', label: '操作', width: 90, fixed: 'right' }
|
||||
])
|
||||
|
||||
/** 聚合库位(按拣货路径):一行一个库位 */
|
||||
const spaceColumns: Record<string, any>[] = [
|
||||
{ prop: 'id', label: '库位ID', width: 90 },
|
||||
{ prop: 'location', label: '库位', minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'custom_barcode', label: '自定义条码', minWidth: 130, showOverflowTooltip: true },
|
||||
{ prop: 'goods_count', label: '任务商品', width: 100 },
|
||||
{ prop: 'checked_goods_count', label: '已盘商品', width: 100 },
|
||||
{ prop: 'actions', label: '操作', width: 90, fixed: 'right' }
|
||||
]
|
||||
|
||||
const emptyText = computed(() => {
|
||||
if (!canLoad.value) {
|
||||
@ -527,7 +512,7 @@ async function loadRecords() {
|
||||
const payload: StockCheckWorkDataParams = {
|
||||
id: taskId.value,
|
||||
// 服务端分页(pageSize 上限 200);rows 为当前页、total 为全量行数
|
||||
pagination: { page: pagination.page, pageSize: pagination.pageSize }
|
||||
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize }
|
||||
}
|
||||
// 视图由「任务范围 + is_goods」解析:仅商品任务可切 goods,space 是商品任务默认、库位任务不带
|
||||
if (!isLocationTask.value && view.value === 'goods') payload.is_goods = true
|
||||
@ -545,12 +530,11 @@ async function loadRecords() {
|
||||
const total = Number(data.total ?? rows.value.length)
|
||||
pagination.total = Number.isFinite(total) ? total : rows.value.length
|
||||
// 响应回带 page/pageSize,> 0 才采纳,避免被回显 0 覆盖
|
||||
if (Number(data.page) > 0) pagination.page = Number(data.page)
|
||||
if (Number(data.page) > 0) pagination.currentPage = Number(data.page)
|
||||
if (Number(data.pageSize) > 0) pagination.pageSize = Number(data.pageSize)
|
||||
const check = data.check ?? {}
|
||||
stats.total = Number(check.total_items ?? pagination.total) || 0
|
||||
stats.checked = Number(check.checked_items ?? 0) || 0
|
||||
nextTick(() => tableRef.value?.setScrollTop?.(0))
|
||||
} catch (e: any) {
|
||||
console.error('[stockcheck] 加载盘点作业数据失败', e)
|
||||
ElMessage.error(e?.message || '获取盘点作业数据失败')
|
||||
@ -562,29 +546,32 @@ async function loadRecords() {
|
||||
}
|
||||
|
||||
function handleViewChange() {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
void loadRecords()
|
||||
}
|
||||
|
||||
/** 关键词查询(仅 location 视图可见):回车 / 清空即查,回到第 1 页 */
|
||||
function handleKeywordSearch() {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
void loadRecords()
|
||||
}
|
||||
|
||||
/** 「只看未盘和差异」切换:过滤在服务端完成 → 重新拉取并回到第 1 页 */
|
||||
function handleFilterChange() {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
void loadRecords()
|
||||
}
|
||||
|
||||
/** 翻页:服务端分页,需重新请求 */
|
||||
function handlePageChange() {
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
void loadRecords()
|
||||
nextTick(() => tableRef.value?.getTableRef?.()?.setScrollTop?.(0))
|
||||
}
|
||||
|
||||
function handlePageSizeChange() {
|
||||
pagination.page = 1
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
void loadRecords()
|
||||
}
|
||||
|
||||
@ -790,7 +777,7 @@ async function handleDeleteRecord(record: Record<string, any>, row?: Record<stri
|
||||
const refreshed = row ? await refreshSingleRow(row) : false
|
||||
if (!refreshed) {
|
||||
// 删除当前页最后一条时回退页码,避免停留在空页
|
||||
if (rows.value.length === 1 && pagination.page > 1) pagination.page -= 1
|
||||
if (rows.value.length === 1 && pagination.currentPage > 1) pagination.currentPage -= 1
|
||||
await loadRecords()
|
||||
}
|
||||
emit('changed')
|
||||
@ -878,7 +865,7 @@ watch(
|
||||
view.value = defaultView.value
|
||||
// 关键词只对库位任务生效,换单后清空(只看未盘和差异属用户偏好,保留)
|
||||
keyword.value = ''
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
void loadRecords()
|
||||
},
|
||||
{ immediate: true }
|
||||
@ -950,11 +937,40 @@ watch(
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
/* 表格容器对齐「盘点明细」CheckItemsPanel 的 UpperTable */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 与「盘点明细」一致:容器撑满、分页右对齐、隐藏左侧「已选/查询用时」 */
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
@ -1020,21 +1036,4 @@ watch(
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
|
||||
/* 分页器:右对齐 + 「每页条数」下拉与 UpperTable 同宽 80px */
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -189,7 +189,7 @@
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100, 200]"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -12,62 +12,52 @@
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="storage-stockout-operation-logs"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column prop="created_at" label="时间" width="250" />
|
||||
<el-table-column prop="operator_name" label="操作人" width="120" />
|
||||
<el-table-column prop="operation_name" label="操作名称" min-width="140" />
|
||||
<el-table-column prop="platform_name" label="操作平台" min-width="120" />
|
||||
<el-table-column prop="message" label="日志内容" min-width="200" show-overflow-tooltip />
|
||||
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@click="viewData(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.external_log_id"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="backData(scope.row)"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.operation_code === 'UPDATE'"
|
||||
>
|
||||
修改前快照
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:columns="columns"
|
||||
:row-key="getRowKey"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
:loading="loading"
|
||||
empty-text="暂无操作日志"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="fetchStockoutLogs"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<template #column-actions="{ row }">
|
||||
<el-button
|
||||
v-if="row.external_log_id"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click.stop="viewData(row)"
|
||||
>
|
||||
查看报文
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.operation_code === 'UPDATE'"
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click.stop="backData(row)"
|
||||
>
|
||||
修改前快照
|
||||
</el-button>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
@ -87,8 +77,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, nextTick, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { stockoutListLogs } from '@/api/storage.stockout/stockout'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
|
||||
@ -101,61 +90,56 @@ const tableData = ref<any[]>([])
|
||||
const showRequestData = ref(false)
|
||||
const requestId = ref(0)
|
||||
const requestType = ref('')
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHeight = ref(280)
|
||||
|
||||
/** 列配置与「商品明细」UpperTable 一致:small 尺寸、默认居中、操作列固定右侧 */
|
||||
const columns: Record<string, any>[] = [
|
||||
{ prop: 'created_at', label: '时间', width: 250 },
|
||||
{ prop: 'operator_name', label: '操作人', width: 120 },
|
||||
{ prop: 'operation_name', label: '操作名称', minWidth: 140 },
|
||||
{ prop: 'platform_name', label: '操作平台', minWidth: 120 },
|
||||
{ prop: 'message', label: '日志内容', minWidth: 200, showOverflowTooltip: true },
|
||||
{ prop: 'actions', label: '操作', width: 150, fixed: 'right' }
|
||||
]
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
/** 表格勾选行(UpperTable selection-change) */
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 行唯一键(日志接口未约定主键,按 id → log_id → 时间+操作编码兜底) */
|
||||
function getRowKey(row: Record<string, any>): string {
|
||||
return String(row?.id ?? row?.log_id ?? `${row?.created_at ?? ''}-${row?.operation_code ?? ''}`)
|
||||
}
|
||||
|
||||
watch(() => props.id, (newVal) => {
|
||||
if (newVal) {
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
fetchStockoutLogs()
|
||||
} else {
|
||||
tableData.value = []
|
||||
pagination.total = 0
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const el = tableHostRef.value
|
||||
if (el) {
|
||||
const h = el.getBoundingClientRect().height
|
||||
if (h >= 100) tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
}, { immediate: true })
|
||||
|
||||
async function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
resetTableScroll()
|
||||
pagination.currentPage = page
|
||||
await fetchStockoutLogs()
|
||||
}
|
||||
|
||||
async function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
resetTableScroll()
|
||||
pagination.currentPage = 1
|
||||
await fetchStockoutLogs()
|
||||
}
|
||||
|
||||
/** 切页后把表格滚动位置归零 */
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
async function fetchStockoutLogs() {
|
||||
if (!props.id) return
|
||||
|
||||
@ -163,7 +147,7 @@ async function fetchStockoutLogs() {
|
||||
try {
|
||||
const res: any = await stockoutListLogs({
|
||||
id: Number(props.id),
|
||||
page: pagination.page,
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
// 兼容 { data: { list, pagination } } 与 { list, pagination } 两种包装
|
||||
@ -177,7 +161,7 @@ async function fetchStockoutLogs() {
|
||||
message: item.message || '',
|
||||
platform_name: item.platform_name || ''
|
||||
}))
|
||||
pagination.page = data?.pagination?.page ?? pagination.page
|
||||
pagination.currentPage = data?.pagination?.page ?? pagination.currentPage
|
||||
pagination.pageSize = data?.pagination?.pageSize ?? pagination.pageSize
|
||||
pagination.total = data?.pagination?.total ?? 0
|
||||
} else {
|
||||
@ -239,28 +223,50 @@ function backData(_row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 与「收货单商品明细」Product.vue 的 UpperTable 完全一致的容器/分页处理 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:deep(.el-drawer__body) {
|
||||
|
||||
@ -5,57 +5,38 @@
|
||||
<el-button size="small" type="primary" :loading="loading" @click="loadData">刷新</el-button>
|
||||
</div>
|
||||
<div class="right-actions">
|
||||
<span v-if="selectedRows.length" class="selection-text">
|
||||
已选 {{ selectedRows.length }} 项
|
||||
</span>
|
||||
<span v-if="orderInfo" class="order-code">出库单号:{{ orderInfo.stockout_order_code }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="tableHostRef" class="table-host">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
<div class="table-host">
|
||||
<upper-table
|
||||
table-id="storage-stockout-product-detail"
|
||||
:data="pagedData"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
>
|
||||
<el-table-column
|
||||
v-for="col in productColumns"
|
||||
:key="col.prop"
|
||||
:prop="col.prop"
|
||||
:label="col.label"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
:fixed="col.fixed"
|
||||
:align="col.align"
|
||||
/>
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无商品明细</div>
|
||||
</template>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:columns="productColumns"
|
||||
:row-key="getRowKey"
|
||||
default-align="center"
|
||||
table-size="small"
|
||||
:show-selection="true"
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
size="small"
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
:loading="loading"
|
||||
empty-text="暂无商品明细"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
@selection-change="handleSelectionChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { productColumns, formatStockoutListItems } from '../stockout-config'
|
||||
import * as stockoutApi from '@/api/storage.stockout/stockout'
|
||||
|
||||
@ -66,44 +47,38 @@ const props = defineProps<{
|
||||
const data = ref<any[]>([])
|
||||
const orderInfo = ref<any>(null)
|
||||
const loading = ref(false)
|
||||
const tableRef = ref<any>(null)
|
||||
const tableHostRef = ref<HTMLElement | null>(null)
|
||||
const tableHeight = ref(280)
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
/** 表格勾选行(UpperTable selection-change) */
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
|
||||
function handleSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
/** 行唯一键(接口未约定主键字段,按 id → detail_id → 商品编码依次兜底) */
|
||||
function getRowKey(row: Record<string, any>): string {
|
||||
return String(row?.id ?? row?.detail_id ?? row?.item_code ?? '')
|
||||
}
|
||||
|
||||
/** 前端分页(接口一次性返回全部明细,无分页参数) */
|
||||
const pagedData = computed(() => {
|
||||
const start = (pagination.page - 1) * pagination.pageSize
|
||||
const start = (pagination.currentPage - 1) * pagination.pageSize
|
||||
return data.value.slice(start, start + pagination.pageSize)
|
||||
})
|
||||
|
||||
useResizeObserver(tableHostRef, (entries) => {
|
||||
const h = entries[0]?.contentRect.height ?? 0
|
||||
if (h >= 100) {
|
||||
tableHeight.value = Math.floor(h)
|
||||
}
|
||||
})
|
||||
|
||||
function resetTableScroll() {
|
||||
nextTick(() => {
|
||||
tableRef.value?.setScrollTop?.(0)
|
||||
})
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
resetTableScroll()
|
||||
pagination.currentPage = page
|
||||
}
|
||||
|
||||
function handlePageSizeChange(pageSize: number) {
|
||||
pagination.pageSize = pageSize
|
||||
pagination.page = 1
|
||||
resetTableScroll()
|
||||
pagination.currentPage = 1
|
||||
}
|
||||
|
||||
const loadData = async () => {
|
||||
@ -111,7 +86,7 @@ const loadData = async () => {
|
||||
loading.value = true
|
||||
data.value = []
|
||||
orderInfo.value = null
|
||||
pagination.page = 1
|
||||
pagination.currentPage = 1
|
||||
try {
|
||||
const res: any = await stockoutApi.stockoutListItems({ id: Number(props.id) })
|
||||
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
||||
@ -135,7 +110,6 @@ const loadData = async () => {
|
||||
ElMessage.error('加载商品明细失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
resetTableScroll()
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,6 +157,11 @@ watch(() => props.id, loadData, { immediate: true })
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
|
||||
.selection-text {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.order-code {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
@ -190,32 +169,38 @@ watch(() => props.id, loadData, { immediate: true })
|
||||
}
|
||||
}
|
||||
|
||||
/* 与「收货单商品明细」Product.vue 的 UpperTable 完全一致的容器/分页处理 */
|
||||
.table-host {
|
||||
flex: 1;
|
||||
min-height: 120px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
margin-top: 6px;
|
||||
|
||||
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||
:deep(.el-select--small) {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
:deep(.el-input__wrapper) {
|
||||
padding: 0 4px;
|
||||
}
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
color: #909399;
|
||||
font-size: 13px;
|
||||
.table-host :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table-host :deep(.table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-container) {
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
border-top: none;
|
||||
margin-top: 6px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.table-host :deep(.pagination-info) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -227,6 +227,7 @@
|
||||
table-id="store-balance-logs"
|
||||
:data="balanceLogList"
|
||||
:columns="balanceLogColumns"
|
||||
:show-selection="true"
|
||||
table-size="small"
|
||||
:loading="balanceLogLoading"
|
||||
:virtual-threshold="100000"
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
:pagination="pagination"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:show-index="true"
|
||||
:show-selection="false"
|
||||
:show-selection="true"
|
||||
:loading="listLoading"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
|
||||
@ -1352,7 +1352,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['app_name', 'self_app_key', 'self_app_secret', 'sign_method', 'rate_limit', 'is_enabled', 'created_at', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: 'API 应用列表',
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '暂无 API 应用数据'
|
||||
},
|
||||
detailTabs: [
|
||||
@ -1446,7 +1446,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['name', 'store_name', 'report_name', 'schedule_times', 'channel', 'enabled', 'late_grace_minutes', 'notify_group_ids', 'notify_member_ids', 'remark', 'created_at', 'updated_at', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: '报表投递计划',
|
||||
showSelection: false
|
||||
showSelection: true
|
||||
},
|
||||
detailTabs: [
|
||||
{ name: 'detail', label: '计划详情', componentKey: 'DetailPanel' }
|
||||
@ -1533,7 +1533,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['id', 'store_id', 'report_code', 'biz_date', 'time_point', 'status', 'channel', 'retry_count', 'file_url', 'error_message', 'delivered_at', 'created_at'],
|
||||
upperTableDefaults: {
|
||||
title: '报表投递记录',
|
||||
showSelection: false
|
||||
showSelection: true
|
||||
},
|
||||
detailTabs: [
|
||||
{ name: 'detail', label: '记录详情', componentKey: 'DetailPanel' }
|
||||
@ -1580,7 +1580,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
tableColumnKeys: ['id', 'name', 'type', 'file_name', 'fields', 'is_enabled', 'remark', 'updated_at', 'operation'],
|
||||
upperTableDefaults: {
|
||||
title: '报表定义',
|
||||
showSelection: false
|
||||
showSelection: true
|
||||
},
|
||||
detailTabs: [
|
||||
{ name: 'detail', label: '定义详情', componentKey: 'DetailPanel' }
|
||||
|
||||
@ -194,7 +194,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-selection="false"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@page-change="handlePageChange"
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -299,7 +299,7 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||
title: raw.upperTableDefaults.title,
|
||||
enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true,
|
||||
showIndex: raw.upperTableDefaults.showIndex ?? true,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? false,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? true,
|
||||
emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据',
|
||||
columns
|
||||
},
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
row-key="id"
|
||||
|
||||
@ -190,7 +190,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -477,7 +477,7 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||
title: raw.upperTableDefaults.title,
|
||||
enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true,
|
||||
showIndex: raw.upperTableDefaults.showIndex ?? true,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? false,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? true,
|
||||
emptyText: raw.upperTableDefaults.emptyText ?? '暂无摄像头数据',
|
||||
columns
|
||||
},
|
||||
@ -632,7 +632,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
upperTableDefaults: {
|
||||
title: '摄像头列表',
|
||||
showIndex: true,
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '暂无摄像头数据,可调整左侧筛选条件'
|
||||
},
|
||||
detailTabs: [
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
@ -500,7 +500,7 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||
title: raw.upperTableDefaults.title,
|
||||
enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true,
|
||||
showIndex: raw.upperTableDefaults.showIndex ?? true,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? false,
|
||||
showSelection: raw.upperTableDefaults.showSelection ?? true,
|
||||
emptyText: raw.upperTableDefaults.emptyText ?? '暂无录像服务器数据',
|
||||
columns
|
||||
},
|
||||
@ -646,7 +646,7 @@ export const tabPages: TabPageRawConfig[] = [
|
||||
upperTableDefaults: {
|
||||
title: '录像服务器列表',
|
||||
showIndex: true,
|
||||
showSelection: false,
|
||||
showSelection: true,
|
||||
emptyText: '暂无录像服务器数据,可调整左侧筛选条件'
|
||||
},
|
||||
detailTabs: [
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
table-size="small"
|
||||
:pagination="pagination"
|
||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
|
||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user