Commit daac14c2 authored by 赵茹林's avatar 赵茹林

聊天记录组件 更新 支持时间分段

团队概况 修复 平均业绩小数点不正确的问题
parent de675b9e
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
<el-dialog title="聊天记录" append-to-body :visible.sync="show"> <el-dialog title="聊天记录" append-to-body :visible.sync="show">
<div v-loading="loading" style="height: 500px; overflow: auto;" class="liaotian-content"> <div v-loading="loading" style="height: 500px; overflow: auto;" class="liaotian-content">
<div class="real-time">{{ startAt }}</div> <div v-if="list.length">
<div class="real-time">{{ startAt || chatStartAt }}</div>
<div class="chat-record" v-for="item in list" :key="item.id"> <div class="chat-record" v-for="item in list" :key="item.id">
<div class="le"> <div class="le">
<div class="le-content" v-if="item.author == 'left'"> <div class="le-content" v-if="item.author == 'left'">
...@@ -149,6 +150,10 @@ ...@@ -149,6 +150,10 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else style="display: flex;align-items: center;justify-content: center;color: #999999;height: 100%;">
暂无数据
</div>
</div>
</el-dialog> </el-dialog>
</div> </div>
...@@ -169,8 +174,18 @@ ...@@ -169,8 +174,18 @@
startAt: { startAt: {
type: String, type: String,
default: '', default: '',
required: true required: false // 与 chatStartAt chatEndAt 两个字段互斥
} },
chatStartAt: {
type: String,
default: '',
required: false
},
chatEndAt: {
type: String,
default: '',
required: false
},
}, },
data() { data() {
return { return {
...@@ -192,7 +207,16 @@ ...@@ -192,7 +207,16 @@
}, },
getData() { getData() {
this.loading = true; this.loading = true;
getChatrecordApi(this.friendId, {start_at: this.startAt}).then(res => { var json = {};
if (this.startAt) {
json = {start_at: this.startAt}
} else if (this.chatStartAt && this.chatEndAt) {
json = {
chat_start_at: this.chatStartAt,
chat_end_at: this.chatEndAt,
}
}
getChatrecordApi(this.friendId, json).then(res => {
if (res.length > 0) { if (res.length > 0) {
res.map(item => { res.map(item => {
if (!Util.isJSON(item.sentence) && String(item.image_type).toUpperCase() === 'NULL') { if (!Util.isJSON(item.sentence) && String(item.image_type).toUpperCase() === 'NULL') {
...@@ -201,7 +225,7 @@ ...@@ -201,7 +225,7 @@
}) })
this.list = res this.list = res
} else { } else {
this.$message.error('没有聊天记录'); // this.$message.error('没有聊天记录');
this.list = [] this.list = []
} }
this.loading = false; this.loading = false;
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<!--<el-button size="small" v-if="scope.row.chat_count > 0">聊天记录</el-button>--> <!--<el-button size="small" v-if="scope.row.chat_count > 0">聊天记录</el-button>-->
<chat-record <chat-record
v-if="scope.row.chat_count > 0" v-if="scope.row.chat_count > 0"
:friend-id="scope.row.friend_id" :start-at="dialogObj.start_at"></chat-record> :friend-id="scope.row.friend_id" :chat-start-at="scope.row.chat_start_at" :chat-end-at="scope.row.chat_end_at"></chat-record>
<phone-record <phone-record
v-if="scope.row.phone_source_file" v-if="scope.row.phone_source_file"
:src="scope.row.phone_source_file"></phone-record> :src="scope.row.phone_source_file"></phone-record>
...@@ -143,8 +143,8 @@ ...@@ -143,8 +143,8 @@
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<chat-record <chat-record
v-if="dialog.search.type == '0'" v-if="scope.row.chat_count > 0"
:friend-id="scope.row.friend_id" :start-at="dialogObj.start_at"></chat-record> :friend-id="scope.row.friend_id" :chat-start-at="scope.row.chat_start_at" :chat-end-at="scope.row.chat_end_at"></chat-record>
<phone-record <phone-record
v-if="dialog.search.type == '1' && scope.row.source_file" v-if="dialog.search.type == '1' && scope.row.source_file"
:src="scope.row.source_file"></phone-record> :src="scope.row.source_file"></phone-record>
......
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
}, },
transRate(child, mother) { transRate(child, mother) {
if (mother) { if (mother) {
return `${Math.floor(child * 100) / mother}%` return `${Math.floor(child * 1000 / mother)/10}%`
} else { } else {
return '-' return '-'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment