Browse Source

文件导出功能

master
453530270@qq.com 3 years ago
parent
commit
8d068ec6b4
  1. 14
      src/api/index.js
  2. 37
      src/components/page/order/closed.vue
  3. 23
      src/components/page/order/completed.vue
  4. 24
      src/components/page/order/index.vue
  5. 19
      src/components/page/order/pendingPayment.vue
  6. 19
      src/components/page/order/toBeDelivered.vue
  7. 19
      src/components/page/order/toBeSettled.vue

14
src/api/index.js

@ -128,6 +128,20 @@ export const rankingSort = query => {
data: query data: query
}); });
}; };
// 导出订单xls
export const xlsdc =query => {
return request({
url: '/admin/order.Order/export',
method: 'post',
data: query,
//
responseType:'blob',
//请求头
headers:{
"Content-Type":"application/json;charset=UTF-8;"
}
});
};
//订单详情 //订单详情
export const orderInfo = query => { export const orderInfo = query => {
return request({ return request({

37
src/components/page/order/closed.vue

@ -75,6 +75,7 @@
<a-space :size="21"> <a-space :size="21">
<a-button type="primary" class="query_button" @click="getList(1)"> </a-button> <a-button type="primary" class="query_button" @click="getList(1)"> </a-button>
<a-button class="query_button" @click="resetQurey"> </a-button> <a-button class="query_button" @click="resetQurey"> </a-button>
<a-button type="default" class="query_button" @click="xlsdc"> </a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
@ -82,7 +83,6 @@
<div class="table"> <div class="table">
<div class="table_title"> <div class="table_title">
<span>查询结果</span> <span>查询结果</span>
<a-button type="primary" class="query_button"> </a-button>
<!-- <a-button type="primary" class="query_button"> </a-button> --> <!-- <a-button type="primary" class="query_button"> </a-button> -->
</div> </div>
<a-table :columns="columns" :data-source="data" bordered :pagination="false"> <a-table :columns="columns" :data-source="data" bordered :pagination="false">
@ -96,17 +96,9 @@
</a-space> </a-space>
</template> </template>
</a-table> </a-table>
<a-pagination <a-pagination class="pagination" size="small" :total="total" v-model="page" :page-size="limit"
class="pagination" :show-total="total => `第 ${startTotal} - ${endTotal} 条 / 总共 ${total} 条`" :page-size-options="pageSizeOptions"
size="small" @showSizeChange="onShowSizeChange" @change="changePage" show-size-changer>
:total="total"
v-model="page"
:page-size="limit"
:show-total="total => `第 ${startTotal} - ${endTotal} 条 / 总共 ${total} 条`"
:page-size-options="pageSizeOptions"
@showSizeChange="onShowSizeChange"
@change="changePage"
show-size-changer >
<template slot="buildOptionText" slot-scope="props"> <template slot="buildOptionText" slot-scope="props">
<span>{{ props.value }}/</span> <span>{{ props.value }}/</span>
</template> </template>
@ -119,7 +111,7 @@
</template> </template>
<script> <script>
import Operation from '../../Operation.vue' import Operation from '../../Operation.vue'
import {getOrderList} from '../../../api/index' import { getOrderList,xlsdc } from '../../../api/index'
export default { export default {
data() { data() {
return { return {
@ -240,6 +232,21 @@ export default {
Object.assign(this.query, this.$options.data().query) Object.assign(this.query, this.$options.data().query)
this.getList() this.getList()
}, },
xlsdc() {
xlsdc(this.query).then(res => {
const fname = '关闭订单'+new Date().getTime() + ".xlsx"
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
})
.catch(err => {
console.error(err)
});
},
getList(type) { getList(type) {
let data = this.query let data = this.query
data.limit = this.limit data.limit = this.limit
@ -280,6 +287,4 @@ export default {
} }
} }
</script> </script>
<style scoped> <style scoped></style>
</style>

23
src/components/page/order/completed.vue

@ -75,6 +75,7 @@
<a-space :size="21"> <a-space :size="21">
<a-button type="primary" class="query_button" @click="getList(1)"> </a-button> <a-button type="primary" class="query_button" @click="getList(1)"> </a-button>
<a-button class="query_button" @click="resetQurey"> </a-button> <a-button class="query_button" @click="resetQurey"> </a-button>
<a-button type="default" class="query_button" @click="xlsdc"> </a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
@ -82,7 +83,6 @@
<div class="table"> <div class="table">
<div class="table_title"> <div class="table_title">
<span>查询结果</span> <span>查询结果</span>
<a-button type="primary" class="query_button"> </a-button>
<!-- <a-button type="primary" class="query_button"> </a-button> --> <!-- <a-button type="primary" class="query_button"> </a-button> -->
</div> </div>
<a-table :columns="columns" :data-source="data" bordered :pagination="false"> <a-table :columns="columns" :data-source="data" bordered :pagination="false">
@ -119,7 +119,7 @@
</template> </template>
<script> <script>
import Operation from '../../Operation.vue' import Operation from '../../Operation.vue'
import {getOrderList} from '../../../api/index' import {getOrderList,xlsdc} from '../../../api/index'
export default { export default {
data() { data() {
return{ return{
@ -238,6 +238,25 @@ export default {
resetQurey(){ resetQurey(){
Object.assign(this.query, this.$options.data().query) Object.assign(this.query, this.$options.data().query)
this.getList() this.getList()
},
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
// console.log(res)
const fname = new Date().getTime()+".xlsx"
// let bloburl = window.URL.createObjectURL(res)
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
console.log(a)
})
.catch(err=>{
console.error(err)
});
}, },
getList(type){ getList(type){
let data=this.query let data=this.query

24
src/components/page/order/index.vue

@ -90,6 +90,7 @@
<a-space :size="21"> <a-space :size="21">
<a-button type="primary" class="query_button" @click="getList(1)"> </a-button> <a-button type="primary" class="query_button" @click="getList(1)"> </a-button>
<a-button class="query_button" @click="resetQurey"> </a-button> <a-button class="query_button" @click="resetQurey"> </a-button>
<a-button type="default" class="query_button" @click="xlsdc"> </a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
@ -97,7 +98,7 @@
<div class="table"> <div class="table">
<div class="table_title"> <div class="table_title">
<span>查询结果</span> <span>查询结果</span>
<a-button type="primary" class="query_button"> </a-button>
<!-- <a-button type="primary" class="query_button"> </a-button> --> <!-- <a-button type="primary" class="query_button"> </a-button> -->
</div> </div>
<a-table :columns="columns" :data-source="data" bordered :pagination="false" rowKey="id"> <a-table :columns="columns" :data-source="data" bordered :pagination="false" rowKey="id">
@ -129,7 +130,7 @@
</template> </template>
<script> <script>
import Operation from '../../Operation.vue' import Operation from '../../Operation.vue'
import { getOrderList } from '../../../api/index' import { getOrderList,xlsdc } from '../../../api/index'
export default { export default {
data() { data() {
return { return {
@ -259,6 +260,25 @@ export default {
Object.assign(this.query, this.$options.data().query) Object.assign(this.query, this.$options.data().query)
this.getList() this.getList()
}, },
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
// console.log(res)
const fname = new Date().getTime()+".xlsx"
// let bloburl = window.URL.createObjectURL(res)
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
console.log(a)
})
.catch(err=>{
console.error(err)
});
},
getList(type) { getList(type) {
let data = this.query let data = this.query
data.limit = this.limit data.limit = this.limit

19
src/components/page/order/pendingPayment.vue

@ -75,6 +75,7 @@
<a-space :size="21"> <a-space :size="21">
<a-button type="primary" class="query_button" @click="getList(1)"> </a-button> <a-button type="primary" class="query_button" @click="getList(1)"> </a-button>
<a-button class="query_button" @click="resetQurey"> </a-button> <a-button class="query_button" @click="resetQurey"> </a-button>
<a-button type="default" class="query_button" @click="xlsdc"> </a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
@ -82,7 +83,7 @@
<div class="table"> <div class="table">
<div class="table_title"> <div class="table_title">
<span>查询结果</span> <span>查询结果</span>
<a-button type="primary" class="query_button"> </a-button> <!-- <a-button type="primary" class="query_button"> </a-button> -->
</div> </div>
<a-table :columns="columns" :data-source="data" bordered :pagination="false"> <a-table :columns="columns" :data-source="data" bordered :pagination="false">
<template slot="type" slot-scope="type"> <template slot="type" slot-scope="type">
@ -237,6 +238,22 @@ export default {
resetQurey(){ resetQurey(){
Object.assign(this.query, this.$options.data().query) Object.assign(this.query, this.$options.data().query)
this.getList() this.getList()
},
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
const fname = new Date().getTime()+".xlsx"
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
})
.catch(err=>{
console.error(err)
});
}, },
getList(type){ getList(type){
let data=this.query let data=this.query

19
src/components/page/order/toBeDelivered.vue

@ -75,6 +75,7 @@
<a-space :size="21"> <a-space :size="21">
<a-button type="primary" class="query_button" @click="getList(1)"> </a-button> <a-button type="primary" class="query_button" @click="getList(1)"> </a-button>
<a-button class="query_button" @click="resetQurey"> </a-button> <a-button class="query_button" @click="resetQurey"> </a-button>
<a-button type="default" class="query_button" @click="xlsdc"> </a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
@ -82,7 +83,7 @@
<div class="table"> <div class="table">
<div class="table_title"> <div class="table_title">
<span>查询结果</span> <span>查询结果</span>
<a-button type="primary" class="query_button"> </a-button> <!-- <a-button type="primary" class="query_button"> </a-button> -->
</div> </div>
<a-table :columns="columns" :data-source="data" bordered :pagination="false"> <a-table :columns="columns" :data-source="data" bordered :pagination="false">
<template slot="type" slot-scope="type"> <template slot="type" slot-scope="type">
@ -236,6 +237,22 @@ export default {
resetQurey(){ resetQurey(){
Object.assign(this.query, this.$options.data().query) Object.assign(this.query, this.$options.data().query)
this.getList() this.getList()
},
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
const fname = new Date().getTime()+".xlsx"
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
})
.catch(err=>{
console.error(err)
});
}, },
getList(type){ getList(type){
let data=this.query let data=this.query

19
src/components/page/order/toBeSettled.vue

@ -75,6 +75,7 @@
<a-space :size="21"> <a-space :size="21">
<a-button type="primary" class="query_button" @click="getList(1)"> </a-button> <a-button type="primary" class="query_button" @click="getList(1)"> </a-button>
<a-button class="query_button" @click="resetQurey"> </a-button> <a-button class="query_button" @click="resetQurey"> </a-button>
<a-button type="default" class="query_button" @click="xlsdc"> </a-button>
</a-space> </a-space>
</a-col> </a-col>
</a-row> </a-row>
@ -82,7 +83,7 @@
<div class="table"> <div class="table">
<div class="table_title"> <div class="table_title">
<span>查询结果</span> <span>查询结果</span>
<a-button type="primary" class="query_button">导出</a-button> <!-- <a-button type="primary" class="query_button">导出</a-button> -->
</div> </div>
<a-table :columns="columns" :data-source="data" bordered :pagination="false"> <a-table :columns="columns" :data-source="data" bordered :pagination="false">
<template slot="type" slot-scope="type"> <template slot="type" slot-scope="type">
@ -237,6 +238,22 @@ export default {
Object.assign(this.query, this.$options.data().query) Object.assign(this.query, this.$options.data().query)
this.getList() this.getList()
}, },
// xls
xlsdc(){
xlsdc(this.query).then(res=>{
const fname = new Date().getTime()+".xlsx"
let bloburl = window.URL.createObjectURL(new Blob([res]))
const a = document.createElement('a')
a.download = fname
a.href = bloburl
// add click
a.click()
window.URL.revokeObjectURL(bloburl)
})
.catch(err=>{
console.error(err)
});
},
getList(type){ getList(type){
let data=this.query let data=this.query
data.limit=this.limit data.limit=this.limit

Loading…
Cancel
Save