From 00212ed8e808fc7b76c04389224e65f27f074fb2 Mon Sep 17 00:00:00 2001 From: su1124 <1583764726@qq.com> Date: 星期五, 26 四月 2024 15:30:04 +0800 Subject: [PATCH] su --- src/views/count/chart/index.vue | 118 ++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 64 insertions(+), 54 deletions(-) diff --git a/src/views/count/chart/index.vue b/src/views/count/chart/index.vue index 46c585e..f4e5bb7 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"); @@ -41,38 +26,46 @@ require("echarts/lib/component/tooltip"); require("echarts/lib/component/legend"); require("echarts/lib/chart/pie"); +import { + getNumber, + hasReport, + getPdf, + getOrderList, + getNewDateList, +} from "@/api/hosp/order"; +import moment from "moment"; export default { name: "chart", 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: "", @@ -85,11 +78,31 @@ }; }, - + 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") + ];; + 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 if(this.value1 == null) { + this.queryParams.startDate = null; + this.queryParams.endDate = null; + } 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); @@ -152,7 +165,4 @@ height: 580px; background-color: #fff; } -</style> - - - \ No newline at end of file +</style> \ No newline at end of file -- Gitblit v1.8.0