Эх сурвалжийг харах

Merge branch 'http_mock' of git.xiaojukeji.com:jacklijiajia/thoth-frontend into http_mock

qinzhipeng_v 5 жил өмнө
parent
commit
01d7db5461

+ 1 - 1
src/api/defectManage.js

@@ -125,7 +125,7 @@ export function settingQueryBizModuleList(bizId) {
 // bug下载
 export function bugDownload(data) {
   return request({
-    url: TeamManagement + '/bug/download',
+    url: TeamManagement + '/bug/downLoad',
     method: 'post',
     data
   })

+ 21 - 3
src/views/projectManage/bugList/bugindex.vue

@@ -360,6 +360,7 @@
                         end-placeholder="结束日期"
                         size="small"
                         value-format="yyyy-MM-dd HH:mm:ss"
+                        :default-time="['00:00:00','23:59:59']"
                         :picker-options="pickerOptions"
                         @change="changDate"
                       />
@@ -430,6 +431,7 @@
             </el-table>
           </el-col>
           <el-col :span="24">
+            <el-button type="primary" size="mini" class="download" @click="download">导出</el-button>
             <div align="right">
               <el-pagination
                 :current-page="currentPage4"
@@ -470,6 +472,8 @@
 </template>
 
 <script>
+import axios from 'axios'
+import { mockUrl } from '@/apiConfig/api'
 import BugDetails from './details/index'
 import createdBug from '@/views/projectManage/bugList/file/createdBug'
 import {
@@ -594,6 +598,9 @@ export default {
     }
   },
   created() {
+    if (this.$route.query.startDate && this.$route.query.endDate) {
+      this.stratAndEnd = [this.$route.query.startDate, this.$route.query.endDate]
+    }
     if (this.type === 'page') {
       this.getBugList()
     } else {
@@ -601,9 +608,6 @@ export default {
     }
     this.bugListSelect()
     this.$store.state.data.status = true
-    if (this.$route.query.startDate && this.$route.query.endDate) {
-      this.stratAndEnd = [this.$route.query.startDate, this.$route.query.endDate]
-    }
   },
   destroyed() {
     this.$store.state.data.status = false
@@ -825,6 +829,20 @@ export default {
           }))
         }
       )
+    },
+    async download() { // 下载导出Excel
+      const res = await axios({
+        method: 'post',
+        url: mockUrl + '/bug/downLoad', // 请求地址
+        data: this.indexPage, // 参数
+        responseType: 'blob' // 表明返回服务器返回的数据类型
+      })
+      const aLink = document.createElement('a')
+      const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
+      aLink.href = URL.createObjectURL(blob)
+      aLink.download = '导出信息.xlsx'
+      aLink.style.display = 'none'
+      aLink.click()
     }
   }
 }

+ 2 - 2
src/views/projectManage/bugList/css/index.css

@@ -199,6 +199,6 @@
 }
 .download {
   position: absolute;
-  bottom: 2%;
-  left: 2%;
+  bottom: 25px;
+  left: 2.5%;
 }