From 514bbb98741f72e8c8cd0df2f5764bc3a71edf9b Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Tue, 27 Jul 2021 10:46:16 +0800
Subject: [PATCH] 增加周月日时间筛选
---
src/views/realTimePolice/real.vue | 72 ++++++++++++++++++++++++++++++++----
1 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index c8ecaad..71e0e38 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -154,8 +154,32 @@
</avue-crud>
<el-row v-show="switchChartType == 1">
+ <el-button
+ v-bind:class="activeClass == 0 ? 'btn-color' : ''"
+ size="mini"
+ @click="getswitchChartdate(0)"
+ >本日
+ </el-button>
+ <el-button
+ v-bind:class="activeClass == 1 ? 'btn-color' : ''"
+ size="mini"
+ @click="getswitchChartdate(1)"
+ >本周
+ </el-button>
+ <el-button
+ v-bind:class="activeClass == 2 ? 'btn-color' : ''"
+ size="mini"
+ @click="getswitchChartdate(2)"
+ >本月
+ </el-button>
+ <el-button
+ v-bind:class="activeClass == 3 ? 'btn-color' : ''"
+ size="mini"
+ @click="getswitchChartdate(3)"
+ >全部
+ </el-button>
<el-button type="success"
- size="small"
+ size="mini"
icon="el-icon-s-marketing"
@click="switchChart">表 格
</el-button>
@@ -815,6 +839,39 @@
this.page.currentPage = 1;
this.onLoad(this.page, params);
},
+
+ getswitchChartdate(e){
+ var params = {};
+ var today = new Date();
+ this.activeClass = e;
+ if (e == 0) {
+ params = {
+ beginTime: this.showToDay(today) + " 00:00:00",
+ endTime: this.showToDay(today) + " 23:59:59",
+ };
+ }
+ if (e == 1) {
+ params = {
+ beginTime: this.showWeekFirstDay(today) + " 00:00:00",
+ endTime: this.showToDay(today) + " 23:59:59",
+ };
+ }
+ if (e == 2) {
+ params = {
+ beginTime: this.showMonthFirstDay(today) + " 00:00:00",
+ endTime: this.showToDay(today) + " 23:59:59",
+ };
+ }
+
+ if (e == 3){
+ params = null;
+ }
+
+ this.getData(params);
+ this.getDataBs(params);
+
+ },
+
//本日
showToDay(Nowdate) {
var M = Number(Nowdate.getMonth()) + 1;
@@ -872,7 +929,6 @@
this.onLoad(this.page, params);
},
getQBdata(e) {
- debugger;
this.search.releaseTimeRange = ["", ""];
this.activeClass = e;
var params = {};
@@ -1056,13 +1112,13 @@
} else {
this.switchChartType = 1;
setTimeout(function () {
- that.getData();
- that.getDataBs();
+ that.getData(null);
+ that.getDataBs(null);
}, 0);
}
- }, getData() {
+ }, getData(data) {
var that = this;
- getChartData(null).then(res => {
+ getChartData(data).then(res => {
var data = res.data.data;
var sum = 0;
for (let i = 0; i < data.length; i++) {
@@ -1121,9 +1177,9 @@
myChart.setOption(option);
});
},
- getDataBs() {
+ getDataBs(data) {
var that = this;
- getChartDataBs(null).then(res => {
+ getChartDataBs(data).then(res => {
var data = res.data.data;
var sum = 0;
for (let i = 0; i < data.length; i++) {
--
Gitblit v1.9.3