Преглед на файлове

付款管理-付款明细导出

ZhangWenQiang преди 4 години
родител
ревизия
845832625b
променени са 1 файла, в които са добавени 37 реда и са изтрити 6 реда
  1. 37 6
      src/views/hlgpayment/HlgPaymentDetailList.vue

+ 37 - 6
src/views/hlgpayment/HlgPaymentDetailList.vue

@@ -41,10 +41,9 @@
     <!-- 查询区域-END -->
 
     <!-- 操作按钮区域 -->
-    <!--<div class="table-operator">-->
-      <!--<a-button @click="handleReissue" type="primary" v-has="'payment:reissue'">补发</a-button>-->
-      <!--<a-button @click="handleNoReissue" type="primary" v-has="'payment:reissue'">不补发</a-button>-->
-    <!--</div>-->
+    <div class="table-operator">
+      <a-button type="primary" icon="download" @click="handleExportXls('付款明细表')">导出</a-button>
+    </div>
 
     <!-- table区域-begin -->
     <div>
@@ -85,7 +84,7 @@
   import '@/assets/less/TableExpand.less'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import HlgPaymentReissueModal from './modules/HlgPaymentReissueModal'
-  import { httpAction, getAction, putAction } from '@/api/manage'
+  import { httpAction, getAction, putAction,downFile } from '@/api/manage'
   import PageLayout from '@/components/page/PageLayout'
 
   const statusMessage = {
@@ -164,7 +163,7 @@
           list: '/hlgpayment/hlgPaymentDetail/list',
           delete: '/hlgpayment/hlgPaymentDetail/delete',
           deleteBatch: '/hlgpayment/hlgPaymentDetail/deleteBatch',
-          exportXlsUrl: '/hlgpayment/hlgPaymentDetail/exportXls',
+          exportXlsUrl: '/hlgpayment/hlgPaymentDetail/exportXlsUrl',
           importExcelUrl: 'hlgpayment/hlgPaymentDetail/importExcel',
           noSupplementPayment: '/hlgpayment/hlgPayment/handNoSupplementPayment'
         },
@@ -273,6 +272,38 @@
         this.selectedRowKeys = [];
         this.selectionRows = [];
       },
+      handleExportXls(fileName){
+        if(!fileName || typeof fileName != "string"){
+          fileName = "导出文件"
+        }
+        let param = {...this.queryParam};
+        if(this.selectedRowKeys && this.selectedRowKeys.length>0){
+          param['selections'] = this.selectedRowKeys.join(",")
+        }
+        param.paymentId = this.paymentId;
+        console.log("导出参数",param)
+        downFile(this.url.exportXlsUrl,param).then((data)=>{
+          console.log("导出参数",param)
+
+          if (!data) {
+            this.$message.warning("文件下载失败")
+            return
+          }
+          if (typeof window.navigator.msSaveBlob !== 'undefined') {
+            window.navigator.msSaveBlob(new Blob([data]), fileName+'.xls')
+          }else{
+            let url = window.URL.createObjectURL(new Blob([data]))
+            let link = document.createElement('a')
+            link.style.display = 'none'
+            link.href = url
+            link.setAttribute('download', fileName+'.xls')
+            document.body.appendChild(link)
+            link.click()
+            document.body.removeChild(link); //下载完成移除元素
+            window.URL.revokeObjectURL(url); //释放掉blob对象
+          }
+        })
+      },
     }
   }
 </script>