|
@@ -4,6 +4,7 @@
|
|
|
<div class="squrt"></div>订单管理
|
|
|
</h2>
|
|
|
<div class="m-core">
|
|
|
+ <div class="newBand" @click="onOrderExport" v-permission="{child: 'export/orderList', parent: '/income'}">报表导出</div>
|
|
|
<!-- 搜索类型 -->
|
|
|
<el-form :inline="true"
|
|
|
class="searchForm"
|
|
@@ -134,6 +135,9 @@ import { orderQueryPage } from '@/api/orderManager'
|
|
|
import { getEmployeeOrgan } from '@/api/buildTeam'
|
|
|
import store from '@/store'
|
|
|
import { orderStatus, dealStatus } from '@/utils/searchArray'
|
|
|
+import axios from 'axios'
|
|
|
+import qs from 'qs'
|
|
|
+import { getToken } from '@/utils/auth'
|
|
|
export default {
|
|
|
components: { pagination },
|
|
|
name: 'income',
|
|
@@ -169,6 +173,45 @@ export default {
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ onOrderExport() { // 报表导出
|
|
|
+ let url = '/api-web/export/orderList'
|
|
|
+ let data = {
|
|
|
+ orderType: 0
|
|
|
+ }
|
|
|
+ const options = {
|
|
|
+ method: 'POST',
|
|
|
+ headers: {
|
|
|
+ 'Authorization': getToken()
|
|
|
+ },
|
|
|
+ data: qs.stringify(data),
|
|
|
+ url,
|
|
|
+ responseType: 'blob'
|
|
|
+ }
|
|
|
+ this.$confirm('您确定导出报表', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ axios(options).then(res => {
|
|
|
+ let blob = new Blob([res.data], {
|
|
|
+ // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
|
+ type: 'application/vnd.ms-excel;charset=utf-8'
|
|
|
+ //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
|
+ })
|
|
|
+ let objectUrl = URL.createObjectURL(blob)
|
|
|
+ let link = document.createElement("a")
|
|
|
+ let nowTime = new Date()
|
|
|
+ let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' +
|
|
|
+ nowTime.getHours() +
|
|
|
+ '' + nowTime.getMinutes()
|
|
|
+ let fname = '报表导出' + new Date().getTime() //下载文件的名字
|
|
|
+ link.href = objectUrl
|
|
|
+ link.setAttribute("download", fname)
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
search () {
|
|
|
this.pageInfo.page = 1;
|
|
|
this.getList();
|