소스 검색

付款管理-付款明细导出

ZhangWenQiang 4 년 전
부모
커밋
5e3d15e406
1개의 변경된 파일38개의 추가작업 그리고 6개의 파일을 삭제
  1. 38 6
      src/views/hwpayment/modules/HwPaymentModal.vue

+ 38 - 6
src/views/hwpayment/modules/HwPaymentModal.vue

@@ -14,7 +14,7 @@
         <!-- 查询区域 -->
         <div class="table-page-search-wrapper">
           <a-form layout="inline" @keyup.enter.native="searchQuery">
-            <a-row :gutter="24" type='flex' justify='space-between'>
+            <a-row :gutter="24">
               <!--<a-col :md="6" :sm="8">-->
                 <!--<a-form-item label="订单编号">-->
                   <!--<a-input placeholder="请输入订单编号" v-model="queryParam.orderNumber"></a-input>-->
@@ -51,8 +51,8 @@
                   <!--</a-form-item>-->
                 <!--</a-col>-->
               <!--</template>-->
-              <a-col>
-                <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-col :md="6" :sm="8">
+                <span style=" float: left;overflow: hidden;" class="table-page-search-submitButtons">
                   <a-button ghost type='primary' @click="searchQuery" icon="search">查询</a-button>
                   <a-button ghost type='primary' @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
                   <!--<a @click="handleToggleSearch" style="margin-left: 8px">-->
@@ -68,7 +68,7 @@
 
         <!-- 操作按钮区域 -->
         <div class="table-operator">
-          <!--<a-button @click="handlePayment" type="primary" icon="plus">付款</a-button>-->
+          <a-button type="primary" icon="download" @click="handleExportXls('付款明细表')">导出</a-button>
         </div>
 
         <!-- table区域-begin -->
@@ -106,7 +106,7 @@
 <script>
   import '@/assets/less/TableExpand.less'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import { httpAction, getAction,putAction } from '@/api/manage'
+  import { httpAction, getAction,putAction,downFile } from '@/api/manage'
   import pick from 'lodash.pick'
   import JDate from '@/components/jeecg/JDate'
   import { filterObj } from '@/utils/util'
@@ -336,7 +336,39 @@
           }
           baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
           return (num1 * baseNum + num2 * baseNum) / baseNum;
-      }
+      },
+      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>