Commit 76fa43a7 by 怪兽?别跑

消息查看调整

1 parent 5f9ebb7d
<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>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
></el-table-column> ></el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" fixed="right" width="180" class-name="small-padding fixed-width">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button type="text">查看</el-button> <el-button type="text" @click="showChatList(row)">查看</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -74,20 +74,22 @@ ...@@ -74,20 +74,22 @@
title="选择部门" title="选择部门"
@success="selectedDept" @success="selectedDept"
></SelectDept> ></SelectDept>
<ChatList v-if="showChat" :visible.sync="showChat" :queryChat="queryChat"></ChatList>
</div> </div>
</template> </template>
<script> <script>
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 { statisticData, statisticTable, statisticRecordList } from './api.js' import { statisticData, statisticTable } from './api.js'
import SelectDept from '@/components/SelectDept' import SelectDept from '@/components/SelectDept'
import ChatList from './chatList.vue'
export default { export default {
name: 'quality-statistics', name: 'quality-statistics',
components: { components: {
SearchTitle, SearchTitle,
ChartLine, ChartLine,
SelectDept SelectDept,
ChatList
}, },
data() { data() {
return { return {
...@@ -138,10 +140,28 @@ ...@@ -138,10 +140,28 @@
deptIds: '', deptIds: '',
userIds: '' userIds: ''
}, },
tableSearch: {} tableSearch: {},
showChat: false,
queryChat: {
formId: '',
msgId: '',
pageType: 0,
receiveId: '',
roomId: ''
}
} }
}, },
methods: { methods: {
showChatList(data) {
this.queryChat = {
fromId: data.fromId,
msgId: data.msgId,
pageType: 0,
receiveId: data.receiveId,
roomId: data.roomId
}
this.showChat = true
},
handleSearch() { handleSearch() {
this.getTableChangeSize() this.getTableChangeSize()
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!