From 78087fcf71f7d3951673030161a0ab90a6937553 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Wed, 26 Mar 2025 16:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/equipment-supply/index.vue | 27 +- src/views/system/log/businessLog/index.vue | 511 +++++++++++---------- 2 files changed, 285 insertions(+), 253 deletions(-) diff --git a/src/views/home/equipment-supply/index.vue b/src/views/home/equipment-supply/index.vue index 9ce299fa..34bdc411 100644 --- a/src/views/home/equipment-supply/index.vue +++ b/src/views/home/equipment-supply/index.vue @@ -301,7 +301,7 @@ export default { }, // 重置 onHandleReset() { - this.queryDate = [] + this.queryDate = this.getDefaultDateRange() this.$refs.queryFormRef.resetFields() this.getCardListFun() }, @@ -324,9 +324,34 @@ export default { label: node.name, children: node.children } + }, + // 默认日期范围 + getDefaultDateRange() { + const today = new Date() + const lastMonth = new Date() + + // 设置为前一个月 + lastMonth.setMonth(today.getMonth() - 1) + + // 处理跨年情况 + if (today.getMonth() === 0) { + lastMonth.setFullYear(today.getFullYear() - 1) + lastMonth.setMonth(11) + } + + const formatDate = date => { + const y = date.getFullYear() + const m = String(date.getMonth() + 1).padStart(2, '0') + const d = String(date.getDate()).padStart(2, '0') + return `${y}-${m}-${d}` + } + + // 返回从前一个月到今天的日期范围 + return [formatDate(lastMonth), formatDate(today)] } }, created() { + this.queryDate = this.getDefaultDateRange() this.getCompanyAndProjectFun() this.getCardListFun() } diff --git a/src/views/system/log/businessLog/index.vue b/src/views/system/log/businessLog/index.vue index 386cde94..5ba2214f 100644 --- a/src/views/system/log/businessLog/index.vue +++ b/src/views/system/log/businessLog/index.vue @@ -1,273 +1,280 @@