浏览代码

reactor:测试呼叫中心;

zhangchong 1 年之前
父节点
当前提交
6343efb5cf
共有 1 个文件被更改,包括 23 次插入14 次删除
  1. 23 14
      src/layout/navBars/breadcrumb/telControl.vue

+ 23 - 14
src/layout/navBars/breadcrumb/telControl.vue

@@ -170,7 +170,7 @@
 			</template>
 
 			<!-- 三方会议 可用(当前处于通话中)-->
-			<template v-if="telStatusInfo.isDutyOn && activeArr.includes('conference')">
+			<template v-if="telStatusInfo.isDutyOn && activeArr.includes('conference') && onCallArr.length !== 1">
 				<div
 					class="item active"
 					@mouseenter="onHover('conferenceSrc', 'phoneControls/conference_white.png')"
@@ -183,7 +183,7 @@
 				</div>
 			</template>
 			<!-- 三方会议并且处于三方会议中  -->
-			<template v-else-if="telStatusInfo.isDutyOn && activeArr.includes('conference') && onCallArr.length === 2">
+			<template v-else-if="telStatusInfo.isDutyOn && activeArr.includes('conference') && onCallArr.length === 1">
 				<el-popover :width="130 * onCallArr.length" :offset="0" v-model:visible="threeWayVisible" trigger="hover" popper-class="hangup-popover">
 					<template #reference>
 						<div
@@ -198,7 +198,7 @@
 					</template>
 					<div class="hangup-container">
 						<div class="hangup-item" v-for="(item, index) in onCallArr" :key="index">
-							<p class="hangup-item-phoneNumber">{{ item.number }}</p>
+							<p class="hangup-item-phoneNumber">{{ item.telNo }}</p>
 							<el-button size="small" @click="kickOut(item)" class="default-button">踢出</el-button>
 						</div>
 					</div>
@@ -622,6 +622,7 @@ const RestApplyPassFn = (data: any) => {
 	});
 	//不需要审核直接开始小休
 	ola.go_break(state.restForm.reason); //设置忙碌
+  console.log('调用示忙审核')
 };
 // 查询所有分机
 const getTelsLists = async () => {
@@ -847,7 +848,8 @@ const onConnect = () => {
 		ola.login(array_ola_queue, currentTel.value.telNo, { type: 'onhook' });
 	}
 };
