|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<avue-crud ref="crud" :page="page" :data="dataList" :option="tableOption" @on-load="getDataList">
|
|
|
<template slot="menuLeft">
|
|
|
- <el-button type="success" icon="el-icon-download" size="small">导出结果至Excel</el-button>
|
|
|
+ <el-button type="success" icon="el-icon-download" size="small" @click="exportToCSVFile">导出结果至Excel</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
</template>
|
|
@@ -11,6 +11,19 @@ import Vue from 'vue'
|
|
|
import { IPage } from '@/utils/vo'
|
|
|
import httpx from '@/utils/httpx'
|
|
|
import { tableOption } from "@/avue/crud/liveroomInviteStats"
|
|
|
+import datasheet2csv from "@/utils/datasheet2csv"
|
|
|
+import { download_blob } from "@/utils/index"
|
|
|
+import { datetime_format } from '@/utils/formatters'
|
|
|
+
|
|
|
+const getPages = (count: number) => {
|
|
|
+ return {
|
|
|
+ total: count,
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: count,
|
|
|
+ pageSizes: [count],
|
|
|
+ layout: '', //隐藏分页
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
export default Vue.extend({
|
|
|
props: {
|
|
@@ -21,12 +34,11 @@ export default Vue.extend({
|
|
|
data() {
|
|
|
return {
|
|
|
dataListLoading: false,
|
|
|
- page: {
|
|
|
- total: 0,
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 10,
|
|
|
- } as IPage,
|
|
|
- dataList: [],
|
|
|
+ page: getPages(10),
|
|
|
+ dataList: [] as {
|
|
|
+ manager_info: string,
|
|
|
+ count: number,
|
|
|
+ }[],
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -41,21 +53,30 @@ export default Vue.extend({
|
|
|
const [start, end] = this.daterange
|
|
|
|
|
|
this.dataListLoading = true
|
|
|
- httpx.post(httpx.makeurl('/rooms/queryConsultList'), {
|
|
|
- start,
|
|
|
- end,
|
|
|
+ httpx.post(httpx.makeurl('/rooms/invitesCountList'), {
|
|
|
+ startTime: start,
|
|
|
+ endTime: end,
|
|
|
roomId: this.roomId,
|
|
|
- limit: page?.pageSize || this.page.pageSize,
|
|
|
- page: page?.currentPage || this.page.currentPage,
|
|
|
}).then(({ data }) => {
|
|
|
- this.dataList = data.consultList
|
|
|
- this.page.total = data.total
|
|
|
+ this.dataList = data.invitesList
|
|
|
this.dataListLoading = false
|
|
|
+ this.page = getPages(data.invitesList.length)
|
|
|
if (done) {
|
|
|
done()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ exportToCSVFile() {
|
|
|
+ const blob = datasheet2csv(
|
|
|
+ this.dataList,
|
|
|
+ (v) => [v.manager_info, v.count],
|
|
|
+ ['客户经理信息', '有效邀约数量']
|
|
|
+ )
|
|
|
+ const start = datetime_format(this.daterange[0] as string, 'YYYY-MM-DD HH-mm-ss')
|
|
|
+ const end = datetime_format(this.daterange[1] as string, 'YYYY-MM-DD HH-mm-ss')
|
|
|
+ download_blob(blob, `客户邀约记录_${this.roomInfo.title}_${start}至${end}.csv`)
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
watch: {
|