From f5a707f00606722f0d288df0d707c7bc9098fcdd Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 10 May 2021 14:55:55 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/jfpt-Vue

---
 src/views/parcel/parcel.vue |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 105 insertions(+), 3 deletions(-)

diff --git a/src/views/parcel/parcel.vue b/src/views/parcel/parcel.vue
index 37b74b0..1a52596 100644
--- a/src/views/parcel/parcel.vue
+++ b/src/views/parcel/parcel.vue
@@ -34,6 +34,27 @@
       </template> -->
 
       <template slot="menuLeft">
+          <el-button
+            v-bind:class="activeClass == 0 ? 'btn-color' : ''"
+            size="small "
+            @click="getParcelData(0)"
+            >本日
+          </el-button>
+          <el-button
+            v-bind:class="activeClass == 1 ? 'btn-color' : ''"
+            size="small "
+            @click="getParcelData(1)"
+            >本周
+          </el-button>
+          <el-button
+            v-bind:class="activeClass == 2 ? 'btn-color' : ''"
+            size="small "
+            @click="getParcelData(2)"
+            >本月
+          </el-button>
+        </template>
+
+      <template slot="menuLeft">
           <el-button type="warning"
                       size="small"
                       plain
@@ -277,13 +298,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+ " 00:00:00";
       },
       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+ " 23:59:59";
       },
       getIsKindParams(){
         if(this.$route.query.decisioDiagramResult && this.$route.query!='' && this.$route.query!=null && this.$route.query!=undefined){
@@ -298,6 +335,71 @@
              color:"#fe1515"
            }
          }
+      },
+      getParcelData(e) {
+        var that = this;
+        this.query={};
+        //清空this.$route.query
+        this.$router.push({ query: {} });
+        that.activeClass = e;
+        var today = new Date();
+        if(e==0){
+          var params = {
+            startTime:this.showToDay(today)+ " 00:00:00",
+            endTime:this.showToDay(today)+ " 23:59:59"
+          };
+        }
+        if(e==1){
+          var params = {
+            startTime:this.showWeekFirstDay(today)+ " 00:00:00",
+            endTime:this.showToDay(today)+ " 23:59:59"
+          };
+        }
+        if(e==2){
+          var params = {
+            startTime:this.showMonthFirstDay(today)+ " 00:00:00",
+            endTime:this.showToDay(today)+ " 23:59:59"
+          };
+        }
+        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() {
@@ -318,7 +420,7 @@
           //window.open(`http://localhost:8108/ureport/excel?_u=blade-parcel.statis.ureport.xml&startTime=${startTime}&endTime=${endTime}&decisioDiagramResult=${decisioDiagramResult}&timeDesc=${timeDesc}`);
           window.open(`https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-parcel.statis.ureport.xml&startTime=${startTime}&endTime=${endTime}&decisioDiagramResult=${decisioDiagramResult}&timeDesc=${timeDesc}`);
       },
-      onLoad(page, params = {}) {
+      onLoad(page, params) {
         const { dateTime } = this.query;
         let values = {
           ...params,

--
Gitblit v1.9.3