Commit 8fc3fa34 authored by guoyou's avatar guoyou

订单统计导出

parent e5b02974
...@@ -19,7 +19,7 @@ export function vehicleInfoExcel(params) { ...@@ -19,7 +19,7 @@ export function vehicleInfoExcel(params) {
}); });
} }
//车辆统计信息列表 //订单统计
export function received_statistics(params) { export function received_statistics(params) {
return fetch({ return fetch({
url: 'api/order/admin/order/received_statistics', url: 'api/order/admin/order/received_statistics',
...@@ -28,3 +28,13 @@ export function received_statistics(params) { ...@@ -28,3 +28,13 @@ export function received_statistics(params) {
data: params data: params
}); });
} }
// 订单统计导出
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 @@ ...@@ -58,7 +58,7 @@
</div> </div>
<el-button type="primary" @click="search">搜索</el-button> <el-button type="primary" @click="search">搜索</el-button>
<el-button type="primary" @click="clearSearch">清空搜索</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-row>
</el-form> </el-form>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
</template> </template>
<script> <script>
import { received_statistics } from 'api/statistics/vehicleStatistics' import { received_statistics,excelExport } from 'api/statistics/vehicleStatistics'
import { formatDate } from 'utils/dateFormattor' import { formatDate } from 'utils/dateFormattor'
import { objDeepCopy } from '../../utils' import { objDeepCopy } from '../../utils'
export default { export default {
...@@ -94,6 +94,7 @@ export default { ...@@ -94,6 +94,7 @@ export default {
} }
} }
return { return {
excelLoading:false,
loading: true, loading: true,
time: null, time: null,
checkArr: [ checkArr: [
...@@ -279,6 +280,34 @@ export default { ...@@ -279,6 +280,34 @@ export default {
this.getList() this.getList()
}, },
methods: { 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() { search() {
if (!!this.time) { 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