From 4f11d6a54ade61ba7daf8ba856014d2f8994badf Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sun, 09 May 2021 08:34:19 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/jfpt-Vue

---
 src/views/healthcode/healthcode.vue |  108 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 87 insertions(+), 21 deletions(-)

diff --git a/src/views/healthcode/healthcode.vue b/src/views/healthcode/healthcode.vue
index 0d0fcc7..16406b3 100644
--- a/src/views/healthcode/healthcode.vue
+++ b/src/views/healthcode/healthcode.vue
@@ -23,24 +23,39 @@
         <template slot="menuLeft">
           <el-button
             v-bind:class="activeClass == 0 ? 'btn-color' : ''"
-            size="medium "
+            size="small "
             @click="getHealthcodeData(0)"
             >本日
           </el-button>
           <el-button
             v-bind:class="activeClass == 1 ? 'btn-color' : ''"
-            size="medium "
+            size="small "
             @click="getHealthcodeData(1)"
             >本周
           </el-button>
           <el-button
             v-bind:class="activeClass == 2 ? 'btn-color' : ''"
-            size="medium "
+            size="small "
             @click="getHealthcodeData(2)"
             >本月
           </el-button>
         </template>
-      
+
+        <template slot="menuLeft">
+          <el-button type="warning"
+                      size="small"
+                      plain
+                      icon="el-icon-download"
+                      @click="handleExport">导出
+          </el-button>
+          <el-button type="warning"
+                      size="small"
+                      plain
+                      icon="el-icon-pie-chart"
+                      @click="handleExportStatis">导出报表
+          </el-button>
+        </template>
+
     </avue-crud>
   </basic-container>
 </template>
@@ -56,6 +71,7 @@
         query: {},
         search:{},
         loading: true,
+        activeClass: 0,
         page: {
           pageSize: 10,
           currentPage: 1,
@@ -65,12 +81,12 @@
         option: {
           menu:false,
           height:'auto',
-          calcHeight: 30,
+          calcHeight: 54,
+          border: false,
+          stripe:true,
           tip: false,
           searchShow: true,
           searchMenuSpan: 6,
-          activeClass: 0,
-          border: true,
           index: true,
           viewBtn: true,
           selection: true,
@@ -105,6 +121,7 @@
               format: "yyyy-MM-dd",
               valueFormat: "yyyy-MM-dd",
               searchRange: true,
+              searchValue:[this.getStartTime(),this.getEndTime()],
               searchSpan: 5,
               hide: true,
               addDisplay: false,
@@ -122,7 +139,7 @@
             {
               label: '省份',
               prop: 'province',
-              search: true,
+              //search: true,
               searchSpan: 3,
               type: 'select',
               props: {
@@ -138,7 +155,7 @@
               prop: 'city',
               type: 'select',
               searchSpan: 3,
-              search: true,
+              //search: true,
               props: {
                 label: 'name',
                 value: 'name'
@@ -149,7 +166,7 @@
             {
               label: '区县',
               searchSpan: 3,
-              search: true,
+              //search: true,
               prop: 'district',
               type: 'select',
               props: {
@@ -190,7 +207,7 @@
         recorder: null,
       };
     },
-    mounted:{
+    mounted(){
 
     },
     computed: {
@@ -215,7 +232,11 @@
       beforeOpen(done, type) {
       },
       searchReset() {
+        //清空搜索框中的内容
         this.query = {};
+        //清空this.$route.query
+        this.$router.push({ query: {} });
+        this.activeClass=0;
         this.onLoad(this.page);
       },
       searchChange(params, done) {
@@ -247,10 +268,22 @@
            }
          }
       },
+      getStartTime(){
+           if (this.$route.query.startTime != undefined && this.$route.query.startTime != null && this.$route.query.startTime != "" ) {
+             return this.$route.query.startTime
+           }
+           return '';
+      },
+      getEndTime(){
+           if (this.$route.query.endTime != undefined && this.$route.query.endTime != null && this.$route.query.endTime != "" ) {
+             return this.$route.query.endTime
+           }
+           return '';
+      },
       getHealthcodeType(){
           if (this.$route.query.type != undefined) {
               var type = this.$route.query.type+"";
-              this.$route.query = {};
+              //this.$route.query = {};
               return type;
           }
       },
@@ -265,42 +298,67 @@
         this.page.currentPage = 1;
         this.onLoad(this.page, params);
       },
+      //数据导出
+      handleExport() {
+        this.$confirm("是否导出健康码数据?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          window.open(`/api/blade-jfpts/healthcode/healthcode/export-healthcode?begTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&type=${this.$route.query.type}&timeDesc=${this.$route.query.timeDesc}`);
+        });
+      },
+      //数据报表导出
+      handleExportStatis() {
+          let begTime = this.$route.query.startTime==undefined? '':this.$route.query.startTime;
+          let endTime = this.$route.query.endTime==undefined? '':this.$route.query.endTime;
+          let type = this.$route.query.type==undefined? '':this.$route.query.type;
+          let timeDesc = this.$route.query.timeDesc==undefined? '':this.$route.query.timeDesc;
+          //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 = {}) {
         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.activeClass = this.$route.query.status;
               this.page.currentPage = 1;
               params = {
                 status:this.$route.query.status,
                 type:this.$route.query.type
               }
             } else {
-              this.activeClass = 0;
               this.page.currentPage = 1;
               params = {
                 type:this.$route.query.status
               };
             }
+            this.activeClass =4;
         }else if(this.$route.query.type != undefined){
           params = {
             type: this.$route.query.type,
             begTime: this.$route.query.startTime,
             endTime: this.$route.query.endTime
           }
+          this.activeClass =4;
         }else{
-            params = {
-                status:this.$route.query.status,
-                type:this.$route.query.type
-            }
-            
+          params = {
+              status:this.$route.query.status,
+              type:this.$route.query.type
+          }
+        }
+
+        if(this.activeClass == 0 && this.query.dateTime==null){
+          params = {
+              status:this.activeClass,
+          }
         }
 
         if (dateTime) {
+          this.activeClass =4;
           values = {
             ...params,
             begTime: dateTime[0],
@@ -311,6 +369,14 @@
         } else {
           values = {
             ...params,
+            ...this.query,
+          };
+        }
+
+        if (this.$route.query.timeDesc) {
+          values = {
+            ...params,
+            timeDesc: this.$route.query.timeDesc,
             ...this.query,
           };
         }
@@ -333,4 +399,4 @@
     background-color: rgb(64, 158, 255);
     border-color: rgb(64, 158, 255);
   }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3