Commit e253ac8b by xinla

客户联系,客群联系,会话存档ui

1 parent d1779481
...@@ -60,14 +60,14 @@ export default { ...@@ -60,14 +60,14 @@ export default {
<li v-for="(row, index) in data" :key="index" class="card-index-li"> <li v-for="(row, index) in data" :key="index" class="card-index-li">
<div class="mb5 label"> <div class="mb5 label">
<span>{{ row[defaultProps.title] }}</span> <span>{{ row[defaultProps.title] }}</span>
<div class="fr"> <div v-if="row[defaultProps.tips]" class="fr">
<el-popover trigger="hover" :content="row[defaultProps.tips]" placement="top"> <el-popover trigger="hover" :content="row[defaultProps.tips]" placement="top">
<i slot="reference" class="el-icon-question"></i> <i slot="reference" class="el-icon-question"></i>
</el-popover> </el-popover>
</div> </div>
</div> </div>
<div class="mb15 value">{{ row[defaultProps.value] }}</div> <div class="mb15 value">{{ row[defaultProps.value] }}</div>
<div class> <div v-if="row[defaultProps.title1] || row[defaultProps.value1]">
{{ row[defaultProps.title1] }} {{ row[defaultProps.title1] }}
<span class="fr" :class="row[defaultProps.noArrow] || getClass(row[defaultProps.value1])"> <span class="fr" :class="row[defaultProps.noArrow] || getClass(row[defaultProps.value1])">
{{ row[defaultProps.noArrow] ? '' : getArrow(row[defaultProps.value1]) }} {{ row[defaultProps.noArrow] ? '' : getArrow(row[defaultProps.value1]) }}
......
...@@ -10,6 +10,10 @@ export default { ...@@ -10,6 +10,10 @@ export default {
type: { type: {
type: String, type: String,
default: '' default: ''
},
legend: {
type: Array,
default: () => ['legend']
} }
}, },
data() { data() {
...@@ -43,7 +47,7 @@ export default { ...@@ -43,7 +47,7 @@ export default {
], ],
xData: [], xData: [],
series: [], series: [],
legend: { legendDict: {
customerTotalChart: ['客户总数'], customerTotalChart: ['客户总数'],
realDataChart: ['新增客户数', '流失客户数', '净增客户数', '发送申请数'], realDataChart: ['新增客户数', '流失客户数', '净增客户数', '发送申请数'],
customerGroupTotalChart: ['客群总数'], customerGroupTotalChart: ['客群总数'],
...@@ -83,6 +87,21 @@ export default { ...@@ -83,6 +87,21 @@ export default {
{ prop: '', label: '客群成员总数' }, { prop: '', label: '客群成员总数' },
{ prop: '', label: '新增客群成员数' }, { prop: '', label: '新增客群成员数' },
{ prop: '', label: '流失客群成员数' } { prop: '', label: '流失客群成员数' }
],
// 客户联系
customerContactTable: [
{ prop: '', label: '日期' },
{ prop: '', label: '单聊总数' },
{ prop: '', label: '发送消息数' },
{ prop: '', label: '已回复聊天占比' },
{ prop: '', label: '平均回复时长(分)' }
],
// 客户联系
customerGroupContactTable: [
{ prop: '', label: '日期' },
{ prop: '', label: '群聊总数' },
{ prop: '', label: '群聊消息数' },
{ prop: '', label: '发送消息群成员数' }
] ]
}, },
userArray: [], // 选择人员 userArray: [], // 选择人员
...@@ -109,7 +128,7 @@ export default { ...@@ -109,7 +128,7 @@ export default {
this.series = this.list.map((e) => e.num) this.series = this.list.map((e) => e.num)
} else if (this.type === 'realDataChart') { } else if (this.type === 'realDataChart') {
this.xData = this.list.map((e) => e.time) this.xData = this.list.map((e) => e.time)
this.legend[this.type].forEach((element) => { this.legendDict[this.type].forEach((element) => {
this.series.push(this.list.map((e) => e.num)) this.series.push(this.list.map((e) => e.num))
}) })
} }
...@@ -188,14 +207,7 @@ export default { ...@@ -188,14 +207,7 @@ export default {
@change="getList" @change="getList"
></el-date-picker> ></el-date-picker>
<el-select <el-select
v-if=" v-if="type.toLowerCase().includes('group')"
[
'customerGroupTotalChart',
'customerGroupMemberTotalChart',
'customerGroupTotalTable',
'customerGroupMemberTotalTable'
].includes(type)
"
v-model="query.group" v-model="query.group"
placeholder="请选择群主" placeholder="请选择群主"
@change="getList" @change="getList"
...@@ -223,27 +235,22 @@ export default { ...@@ -223,27 +235,22 @@ export default {
</el-option> </el-option>
</el-select> </el-select>
<el-input <el-input
v-if="['customerTotalChart', 'realDataChart'].includes(type)" v-if="['customerTotalChart', 'realDataChart', 'customerContactTable'].includes(type)"
style="width: 180px" style="width: 180px"
:value="query.qrUserName" :value="query.qrUserName"
readonly readonly
@focus="dialogVisible = true" @focus="dialogVisible = true"
placeholder="请选择员工" placeholder="请选择部门或员工"
/> />
<el-button v-if="type.includes('Table')" class="fr" type="primary">导出 Exce</el-button>
</div> </div>
<ChartLine <ChartLine
v-if="type.includes('Chart')" v-if="type.includes('Chart')"
:xData="xData" :xData="xData"
:legend="legend[type]" :legend="legend || legendDict[type]"
:series="series" :series="series"
></ChartLine> ></ChartLine>
<el-table <el-table v-else-if="type.includes('Table')" :data="list" style="width: 100%">
v-else-if="
'customerTotalTable,customerGroupTotalTable,customerGroupMemberTotalTable'.includes(type)
"
:data="list"
style="width: 100%"
>
<el-table-column <el-table-column
v-for="(item, index) in tableProps[type]" v-for="(item, index) in tableProps[type]"
:key="index" :key="index"
......
<script>
import TabContent from '../components/TabContent'
export default {
name: '',
components: { TabContent },
data() {
return {
cardData: [
{
title: '开启会话存档员工',
value: 1222453
},
{
title: '未开启会话存档员工',
value: 1222453
},
{
title: '今日流失客户',
value: 1222453
},
{
title: '未同意会话存档客户',
value: 1222453
}
],
active: 0
}
},
computed: {},
watch: {},
created() {
// this.getList()
},
mounted() {},
methods: {
getList() {
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = Number(total)
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false
})
}
}
}
</script>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div>
<div>数据占比</div>
</div>
<div>
<div>会话存档同意明细</div>
<el-table :data="data" style="width: 100%">
<el-table-column align="center" prop="prop" label="存档员工"> </el-table-column>
<el-table-column align="center" prop="prop" label="客户"> </el-table-column>
<el-table-column align="center" prop="prop" label="同意时间"> </el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :total="50"> </el-pagination>
</div>
</div>
</template>
<style lang="scss" scoped></style>
<script>
import TabContent from '../components/TabContent'
import TabContentstaffContact from './TabContentstaffContact'
export default {
name: '',
components: { TabContent, TabContentstaffContact },
data() {
return {
cardData: [
{
title: '昨日单聊总数',
tips: '企业员工发送过消息的单聊数量',
value: 1222453,
title1: '较前日',
value1: 344,
noArrow: true
},
{
title: '昨日发送消息数',
tips: '企业员工在单聊中发送的消息的数量',
value: 1222453,
title1: '较前日',
value1: 344
},
{
title: '昨日回复单聊占比',
tips: '一个自然日内,客户首先发消息的会话中,成员回复了的会话的占比。若数据展示为“-”代表没有给成员发送消息的客户,该项无法计算',
value: 1222453,
title1: '较前日',
value1: 344
},
{
title: '平均首次回复时长(分)',
tips: '一个自然日内,客户首先发消息至成员回复之间的时长,为首次回复时长。所有的首次回复总时长/已回复单聊总数,即为平均首次回复时长。若数据展示为“-”代表没有给成员发送消息的客户,该项无法计算',
value: 1222453,
title1: '较前日',
value1: 344
}
],
tabs: [
{
label: '单聊总数',
type: 'singleChatTotalChart'
},
{
label: '发送消息数',
type: 'sendMessageNumChart'
},
{
label: '回复单聊占比',
type: 'replySingleChatChart'
},
{
label: '平均首次回复时长',
type: 'averageReplyDurationChart'
}
],
active: 0
}
},
computed: {},
watch: {},
created() {
// this.getList()
},
mounted() {},
methods: {
getList() {
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = Number(total)
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false
})
}
}
}
</script>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div>
<div>数据趋势</div>
<el-tabs v-model="active">
<el-tab-pane v-for="(item, index) of tabs" :key="index" :label="item.label">
<TabContent :type="item.type" :legend="[item.label]"></TabContent>
</el-tab-pane>
</el-tabs>
</div>
<div>
<div>员工客户Top5</div>
<TabContentstaffContact type="staffCustomerBar"></TabContentstaffContact>
</div>
<div>
<div>数据报表</div>
<TabContent type="customerContactTable"></TabContent>
</div>
</div>
</template>
<style lang="scss" scoped></style>
<script>
import TabContent from '../components/TabContent'
export default {
name: '',
components: { TabContent },
data() {
return {
cardData: [
{
title: '昨日群聊总数',
tips: '企业员工全部客户数量(包含重复)',
value: 1222453,
title1: '较前日',
value1: 344,
noArrow: true
},
{
title: '昨日群聊消息数',
tips: '企业员工今日添加的客户数(包含重复及已流失)',
value: 1222453,
title1: '较前日',
value1: 344
},
{
title: '昨日发送消息群成员数',
tips: '今日删除企业员工的客户数',
value: 1222453,
title1: '较前日',
value1: 344
}
],
tabs: [
{
label: '群聊总数',
type: 'groupChatTotalChart'
},
{
label: '群聊消息数',
type: 'groupChatMessageNumChart'
},
{
label: '发送消息群成员数',
type: 'sendMessageGroupMemberChart'
}
],
active: 0
}
},
computed: {},
watch: {},
created() {
// this.getList()
console.log(3)
},
mounted() {
console.log(4)
},
methods: {
getList() {
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = Number(total)
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false
})
}
}
}
</script>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div>
<div>数据趋势</div>
<el-tabs v-model="active">
<el-tab-pane v-for="(item, index) of tabs" :key="index" :label="item.label">
<TabContent :type="item.type" :legend="[item.label]"></TabContent>
</el-tab-pane>
</el-tabs>
</div>
<div>
<div>数据报表</div>
<TabContent type="customerGroupContactTable"></TabContent>
</div>
</div>
</template>
<style lang="scss" scoped></style>
<script>
import ChartBar from '@/components/ChartBar'
import ChartLine from '@/components/ChartLine'
import SelectUser from '@/components/SelectUser'
import { getList } from '@/api/drainageCode/staff'
export default {
name: '',
components: { ChartLine, ChartBar, SelectUser },
props: {
type: {
type: String,
default: ''
}
},
data() {
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: [],
// 查询参数
query: {
group: '',
beginTime: undefined,
endTime: undefined
},
// 群主
groupOwners: [],
// 群聊
groupChats: []
}
},
computed: {},
watch: {},
created() {
// this.getSelectList('groupOwners')
// this.getSelectList('groupChats')
this.setTime(7)
},
mounted() {},
methods: {
getList(page) {
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()
.then(({ rows }) => {
this[type] = rows
})
.catch(() => {})
},
getTime(datePar) {
const d = datePar ? new Date(datePar) : new Date()
d.setMinutes(d.getMinutes() - d.getTimezoneOffset())
return d.toJSON().substr(0, 10)
},
setTime(days) {
this.timeRange = days
if (days) {
let date = new Date()
date.setDate(date.getDate() - days)
this.dateRange = [this.getTime(date), this.getTime()]
this.getList()
} else {
this.dateRange = null
}
},
getSelectUser(data) {
this.userArray = data
this.query.qrUserName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
}
}
}
</script>
<template>
<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-group>
<el-date-picker
v-if="!timeRange"
v-model="dateRange"
size="small"
class="ml20"
style="width: 260px"
value-format="yyyy-MM-dd"
type="daterange"
:clearable="false"
range-separator="-"
start-placeholder="开始日期"
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">
<ChartLine :xData="xData" :legend="legend['customerGroup']" :series="series"></ChartLine>
</el-col>
<el-col :span="12">
<ChartLine
:xData="xData"
:legend="legend['customerGroupMember']"
:series="series"
></ChartLine>
</el-col>
</el-row>
</div>
</template>
<style lang="scss" scoped></style>
<script>
import CustomerContact from './CustomerContact'
import CustomerGroupContact from './CustomerGroupContact'
import Conversation from './Conversation'
export default {
name: '',
components: { CustomerContact, CustomerGroupContact, Conversation },
data() {
return {
active: 0
}
},
computed: {},
watch: {},
created() {
// this.getList()
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>企业客户/客户群联系相关数据统计与分析</div>
`
)
},
mounted() {},
methods: {}
}
</script>
<template>
<el-tabs v-model="active">
<el-tab-pane label="客户联系">
<CustomerContact></CustomerContact>
</el-tab-pane>
<el-tab-pane label="客群联系">
<CustomerGroupContact></CustomerGroupContact>
</el-tab-pane>
<el-tab-pane label="会话存档">
<Conversation></Conversation>
</el-tab-pane>
</el-tabs>
</template>
<style lang="scss" scoped></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!