|
@@ -1,7 +1,10 @@
|
|
<template>
|
|
<template>
|
|
<avue-crud ref="crud" :page="page" :data="dataList" :option="tableOption" @on-load="getDataList">
|
|
<avue-crud ref="crud" :page="page" :data="dataList" :option="tableOption" @on-load="getDataList">
|
|
<template slot="menuLeft">
|
|
<template slot="menuLeft">
|
|
- <el-button type="success" icon="el-icon-download" size="small">导出结果至Excel</el-button>
|
|
|
|
|
|
+ <div style="display:flex; flex-direction: row; align-items: center;">
|
|
|
|
+ <el-button type="success" icon="el-icon-download" size="small" @click="exportToCSVFile">导出结果至Excel</el-button>
|
|
|
|
+ <div style="padding-left: 1em; color: grey;font-size: small;">共有 {{ page.total }} 条记录</div>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
</avue-crud>
|
|
</avue-crud>
|
|
</template>
|
|
</template>
|
|
@@ -11,6 +14,20 @@ import Vue from 'vue'
|
|
import { IPage } from '@/utils/vo'
|
|
import { IPage } from '@/utils/vo'
|
|
import httpx from '@/utils/httpx'
|
|
import httpx from '@/utils/httpx'
|
|
import { tableOption } from "@/avue/crud/liveroomInvite"
|
|
import { tableOption } from "@/avue/crud/liveroomInvite"
|
|
|
|
+import datasheet2csv from "@/utils/datasheet2csv"
|
|
|
|
+import { download_blob } from "@/utils/index"
|
|
|
|
+import { datetime_format } from '@/utils/formatters'
|
|
|
|
+
|
|
|
|
+interface InvitationInfo {
|
|
|
|
+ user_info: string
|
|
|
|
+ created_at: string,
|
|
|
|
+ manager_info: string,
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+interface ApiReturn {
|
|
|
|
+ invitesList: InvitationInfo[],
|
|
|
|
+ total: number
|
|
|
|
+}
|
|
|
|
|
|
export default Vue.extend({
|
|
export default Vue.extend({
|
|
props: {
|
|
props: {
|
|
@@ -26,7 +43,7 @@ export default Vue.extend({
|
|
currentPage: 1,
|
|
currentPage: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
} as IPage,
|
|
} as IPage,
|
|
- dataList: [],
|
|
|
|
|
|
+ dataList: [] as InvitationInfo[],
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -41,14 +58,14 @@ export default Vue.extend({
|
|
const [start, end] = this.daterange
|
|
const [start, end] = this.daterange
|
|
|
|
|
|
this.dataListLoading = true
|
|
this.dataListLoading = true
|
|
- httpx.post(httpx.makeurl('/rooms/queryConsultList'), {
|
|
|
|
- start,
|
|
|
|
- end,
|
|
|
|
|
|
+ httpx.post(httpx.makeurl('/rooms/queryInvitesList'), {
|
|
|
|
+ startTime: start,
|
|
|
|
+ endTime: end,
|
|
roomId: this.roomId,
|
|
roomId: this.roomId,
|
|
limit: page?.pageSize || this.page.pageSize,
|
|
limit: page?.pageSize || this.page.pageSize,
|
|
page: page?.currentPage || this.page.currentPage,
|
|
page: page?.currentPage || this.page.currentPage,
|
|
- }).then(({ data }) => {
|
|
|
|
- this.dataList = data.consultList
|
|
|
|
|
|
+ }).then(({ data }: { data: ApiReturn }) => {
|
|
|
|
+ this.dataList = data.invitesList
|
|
this.page.total = data.total
|
|
this.page.total = data.total
|
|
this.dataListLoading = false
|
|
this.dataListLoading = false
|
|
if (done) {
|
|
if (done) {
|
|
@@ -57,6 +74,39 @@ export default Vue.extend({
|
|
this.$message.success({ message: "加载成功", duration: 700 })
|
|
this.$message.success({ message: "加载成功", duration: 700 })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ exportToCSVFile() {
|
|
|
|
+ const loading = this.$loading({
|
|
|
|
+ lock: true,
|
|
|
|
+ text: '正在导出数据',
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
+ background: 'rgba(255,255,255,0.75)'
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 获取指定时间范围内的所有数据
|
|
|
|
+ return httpx.post(
|
|
|
|
+ httpx.makeurl('/rooms/queryInvitesList'),
|
|
|
|
+ {
|
|
|
|
+ startTime: this.daterange[0],
|
|
|
|
+ endTime: this.daterange[1],
|
|
|
|
+ roomId: this.roomId,
|
|
|
|
+ limit: 0, // limit为0时后端会返回全部数据
|
|
|
|
+ page: 1,
|
|
|
|
+ }
|
|
|
|
+ ).then(({ data }: { data: ApiReturn }) => {
|
|
|
|
+ const blob = datasheet2csv(
|
|
|
|
+ data.invitesList,
|
|
|
|
+ (v) => [v.user_info, v.manager_info, datetime_format(v.created_at)],
|
|
|
|
+ ['受邀客户手机号', '邀约客户经理信息', '进入直播间时间']
|
|
|
|
+ )
|
|
|
|
+ const start = (this.daterange[0] as string).replaceAll(':', "-")
|
|
|
|
+ const end = (this.daterange[1] as string).replaceAll(':', "-")
|
|
|
|
+ download_blob(blob, `客户邀约记录_${this.roomInfo.title}_${start}至${end}.csv`)
|
|
|
|
+ this.$message.success({ message: "导出完成", duration: 1500 })
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ loading.close()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
},
|
|
},
|
|
|
|
|
|
watch: {
|
|
watch: {
|