Commit f1303fa8 by 怪兽?别跑

Merge branch 'dev-jiangpengkai'

2 parents b04eec47 3948bc0d
import request from '@/utils/request'
const service = window.lwConfig.services.system + window.lwConfig.services.wecom
// 列表
export function getList(data) {
return request({
url: service + '/qi/list',
method: 'get',
params: data
})
}
// 新增
export function addQuality(data) {
return request({
url: service + '/qi/add',
method: 'post',
data
})
}
// 编辑
export function editQuality(id, data) {
return request({
url: service + '/qi/update/' + id,
method: 'put',
data
})
}
// 删除
export function deleteQuality(id) {
return request({
url: service + '/qi/del/' + id,
method: 'delete'
})
}
// 详情
export function detailQuality(id) {
return request({
url: service + '/qi/get/' + id
})
}
// 质检统计 看板
export function statisticData(id) {
return request({
url: service + '/qi/statistics/view/' + id
})
}
// 质检统计 质检记录
export function statisticTable(id, data) {
return request({
url: service + '/qi/statistics/table/' + id,
params: data
})
}
// 质检统计 消息记录
export function statisticRecordList(data) {
return request({
url: service + '/qi/statistics/table/msg',
method: 'post',
data
})
}
// 质检周报 列表
export function qualityWeekly(data) {
return request({
url: service + '/qi/weekly/list',
params: data
})
}
// 质检周报 详情汇总卡片
export function qualityWeeklyDetailTotal(id) {
return request({
url: service + '/qi/weekly/getDetail/' + id
})
}
// 质检周报 详情列表
export function qualityWeeklyTable(id, data) {
return request({
url: service + '/qi/weekly/detail/list/' + id,
params: data
})
}
// 质检周报 详情列表导出
export function getTableExport(id, data) {
return request({
url: service + '/qi/weekly/detail/list/export/' + id,
params: data,
responseType: 'blob'
})
}
<template>
<div>
<el-dialog title="查看详情" :close-on-click-modal="false" :show-close="false" :visible.sync="Pvisible">
<el-tabs v-model="activeTab" @tab-click="(v) => opened.includes(v.name) || opened.push(v.name)">
<el-tab-pane v-for="(item, index) of list" :key="index" :label="item.label" :name="item.type">
<chatListClassTab
v-if="opened.includes(item.type)"
:queryChat="queryChat"
:type="item.type"
></chatListClassTab>
</el-tab-pane>
</el-tabs>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="Pvisible = false">关 闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import chatListClassTab from './component/chatListClassTab.vue'
export default {
name: 'ChatList',
components: { chatListClassTab },
props: {
visible: {
type: Boolean,
default: false
},
queryChat: {
type: Object,
default: () => ({})
}
},
data() {
return {
activeTab: 'all',
opened: ['all'],
list: [
{
label: '全部',
type: 'all'
},
{
label: '图片及视频',
type: 'image,video'
},
{
label: '文件',
type: 'file'
},
{
label: '链接',
type: 'link'
},
{
label: '语音',
type: 'voice,meeting_voice_call'
}
]
}
},
watch: {
// Pvisible(val) {
// this.selectList = this.defaultValues
// }
},
computed: {
Pvisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
}
}
</script>
<template>
<div class="takecontent">
<ul id="123">
<li v-for="(item, index) in data" :key="index" :id="item.msgId">
<div :class="['mb10', queryChat.fromId === item.fromId && 'ar']">
<span :class="['', queryChat.fromId === item.fromId && 'fr']" style="color: #4e5969;">{{ item.name }}</span>
<span :style="{ color: item.action == 'send' ? '#86909C' : '#999', margin: '0 8px' }">
{{ item.msgTime }}
</span>
</div>
<div :class="[queryChat.msgId === item.msgId && 'line-height', queryChat.fromId === item.fromId && 'ar']">
<img
:class="['image', queryChat.fromId === item.fromId && 'fr']"
:src="item.avatar || require('@/assets/image/profile.jpg')"
/>
<ChatContent :queryChat="queryChat" :message="item"></ChatContent>
</div>
</li>
</ul>
</div>
</template>
<script>
import ChatContent from '@/components/ChatContent'
export default {
components: {
ChatContent
},
props: {
data: {
type: Array,
defluat: () => []
},
queryChat: {
type: Object,
default: () => ({})
}
},
mounted() {
this.$nextTick(() => {
setTimeout(() => {
document.getElementById(this.queryChat.msgId).scrollIntoView({ behavior: 'smooth', block: 'center' })
}, 300)
})
},
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.line-height {
padding: 5px;
border-radius: 8px 8px 8px 8px;
background-color: #fff;
}
.image {
width: 40px;
height: 40px;
vertical-align: top;
box-shadow: 0px 6px 8px 0px rgba(78, 89, 105, 0.3);
border-radius: 8px 8px 8px 8px;
border: 1px solid #fff;
background: #fff;
}
.shabowbox {
position: fixed;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.4);
left: 0;
top: 0;
z-index: 2000;
}
.shabowboxvidoe {
position: fixed;
width: 800px;
height: 475px;
left: 50%;
margin-left: -400px;
top: 50%;
margin-top: -235px;
z-index: 2001;
background: #fff;
}
.shabowboxaudio {
height: 125px;
padding: 12px;
}
.close {
position: fixed;
width: 50px;
height: 50px;
right: 10px;
z-index: 2012;
top: 10px;
text-align: center;
line-height: 50px;
font-size: 20px;
color: #fff;
cursor: pointer;
font-size: 43px;
}
.takecontent {
border-radius: 3px;
background-color: #eee;
position: relative;
text-align: left;
height: 100%;
width: 100%;
overflow-y: scroll;
::-webkit-scrollbar {
display: none;
}
ul li {
padding: 10px;
}
}
</style>
<template>
<div class="chatListClassTab" v-loading="loading">
<!-- <el-date-picker
v-model="dateRange"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
align="right"
@change="getList(1)"></el-date-picker> -->
<div class="list">
<template v-if="list.length">
<chatList :queryChat="queryChat" v-if="'all,image,video,link,'.includes(type)" :data="list"></chatList>
<el-table
v-else-if="type == 'file'"
:data="list"
stripe
style="width: 100%;"
:header-cell-style="{ background: '#fff' }"
>
<!-- <el-table-column prop="msgtype" label="类型"> </el-table-column> -->
<el-table-column label="名称">
<template slot-scope="{ row }">
{{ JSON.parse(row.contact).filename }}
</template>
</el-table-column>
<el-table-column label="大小">
<template slot-scope="{ row }">
{{ filterSize(JSON.parse(row.contact).filesize) }}
</template>
</el-table-column>
<el-table-column label="来源">
<template slot-scope="{ row }">
{{ row.name }}
</template>
</el-table-column>
<el-table-column prop="action" label="操作">
<template slot-scope="{ row }">
<el-button type="text" @click="downloadFile(row)">下载</el-button>
</template>
</el-table-column>
</el-table>
<el-table
v-else-if="'voice,meeting_voice_call'.includes(type)"
:data="list"
stripe
:header-cell-style="{ background: '#fff' }"
>
<el-table-column prop="date" label="发起人">
<template slot-scope="{ row }">
{{ row.name }}
</template>
</el-table-column>
<el-table-column prop="name" label="通话时间">
<template slot-scope="{ row }">
{{ row.msgTime }}
</template>
</el-table-column>
<el-table-column prop="address" label="时长" min-width="50">
<template slot-scope="{ row }">
<span v-if="row.msgType == 'voice'">{{ JSON.parse(row.contact).play_length }}s</span>
<span v-else>
{{ setDate(JSON.parse(row.contact).endtime, row.msgTime) }}
</span>
</template>
</el-table-column>
<el-table-column prop="msgType" label="类型">
<template slot-scope="{ row }">
{{ row.msgType === 'voice' ? '语音消息' : '语音通话' }}
</template>
</el-table-column>
<el-table-column prop="address" min-width="80" label="操作">
<template slot-scope="{ row }">
<!-- <el-button
type="text"
@click="voiceLook(JSON.parse(row.contact))"
>查看</el-button
> -->
<!-- <AudioPlayer
:audio-list="[JSON.parse(row.contact).attachment]"
ref="AudioPlayer"
/> -->
<voice :amrUrl="JSON.parse(row.contact)['attachment']"></voice>
<!-- <audio controls>
<source :src="JSON.parse(row.contact).attachment" type="audio/mpeg" />
</audio> -->
</template>
</el-table-column>
</el-table>
</template>
<el-empty v-else :image-size="100"></el-empty>
</div>
<el-pagination
v-if="total"
layout="prev, pager, next"
:current-page.sync="currentPage"
@current-change="getList"
:total="total"
/>
</div>
</template>
<script>
import chatList from './chatList.vue'
import { statisticRecordList } from '../api.js'
import Voice from '@/components/Voice'
import { download } from '@/api/common.js'
import { diffDate } from '@/utils/index'
import { parseTime } from '@/utils/common'
export default {
name: '',
components: { chatList, Voice },
props: {
// 消息收发者
queryChat: {
type: Object,
default: () => ({})
},
// 消息类型
type: {
type: String | Number,
default: 0
}
},
data() {
return {
loading: false,
currentPage: 1,
dateRange: [],
list: [],
total: 0
}
},
computed: {},
watch: {
queryChat() {
this.getList(1)
}
},
created() {
this.getList(1)
},
mounted() {},
methods: {
setDate(start, end) {
return diffDate(end, parseTime(start))
},
getList(page) {
// if (!this.queryChat.fromId) {
// return //没有选择人
// }
this.loading = true
let query = {
msgType: this.type == 'all' ? '' : this.type
}
// if (this.dateRange) {
// query.beginTime = this.dateRange[0]
// query.endTime = this.dateRange[1]
// } else {
// query.beginTime = ''
// query.endTime = ''
// }
page && (query.pageNum = this.currentPage = page)
Object.assign(query, this.queryChat)
statisticRecordList(query)
.then((res) => {
// this.total = ~~res.total
this.list = res.data
this.loading = false
})
.catch((err) => {
this.loading = false
})
},
filterSize(size) {
if (!size) return ''
if (size < pow1024(1)) return size + ' B'
if (size < pow1024(2)) return (size / pow1024(1)).toFixed(2) + ' KB'
if (size < pow1024(3)) return (size / pow1024(2)).toFixed(2) + ' MB'
if (size < pow1024(4)) return (size / pow1024(3)).toFixed(2) + ' GB'
return (size / pow1024(4)).toFixed(2) + ' TB'
function pow1024(num) {
return Math.pow(1024, num)
}
},
downloadFile(row) {
this.$confirm('是否确认下载该文件?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then((response) => {
this.downloadNet(JSON.parse(row.contact).attachment, JSON.parse(row.contact).filename)
})
.catch(function () {})
}
}
}
</script>
<style lang="scss" scoped>
.list {
height: calc(100vh - 420px);
margin-top: 10px;
background: white;
overflow-y: scroll;
border-bottom: 1px solid #efefef;
color: #999;
text-align: center;
::-webkit-scrollbar {
display: none;
}
}
.chatListClassTab {
padding: 10px 10px 0;
background: #fff;
text-align: left;
}
</style>
<template>
<div>
<el-form ref="queryForm" :model="query" inline class="top-search" label-position="left" label-width="">
<el-form-item label="规则名称" prop="name">
<el-input clearable v-model="query.name" placeholder="请输入规则名称"></el-input>
</el-form-item>
<el-form-item label="适用成员" prop="userIds">
<el-input :value="userName" readonly @focus="dialogVisible = true" placeholder="请选择适用成员" />
</el-form-item>
<el-form-item label="会话类型">
<el-select v-model="query.chatType" :popper-append-to-body="false">
<el-option :label="data.value" :value="data.key" v-for="(data, key) in chatTypeArray" :key="key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="操作时间">
<el-date-picker
v-model="searchDate"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
@change="setDateChange"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="">
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<div class="mid-action">
<el-button type="primary" @click="$router.push('./add')">新建质检规则</el-button>
<el-button type="primary" plain @click="$router.push('./records')">
质检报告记录
</el-button>
</div>
<el-table v-loading="loading" :data="list">
<el-table-column label="规则名称" align="center" min-width="100" prop="name" show-overflow-tooltip />
<el-table-column label="适用成员范围" align="center" prop="qiRuleScope" min-width="160px">
<template slot-scope="{ row }">
<TagEllipsis :list="row.qiRuleScope" defaultProps="userName" />
</template>
</el-table-column>
<el-table-column label="超时时间标准" align="center" min-width="100" prop="timeOut" show-overflow-tooltip>
<template slot-scope="{ row }"> {{ row.timeOut }}分钟 </template>
</el-table-column>
<el-table-column label="质检会话类型" align="center" prop="chatType" min-width="160px">
<template slot-scope="{ row }">
{{ row.chatType == 1 ? '全部' : rew.chatType == 2 ? '客户会话' : '客群会话' }}
</template>
</el-table-column>
<el-table-column label="质检督导" align="center" prop="manageUser" min-width="160px">
<template slot-scope="{ row }">
<TagEllipsis :list="row.manageUserInfo" defaultProps="userName" />
<!-- {{ row.manageUser }} -->
</template>
</el-table-column>
<el-table-column label="操作时间" align="center" prop="updateTime" width="180"></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<el-button type="text" @click="goRoute('statistic', row.id)">统计</el-button>
<el-button type="text" @click="goRoute('add', row.id)">编辑</el-button>
<el-button type="text" @click="removeFn(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" />
</div>
<SelectWeUser
:visible.sync="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"
></SelectWeUser>
</div>
</template>
<script>
import { getList, deleteQuality } from './api.js'
export default {
name: 'quality',
data() {
return {
query: {
pageSize: 10,
pageNum: 1,
name: '',
userIds: '',
startTime: '',
endTime: '',
chatType: 1
},
total: 0,
dialogVisible: false,
userName: '',
userArray: [],
searchDate: [],
list: [],
loading: false,
chatTypeArray: [
{
key: 1,
value: '全部'
},
{
key: 2,
value: '客户会话'
},
{
key: 3,
value: '客群会话'
}
]
}
},
created() {
this.getList()
},
methods: {
getSelectUser(data) {
this.userArray = data
this.userName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
this.query.userIds = this.userArray
.map(function (obj, index) {
return obj.userId
})
.join(',')
},
setDateChange(data) {
if (data && data[0]) {
this.query.beginTime = data[0]
} else {
this.query.beginTime = ''
}
if (data && data[1]) {
this.query.endTime = data[1]
} else {
this.query.endTime = ''
}
},
handleSearch() {
this.query.pageNum = 1
this.getList()
},
getList() {
getList(this.query).then((res) => {
this.total = Number(res.total)
this.list = res.rows
})
},
resetQuery() {
this.query = {
pageSize: 10,
pageNum: 1,
name: '',
userIds: '',
startTime: '',
endTime: '',
chatType: 1
}
this.userName = ''
this.userArray = []
this.getList()
},
goRoute(path, id) {
this.$router.push({ path: path, query: { id } })
},
removeFn(id) {
this.$confirm('是否确认删除当前质检规则??', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
return deleteQuality(id)
})
.then(() => {
this.handleSearch()
this.msgSuccess('删除成功')
})
.catch(function () {})
}
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div class="g-card">
<div class="g-card-title">数据报表</div>
<div style="display: flex; align-items: center; justify-content: space-between;">
<div style="display: flex; align-items: center;">
<search-title :showMore="true" @search="getTableFn"> </search-title>
<el-input
style="width: 150px;"
:value="userName"
readonly
size="mini"
@focus="dialogVisible = true"
placeholder="请选择成员"
/>
<el-input
style="width: 150px; margin: 0 20px;"
:value="deptName"
readonly
size="mini"
@focus="dialogDeptVisible = true"
placeholder="请选择部门"
/>
<el-button size="mini" type="primary" @click="handleSearch">查询</el-button>
<el-button size="mini" @click="resetQuery">重置</el-button>
</div>
<el-button type="primary" size="mini" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column
label="成员名称"
align="center"
prop="userName"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column label="所属部门" align="center" prop="deptName" show-overflow-tooltip></el-table-column>
<el-table-column label="超时次数" align="center" prop="timeOutNum" show-overflow-tooltip></el-table-column>
<el-table-column label="超时率" align="center" prop="timeOutRate" show-overflow-tooltip>
<template slot-scope="{ row }">
<div>{{ Number(row.timeOutRate) * 100 + '%' }}</div>
</template>
</el-table-column>
<el-table-column label="客户会话超时率" align="center" prop="chatTimeOutRate" show-overflow-tooltip>
<template slot-scope="{ row }">
<div>{{ Number(row.chatTimeOutRate) * 100 + '%' }}</div>
</template>
</el-table-column>
<el-table-column label="客群会话超时率" align="center" prop="groupChatTimeOutRate" show-overflow-tooltip>
<template slot-scope="{ row }">
<div>{{ Number(row.groupChatTimeOutRate) * 100 + '%' }}</div>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getTableChangeSize()"
/>
</div>
<SelectWeUser
:visible.sync="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"
></SelectWeUser>
<SelectDept
:defaultValues="deptArray"
:visible.sync="dialogDeptVisible"
title="选择部门"
@success="selectedDept"
></SelectDept>
</div>
</template>
<script>
import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '@/components/SearchTitle.vue'
import { qualityWeeklyDetailTotal, qualityWeeklyTable, getTableExport } from './api.js'
import SelectDept from '@/components/SelectDept'
import { dateFormat } from '@/utils/index'
export default {
name: 'records-statistic',
components: {
SearchTitle,
ChartLine,
SelectDept
},
data() {
return {
deptArray: [],
deptName: '',
dialogDeptVisible: false,
dialogVisible: false,
userArray: [],
userName: '',
cardData: [
{
title: '本周督导成员数',
value: 0
},
{
title: '客户会话数',
value: 0
},
{
title: '客群会话数',
value: 0
},
{
title: '成员回复次数',
value: 0
},
{
title: '成员超时次数',
value: 0
},
{
title: '成员超时率',
value: 0
},
{
title: '客户会话超时率',
value: 0
},
{
title: '客群会话超时率',
value: 0
}
],
value: [],
id: '',
exportLoading: false,
tableList: [],
loading: false,
total: 0,
query: {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: '',
deptIds: '',
userIds: ''
},
tableSearch: {}
}
},
methods: {
exportFn() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.exportLoading = true
return getTableExport(this.id, Object.assign({}, this.query))
})
.then((res) => {
if (!res) return
const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) // 构造一个blob对象来处理数据,并设置文件类型
if (window.navigator.msSaveOrOpenBlob) {
//兼容IE10
navigator.msSaveBlob(blob, '质检详情')
} else {
const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象
const a = document.createElement('a') //创建a标签
a.style.display = 'none'
a.href = href // 指定下载链接
a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '-质检详情.xlsx' //指定下载文件名
a.click() //触发下载
URL.revokeObjectURL(a.href) //释放URL对象
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.exportLoading = false
})
},
handleSearch() {
this.getTableChangeSize()
},
resetQuery() {
this.query = {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: '',
deptIds: '',
userIds: ''
}
this.userArray = []
this.userName = ''
this.deptArray = []
this.deptName = ''
this.getTableChangeSize()
},
getSelectUser(data) {
this.userArray = data
this.userName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
this.query.userIds = this.userArray
.map(function (obj, index) {
return obj.userId
})
.join(',')
},
selectedDept(data) {
this.deptArray = data
this.deptName = this.deptArray
.map(function (obj, index) {
return obj.deptName
})
.join(',')
this.query.deptIds = this.userArray
.map(function (obj, index) {
return obj.deptId
})
.join(',')
},
getTabTotalFn() {
qualityWeeklyDetailTotal(this.id).then((res) => {
this.cardData[0].value = res.data.staffNum
this.cardData[1].value = res.data.chatNum
this.cardData[2].value = res.data.groupChatNum
this.cardData[3].value = res.data.replyNum
this.cardData[4].value = res.data.timeOutNum
this.cardData[5].value = Number(res.data.timeOutRate) * 100 + '%'
this.cardData[6].value = Number(res.data.chatTimeOutRate) * 100 + '%'
this.cardData[7].value = Number(res.data.chatTimeOutRate) * 100 + '%'
})
},
getTableChangeSize() {
this.loading = true
qualityWeeklyTable(this.id, Object.assign({}, this.query)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
},
getTableFn(data) {
this.loading = true
// this.query.id = this.id
this.query.beginTime = data.beginTime
this.query.endTime = data.endTime
this.getTableChangeSize()
}
},
created() {
this.id = this.$route.query.id
this.getTabTotalFn()
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<el-form ref="queryForm" :model="query" inline class="top-search" label-position="left" label-width="">
<el-form-item label="成员" prop="userIds">
<el-input v-model="query.userName" placeholder="请输入成员名称" />
</el-form-item>
<el-form-item label="选择时间">
<el-date-picker
v-model="query.dateTime"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
></el-date-picker>
</el-form-item>
<el-form-item label="">
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div class="g-card">
<el-table v-loading="loading" :data="list">
<el-table-column label="质检周期" align="center" width="180" prop="weeklyTime" show-overflow-tooltip />
<el-table-column label="目标发送成员" align="center" prop="userName">
<!-- <template slot-scope="{ row }">
<TagEllipsis :list="row.qiRuleScope" defaultProps="userName" />
</template> -->
</el-table-column>
<el-table-column label="发送时间" align="center" prop="sendTime" width="180"></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<el-button type="text" @click="goRoute('recordsStatistic', row.id)">统计</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" :page.sync="query.pageNum" :limit.sync="query.pageSize" @pagination="getList()" />
</div>
</div>
</template>
<script>
import { qualityWeekly } from './api.js'
export default {
name: 'quality-records',
data() {
return {
dialogVisible: false,
query: {
dateTime: '',
userName: '',
pageNum: 1,
pageSize: 10
},
list: [],
loading: false,
total: 0
}
},
created() {
this.getList()
},
methods: {
goRoute(path, id) {
this.$router.push({ path: path, query: { id } })
},
handleSearch() {
this.query.pageNum = 1
this.getList()
},
getList() {
this.loading = true
qualityWeekly(this.query)
.then((res) => {
if (res.code == 200) {
this.list = res.rows
this.total = Number(res.total)
}
this.loading = false
})
.catch(() => {
this.loading = false
})
},
resetQuery() {
this.query = {
pageSize: 10,
pageNum: 1,
dateTime: '',
userName: ''
}
this.getList()
}
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div class="g-card">
<div class="g-card-title">数据报表</div>
<div style="display: flex; align-items: center;">
<search-title :showMore="true" @search="getTableFn"> </search-title>
<el-input
style="width: 150px;"
:value="userName"
readonly
size="mini"
@focus="dialogVisible = true"
placeholder="请选择成员"
/>
<el-input
style="width: 150px; margin: 0 20px;"
:value="deptName"
readonly
size="mini"
@focus="dialogDeptVisible = true"
placeholder="请选择部门"
/>
<el-button size="mini" type="primary" @click="handleSearch">查询</el-button>
<el-button size="mini" @click="resetQuery">重置</el-button>
</div>
<el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column
label="成员名称"
align="center"
prop="userName"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column label="所属部门" align="center" prop="deptName" show-overflow-tooltip></el-table-column>
<el-table-column label="所属会话" align="center" prop="chatName" show-overflow-tooltip></el-table-column>
<el-table-column label="会话类型" align="center" prop="chatType" show-overflow-tooltip>
<template slot-scope="{ row }">
<div>
{{ row.chatType == 1 ? '客户会话' : '客群会话' }}
</div>
</template>
</el-table-column>
<el-table-column label="超时时长" align="center" prop="timeout" show-overflow-tooltip></el-table-column>
<el-table-column
label="触发时间"
align="center"
prop="createTime"
width="180"
show-overflow-tooltip
></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
<template slot-scope="{ row }">
<el-button type="text" @click="showChatList(row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getTableChangeSize()"
/>
</div>
<SelectWeUser
:visible.sync="dialogVisible"
title="组织架构"
:defaultValues="userArray"
@success="getSelectUser"
></SelectWeUser>
<SelectDept
:defaultValues="deptArray"
:visible.sync="dialogDeptVisible"
title="选择部门"
@success="selectedDept"
></SelectDept>
<ChatList v-if="showChat" :visible.sync="showChat" :queryChat="queryChat"></ChatList>
</div>
</template>
<script>
import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '@/components/SearchTitle.vue'
import { statisticData, statisticTable } from './api.js'
import SelectDept from '@/components/SelectDept'
import ChatList from './chatList.vue'
export default {
name: 'quality-statistics',
components: {
SearchTitle,
ChartLine,
SelectDept,
ChatList
},
data() {
return {
deptArray: [],
deptName: '',
dialogDeptVisible: false,
dialogVisible: false,
userArray: [],
userName: '',
cardData: [
{
title: '总超时次数',
tips: '成员在会话中未能及时回复的次数,仅计算产生双方参与的会话次数',
value: 0
},
{
title: '总超时率',
tips: '成员在会话中未能及时回复的次数/双方共产生会话的次数',
value: 0
},
{
title: '今日超时人数',
tips: '今日未能及时回复用户会话的成员人数',
value: 0
},
{
title: '今日超时次数',
tips: '今日成员在会话中未能及时回复的次数',
value: 0
},
{
title: '今日超时率',
tips: '今日成员在会话中未能及时回复的次数/今日双方共产生会话的次数',
value: 0
}
],
value: [],
id: '',
exportLoading: false,
tableList: [],
loading: false,
total: 0,
query: {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: '',
deptIds: '',
userIds: ''
},
tableSearch: {},
showChat: false,
queryChat: {
formId: '',
msgId: '',
pageType: 0,
receiveId: '',
roomId: ''
}
}
},
methods: {
showChatList(data) {
this.queryChat = {
fromId: data.fromId,
msgId: data.msgId,
pageType: 0,
receiveId: data.receiveId,
roomId: data.roomId
}
this.showChat = true
},
handleSearch() {
this.getTableChangeSize()
},
resetQuery() {
this.query = {
pageSize: 10,
pageNum: 1,
beginTime: '',
endTime: '',
deptIds: '',
userIds: ''
}
this.userArray = []
this.userName = ''
this.deptArray = []
this.deptName = ''
this.getTableChangeSize()
},
getSelectUser(data) {
this.userArray = data
this.userName = this.userArray
.map(function (obj, index) {
return obj.name
})
.join(',')
this.query.userIds = this.userArray
.map(function (obj, index) {
return obj.userId
})
.join(',')
},
selectedDept(data) {
this.deptArray = data
this.deptName = this.deptArray
.map(function (obj, index) {
return obj.deptName
})
.join(',')
this.query.deptIds = this.userArray
.map(function (obj, index) {
return obj.deptId
})
.join(',')
},
getTabTotalFn() {
statisticData(this.id).then((res) => {
this.cardData[0].value = res.data.timeOutTotalNum
this.cardData[1].value = Number(res.data.timeOutTotalRate) * 100 + '%'
this.cardData[2].value = res.data.todayTimeOutUserNum
this.cardData[3].value = res.data.todayTimeOutNum
this.cardData[4].value = Number(res.data.todayTimeOutRate) * 100 + '%'
})
},
getTableChangeSize() {
this.loading = true
statisticTable(this.id, Object.assign({}, this.query)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
},
getTableFn(data) {
this.tableSearch = data
this.loading = true
// this.query.id = this.id
this.query.beginTime = data.beginTime
this.query.endTime = data.endTime
this.getTableChangeSize()
}
},
created() {
this.id = this.$route.query.id
this.getTabTotalFn()
}
}
</script>
<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!