fix : 修复工作台历史记录弹窗数据显示bug

This commit is contained in:
2024-10-06 19:25:02 +08:00
parent 25da31b034
commit d6e6843ecb
5 changed files with 117 additions and 103 deletions

View File

@@ -1,11 +1,16 @@
<script setup>
import LiveCallItem from '@/components/liveCall/LiveCallItem.vue'
import {getHistoryCallContent} from '@/api/workbench';
import {ElMessage} from "element-plus";
const dialogVisible = ref(false);
const recordLeftRef = ref(null);
const emit = defineEmits(['update:value'])
const props = defineProps({
rowData: String
value: {
type:String,
default:''
}
})
const open = (row) => {
@@ -13,14 +18,20 @@ const open = (row) => {
};
const leftHeadData = ref({
username: '张三',
phone: '13546812315',
orderName: '张三工单',
// username: '张三',
// phone: '13546812315',
// orderName: '张三工单',
})
const detailLoading=ref(false)
const recordLeftObj = ref({});
const _value = computed({
get() {
return props.value;
},
set(val) {
emit("update:value", val);
}
})
const recordLeftObj = ref({
content: []
});
const convertArrayToMap=(array)=> {
const map = new Map();
array.forEach(item => {
@@ -35,22 +46,33 @@ const convertArrayToMap=(array)=> {
return map;
}
watch(() => props.rowData, async (newVal) => {
recordLeftObj.value.content = []
// let map1 = new Map()
await getHistoryCallContent(newVal).then(res => {
res.data?.forEach(item => {
item.textVoList = convertArrayToMap(item.textVoList);
})
recordLeftObj.value = res.data
// console.info("🚀 ~method:res.data -----", res.data)
if (res.data && res.data.length > 0) {
leftHeadData.value.username = res.data[0].callIdNumber || '--';
leftHeadData.value.phone = res.data[0].callPhone || '--';
leftHeadData.value.orderName = res.data[0].orderName || '--';
}
})
watch(() => props.value, async (newVal) => {
if(newVal){
getHistoryDetail(newVal)
}
})
const getHistoryDetail=(newVal)=>{
detailLoading.value=true
getHistoryCallContent(newVal).then(res => {
if (res.code === 1000) {
detailLoading.value=false
res.data?.forEach(item => {
if( item.textVoList&& item.textVoList.length>0){
item.textVoList = convertArrayToMap(item.textVoList);
}
})
recordLeftObj.value = res.data
if (res.data && res.data.length > 0) {
leftHeadData.value.username = res.data[0].callIdNumber || '--';
leftHeadData.value.phone = res.data[0].callPhone || '--';
leftHeadData.value.orderName = res.data[0].orderName || '--';
}
} else {
ElMessage.error(res.msg);
}
})
}
const scrollToBottom = (scrollbarRef) => {
if (scrollbarRef) {
@@ -68,8 +90,8 @@ defineExpose({
</script>
<template>
<el-dialog v-model="dialogVisible" title="历史通话记录" width="600" class="box">
<LiveCallItem ref="recordLeftRef" :recordArray="recordLeftObj" :headData="leftHeadData" style="width: 100%;"/>
<el-dialog v-model="dialogVisible" title="历史通话记录" width="700" class="box">
<LiveCallItem ref="recordLeftRef" :recordArray="recordLeftObj" :headData="leftHeadData" style="width: 100%;" :detailLoading="detailLoading"/>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false">
@@ -82,6 +104,6 @@ defineExpose({
<style>
.box {
height: 68vh;
/*height: 68vh;*/
}
</style>