Commit 41239978 by xinla

运营分析联调完结

1 parent f5c16b09
...@@ -5,7 +5,7 @@ const service = window.CONFIG.services.system + window.CONFIG.services.wecom + ' ...@@ -5,7 +5,7 @@ const service = window.CONFIG.services.system + window.CONFIG.services.wecom + '
* 会话分析-客户联系总数 * 会话分析-客户联系总数
* @param {*} params * @param {*} params
*/ */
export function getAnalysisCustomer () { export function getAnalysisCustomer() {
return request({ return request({
url: service + '/customer/getAnalysis' url: service + '/customer/getAnalysis'
}) })
...@@ -19,9 +19,9 @@ userIds 否[]员工 ...@@ -19,9 +19,9 @@ userIds 否[]员工
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getTotalCntCustomer (params) { export function getTotalCntCustomer(params) {
return request({ return request({
url: service + '/customer/getTotalCnt', url: service + '/customer/getTotalPageCnt',
params params
}) })
} }
...@@ -34,7 +34,7 @@ userIds 否[]员工 ...@@ -34,7 +34,7 @@ userIds 否[]员工
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getUserAvgReplyTimeRank (params) { export function getUserAvgReplyTimeRank(params) {
return request({ return request({
url: service + '/customer/getUserAvgReplyTimeRank', url: service + '/customer/getUserAvgReplyTimeRank',
params params
...@@ -49,7 +49,7 @@ userIds 否[]员工 ...@@ -49,7 +49,7 @@ userIds 否[]员工
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getUserChatRank (params) { export function getUserChatRank(params) {
return request({ return request({
url: service + '/customer/getUserChatRank', url: service + '/customer/getUserChatRank',
params params
...@@ -64,7 +64,7 @@ userIds 否[]员工 ...@@ -64,7 +64,7 @@ userIds 否[]员工
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function dataExportGroup (params) { export function dataExportGroup(params) {
return request({ return request({
url: service + '/customer/total/export', url: service + '/customer/total/export',
params params
...@@ -74,7 +74,7 @@ export function dataExportGroup (params) { ...@@ -74,7 +74,7 @@ export function dataExportGroup (params) {
/** /**
* 会话分析-客群联系总数 * 会话分析-客群联系总数
*/ */
export function getAnalysisGroup () { export function getAnalysisGroup() {
return request({ return request({
url: service + '/group/getAnalysis' url: service + '/group/getAnalysis'
}) })
...@@ -88,9 +88,9 @@ userIds 否[]员工 ...@@ -88,9 +88,9 @@ userIds 否[]员工
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getTotalCntGroup (params) { export function getTotalCntGroup(params) {
return request({ return request({
url: service + '/group/getTotalCnt', url: service + '/group/getTotalPageCnt',
params params
}) })
} }
...@@ -103,7 +103,7 @@ userIds 否[]员工 ...@@ -103,7 +103,7 @@ userIds 否[]员工
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function realDataExportGroup (params) { export function realDataExportGroup(params) {
return request({ return request({
url: service + '/group/real/export', url: service + '/group/real/export',
params params
......
...@@ -4,7 +4,7 @@ const service = window.CONFIG.services.system + window.CONFIG.services.wecom + ' ...@@ -4,7 +4,7 @@ const service = window.CONFIG.services.system + window.CONFIG.services.wecom + '
/** /**
* 客群数据分析 * 客群数据分析
*/ */
export function getAnalysis () { export function getAnalysis() {
return request({ return request({
url: service + '/getAnalysis' url: service + '/getAnalysis'
}) })
...@@ -18,7 +18,7 @@ ownerIds 否[]群主id ...@@ -18,7 +18,7 @@ ownerIds 否[]群主id
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getTotalCnt (params) { export function getTotalCnt(params) {
return request({ return request({
url: service + '/getTotalCnt', url: service + '/getTotalCnt',
params params
...@@ -33,7 +33,7 @@ ownerIds 否[]群主id ...@@ -33,7 +33,7 @@ ownerIds 否[]群主id
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getTotalCntMember (params) { export function getTotalCntMember(params) {
return request({ return request({
url: service + '/member/getTotalCnt', url: service + '/member/getTotalCnt',
params params
...@@ -48,9 +48,9 @@ ownerIds 否[]群主id ...@@ -48,9 +48,9 @@ ownerIds 否[]群主id
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getRealCnt (params) { export function getRealCnt(params) {
return request({ return request({
url: service + '/getRealCnt', url: service + '/getGroupRealPageCnt',
params params
}) })
} }
...@@ -63,9 +63,9 @@ ownerIds 否[]群主id ...@@ -63,9 +63,9 @@ ownerIds 否[]群主id
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function getRealCntMember (params) { export function getRealCntMember(params) {
return request({ return request({
url: service + '/member/getRealCnt', url: service + '/member/getGroupMemberRealPageCnt',
params params
}) })
} }
...@@ -78,7 +78,7 @@ ownerIds 否[]群主id ...@@ -78,7 +78,7 @@ ownerIds 否[]群主id
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function realDataExport (params) { export function realDataExport(params) {
return request({ return request({
url: service + '/real/export', url: service + '/real/export',
params params
...@@ -93,7 +93,7 @@ ownerIds 否[]群主id ...@@ -93,7 +93,7 @@ ownerIds 否[]群主id
beginTime 是 开始时间 beginTime 是 开始时间
endTime 是 结束时间 endTime 是 结束时间
*/ */
export function realDataExportMember (params) { export function realDataExportMember(params) {
return request({ return request({
url: service + '/member/real/export', url: service + '/member/real/export',
params params
......
...@@ -121,11 +121,11 @@ export default { ...@@ -121,11 +121,11 @@ export default {
} }
.descend { .descend {
color: #ff0000; color: green;
} }
.ascend { .ascend {
color: green; color: red;
} }
} }
</style> </style>
...@@ -151,11 +151,11 @@ export default { ...@@ -151,11 +151,11 @@ export default {
// } // }
x: 'center', x: 'center',
y: 'bottom', y: 'bottom',
selectedMode: false, // selectedMode: false,
type: 'scroll', // 分页类型 type: 'scroll', // 分页类型
icon: 'circle', icon: 'line',
itemWidth: 8, itemWidth: 16,
itemHeight: 8, // itemHeight: 8,
tooltip: { tooltip: {
show: true show: true
}, },
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// import * as customerApi from '@/api/operateCenter/customerAnalysis' // import * as customerApi from '@/api/operateCenter/customerAnalysis'
// import * as groupApi from '@/api/operateCenter/groupAnalysis' // import * as groupApi from '@/api/operateCenter/groupAnalysis'
// import * as conversationApi from '@/api/operateCenter/conversationAnalysis' // import * as conversationApi from '@/api/operateCenter/conversationAnalysis'
import { getList as getGroupList } from '@/api/customer/group'
export default { export default {
name: '', name: '',
components: { components: {
...@@ -58,8 +59,6 @@ export default { ...@@ -58,8 +59,6 @@ export default {
beginTime: undefined, beginTime: undefined,
endTime: undefined endTime: undefined
}, },
// 群主
groupOwners: [],
// 群聊 // 群聊
groupChats: [], groupChats: [],
tableProps: { tableProps: {
...@@ -110,8 +109,7 @@ export default { ...@@ -110,8 +109,7 @@ export default {
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
// this.getSelectList('groupOwners') this.getGroupList()
// this.getSelectList('groupChats')
this.setTime(7) this.setTime(7)
}, },
mounted() {}, mounted() {},
...@@ -151,8 +149,11 @@ export default { ...@@ -151,8 +149,11 @@ export default {
this.request(this.query) this.request(this.query)
.then(({ rows, total, data }) => { .then(({ rows, total, data }) => {
this.series = []
data = data || rows data = data || rows
if (this.type.includes('Chart')) { if (this.type.includes('Chart')) {
// (条形图)
this.xData = data.map((e) => e.xtime) this.xData = data.map((e) => e.xtime)
if ( if (
...@@ -160,7 +161,7 @@ export default { ...@@ -160,7 +161,7 @@ export default {
this.type this.type
) )
) { ) {
// 客户总数 // 客户总数 / 客群总数 / 客群成员总数 (条形图)
this.series = data.map((e) => e.totalCnt) this.series = data.map((e) => e.totalCnt)
} else if (this.type === 'realDataChart') { } else if (this.type === 'realDataChart') {
// 实时数据 // 实时数据
...@@ -181,10 +182,12 @@ export default { ...@@ -181,10 +182,12 @@ export default {
this.series = data.map((e) => e[dict[this.type]]) this.series = data.map((e) => e[dict[this.type]])
} }
} else if (this.type === 'staffCustomerBar') { } else if (this.type === 'staffCustomerBar') {
// 柱状图
// 员工客户Top10 // 员工客户Top10
this.xData = data.map((e) => e.userName) this.xData = data.map((e) => e.userName)
this.series = data.map((e) => e.totalCnt) this.series = data.map((e) => e.totalCnt)
} else if (this.type.includes('Table')) { } else if (this.type.includes('Table')) {
// 表格
this.list = data this.list = data
this.total = Number(total) this.total = Number(total)
} }
...@@ -196,10 +199,10 @@ export default { ...@@ -196,10 +199,10 @@ export default {
this.loading = false this.loading = false
}) })
}, },
getSelectList(type) { getGroupList() {
getList() getGroupList()
.then(({ rows }) => { .then(({ rows }) => {
this[type] = rows this.groupChats = rows
}) })
.catch(() => {}) .catch(() => {})
}, },
...@@ -235,6 +238,7 @@ export default { ...@@ -235,6 +238,7 @@ export default {
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
this.loading = true
let query = Object.assign({}, this.query, { pageNum: undefined, pageSize: undefined }) let query = Object.assign({}, this.query, { pageNum: undefined, pageSize: undefined })
return this.requestExport(query) return this.requestExport(query)
}) })
...@@ -244,6 +248,9 @@ export default { ...@@ -244,6 +248,9 @@ export default {
.catch((error) => { .catch((error) => {
console.error(error) console.error(error)
}) })
.finally(() => {
this.loading = false
})
} }
} }
} }
...@@ -253,20 +260,13 @@ export default { ...@@ -253,20 +260,13 @@ export default {
<div> <div>
<div class="operation"> <div class="operation">
<el-button-group> <el-button-group>
<el-button size="small" type="primary" :plain="timeRange != 7" @click="setTime(7)" <el-button type="primary" :plain="timeRange != 7" @click="setTime(7)">近一周</el-button>
>近一周</el-button <el-button type="primary" :plain="timeRange != 30" @click="setTime(30)">近一月 </el-button>
> <el-button type="primary" :plain="!!timeRange" @click="setTime()">自定义 </el-button>
<el-button size="small" type="primary" :plain="timeRange != 30" @click="setTime(30)"
>近一月
</el-button>
<el-button size="small" type="primary" :plain="!!timeRange" @click="setTime()"
>自定义
</el-button>
</el-button-group> </el-button-group>
<el-date-picker <el-date-picker
v-if="!timeRange" v-if="!timeRange"
v-model="dateRange" v-model="dateRange"
size="small"
class="ml20" class="ml20"
style="width: 260px" style="width: 260px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
...@@ -285,20 +285,19 @@ export default { ...@@ -285,20 +285,19 @@ export default {
readonly readonly
@focus="showDialog('_groupOwners')" @focus="showDialog('_groupOwners')"
placeholder="请选择群主" placeholder="请选择群主"
@change="getList(1)"
> >
</el-input> </el-input>
<el-select <el-select
v-if="['customerGroupMemberTotalChart', 'customerGroupMemberTotalTable'].includes(type)" v-if="['customerGroupMemberTotalChart', 'customerGroupMemberTotalTable'].includes(type)"
v-model="query.group" v-model="query.chatIds"
placeholder="请选择群聊" placeholder="请选择群聊"
@change="getList(1)" @change="getList(1)"
> >
<el-option <el-option
v-for="item in groupChats" v-for="item in groupChats"
:key="item.value" :key="item.chatId"
:label="item.label" :label="item.groupName"
:value="item.value" :value="item.chatId"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -316,7 +315,6 @@ export default { ...@@ -316,7 +315,6 @@ export default {
readonly readonly
@focus="showDialog('_users')" @focus="showDialog('_users')"
placeholder="请选择部门或员工" placeholder="请选择部门或员工"
@change="getList(1)"
/> />
<el-button v-if="type.includes('Table')" class="fr" type="primary" @click="exprotTable" <el-button v-if="type.includes('Table')" class="fr" type="primary" @click="exprotTable"
>导出 Excel</el-button >导出 Excel</el-button
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
import ChartBar from '@/components/ChartBar' import ChartBar from '@/components/ChartBar'
import ChartLine from '@/components/ChartLine' import ChartLine from '@/components/ChartLine'
import SelectUser from '@/components/SelectUser' import SelectUser from '@/components/SelectUser'
import { getList } from '@/api/drainageCode/staff' import { getRealCnt, getRealCntMember } from '@/api/operateCenter/groupAnalysis'
import { getList as getGroupList } from '@/api/customer/group'
export default { export default {
name: '', name: '',
components: { ChartLine, ChartBar, SelectUser }, components: { ChartLine, ChartBar, SelectUser },
...@@ -16,87 +17,82 @@ export default { ...@@ -16,87 +17,82 @@ export default {
return { return {
loading: false, loading: false,
timeRange: 7, timeRange: 7,
total: 0,
// 表格数据
list: [
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
}
],
xData: [],
series: [],
legend: {
customerGroup: ['新增客群数', '解散客群数'],
customerGroupMember: ['新增客群成员数', '流失客群成员数']
},
// 日期范围 // 日期范围
dateRange: [], dateRange: [],
dialogVisible: false,
dialogType: '_users',
// 群聊
groupChats: [],
// 查询参数 // 查询参数
query: { query: {
group: '', chatIds: '',
ownerIds: '',
beginTime: undefined, beginTime: undefined,
endTime: undefined endTime: undefined
}, },
// 群主 legend: {
groupOwners: [], customerGroup: ['新增客群数', '解散客群数'],
// 群聊 customerGroupMember: ['新增客群成员数', '流失客群成员数']
groupChats: [] },
// 选择人员
selectUsers: {
customerGroup: [],
customerGroupMember: []
},
customerGroup: {
xData: [],
series: []
},
customerGroupMember: {
xData: [],
series: []
}
} }
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
// this.getSelectList('groupOwners') this.getGroupList()
// this.getSelectList('groupChats')
this.setTime(7) this.setTime(7)
}, },
mounted() {}, mounted() {},
methods: { methods: {
getList(page) { getList(type) {
this.query.beginTime = this.dateRange && this.dateRange[0] this.query.beginTime = this.dateRange && this.dateRange[0]
this.query.endTime = this.dateRange && this.dateRange[1] this.query.endTime = this.dateRange && this.dateRange[1]
this.loading = true let selectUsers = this.selectUsers[type]
page && (this.query.pageNum = page) if (Array.isArray(selectUsers)) {
this.query.ownerIds = selectUsers.map((e) => e.userId).join(',')
} else {
this.query.ownerIds = ''
}
this.xData = this.list.map((e) => e.time) this.loading = true
this.legend['customerGroup'].forEach((element) => { let api = { customerGroup: getRealCnt, customerGroupMember: getRealCntMember }
this.series.push(this.list.map((e) => e.num)) api[type](this.query)
}) .then(({ rows }) => {
this[type].series = []
// getList(this.query) this[type].xData = rows.map((e) => e.xtime)
// .then(({ rows, total }) => { this[type].series.push(rows.map((e) => e.addCnt))
// this.list = rows type === 'customerGroup' && this[type].series.push(rows.map((e) => e.dissolveCnt))
// this.total = Number(total) type === 'customerGroupMember' && this[type].series.push(rows.map((e) => e.quitCnt))
// this.loading = false })
// }) .catch((error) => {
// .catch(() => { console.error(error)
// this.loading = false })
// }) .finally(() => {
this.loading = false
})
}, },
getSelectList(type) { getGroupList() {
getList() getGroupList()
.then(({ rows }) => { .then(({ rows }) => {
this[type] = rows this.groupChats = rows
})
.catch((e) => {
console.error(e)
}) })
.catch(() => {})
}, },
getTime(datePar) { getTime(datePar) {
const d = datePar ? new Date(datePar) : new Date() const d = datePar ? new Date(datePar) : new Date()
...@@ -109,18 +105,20 @@ export default { ...@@ -109,18 +105,20 @@ export default {
let date = new Date() let date = new Date()
date.setDate(date.getDate() - days) date.setDate(date.getDate() - days)
this.dateRange = [this.getTime(date), this.getTime()] this.dateRange = [this.getTime(date), this.getTime()]
this.getList() this.getList('customerGroup')
this.getList('customerGroupMember')
} else { } else {
this.dateRange = null this.dateRange = null
} }
}, },
showDialog(type) {
this.dialogType = type
this.dialogVisible = true
},
getSelectUser(data) { getSelectUser(data) {
this.userArray = data this.selectUsers[this.dialogType] = data
this.query.qrUserName = this.userArray this.query[this.dialogType] = data.map((e) => e.name).join(',')
.map(function (obj, index) { this.getList(this.dialogType)
return obj.name
})
.join(',')
} }
} }
} }
...@@ -152,64 +150,68 @@ export default { ...@@ -152,64 +150,68 @@ export default {
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@change="getList" @change="
></el-date-picker> getList('customerGroup')
<el-select getList('customerGroupMember')
v-if="
[
'customerGroupTotalChart',
'customerGroupMemberTotalChart',
'customerGroupTotalTable',
'customerGroupMemberTotalTable'
].includes(type)
" "
v-model="query.group" ></el-date-picker>
placeholder="请选择群主"
@change="getList"
>
<el-option
v-for="item in groupOwners"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-if="['customerGroupMemberTotalChart', 'customerGroupMemberTotalTable'].includes(type)"
v-model="query.group"
placeholder="请选择群聊"
@change="getList"
>
<el-option
v-for="item in groupChats"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-input
v-if="['customerTotalChart', 'realDataChart'].includes(type)"
style="width: 180px"
:value="query.qrUserName"
readonly
@focus="dialogVisible = true"
placeholder="请选择员工"
/>
</div> </div>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="12"> <el-col :span="12">
<ChartLine :xData="xData" :legend="legend['customerGroup']" :series="series"></ChartLine> <div>
<el-input
style="width: 180px"
v-model="query.customerGroup"
readonly
@focus="showDialog('customerGroup')"
placeholder="请选择群主"
@change="getList(1)"
/>
</div>
<ChartLine
:xData="customerGroup.xData"
:legend="legend['customerGroup']"
:series="customerGroup.series"
></ChartLine>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<div>
<el-input
style="width: 180px"
v-model="query.customerGroupMember"
readonly
@focus="showDialog('customerGroupMember')"
placeholder="请选择群主"
/>
<el-select
v-model="query.chatIds"
placeholder="请选择群聊"
@change="getList('customerGroupMember')"
>
<el-option
v-for="item in groupChats"
:key="item.chatId"
:label="item.groupName"
:value="item.chatId"
>
</el-option>
</el-select>
</div>
<ChartLine <ChartLine
:xData="xData" :xData="customerGroupMember.xData"
:legend="legend['customerGroupMember']" :legend="legend['customerGroupMember']"
:series="series" :series="customerGroupMember.series"
></ChartLine> ></ChartLine>
</el-col> </el-col>
</el-row> </el-row>
<SelectUser
:visible.sync="dialogVisible"
title="组织架构"
:defaultValues="selectUsers[dialogType]"
@success="getSelectUser"
:isOnlyLeaf="true"
></SelectUser>
</div> </div>
</template> </template>
......
...@@ -50,8 +50,7 @@ export default { ...@@ -50,8 +50,7 @@ export default {
tips: '企业员工发送过消息的单聊数量', tips: '企业员工发送过消息的单聊数量',
value: data.ydChatCnt, value: data.ydChatCnt,
title1: '较前日', title1: '较前日',
value1: data.bydChatCnt, value1: data.bydChatCnt
noArrow: true
}, },
{ {
title: '昨日发送消息数', title: '昨日发送消息数',
...@@ -114,7 +113,7 @@ export default { ...@@ -114,7 +113,7 @@ export default {
<TabContent <TabContent
type="customerContactTable" type="customerContactTable"
:request="api.getTotalCntCustomer" :request="api.getTotalCntCustomer"
:requestExport="api.realDataExport" :requestExport="api.dataExportGroup"
></TabContent> ></TabContent>
</div> </div>
</div> </div>
......
...@@ -42,22 +42,21 @@ export default { ...@@ -42,22 +42,21 @@ export default {
this.cardData = [ this.cardData = [
{ {
title: '昨日群聊总数', title: '昨日群聊总数',
tips: '企业员工全部客户数量(包含重复)', tips: '企业员工的客户群中有过聊天的数量',
value: data.ydChatTotal, value: data.ydChatTotal,
title1: '较前日', title1: '较前日',
value1: data.bydChatTotal, value1: data.bydChatTotal
noArrow: true
}, },
{ {
title: '昨日群聊消息数', title: '昨日群聊消息数',
tips: '企业员工今日添加的客户数(包含重复及已流失)', tips: '企业员工的客户群中的消息数量',
value: data.ydMsgTotal, value: data.ydMsgTotal,
title1: '较前日', title1: '较前日',
value1: data.bydMsgTotal value1: data.bydMsgTotal
}, },
{ {
title: '昨日发送消息群成员数', title: '昨日发送消息群成员数',
tips: '今日删除企业员工的客户数', tips: '在客户群中发过消息的群成员的数量,包含企业员工',
value: data.ydMemberHasMsg, value: data.ydMemberHasMsg,
title1: '较前日', title1: '较前日',
value1: data.bydMemberHasMsg value1: data.bydMemberHasMsg
...@@ -94,7 +93,11 @@ export default { ...@@ -94,7 +93,11 @@ export default {
<div> <div>
<div>数据报表</div> <div>数据报表</div>
<TabContent type="customerGroupContactTable" :request="api.getTotalCntGroup"></TabContent> <TabContent
type="customerGroupContactTable"
:request="api.getTotalCntGroup"
:requestExport="api.realDataExportGroup"
></TabContent>
</div> </div>
</div> </div>
</template> </template>
......
<script> <script>
import ChartBar from '@/components/ChartBar' import ChartBar from '@/components/ChartBar'
import SelectUser from '@/components/SelectUser' import { getUserChatRank, getUserAvgReplyTimeRank } from '@/api/operateCenter/conversationAnalysis'
import { getList } from '@/api/drainageCode/staff'
export default { export default {
name: '', name: '',
components: { ChartBar, SelectUser }, components: { ChartBar },
props: { props: {
type: { type: {
type: String, type: String,
...@@ -15,87 +14,59 @@ export default { ...@@ -15,87 +14,59 @@ export default {
return { return {
loading: false, loading: false,
timeRange: 7, timeRange: 7,
total: 0,
// 表格数据
list: [
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
},
{
time: '2021-12-01',
num: 120
}
],
xData: [],
series: [],
legend: { legend: {
customerGroup: ['员工单聊数'], num: ['员工单聊数'],
customerGroupMember: ['平均首次回复时长'] time: ['平均首次回复时长']
}, },
// 日期范围 // 日期范围
dateRange: [], dateRange: [],
// 查询参数 // 查询参数
query: { query: {
group: '',
beginTime: undefined, beginTime: undefined,
endTime: undefined endTime: undefined
}, },
// 群主 num: {
groupOwners: [], xData: [],
// 群聊 series: []
groupChats: [] },
time: {
xData: [],
series: []
}
} }
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
// this.getSelectList('groupOwners')
// this.getSelectList('groupChats')
this.setTime(7) this.setTime(7)
}, },
mounted() {}, mounted() {},
methods: { methods: {
getList(page) { getList() {
this.query.beginTime = this.dateRange && this.dateRange[0] this.query.beginTime = this.dateRange && this.dateRange[0]
this.query.endTime = this.dateRange && this.dateRange[1] this.query.endTime = this.dateRange && this.dateRange[1]
this.loading = true this.loading = true
page && (this.query.pageNum = page)
this.xData = this.list.map((e) => e.time)
this.legend['customerGroup'].forEach((element) => {
this.series.push(this.list.map((e) => e.num))
})
// getList(this.query) getUserChatRank(this.query)
// .then(({ rows, total }) => { .then(({ rows }) => {
// this.list = rows this.num.series = rows.map((e) => e.chatCnt)
// this.total = Number(total) this.num.xData = rows.map((e) => e.userName)
// this.loading = false })
// }) .catch((e) => {
// .catch(() => { console.error(e)
// this.loading = false })
// }) getUserAvgReplyTimeRank(this.query)
},
getSelectList(type) {
getList()
.then(({ rows }) => { .then(({ rows }) => {
this[type] = rows this.time.series = rows.map((e) => e.avgReplyTime)
this.time.xData = rows.map((e) => e.userName)
this.loading = false
})
.catch((e) => {
console.error(e)
})
.finally(() => {
this.loading = false
}) })
.catch(() => {})
}, },
getTime(datePar) { getTime(datePar) {
const d = datePar ? new Date(datePar) : new Date() const d = datePar ? new Date(datePar) : new Date()
...@@ -112,14 +83,6 @@ export default { ...@@ -112,14 +83,6 @@ export default {
} else { } else {
this.dateRange = null this.dateRange = null
} }
},
getSelectUser(data) {
this.userArray = data
this.query.qrUserName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
} }
} }
} }
...@@ -129,20 +92,13 @@ export default { ...@@ -129,20 +92,13 @@ export default {
<div> <div>
<div class="operation"> <div class="operation">
<el-button-group> <el-button-group>
<el-button size="small" type="primary" :plain="timeRange != 7" @click="setTime(7)" <el-button type="primary" :plain="timeRange != 7" @click="setTime(7)">近一周</el-button>
>近一周</el-button <el-button type="primary" :plain="timeRange != 30" @click="setTime(30)">近一月 </el-button>
> <el-button type="primary" :plain="!!timeRange" @click="setTime()">自定义 </el-button>
<el-button size="small" type="primary" :plain="timeRange != 30" @click="setTime(30)"
>近一月
</el-button>
<el-button size="small" type="primary" :plain="!!timeRange" @click="setTime()"
>自定义
</el-button>
</el-button-group> </el-button-group>
<el-date-picker <el-date-picker
v-if="!timeRange" v-if="!timeRange"
v-model="dateRange" v-model="dateRange"
size="small"
class="ml20" class="ml20"
style="width: 260px" style="width: 260px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
...@@ -153,61 +109,18 @@ export default { ...@@ -153,61 +109,18 @@ export default {
end-placeholder="结束日期" end-placeholder="结束日期"
@change="getList" @change="getList"
></el-date-picker> ></el-date-picker>
<el-select
v-if="
[
'customerGroupTotalChart',
'customerGroupMemberTotalChart',
'customerGroupTotalTable',
'customerGroupMemberTotalTable'
].includes(type)
"
v-model="query.group"
placeholder="请选择群主"
@change="getList"
>
<el-option
v-for="item in groupOwners"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-select
v-if="['customerGroupMemberTotalChart', 'customerGroupMemberTotalTable'].includes(type)"
v-model="query.group"
placeholder="请选择群聊"
@change="getList"
>
<el-option
v-for="item in groupChats"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-input
v-if="['customerTotalChart', 'realDataChart'].includes(type)"
style="width: 180px"
:value="query.qrUserName"
readonly
@focus="dialogVisible = true"
placeholder="请选择员工"
/>
</div> </div>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="12"> <el-col :span="12">
<ChartBar :xData="xData" :legend="legend['customerGroup']" :series="series"></ChartBar> <ChartBar :xData="num.xData" :legend="legend.num" :series="num.series"></ChartBar>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<ChartBar <ChartBar
:legend="legend['customerGroupMember']" :legend="legend.time"
:series="series" :series="time.series"
:option="{ :option="{
xAxis: [{ type: 'value' }], xAxis: [{ type: 'value' }],
yAxis: [{ type: 'category', data: [1, 2, 3, 4, 5] }] yAxis: [{ type: 'category', data: time.xData }]
}" }"
></ChartBar> ></ChartBar>
</el-col> </el-col>
......
...@@ -117,12 +117,17 @@ export default { ...@@ -117,12 +117,17 @@ export default {
<div>数据报表</div> <div>数据报表</div>
<el-tabs v-model="activeSheet"> <el-tabs v-model="activeSheet">
<el-tab-pane label="客群总数"> <el-tab-pane label="客群总数">
<TabContent type="customerGroupTotalTable" :request="api.getRealCnt"></TabContent> <TabContent
type="customerGroupTotalTable"
:request="api.getRealCnt"
:requestExport="api.realDataExport"
></TabContent>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="客群成员总数"> <el-tab-pane label="客群成员总数">
<TabContent <TabContent
type="customerGroupMemberTotalTable" type="customerGroupMemberTotalTable"
:request="api.getRealCntMember" :request="api.getRealCntMember"
:requestExport="api.realDataExportMember"
></TabContent> ></TabContent>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!