From 936585530457239d58fbee7ed4a793167b622c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 13 Jan 2026 09:46:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(wms):=20=E4=BF=AE=E6=94=B9=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4=E4=B8=BA=E6=98=A8?= =?UTF-8?q?=E5=A4=A96=E7=82=B9=E8=87=B3=E4=BB=8A=E5=A4=A96=E7=82=B9?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=A0=87=E7=AD=BE=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改多个报表页面的默认时间区间从全天改为昨天6点至今天6点,自动处理跨月跨年情况 在钢卷操作面板添加标签打印按钮功能,优化标签预览按钮样式 --- klp-ui/src/views/wms/coil/panels/do.vue | 22 ++++++++++++++-- klp-ui/src/views/wms/report/delivery.vue | 33 +++++++++++++++--------- klp-ui/src/views/wms/report/receive.vue | 25 ++++++++++++------ klp-ui/src/views/wms/report/zha.vue | 27 ++++++++++++------- 4 files changed, 76 insertions(+), 31 deletions(-) diff --git a/klp-ui/src/views/wms/coil/panels/do.vue b/klp-ui/src/views/wms/coil/panels/do.vue index af24e23b..e1062104 100644 --- a/klp-ui/src/views/wms/coil/panels/do.vue +++ b/klp-ui/src/views/wms/coil/panels/do.vue @@ -137,7 +137,8 @@ - + 预览 + 打印 @@ -328,7 +329,7 @@ @@ -337,6 +338,8 @@ + + @@ -477,6 +480,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.data = { + ...row, + itemName: itemName, + updateTime: row.updateTime?.split(' ')[0] || '', + }; + this.$refs.labelRender.printLabel(); + // this.labelRender.visible = true; + // this.labelRender.data = row; + // this.labelRender.type = '2'; + }, /** 预览标签 */ 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: { From c1cca9e7a194eb273c86e01e16783c1d3fcf7539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 13 Jan 2026 10:19:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor(wms/coil):=20=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=8C=89=E9=92=AE=E4=B8=BA=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E6=A0=87=E7=AD=BE=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将预览按钮替换为更简洁的图标,提升界面美观度 优化标签打印逻辑,确保在DOM更新后执行打印操作 --- klp-ui/src/views/wms/coil/panels/do.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/klp-ui/src/views/wms/coil/panels/do.vue b/klp-ui/src/views/wms/coil/panels/do.vue index e1062104..70c6dc5f 100644 --- a/klp-ui/src/views/wms/coil/panels/do.vue +++ b/klp-ui/src/views/wms/coil/panels/do.vue @@ -137,7 +137,8 @@ - 预览 + + 打印 @@ -485,15 +486,15 @@ export default { 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.$refs.labelRender.printLabel(); - // this.labelRender.visible = true; - // this.labelRender.data = row; - // this.labelRender.type = '2'; + this.$nextTick(() => { + this.$refs.labelRender.printLabel(); + }) }, /** 预览标签 */