From 5bf89c3ef010c7c38cadd0bca76ee0915e2970e9 Mon Sep 17 00:00:00 2001 From: little4 <360013221@qq.com> Date: Thu, 19 Sep 2024 10:05:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=AB=98=E9=80=9F=E4=BA=91?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/service/analysis/search/index.vue | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/search/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/search/index.vue index 6abf9415..2b6dce55 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/search/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/search/index.vue @@ -12,11 +12,11 @@ @@ -87,7 +87,7 @@ export default { } ], quarter: "2", - dateTime: moment().format("YYYY-MM-DD HH:mm:ss"), + dateTime: [moment().format("YYYY-MM-DD"),moment().format("YYYY-MM-DD")], dataList: [], year: "", @@ -101,6 +101,16 @@ export default { }, created() { }, + + watch: { + dateTime:{ + handler: function(n,o) { + if(n.length>2){ + n.shift(); + this.dateTime = n; + } + } + }, methods: { // 上传成功 @@ -134,19 +144,21 @@ export default { return filter; }, getStartTime(){ - let startTime = ""; - let endTime = ""; + let thisTime = this.dateTime[0]; + let lastTime = this.dateTime[1]; if (this.type == 2) { //日 - startTime = moment(this.dateTime).format("YYYY-MM-DD 00:00:00"); - endTime = moment(this.dateTime).format("YYYY-MM-DD 23:59:59"); + // startTime = moment(this.dateTime).format("YYYY-MM-DD 00:00:00"); + // endTime = moment(this.dateTime).format("YYYY-MM-DD 23:59:59"); + thisTime = moment(this.dateTime[0]).format("YYYY-MM-DD"); + lastTime = moment(this.dateTime[1]).format("YYYY-MM-DD"); } else if (this.type == 1) { //月 - startTime = moment(this.dateTime).format("YYYY-MM-01 00:00:00"); - endTime = moment(this.dateTime).endOf('month').format("YYYY-MM-DD 23:59:59"); + thisTime = moment(this.dateTime[0]).format("YYYY-MM"); + lastTime = moment(this.dateTime[1]).format("YYYY-MM"); } else if (this.type == 0) { //年 - startTime = moment(this.dateTime).format("YYYY-01-01 00:00:00"); - endTime = moment(this.dateTime).format("YYYY-12-31 23:59:59"); + thisTime = moment(this.dateTime[0]).format("YYYY"); + lastTime = moment(this.dateTime[1]).format("YYYY"); } - return {type: this.type, startTime,endTime} + return {type: this.type, thisTime,lastTime} }, onReset() { this.selectId = 1;