ソースを参照

收货看板-收货表单添加导出功能

eric2h 3 年 前
コミット
52eb61a4f5

+ 25 - 0
resources/views/store/receivingDashboard/receivingTableList/index.blade.php

@@ -49,6 +49,9 @@
             <div class="form-group m-2">
                 <button class="form-control btn btn-sm btn-info" @click="searchData()">查询</button>
             </div>
+            <div class="form-group m-2">
+                <button class="form-control btn btn-sm btn-success" @click="downExcel()">导出EXCEL</button>
+            </div>
         </div>
         <!--            表格-->
         <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80"
@@ -457,6 +460,28 @@
                         }
                     });
                 },
+                downExcel() {
+                    let url = this.getBaseUrl();
+                    url += '/api/device/check/receiveBoard/export';
+                    let search = this.getSearch();
+                    axios.post(url, search).then(res => {
+                        if (res.data.code === 200) {
+                            let filename = res.data.data;
+                            let downUrl = this.getBaseUrl() + '/api/device/check/receiveBoard/download?filename=' + filename;
+                            let link = document.createElement('a');
+                            link.style.display = 'none';
+                            link.href = downUrl;
+                            link.download = `${filename}.xlsx`;
+                            document.body.appendChild(link);
+                            link.click();
+                            document.body.removeChild(link);
+                            tempTip.showSuccess('导出成功!');
+                        } else {
+                            tempTip.setDuration(3000);
+                            tempTip.show(res.data.data);
+                        }
+                    })
+                }
 
             },