From 8d3d3c935d5365ebd983843985bd556a62a05c20 Mon Sep 17 00:00:00 2001 From: yujt Date: Mon, 20 Jul 2020 14:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=88=86?= =?UTF-8?q?=E6=9E=90=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/analysis/export/operation.vue | 3 +- .../modules/analysis/user/gridopening.vue | 33 +++++++++++++++++-- src/views/modules/analysis/user/party.vue | 29 ++++++++++++++++ src/views/modules/analysis/user/register.vue | 29 ++++++++++++++++ 4 files changed, 91 insertions(+), 3 deletions(-) diff --git a/src/views/modules/analysis/export/operation.vue b/src/views/modules/analysis/export/operation.vue index 102f3ca..184a198 100644 --- a/src/views/modules/analysis/export/operation.vue +++ b/src/views/modules/analysis/export/operation.vue @@ -46,6 +46,7 @@ label="截止时间"> @@ -163,7 +164,7 @@ export default { mixins: [mixinViewModule], watch: { 'timeFlag': function (val) { - if (val == 0) { + if (val === 0) { this.dataForm.operationStartTime = '' this.dataForm.operationEndTime = '' this.time = [] diff --git a/src/views/modules/analysis/user/gridopening.vue b/src/views/modules/analysis/user/gridopening.vue index dd4dd57..8e85069 100644 --- a/src/views/modules/analysis/user/gridopening.vue +++ b/src/views/modules/analysis/user/gridopening.vue @@ -86,12 +86,12 @@ header-align="center" align="center"> @@ -299,10 +299,39 @@ export default { this.options = res.data.options }) .catch(() => { }) + this.initTime() // this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) // this.getListCategory() }, methods: { + initTime () { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + this.time = [start, end] + let year = start.getFullYear() + let month = start.getMonth() + 1 + if (month < 10) { + month = '0' + month + } + let date = start.getDate() + if (date < 10) { + date = '0' + date + } + let startDate = year + '-' + month + '-' + date + let yearend = end.getFullYear() + let monthend = end.getMonth() + 1 + if (monthend < 10) { + monthend = '0' + monthend + } + let dateend = end.getDate() + if (dateend < 10) { + dateend = '0' + dateend + } + let endDate = yearend + '-' + monthend + '-' + dateend + this.dataForm.startTime = startDate + this.dataForm.endTime = endDate + }, newsUpDownState: function (row) { return row.newsUpDownState === '1' ? '下线' : '上线' }, diff --git a/src/views/modules/analysis/user/party.vue b/src/views/modules/analysis/user/party.vue index b8917be..41eebd2 100644 --- a/src/views/modules/analysis/user/party.vue +++ b/src/views/modules/analysis/user/party.vue @@ -188,10 +188,39 @@ export default { this.options = res.data.options }) .catch(() => { }) + this.initTime() // this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) // this.getListCategory() }, methods: { + initTime () { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + this.time = [start, end] + let year = start.getFullYear() + let month = start.getMonth() + 1 + if (month < 10) { + month = '0' + month + } + let date = start.getDate() + if (date < 10) { + date = '0' + date + } + let startDate = year + '-' + month + '-' + date + let yearend = end.getFullYear() + let monthend = end.getMonth() + 1 + if (monthend < 10) { + monthend = '0' + monthend + } + let dateend = end.getDate() + if (dateend < 10) { + dateend = '0' + dateend + } + let endDate = yearend + '-' + monthend + '-' + dateend + this.dataForm.startTime = startDate + this.dataForm.endTime = endDate + }, newsUpDownState: function (row) { return row.newsUpDownState === '1' ? '下线' : '上线' }, diff --git a/src/views/modules/analysis/user/register.vue b/src/views/modules/analysis/user/register.vue index 5ff2b98..b2c8376 100644 --- a/src/views/modules/analysis/user/register.vue +++ b/src/views/modules/analysis/user/register.vue @@ -206,10 +206,39 @@ export default { this.options = res.data.options }) .catch(() => { }) + this.initTime() // this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) // this.getListCategory() }, methods: { + initTime () { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + this.time = [start, end] + let year = start.getFullYear() + let month = start.getMonth() + 1 + if (month < 10) { + month = '0' + month + } + let date = start.getDate() + if (date < 10) { + date = '0' + date + } + let startDate = year + '-' + month + '-' + date + let yearend = end.getFullYear() + let monthend = end.getMonth() + 1 + if (monthend < 10) { + monthend = '0' + monthend + } + let dateend = end.getDate() + if (dateend < 10) { + dateend = '0' + dateend + } + let endDate = yearend + '-' + monthend + '-' + dateend + this.dataForm.startTime = startDate + this.dataForm.endTime = endDate + }, newsUpDownState: function (row) { return row.newsUpDownState === '1' ? '下线' : '上线' },