-const router = useRouter()
+const router = useRouter();
+const talkDealTimer = ref<any>(null); // 话后整理定时器
 // 呼叫中心消息
 const onMessage = (event: any) => {
 	const data = JSON.parse(event.data);
@@ -868,6 +870,7 @@ const onMessage = (event: any) => {
 			setTimeout(() => {
 				// 设置示闲状态
 				ola.go_ready();
+        console.log('调用示闲')
 			}, 1000);
 			console.log('已签入');
       ElMessage.success('签入成功!');
@@ -933,7 +936,6 @@ const onMessage = (event: any) => {
       // 设置分机号和坐席组
       useTelStatusStore.setCallInfo({ telsNo: data.agent_extn});
 
-
 			// 话后整理中
 			const time: number = AppConfigInfo.value.talkingDealTime * 1000; // 话后整理时间
 			ElNotification({
@@ -945,12 +947,14 @@ const onMessage = (event: any) => {
 			useTelStatusStore.setTalkingDeal(true);
 			// 设置话机状态 设置为话后整理中
 			useTelStatusStore.setPhoneControlState(TelStates.onTalkingDeal);
-			setTimeout(() => {
+      talkDealTimer.value =  setTimeout(() => {
 				// 设置话后整理
 				useTelStatusStore.setTalkingDeal(false);
 				// 设置话机状态 取消话后整理修改为空闲状态
 				useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
 				ola.go_ready(); // 示闲
+        console.log('调用示闲')
+        clearTimeout(talkDealTimer.value); // 清除话后整理定时器
 			}, time);
 			console.log('话后整理中');
 		} else if (data.state == 'busy') {
@@ -974,8 +978,9 @@ const onMessage = (event: any) => {
       } else if(data.private_data == 'three_way_ring'){ // 三方通话呼出中
         console.log('三方通话呼出中')
       }else if(data.private_data == 'three_way_answered'){ // 三方通话呼出接通
-        onCallArr.value.push(data); // 三方通话呼出中
+        onCallArr.value.push({telNo:state.threeWayForm.telNo}); // 三方通话呼出接通
         console.log('三方通话呼出接通,推送一次')
+        console.log(onCallArr.value,telStatusInfo.value.isDutyOn, activeArr.value.includes('conference'))
       }else if (data.call_direction == 'outbound') {
 				// 呼出
 				if (data.private_data == 'calling') {
@@ -995,9 +1000,7 @@ const onMessage = (event: any) => {
 						startTime();
 						// 设置电话状态 通话中
 						useTelStatusStore.setPhoneControlState(TelStates.onCall);
-
-            onCallArr.value.push(data); // 呼出通话中
-						console.log('呼出通话中,推送一次');
+						console.log('呼出通话中');
 					}
 				}
 			} else {
@@ -1033,8 +1036,7 @@ const onMessage = (event: any) => {
 					// 设置电话状态 通话中
 					useTelStatusStore.setPhoneControlState(TelStates.onCall);
 
-          onCallArr.value.push(data); // 呼入通话中
-					console.log('呼入通话中,推送一次');
+					console.log('呼入通话中');
 				}
 			}
 		}  else if (data.old_state == 'busy') {
@@ -1046,6 +1048,7 @@ const onMessage = (event: any) => {
 
 			// 结束计时
 			removeTimer();
+      onCallArr.value = [];
 			console.log('已挂机',onCallArr.value,data);
 		}
 	} else if (data.event_type == 'agent_caller_state') {
@@ -1245,6 +1248,7 @@ const clickOnRest = (formEl: FormInstance | undefined) => {
 		} else {
 			//不需要审核直接开始小休
 			ola.go_break(state.restForm.reason); //设置忙碌
+      console.log('调用示忙')
 			state.restDialogVisible = false;
 			state.loading = false;
 		}
@@ -1272,6 +1276,7 @@ const onRestEnd = () => {
 		.then(() => {
 			state.loading = true;
 			ola.go_ready(); // 示闲
+      console.log('调用示闲')
 			state.loading = false;
 		})
 		.catch(() => {});
@@ -1329,6 +1334,8 @@ const unTalkingDeal = () => {
 			// 设置话机状态 取消话后整理修改为空闲状态
 			useTelStatusStore.setPhoneControlState(TelStates.dutyOn);
 			ola.go_ready(); // 示闲
+      clearTimeout(talkDealTimer.value); // 清除话后整理定时器
+      console.log('调用示闲')
 			state.loading = false;
 		})
 		.catch(() => {});
@@ -1370,7 +1377,7 @@ const clickOnThreeWay = (formEl: FormInstance | undefined) => {
 	});
 };
 const kickOut = (item: any) => {
-	ElMessageBox.confirm(`确定确定要踢出${item.number},并恢复通话,是否继续?`, '提示', {
+	ElMessageBox.confirm(`确定确定要踢出${item.telNo},并恢复通话,是否继续?`, '提示', {
 		confirmButtonText: '确认',
 		cancelButtonText: '取消',
 		type: 'warning',
@@ -1379,7 +1386,8 @@ const kickOut = (item: any) => {
 		autofocus: false,
 	})
 		.then(() => {
-			// state.threeWayDialogVisible = true;
+      ola.exit_three_way(item.telNo) // 踢出第三方
+      onCallArr.value = [];
 		})
 		.catch(() => {});
 };
@@ -1405,6 +1413,7 @@ const clickOnOutbound = (formEl: FormInstance | undefined) => {
 	});
 };
 onMounted(async () => {
+  clearTimeout(talkDealTimer.value); // 清除话后整理定时器
 	signalRStart(); //开启消息监听
 	await getTelsLists(); // 查询所有分机
 	if (telStatusInfo.value.telsNo) {