From 087691a24c27cebbe114ea1f82856280400a3138 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 05 Feb 2024 09:50:20 +0800
Subject: [PATCH] fix:bug修复
---
src/views/onlineRate/index.vue | 57 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/src/views/onlineRate/index.vue b/src/views/onlineRate/index.vue
index abe1530..e62b284 100644
--- a/src/views/onlineRate/index.vue
+++ b/src/views/onlineRate/index.vue
@@ -36,10 +36,12 @@
type="datetimerange"
range-separator="���"
start-placeholder="������������"
+ :clearable="false"
end-placeholder="������������"
value-format="yyyy-MM-dd HH:mm:ss"
+ :default-date="[selectTime[0], selectTime[1]]"
:picker-options="pickerOptions"
- @change="changeDay"
+ @change="changeDay()"
/>
</el-form-item>
<el-form-item label="������������:">
@@ -210,11 +212,11 @@
organizationId: '',
hourState: '',
state: '',
- startTime: dayjs().startOf('day').format('YYYY-MM-DD HH:mm'),
- endTime: dayjs().subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
+ startTime: '',
+ endTime: ''
},
time: '������',
- selectTime: '',
+ selectTime: [],
macDate: {},
macOnlineData: {},
orgData: [],
@@ -267,45 +269,70 @@
time (newValue, oldValue) {
let now = dayjs() // ������������������
if (newValue === '���1���') {
- this.selectTime = []
+ this.$set(this.selectTime, 0, new Date(now.subtract(1, 'day').format('YYYY-MM-DD HH:mm')))
+ this.$set(this.selectTime, 1, new Date(now.format('YYYY-MM-DD HH:mm')))
+ this.formInline.endTime = now.subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
this.formInline.startTime = now.subtract(1, 'day').format('YYYY-MM-DD HH:mm') // ���������������������
} else if (newValue === '���3���') {
- this.selectTime = []
+ this.$set(this.selectTime, 0, new Date(now.subtract(3, 'day').format('YYYY-MM-DD HH:mm')))
+ this.$set(this.selectTime, 1, new Date(now.format('YYYY-MM-DD HH:mm')))
+ this.formInline.endTime = now.subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
this.formInline.startTime = now.subtract(3, 'day').format('YYYY-MM-DD HH:mm') // ���������������������
} else if (newValue === '���5���') {
- this.selectTime = []
+ this.$set(this.selectTime, 0, new Date(now.subtract(5, 'day').format('YYYY-MM-DD HH:mm')))
+ this.$set(this.selectTime, 1, new Date(now.format('YYYY-MM-DD HH:mm')))
+ this.formInline.endTime = now.subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
this.formInline.startTime = now.subtract(5, 'day').format('YYYY-MM-DD HH:mm') // ���������������������
} else if (newValue === '���7���') {
- this.selectTime = []
+ this.$set(this.selectTime, 0, new Date(now.subtract(7, 'day').format('YYYY-MM-DD HH:mm')))
+ this.$set(this.selectTime, 1, new Date(now.format('YYYY-MM-DD HH:mm')))
+ this.formInline.endTime = now.subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
this.formInline.startTime = now.subtract(7, 'day').format('YYYY-MM-DD HH:mm') // ���������������������
} else if (newValue === '������') {
- this.selectTime = []
+ this.$set(this.selectTime, 0, new Date(dayjs().startOf('day').format('YYYY-MM-DD HH:mm')))
+ this.$set(this.selectTime, 1, new Date(now.format('YYYY-MM-DD HH:mm')))
+ this.formInline.endTime = now.subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
console.log('000', dayjs().startOf('day').format('YYYY-MM-DD HH:mm'))
this.formInline.startTime = dayjs().startOf('day').format('YYYY-MM-DD HH:mm')
}
}
+ },
+ mounted () {
+ this.$set(this.selectTime, 0, new Date(dayjs().startOf('day').format('YYYY-MM-DD HH:mm')))
+ this.$set(this.selectTime, 1, new Date(dayjs().format('YYYY-MM-DD HH:mm')))
},
created () {
this.getOrganizationId()
},
methods: {
changeDay () {
- console.log(this.selectTime)
- this.formInline.startTime = this.selectTime[0]
- this.formInline.endTime = this.selectTime[1]
+ console.log('this.selectTime', this.selectTime)
+ if (this.selectTime !== null) {
+ console.log(this.selectTime)
+ this.formInline.startTime = this.selectTime[0]
+
+ if (dayjs(this.selectTime[1]).format('YYYY-MM-DD HH') === dayjs().format('YYYY-MM-DD HH')) {
+ this.formInline.endTime = dayjs(this.selectTime[1]).subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
+ } else {
+ this.formInline.endTime = dayjs(this.selectTime[1]).startOf('day').format('YYYY-MM-DD HH:mm')
+ }
+ }
+ console.log('this.formInline12', this.formInline)
this.time = ''
},
handleDetail (row) {
- console.log(row)
this.handleShow = true
this.macDate = _.cloneDeep(row)
- this.macDate.startTime = this.formInline.startTime
- this.macDate.endTime = this.formInline.endTime
+ this.macDate.startTime = this.selectTime[0]
+ this.macDate.endTime = this.selectTime[1]
+ console.log(this.macDate)
},
handleSearch () {
this.getOnlineData()
+ console.log(' this.formInline', this.formInline)
if (this.formInline.organizationId !== '') {
if (this.time === '������') {
+ console.log('������������')
this.formInline.startTime = dayjs().startOf('day').format('YYYY-MM-DD HH:mm')
this.formInline.endTime = dayjs().subtract(1, 'hour').format('YYYY-MM-DD HH:mm')
}
--
Gitblit v1.8.0