From e3a63203c823a4b7fcb12a52769c34acdc0b7a19 Mon Sep 17 00:00:00 2001 From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com> Date: 星期一, 18 三月 2024 18:03:51 +0800 Subject: [PATCH] qxtj --- src/views/count/chart/index.vue | 103 +++++++++++++++++++++++---------------------------- 1 files changed, 46 insertions(+), 57 deletions(-) diff --git a/src/views/count/chart/index.vue b/src/views/count/chart/index.vue index 1fdaa72..0561b51 100644 --- a/src/views/count/chart/index.vue +++ b/src/views/count/chart/index.vue @@ -1,25 +1,10 @@ <template> <div> - <el-form - :model="queryParams" - ref="tableList" - :inline="true" - label-width="76px" - style="margin: 10px 10px" - > + <el-form :model="queryParams" ref="tableList" :inline="true" label-width="76px" style="margin: 10px 10px"> <el-form-item label="浣撴鏃堕棿" prop="date"> - <el-date-picker - v-model="value1" - type="datetimerange" - align="right" - start-placeholder="寮�濮嬫棩鏈�" - :picker-options="pickerOptions" - end-placeholder="缁撴潫鏃ユ湡" - :default-time="['00:00:00', '23:00:00']" - format="yyyy-MM-dd HH:mm" - value-format="yyyy-MM-dd HH:mm" - @change="dateChangebirthday1" - > + <el-date-picker v-model="value1" type="datetimerange" align="right" start-placeholder="寮�濮嬫棩鏈�" + :picker-options="pickerOptions" end-placeholder="缁撴潫鏃ユ湡" :default-time="['00:00:00', '23:00:00']" + format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" @change="dateChangebirthday1"> </el-date-picker> </el-form-item> <el-form-item> @@ -32,8 +17,8 @@ </div> </div> </template> - - + + <script> import { GetChartByDate } from "@/api/count/chart"; const echarts = require("echarts/lib/echarts"); @@ -55,32 +40,32 @@ data() { return { pickerOptions: { - shortcuts: [{ - text: '鏈�杩戜竴鍛�', - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); - picker.$emit('pick', [start, end]); - } - }, { - text: '鏈�杩戜竴涓湀', - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); - picker.$emit('pick', [start, end]); - } - }, { - text: '鏈�杩戜笁涓湀', - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); - picker.$emit('pick', [start, end]); - } - }] - }, + shortcuts: [{ + text: '鏈�杩戜竴鍛�', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); + picker.$emit('pick', [start, end]); + } + }, { + text: '鏈�杩戜竴涓湀', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit('pick', [start, end]); + } + }, { + text: '鏈�杩戜笁涓湀', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); + picker.$emit('pick', [start, end]); + } + }] + }, value1: "", DateList: [], startTime: "", @@ -93,21 +78,28 @@ }; }, -created() { + created() { this.getdate(); }, methods: { getdate() { getNewDateList().then((res) => { this.value1 = [ - moment(res.data).format("YYYY-MM-DD 00:00:00"), - moment(res.data).format("YYYY-MM-DD 23:59:00") - ];; + moment(res.data).format("YYYY-MM-DD 00:00:00"), + moment(res.data).format("YYYY-MM-DD 23:59:00") + ];; + this.getList() }); }, getList() { - this.queryParams.startDate = this.startTime[0]; - this.queryParams.endDate = this.startTime[1]; + if (this.value1) { + this.queryParams.startDate = this.value1[0]; + this.queryParams.endDate = this.value1[1]; + } else { + this.queryParams.startDate = this.startTime[0]; + this.queryParams.endDate = this.startTime[1]; + } + GetChartByDate(this.queryParams).then((response) => { this.DateList = response; console.log(this.DateList); @@ -170,7 +162,4 @@ height: 580px; background-color: #fff; } -</style> - - - \ No newline at end of file +</style> \ No newline at end of file -- Gitblit v1.8.0