feat(wms): 修改报表时间区间为昨天6点至今天6点并添加标签打印功能

修改多个报表页面的默认时间区间从全天改为昨天6点至今天6点,自动处理跨月跨年情况
在钢卷操作面板添加标签打印按钮功能,优化标签预览按钮样式
This commit is contained in:
砂糖
2026-01-13 09:46:11 +08:00
parent 1e7abc665d
commit 9365855304
4 changed files with 76 additions and 31 deletions

View File

@@ -122,15 +122,24 @@ export default {
// 工具函数:个位数补零,保证格式统一(比如 9 → 095 → 05
const addZero = (num) => num.toString().padStart(2, '0')
const now = new Date()
// 基于【本地北京时间】获取年月日
const year = now.getFullYear()
const month = addZero(now.getMonth() + 1) // 月份+1 补零
const day = addZero(now.getDate())
const now = new Date() // 当前本地北京时间
// 核心:获取【昨天】的日期对象(自动处理跨月/跨年,无边界问题)
const yesterday = new Date(now)
yesterday.setDate(yesterday.getDate() - 1)
// ✅ 正确的 北京时间 今日开始/结束时间
const startTime = `${year}-${month}-${day} 00:00:00`
const endTime = `${year}-${month}-${day} 23:59:59`
// 昨天的年、月、日(补零格式化)
const yesYear = yesterday.getFullYear()
const yesMonth = addZero(yesterday.getMonth() + 1)
const yesDay = addZero(yesterday.getDate())
// 今天的年、月、日(补零格式化)
const nowYear = now.getFullYear()
const nowMonth = addZero(now.getMonth() + 1)
const nowDay = addZero(now.getDate())
// ✅ 目标时间区间昨天早上6点 至 今天早上6点
const startTime = `${yesYear}-${yesMonth}-${yesDay} 06:00:00`
const endTime = `${nowYear}-${nowMonth}-${nowDay} 06:00:00`
return {
list: [],
queryParams: {