Browse Source

计划单统计表-导出

jbb 1 year ago
parent
commit
9d8108a247
1 changed files with 28 additions and 0 deletions
  1. 28 0
      src/views/cost-allocation-total/inancialReconciliation.vue

+ 28 - 0
src/views/cost-allocation-total/inancialReconciliation.vue

@@ -124,6 +124,9 @@
 
     <!-- table区域  -->
     <a-card :bordered="false" style=" marginTop:10px;">
+      <div class="table-operator">
+        <a-button type="primary" @click="exportList('计划单统计表')" icon="plus">导出</a-button>
+      </div>
       <a-table
         bordered
         rowKey="index"
@@ -507,6 +510,31 @@ export default {
         })
     },
 
+    //导出
+    exportList(fileName){
+      var params = this.queryParam
+      downFile('/orderData/syCostLossReview/planExportXls', params).then(data => {
+        console.log('888')
+        if (!data) {
+          this.$message.warning('文件下载失败')
+          return
+        }
+        if (typeof window.navigator.msSaveBlob !== 'undefined') {
+          window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xlsx')
+        } else {
+          let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
+          let link = document.createElement('a')
+          link.style.display = 'none'
+          link.href = url
+          link.setAttribute('download', fileName + '.xlsx')
+          document.body.appendChild(link)
+          link.click()
+          document.body.removeChild(link) // 下载完成移除元素
+          window.URL.revokeObjectURL(url) // 释放掉blob对象
+        }
+      })
+    },
+
     handleTableChange(pagination, filters, sorter) {
       this.queryParam.pageNo = pagination.current
       this.queryParam.pageSize = pagination.pageSize