|
@@ -19,7 +19,9 @@
|
|
|
</a-select>
|
|
|
<a-range-picker v-model="dateRange" @change="dateChange" style="width:200px" />
|
|
|
<div class="opt">
|
|
|
- <a-button type='primary' @click="search">查询</a-button>
|
|
|
+ <a-button type='primary' @click="search" style="margin-right:15px">查询</a-button>
|
|
|
+ <a-button type='primary' @click="exportExcel" :loading='exportLoading'>导出报表</a-button>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
<a-spin :spinning="spinning">
|
|
@@ -782,6 +784,7 @@
|
|
|
mixins: [JeecgListMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
+ exportLoading:false,
|
|
|
projectValue: [],
|
|
|
dateRange: [moment().subtract(1, 'days'), moment()],
|
|
|
projectData: [],
|
|
@@ -820,6 +823,36 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //导出报表
|
|
|
+ exportExcel() {
|
|
|
+ this.exportLoading=true;
|
|
|
+ let url=''
|
|
|
+ if (this.tabKey == 1) {
|
|
|
+ url='/ctop/report/exportBytedanceSaleProjectInfo'
|
|
|
+
|
|
|
+ } else if (this.tabKey == 2) {
|
|
|
+ url='/kuaishou/exportKuaishouSaleProjectInfo'
|
|
|
+ }
|
|
|
+ downFilePost(url, {
|
|
|
+ startDate: this.dateRange[0].format('YYYY-MM-DD'),
|
|
|
+ endDate: this.dateRange[1].format('YYYY-MM-DD'),
|
|
|
+ projectList: this.projectValue,
|
|
|
+
|
|
|
+ }).then(res => {
|
|
|
+ this.exportLoading=false;
|
|
|
+ let blob = new Blob([res], {
|
|
|
+ type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
+ })
|
|
|
+ let downloadElement = document.createElement('a')
|
|
|
+ let href = window.URL.createObjectURL(blob) //创建下载的链接
|
|
|
+ downloadElement.href = href
|
|
|
+ downloadElement.download = `${this.dateRange[0].format('YYYY-MM-DD')}~${this.dateRange[1].format('YYYY-MM-DD')}销售报表.xlsx` //下载后文件名
|
|
|
+ document.body.appendChild(downloadElement)
|
|
|
+ downloadElement.click() //点击下载
|
|
|
+ document.body.removeChild(downloadElement) //下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href) //释放掉blob对象
|
|
|
+ })
|
|
|
+ },
|
|
|
showClick(record) {
|
|
|
this.visible = true
|
|
|
this.loadingChild = true
|