diff --git a/klp-ui/src/views/wms/coil/panels/do.vue b/klp-ui/src/views/wms/coil/panels/do.vue index af24e23b..70c6dc5f 100644 --- a/klp-ui/src/views/wms/coil/panels/do.vue +++ b/klp-ui/src/views/wms/coil/panels/do.vue @@ -138,6 +138,8 @@ + + 打印 @@ -328,7 +330,7 @@ @@ -337,6 +339,8 @@ + + @@ -477,6 +481,21 @@ export default { }, methods: { parseTime, + // 打印标签 + handlePrintLabel(row) { + const item = row.itemType === 'product' ? row.product : row.rawMaterial; + const itemName = row.itemType === 'product' ? item?.productName || '' : item?.rawMaterialName || ''; + + this.labelRender.type = row.itemType === 'product' ? '3' : '2' + this.labelRender.data = { + ...row, + itemName: itemName, + updateTime: row.updateTime?.split(' ')[0] || '', + }; + this.$nextTick(() => { + this.$refs.labelRender.printLabel(); + }) + }, /** 预览标签 */ handlePreviewLabel(row) { diff --git a/klp-ui/src/views/wms/report/delivery.vue b/klp-ui/src/views/wms/report/delivery.vue index dc4ded47..223dcda9 100644 --- a/klp-ui/src/views/wms/report/delivery.vue +++ b/klp-ui/src/views/wms/report/delivery.vue @@ -3,12 +3,12 @@ - + - + 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: { diff --git a/klp-ui/src/views/wms/report/receive.vue b/klp-ui/src/views/wms/report/receive.vue index 5de2e754..f3fb98d4 100644 --- a/klp-ui/src/views/wms/report/receive.vue +++ b/klp-ui/src/views/wms/report/receive.vue @@ -122,15 +122,24 @@ export default { // 工具函数:个位数补零,保证格式统一(比如 9 → 09,5 → 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: { diff --git a/klp-ui/src/views/wms/report/zha.vue b/klp-ui/src/views/wms/report/zha.vue index 5260cfb0..3d484f17 100644 --- a/klp-ui/src/views/wms/report/zha.vue +++ b/klp-ui/src/views/wms/report/zha.vue @@ -112,18 +112,27 @@ export default { }, dicts: ['product_coil_status', 'coil_material', 'coil_itemname', 'coil_manufacturer'], data() { - // 工具函数:个位数补零,保证格式统一(比如 9 → 09,5 → 05) + // 工具函数:个位数补零,保证格式统一(比如 9 → 09,5 → 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: {