Commit dc35c1fb by 姜鹏凯

场景统计

1 parent fe524ca1
...@@ -110,3 +110,42 @@ export function getResultDetail (params) { ...@@ -110,3 +110,42 @@ export function getResultDetail (params) {
params: params params: params
}) })
} }
// 场景分析 抬头数据
export function getSceneTotal () {
return request({
url: service + '/wecom/kf/statistic/scene/getAnalysis'
})
}
// 场景分析 数据趋势 客户总数/实时数据
export function getLineChartTotal (params) {
return request({
url: service + '/wecom/kf/statistic/scene/getRealCnt',
params
})
}
// 场景分析 访问场景 top5
export function getBarTop5Total (params) {
return request({
url: service + '/wecom/kf/statistic/scene/getRankCnt',
params
})
}
// 场景分析 数据报表
export function getTableTotal (params) {
return request({
url: service + '/wecom/kf/statistic/scene/getRealPageCnt',
params
})
}
// 场景分析 数据报表 导出
export function getTableExport (params) {
return request({
url: service + '/wecom/kf/statistic/scene/real/export',
params
})
}
\ No newline at end of file \ No newline at end of file
...@@ -8,19 +8,21 @@ ...@@ -8,19 +8,21 @@
</el-button-group> </el-button-group>
</div> </div>
<div class="item" v-if="active === 3"> <div class="item" v-if="active === 3">
<el-date-picker style="width: 250px;" size="mini" v-model="value" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> <el-date-picker style="width: 250px;" @change="setTime" size="mini" clearable v-model="value" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="item" v-if="showScene"> <div class="item" v-if="showScene">
<el-select size="mini" v-model="value2" placeholder="请选择场景"> <!-- <el-select size="mini" v-model="data." placeholder="请选择场景" clearable>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-option> </el-select> -->
<el-select size="mini" @change="submit()" v-model="data.scenes" clearable placeholder="请选择场景">
<el-option value="" label="全部场景"></el-option>
<el-option v-for="(data, index) in sceneList" :key="index" :value="data.id" :label="data.name"></el-option>
</el-select> </el-select>
</div> </div>
<div class="item" v-if="showMember"> <div class="item" v-if="showMember">
<el-select size="mini" v-model="value2" placeholder="请选择客服"> <el-select size="mini" v-model="value2" placeholder="请选择客服">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-option>
</el-select> </el-select>
</div> </div>
<div class="item" v-if="showMember"> <div class="item" v-if="showMember">
...@@ -32,16 +34,18 @@ ...@@ -32,16 +34,18 @@
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment'
import { getSceneList } from '@/api/drainageCode/customerService.js'
export default { export default {
name: 'search-title', name: 'search-title',
props: { props: {
showScene:{ showScene: {
type: Boolean, type: Boolean,
default: false default: false
}, },
showMember: { showMember: {
type: Boolean, type: Boolean,
default:false default: false
} }
}, },
data () { data () {
...@@ -49,13 +53,51 @@ ...@@ -49,13 +53,51 @@
active: 1, active: 1,
value: [], value: [],
options: [{ value: 10, label: '1123' }], options: [{ value: 10, label: '1123' }],
value2: '' value2: '',
data: {
scenes: '',
userIds: '',
beginTime: '',
endTime: ''
},
sceneList: []
} }
}, },
methods: { methods: {
submit () {
console.log(this.data)
this.$emit('search', this.data)
},
setTime (e) {
if (e) {
this.data.beginTime = moment(e[0]).format('YYYY-MM-DD')
this.data.endTime = moment(e[1]).format('YYYY-MM-DD')
} else {
this.data.beginTime = ''
this.data.endTime = ''
}
this.submit()
},
setType (type) { setType (type) {
this.active = type this.active = type
if (type === 1) {
const weekStart = moment().subtract(6, 'days').format('YYYY-MM-DD')
const weekEnd = moment().format('YYYY-MM-DD')
this.data.beginTime = weekStart
this.data.endTime = weekEnd
this.submit()
} else if (type === 2) {
this.data.endTime = moment().format("YYYY-MM-DD")
this.data.beginTime = moment().subtract(29, 'days').format("YYYY-MM-DD")
this.submit()
} }
},
},
created () {
getSceneList({ pageSize: 1000 }).then(dd => {
this.sceneList = dd.rows
})
this.setType(1)
} }
} }
</script> </script>
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</el-table-column> </el-table-column>
<el-table-column label="接待员工" align="center" min-width="100" prop="userName"> <el-table-column label="接待员工" align="center" min-width="100" prop="userName">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
{{row.receptionType === 1 ? userName: '-'}} {{row.receptionType === 1 ? row.userName: '-'}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="咨询开始时间" align="center" prop="sessionStartTime" width="180"></el-table-column> <el-table-column label="咨询开始时间" align="center" prop="sessionStartTime" width="180"></el-table-column>
...@@ -124,33 +124,13 @@ ...@@ -124,33 +124,13 @@
}, },
methods: { methods: {
showResultList (data) { showResultList (data) {
// getResultDetail({ openKfId: data.openKfId, externalUserId: data.externalUserId }).then(res => { getResultDetail({ openKfId: data.openKfId, externalUserId: data.externalUserId }).then(res => {
this.showPreviewDialog = true this.showPreviewDialog = true
this.detail = [{ this.detail = res.rows
"content": "string", this.detail.forEach(dd => {
"customerAvatar": "string", dd.content = JSON.parse(dd.content).content
"customerName": "string", })
"externalUserId": "string", })
"kfAvatar": "string",
"kfName": "string",
"msgId": "string",
"msgType": "string",
"openKfId": "string",
"origin": 3,
"sendTime": "2022-02-14T15:40:11.085Z"
}, {"content": "string",
"customerAvatar": "string",
"customerName": "string",
"externalUserId": "string",
"kfAvatar": "string",
"kfName": "string",
"msgId": "string",
"msgType": "string",
"openKfId": "string",
"origin": 5,
"sendTime": "2022-02-14T15:40:11.085Z"
},]
// })
}, },
exportFn () { exportFn () {
this.$confirm('确认导出吗?', '提示', { this.$confirm('确认导出吗?', '提示', {
......
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
数据概览 数据概览
</div> </div>
<div class="data-content"> <div class="data-content">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName" @tab-click="setTabs">
<el-tab-pane label="客户总数" name="first"> <el-tab-pane label="客户总数" name="first">
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="实时数据" name="second"> <el-tab-pane label="实时数据" name="second">
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div class="chart-content"> <div class="chart-content">
<search-title :showScene='true'></search-title> <search-title :showScene='true' @search="getLineData"></search-title>
<chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line> <chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line>
</div> </div>
</div> </div>
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
</div> </div>
<div class="data-content" style="margin-top: 20px;"> <div class="data-content" style="margin-top: 20px;">
<div class="chart-content"> <div class="chart-content">
<search-title></search-title> <search-title @search="getTop5Fn"></search-title>
<div class="column"> <div class="column">
<div class="column-item"> <div class="column-item">
<chart-bar style="height: 300px;" :legend="barLegend1"></chart-bar> <chart-bar style="height: 300px;" :xData="bar1" :series="value1" :legend="barLegend1"></chart-bar>
</div> </div>
<div class="column-item"> <div class="column-item">
<chart-bar style="height: 300px;" :legend="barLegend2"></chart-bar> <chart-bar style="height: 300px;" :xData="bar2" :series="value2" :legend="barLegend2"></chart-bar>
</div> </div>
</div> </div>
</div> </div>
...@@ -44,21 +44,21 @@ ...@@ -44,21 +44,21 @@
</div> </div>
<div class="data-content" style="margin-top: 20px;"> <div class="data-content" style="margin-top: 20px;">
<div class="search-content"> <div class="search-content">
<search-title :showScene='true'></search-title> <search-title :showScene='true' @search="getTableFn"></search-title>
<el-button type="primary" size="mini">导出Excel</el-button> <el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
</div> </div>
<div class="table-content"> <div class="table-content">
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange" style="width: 100%"> <el-table v-loading="loading" :data="tableList" style="width: 100%">
<el-table-column label="日期" align="center" min-width="100" prop="" show-overflow-tooltip /> <el-table-column label="日期" align="center" min-width="100" prop="xtime" show-overflow-tooltip />
<el-table-column label="访问客户总数" align="center" min-width="100" prop="" show-overflow-tooltip /> <el-table-column label="访问客户总数" align="center" min-width="100" prop="visitTotalCnt" show-overflow-tooltip />
<el-table-column label="咨询客户总数" align="center" prop="" min-width="100" show-overflow-tooltip></el-table-column> <el-table-column label="咨询客户总数" align="center" prop="consultTotalCnt" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="接待客户总数" align="center" prop="" min-width="100" show-overflow-tooltip></el-table-column> <el-table-column label="接待客户总数" align="center" prop="receptionTotalCnt" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="今日新增访问客户" align="center" prop="" min-width="100" show-overflow-tooltip></el-table-column> <el-table-column label="今日新增访问客户" align="center" prop=tdVisitCnt "" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="今日新增咨询客户" align="center" prop="" min-width="100" show-overflow-tooltip></el-table-column> <el-table-column label="今日新增咨询客户" align="center" prop="tdConsultCnt" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column label="今日新增接待客户" align="center" prop="" min-width="100" show-overflow-tooltip></el-table-column> <el-table-column label="今日新增接待客户" align="center" prop="tdReceptionCnt" min-width="100" show-overflow-tooltip></el-table-column>
</el-table> </el-table>
<!-- <div class="bottom"> --> <!-- <div class="bottom"> -->
<pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" /> <pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getTableChangeSize()" />
<!-- </div> --> <!-- </div> -->
</div> </div>
</div> </div>
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
import ChartLine from '@/components/ChartLine.vue' import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '../components/SearchTitle.vue' import SearchTitle from '../components/SearchTitle.vue'
import CardGroupIndex from '@/components/CardGroupIndex.vue' import CardGroupIndex from '@/components/CardGroupIndex.vue'
import { getTableExport, getTableTotal, getBarTop5Total, getLineChartTotal, getSceneTotal } from '@/api/drainageCode/customerService.js'
import { download } from '@/utils/common'
export default { export default {
name: 'scene-statistics-scene', name: 'scene-statistics-scene',
components: { components: {
...@@ -80,49 +82,50 @@ ...@@ -80,49 +82,50 @@
}, },
data () { data () {
return { return {
exportLoading: false,
barLegend1: ['访问客户总数'], barLegend1: ['访问客户总数'],
barLegend2: ['咨询客户总数'], barLegend2: ['咨询客户总数'],
legend: ['访问客户总数', '咨询客户总数', '接待客户总数'], legend: ['访问客户总数', '咨询客户总数', '接待客户总数'],
xdata: [12, 13, 14], xdata: [],
series: [[34, 35, 26], [22, 23, 33], [77, 57, 55]], series: [],
activeName: 'first', activeName: 'first',
cardData: [ cardData: [
{ {
title: '访问客户总数', title: '访问客户总数',
tips: '进入咨询页面的客户总数(包含重复)', tips: '进入咨询页面的客户总数(包含重复)',
value: 1234, value: 0,
noArrow: true noArrow: true
}, },
{ {
title: '咨询客户总数', title: '咨询客户总数',
tips: '发送咨询消息的客户总数(包含重复)', tips: '发送咨询消息的客户总数(包含重复)',
value: 12345, value: 0,
}, },
{ {
title: '接待客户总数', title: '接待客户总数',
tips: '人工客服接待的客户总数(包含重复)', tips: '人工客服接待的客户总数(包含重复)',
value: 1222453, value: 0,
}, },
{ {
title: '今日新增访问客户', title: '今日新增访问客户',
tips: '今日进入咨询页面的客户数(包含重复)', tips: '今日进入咨询页面的客户数(包含重复)',
value: 1222453, value: 0,
title1: '较前日', title1: '较前日',
value1: 344 value1: 0
}, },
{ {
title: '今日新增咨询客户', title: '今日新增咨询客户',
tips: '今日发送咨询消息的客户数(包含重复)', tips: '今日发送咨询消息的客户数(包含重复)',
value: 1222453, value: 0,
title1: '较前日', title1: '较前日',
value1: 344 value1: 0
}, },
{ {
title: '今日新增接待客户', title: '今日新增接待客户',
tips: '今日人工客服接待的客户数(包含重复)', tips: '今日人工客服接待的客户数(包含重复)',
value: 1222453, value: 0,
title1: '较前日', title1: '较前日',
value1: 344 value1: 0
} }
], ],
total: 0, total: 0,
...@@ -131,19 +134,131 @@ ...@@ -131,19 +134,131 @@
pageNum: 1 pageNum: 1
}, },
tableList: [], tableList: [],
loading: false loading: false,
searchData: {},
bar1: [],
bar2: [],
value1: [],
value2: [],
tableSearch: {}
} }
}, },
methods: { methods: {
handleSelectionChange () { exportFn () {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.exportLoading = true
return getTableExport(Object.assign({}, this.query, this.tableSearch))
})
.then((res) => {
console.log(res)
download(res.msg)
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.exportLoading = false
})
}, },
getList () { setTabs (e) {
this.getLineData(this.searchData)
},
getSceneTotalFn () {
getSceneTotal().then(res => {
this.cardData[0].value = res.data.visitCnt
this.cardData[1].value = res.data.consultCnt
this.cardData[2].value = res.data.receptionCnt
this.cardData[3].value = res.data.tdVisitCnt
this.cardData[3].value1 = res.data.ydVisitCnt
this.cardData[4].value = res.data.tdConsultCnt
this.cardData[4].value1 = res.data.ydConsultCnt
this.cardData[5].value = res.data.tdReceptionCnt
this.cardData[5].value1 = res.data.ydReceptionCnt
})
},
getLineData (data) {
this.searchData = data
if (this.activeName === 'first') {
this.legend = ['访问客户总数', '咨询客户总数', '接待客户总数']
} else {
this.legend = ['新增访问客户', '新增咨询客户', '新增接待客户']
}
this.$forceUpdate()
getLineChartTotal(data).then(res => {
this.xdata = []
this.series = []
let arr1 = []
let arr2 = []
let arr3 = []
if (this.activeName === 'first') {
if (res.data && res.data.length) {
res.data.forEach(dd => {
this.xdata.push(dd.xtime)
arr1.push(dd.visitTotalCnt)
arr2.push(dd.consultTotalCnt)
arr3.push(dd.receptionTotalCnt)
})
this.series = [arr1, arr2, arr3]
}
} else {
if (res.data && res.data.length) {
res.data.forEach(dd => {
this.xdata.push(dd.xtime)
arr1.push(dd.tdVisitCnt)
arr2.push(dd.tdConsultCnt)
arr3.push(dd.tdReceptionCnt)
})
this.series = [arr1, arr2, arr3]
}
}
})
},
getTop5Fn (data) {
getBarTop5Total(data).then(res => {
if (res.data.consult && res.data.consult.length) {
this.bar1 = []
this.value1 = []
res.data.consult.forEach(dd => {
this.bar1.push(dd.sceneName)
this.value1.push(dd.total)
})
}
if (res.data.visit && res.data.visit.length) {
this.bar2 = []
this.value2 = []
res.data.consult.forEach(dd => {
this.bar2.push(dd.sceneName)
this.value2.push(dd.total)
})
}
})
},
getTableChangeSize () {
this.loading = true
getTableTotal(Object.assign({}, this.query, this.tableSearch)).then(res => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
},
getTableFn (data) {
this.loading = true
this.tableSearch = data
getTableTotal(Object.assign({}, this.query, data)).then(res => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
} }
}, },
created () { created () {
this.getSceneTotalFn()
// this.getTop5Fn()
} }
} }
</script> </script>
...@@ -157,7 +272,7 @@ ...@@ -157,7 +272,7 @@
.title { .title {
font-size: 16px; font-size: 16px;
color: #333; color: #333;
font-weight: 500; font-weight: 600;
} }
.data-content { .data-content {
margin-top: 10px; margin-top: 10px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!