Merge pull request 'master' (#134) from master into test

Reviewed-on: http://git.feashow.cn/feashow/SmartOpsWeb/pulls/134
This commit is contained in:
2024-10-06 11:27:38 +00:00
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>

View File

@@ -1,11 +1,13 @@
<template>
<div class="live-call">
<div class="live-call" v-loading="detailLoading">
<div class="header">
<div>
<span style="margin-right: 20px">{{ headData.username }}</span>
<span>电话号码{{ headData.phone }}</span>
</div>
<div><span>工单名称{{ headData.orderName }}</span></div>
<div>
<span>电话号码{{ headData.phone ||'--'}}</span>
</div>
<div><span>工单名称{{ headData.orderName ||'--'}}</span></div>
</div>
<el-scrollbar ref="scrollbarRef" class="scrollbar">
<div class="chat-content" ref="innerRef">
@@ -31,8 +33,10 @@
</div>
</div>
</div>
<el-divider border-style="dotted" v-if="item">一轮通话结束~~</el-divider>
<el-divider border-style="dotted" v-if="item.textVoList&&item.textVoList.length>0">一轮通话结束~~</el-divider>
</div>
<!-- <el-empty description="暂无通话记录~" v-if="recordArray"/>-->
</div>
</el-scrollbar>
</div>
@@ -51,10 +55,17 @@ const props = defineProps({
type: Object,
default: {}
},
detailLoading: {
type: Boolean,
default: false
},
})
const getScrollbarRef = () => {
return scrollbarRef.value
}
watch(() => props.detailLoading, (newVal) => {
props.detailLoading=newVal
})
defineExpose({
getScrollbarRef
})
@@ -62,7 +73,7 @@ defineExpose({
<style lang="scss" scoped>
.live-call {
width: 48%;
width: 50%;
height: 47vh;
margin-bottom: 20px;
overflow: hidden;

View File

@@ -2,10 +2,11 @@
<div class="live-call">
<div class="header">
<div>
<span style="margin-right: 20px">{{ headData.username }}</span>
<span>{{ headData.phone }}</span>
<span style="margin-right: 20px">姓名{{ recordObj.name ||'--'}}</span>
<span>电话号码{{ recordObj.phone ||'--'}}</span>
</div>
<div><span>工单名称{{ headData.orderName }}</span></div>
<div><span>工单名称{{ recordObj.orderName||'--' }}</span></div>
<div><span>{{ recordObj.type=='1'?'线路一':recordObj.type=='2'?'线路二':'' }}</span></div>
</div>
<el-scrollbar ref="scrollbarRef" class="scrollbar">
<div class="chat-content" ref="innerRef">
@@ -14,7 +15,8 @@
<!-- 我的 -->
<div v-if="item.speaker==0" class="word-my">
<div class="info">
<p class="name">{{ item.speaker==0?headData.username:'AI助手' }} </p>
<!-- <p class="name">{{ item.speaker==0?recordObj.name:'AI助手' }} </p>-->
<p class="name">{{ item.speaker==0?item.callIdNumber:'AI助手' }} </p>
<div class="info-content">{{ item.message }}</div>
</div>
<el-avatar text="我"/>
@@ -23,11 +25,15 @@
<div v-else class="word">
<el-avatar text="对方"/>
<div class="info">
<p class="name">{{ item.speaker==0?headData.username:'AI助手' }} </p>
<p class="name">{{ item.speaker==0?item.callIdNumber:'AI助手' }} </p>
<div class="info-content">{{ item.message }}</div>
</div>
</div>
</div>
<!-- <el-divider border-style="dotted" v-if="handleShowDeadLine(recordObj)">一轮通话结束~~</el-divider>-->
<!-- <el-empty description="暂无通话记录~" v-else/>-->
</div>
</el-scrollbar>
</div>
@@ -46,9 +52,28 @@ const props = defineProps({
default: {}
},
})
const getScrollbarRef=()=>{
return scrollbarRef.value
}
const handleShowDeadLine=(recordObj)=>{
console.info("🚀 ~method:'recordObj' -----", recordObj)
let flag=false
if(recordObj.content&&recordObj.content.length>1){
let indices = recordObj.content.reduce(function (r, v, i) {
return r.concat(v === 'a' ? i : []);
}, []);
console.log(indices);
recordObj.content.forEach((item,index)=>{
console.info("🚀 ~method:.callIdNumber -----",recordObj.content.findIndex(item=>item.callIdNumber), item.callIdNumber)
flag=recordObj.content[recordObj.content.length-2]?.callIdNumber!=recordObj.content[recordObj.content.length-1].callIdNumber
})
}
return flag;
}
defineExpose({
getScrollbarRef
})

View File

@@ -17,71 +17,21 @@ const authStore = useAuthStore()
const recordLeftRef = ref(null);
const recordRightRef = ref(null);
const leftHeadData = ref({
username: '张三',
phone: '13546812315',
orderName: '张三工单',
// username: '张三',
// phone: '13546812315',
// orderName: '张三工单',
})
const rightHeadData = ref({
username: '李四',
phone: '18246812546',
orderName: '李四工单',
// username: '李四',
// phone: '18246812546',
// orderName: '李四工单',
})
const recordLeftObj = ref({
content: []
}
// {
// "callIdNumber": "17260625724565",
// "content": [{
// "callIdNumber": "17260625724565",
// "conversationId": 0,
// "conversationTimestamp": "2024-09-15 12:10",
// "createTime": "2024-09-16",
// "message": "你好11",
// "speaker": "1"
// },
// {
// "callIdNumber": "17260625724565",
// "conversationId": 0,
// "conversationTimestamp": "2024-09-15 16:10",
// "createTime": "2024-09-16",
// "message": "你好好11!",
// "speaker": "0"
// }
// ],
// "name": "",
// "phone": "",
// "timestamp": "1726416597958",
// "type": "1"
// }
)
content: []
})
const recordRightObj = ref({
content: []
}
// {
// "callIdNumber": "17260625724123",
// "content": [{
// "callIdNumber": "17260625724123",
// "conversationId": 0,
// "conversationTimestamp": "2024-09-15 12:10",
// "createTime": "2024-09-16",
// "message": "你好22",
// "speaker": "1"
// },
// {
// "callIdNumber": "17260625724123",
// "conversationId": 0,
// "conversationTimestamp": "2024-09-15 16:10",
// "createTime": "2024-09-16",
// "message": "你好好222!",
// "speaker": "0"
// }
// ],
// "name": "",
// "phone": "",
// "timestamp": "1726416597958",
// "type": "2"
// }
)
content: []
})
let socket = reactive("");
let token = getToken();
let send = {
@@ -139,12 +89,20 @@ const initWebSocket = () => {
}
console.log("服务器返回的信息: ", data);
if (data.type == '1') {
recordLeftObj.value.name=data.name
recordLeftObj.value.phone=data.phone
recordLeftObj.value.type=data.type
recordLeftObj.value.orderName=data.orderName
recordLeftObj.value.content.push(data.content)
// console.info("🚀 ~method:onmessage -----", recordLeftObj.value)
nextTick(() => {
scrollToBottom(recordLeftRef.value)
})
} else {
recordRightObj.value.name=data.name
recordRightObj.value.phone=data.phone
recordRightObj.value.type=data.type
recordRightObj.value.orderName=data.orderName
recordRightObj.value.content.push(data.content)
// console.info("🚀 ~method:onmessage -----", recordRightObj.value)
nextTick(() => {

View File

@@ -8,7 +8,7 @@
<h3>历史通话记录</h3>
<fvTable ref="tableIns" :tableConfig="tableConfig"></fvTable>
<voice ref="voiceRef" title="语音详情" :rowUrl="rowUrl" />
<infoLiveCall ref="infoLiveCallRef" :rowData="rowData" />
<infoLiveCall ref="infoLiveCallRef" v-model:value="orderNumber" />
</div>
</div>
</template>
@@ -17,7 +17,7 @@
import LiveCall from '@/components/liveCall/index.vue'
import Voice from '@/components/voice/index.vue'
import InfoLiveCall from '@/components/infoLiveCall/index.vue'
const rowData = ref()
const orderNumber = ref('')
const rowUrl = ref()
const infoLiveCallRef = ref()
const voiceRef = ref()
@@ -121,7 +121,6 @@ const tableConfig = reactive({
],
api: '/order/list',
params: {
orderState: '2'
}
})
const handleVoice = (row) => {
@@ -137,10 +136,9 @@ const handleVoice = (row) => {
}
const handleInfo = (row) => {
console.log(row);
infoLiveCallRef.value.open(true)
rowData.value = row.orderNumber
console.log('fefe',row.orderNumber);
orderNumber.value = row.orderNumber
infoLiveCallRef.value.open()
}
</script>