From 8aa3edd56c279100c9053576f3e90fa55459fe77 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 Jan 2023 16:15:55 +0800
Subject: [PATCH] 修改
---
src/views/healthcode/healthcode.vue | 99 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 88 insertions(+), 11 deletions(-)
diff --git a/src/views/healthcode/healthcode.vue b/src/views/healthcode/healthcode.vue
index 16406b3..973b5e4 100644
--- a/src/views/healthcode/healthcode.vue
+++ b/src/views/healthcode/healthcode.vue
@@ -240,6 +240,8 @@
this.onLoad(this.page);
},
searchChange(params, done) {
+ //清空this.$route.query
+ this.$router.push({ query: {} });
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
@@ -272,13 +274,29 @@
if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
return this.$route.query.startTime
}
- return '';
+ // 当前时间
+ var date = new Date();
+ //年
+ var Y = date.getFullYear();
+ //月
+ var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
+ //日
+ var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+ return Y + "-" + M + "-" + D;
},
getEndTime(){
if (this.$route.query.endTime != undefined && this.$route.query.endTime != null && this.$route.query.endTime != "" ) {
return this.$route.query.endTime
}
- return '';
+ // 当前时间
+ var date = new Date();
+ //年
+ var Y = date.getFullYear();
+ //月
+ var M = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
+ //日
+ var D = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
+ return Y + "-" + M + "-" + D;
},
getHealthcodeType(){
if (this.$route.query.type != undefined) {
@@ -289,14 +307,73 @@
},
getHealthcodeData(e) {
var that = this;
+ this.query={};
+ this.$router.push({ query: {} });
that.activeClass = e;
//status 0:本日 1:本月 2:本年 type: 1:绿色 2:黄色 3:红色
- var params = {
+ var today = new Date();
+ var params ={};
+ if(e==0){
+ //修改搜索框中的值
+ this.search.releaseTimeRange=[this.showToDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
+ }
+ if(e==1){
+ //修改搜索框中的值
+ this.search.releaseTimeRange=[this.showWeekFirstDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
+ }
+ if(e==2){
+ //修改搜索框中的值
+ this.search.releaseTimeRange=[this.showMonthFirstDay(today)+" 00:00:00",this.showToDay(today)+" 23:59:59"]
+ }
+ params = {
+ ... params,
status: e
};
- this.query = params;
+ if(this.search.type){
+ params = {
+ ... params,
+ type: this.search.type
+ };
+ }
+ this.query=params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
+ },
+ //本日
+ showToDay(Nowdate){
+ var M=Number(Nowdate.getMonth())+1;
+ if(M<10){
+ M="0"+M;
+ }
+ var day = Nowdate.getDate();
+ if(day<10){
+ day = "0"+day;
+ }
+ return Nowdate.getFullYear()+"-"+M+"-"+day;
+ },
+
+ //本周第一天
+ showWeekFirstDay(Nowdate){
+ var WeekFirstDay=new Date(Nowdate-(Nowdate.getDay()-1)*86400000);
+ var M=Number(WeekFirstDay.getMonth())+1;
+ if(M<10){
+ M="0"+M;
+ }
+ var day = WeekFirstDay.getDate();
+ if(day<10){
+ day = "0"+day;
+ }
+ return WeekFirstDay.getFullYear()+"-"+M+"-"+day;
+ },
+
+ //本月第一天
+ showMonthFirstDay(Nowdate){
+ var MonthFirstDay=new Date(Nowdate.getFullYear(),Nowdate.getMonth(),1);
+ var M=Number(MonthFirstDay.getMonth())+1;
+ if(M<10){
+ M="0"+M;
+ }
+ return MonthFirstDay.getFullYear()+"-"+M+"-"+"0"+MonthFirstDay.getDate();
},
//数据导出
handleExport() {
@@ -317,12 +394,11 @@
//window.open(`http://localhost:8108/ureport/excel?_u=blade-healthcode.statis.xml.ureport.xml&begTime=${begTime}&endTime=${endTime}&type=${type}&timeDesc=${timeDesc}`);
window.open(`https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-healthcode.statis.xml.ureport.xml&begTime=${begTime}&endTime=${endTime}&type=${type}&timeDesc=${timeDesc}`);
},
- onLoad(page, params = {}) {
+ onLoad(page, params={}) {
const { dateTime } = this.query;
let values = {
...params,
};
- debugger;
if (this.$route.query.status!=undefined && this.$route.query != undefined && this.$route.query != null && this.$route.query != "" ) {
if (this.$route.query.type != undefined) {
this.page.currentPage = 1;
@@ -344,12 +420,13 @@
endTime: this.$route.query.endTime
}
this.activeClass =4;
- }else{
- params = {
- status:this.$route.query.status,
- type:this.$route.query.type
- }
}
+ // else{
+ // params = {
+ // status:this.$route.query.status,
+ // type:this.$route.query.type
+ // }
+ // }
if(this.activeClass == 0 && this.query.dateTime==null){
params = {
--
Gitblit v1.9.3