Commit 41239978 by xinla

运营分析联调完结

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