Commit 8fc3fa34 authored by guoyou's avatar guoyou

订单统计导出

parent e5b02974
......@@ -19,7 +19,7 @@ export function vehicleInfoExcel(params) {
});
}
//车辆统计信息列表
//订单统计
export function received_statistics(params) {
return fetch({
url: 'api/order/admin/order/received_statistics',
......@@ -27,4 +27,14 @@ export function received_statistics(params) {
timeout:'50000',
data: params
});
}
\ No newline at end of file
}
// 订单统计导出
export function excelExport(query) {
return fetch({
url: '/api/order/orderStatistics/excel',
method: 'post',
data: query,
responseType: 'blob'
});
}
\ No newline at end of file
......@@ -58,7 +58,7 @@
</div>
<el-button type="primary" @click="search">搜索</el-button>
<el-button type="primary" @click="clearSearch">清空搜索</el-button>
<el-button type="primary">导出excel</el-button>
<el-button type="primary" :loading="excelLoading" @click="downloadExcel">导出报表</el-button>
</el-row>
</el-form>
......@@ -72,7 +72,7 @@
</template>
<script>
import { received_statistics } from 'api/statistics/vehicleStatistics'
import { received_statistics,excelExport } from 'api/statistics/vehicleStatistics'
import { formatDate } from 'utils/dateFormattor'
import { objDeepCopy } from '../../utils'
export default {
......@@ -94,6 +94,7 @@ export default {
}
}
return {
excelLoading:false,
loading: true,
time: null,
checkArr: [
......@@ -279,6 +280,34 @@ export default {
this.getList()
},
methods: {
//导出
downloadExcel() {
this.excelLoading = true
var u = navigator.userAgent,
app = navigator.appVersion
excelExport(this.listQuery, { responseType: 'arraybuffer' }).then(
res => {
const content = res
const blob = new Blob([content], {
type: 'application/vnd.ms-excel'
})
const fileName = '订单统计.xlsx'
if (u.indexOf('Edge') > -1) {
window.navigator.msSaveBlob(blob, fileName)
} else {
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
}
this.excelLoading = false
}
)
},
//搜索
search() {
if (!!this.time) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment