|
@@ -509,7 +509,7 @@ import { useRouter } from 'vue-router';
|
|
|
import { useSocket } from '@/utils/websocket';
|
|
|
import mittBus from '@/utils/mitt';
|
|
|
import { voiceAssistant } from '@/api/todo/voiceAssistant';
|
|
|
-import {submitLog} from "@/api/public/log";
|
|
|
+import { submitLog } from '@/api/public/log';
|
|
|
// 引入组件
|
|
|
const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
|
|
|
const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue'));
|
|
@@ -875,7 +875,7 @@ const onConnect = () => {
|
|
|
ola.login(array_ola_queue, currentTel.value.telNo, { type: 'onhook' });
|
|
|
connectVoiceAssistant(currentTel.value.telNo); // 坐席助手开启
|
|
|
}
|
|
|
- Local.set('telNo', currentTel.value.telNo);
|
|
|
+ Local.set('telNo', currentTel.value.telNo);
|
|
|
};
|
|
|
// 业务系统发送消息
|
|
|
const sendMsg = (msg: any) => {
|
|
@@ -923,6 +923,7 @@ const onMessage = async (event: any) => {
|
|
|
console.log('呼叫中心:已签出');
|
|
|
ElMessage.success('签出成功');
|
|
|
clearInterval(pingTimer.value); // 清除心跳定时器
|
|
|
+ isReconnect.value = false; // 不需要重连
|
|
|
seatAssistOff();
|
|
|
} else if (data.state == 'ready') {
|
|
|
// 结束计时
|
|
@@ -1157,40 +1158,40 @@ const onMessage = async (event: any) => {
|
|
|
};
|
|
|
// 记录日志
|
|
|
const submitLogFn = async (event: any) => {
|
|
|
- const telsNo = Local.get('telNo');
|
|
|
- const name: string = `分机号:${telsNo}的websocket断开链接`;
|
|
|
- const remark: string = `websocket 断开: 错误code:${event.code}, 错误原因:${event.reason}, 是否正常断开:${event.wasClean}`;
|
|
|
- console.log(name, remark, event);
|
|
|
- const request = {
|
|
|
- creationTime: new Date(),
|
|
|
- name,
|
|
|
- remark,
|
|
|
- executeUrl: import.meta.env.VITE_CALLCENTER_SOCKET_URL,
|
|
|
- };
|
|
|
- try {
|
|
|
- await submitLog(request);
|
|
|
- Local.remove('telNo');
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- }
|
|
|
+ const telsNo = Local.get('telNo');
|
|
|
+ const name: string = `分机号:${telsNo}的websocket断开链接`;
|
|
|
+ const remark: string = `websocket 断开: 错误code:${event.code}, 错误原因:${event.reason}, 是否正常断开:${event.wasClean}`;
|
|
|
+ console.log(name, remark, event);
|
|
|
+ const request = {
|
|
|
+ creationTime: new Date(),
|
|
|
+ name,
|
|
|
+ remark,
|
|
|
+ executeUrl: import.meta.env.VITE_CALLCENTER_SOCKET_URL,
|
|
|
+ };
|
|
|
+ try {
|
|
|
+ await submitLog(request);
|
|
|
+ Local.remove('telNo');
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
};
|
|
|
// 呼叫中心链接关闭
|
|
|
const isReconnect = ref(true); // 呼叫中心是否需要重连
|
|
|
-const onClose = async(event: any) => {
|
|
|
+const onClose = async (event: any) => {
|
|
|
removeTimerOnDuty(); // 移除签入时长定时器
|
|
|
removeTimer(); // 移除通话计时器
|
|
|
clearTimeout(talkDealTimer.value); // 清除话后整理定时器
|
|
|
clearInterval(pingTimer.value); // 清除心跳定时器
|
|
|
clearInterval(onDutyTimer.value); // 清除签入时长定时器
|
|
|
clearInterval(talkTimer.value); // 清除通话时长定时器
|
|
|
- console.log('呼叫中心断开链接', isReconnect.value ? '需要重连' : '不需要重连');
|
|
|
+ console.log('呼叫中心断开链接', isReconnect.value ? '需要重连' : '不需要重连');
|
|
|
if (isReconnect.value) {
|
|
|
await reConnect(); // 重新链接呼叫中心
|
|
|
Local.set('currentTelNo', currentTel.value.telNo);
|
|
|
}
|
|
|
// 重置所有状态
|
|
|
useTelStatusStore.resetState();
|
|
|
- await submitLogFn(event);
|
|
|
+ await submitLogFn(event);
|
|
|
};
|
|
|
// 重新链接呼叫中心
|
|
|
let reconnectAttempts = 0; // 重连次数
|
|
@@ -1292,10 +1293,8 @@ const offDutyFn = () => {
|
|
|
state.loading = true;
|
|
|
dutyOff()
|
|
|
.then(() => {
|
|
|
- console.log('业务系统:签出成功')
|
|
|
-
|
|
|
- isReconnect.value = false; // 不需要重连
|
|
|
- Local.set('isReconnect1',false)
|
|
|
+ console.log('业务系统:签出成功');
|
|
|
+ Local.set('isReconnect1', false);
|
|
|
sendMsg('logout');
|
|
|
ola.logout(currentTel.value.telNo); //签出
|
|
|
setTimeout(() => {
|