|
@@ -509,6 +509,7 @@ import { useRouter } from 'vue-router';
|
|
import { useSocket } from '@/utils/websocket';
|
|
import { useSocket } from '@/utils/websocket';
|
|
import mittBus from '@/utils/mitt';
|
|
import mittBus from '@/utils/mitt';
|
|
import { voiceAssistant } from '@/api/todo/voiceAssistant';
|
|
import { voiceAssistant } from '@/api/todo/voiceAssistant';
|
|
|
|
+import {submitLog} from "@/api/public/log";
|
|
// 引入组件
|
|
// 引入组件
|
|
const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
|
|
const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
|
|
const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue'));
|
|
const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue'));
|
|
@@ -582,7 +583,7 @@ const talkTimer = ref<any>(null); // 通话时长定时器
|
|
// 开始通话计时
|
|
// 开始通话计时
|
|
const startTime = () => {
|
|
const startTime = () => {
|
|
let localTalkTime = Local.get('talkTime');
|
|
let localTalkTime = Local.get('talkTime');
|
|
- if (talkTime) {
|
|
|
|
|
|
+ if (talkTime.value) {
|
|
talkTime.value = Number(localTalkTime);
|
|
talkTime.value = Number(localTalkTime);
|
|
talkTimer.value = setInterval(() => {
|
|
talkTimer.value = setInterval(() => {
|
|
talkTime.value++;
|
|
talkTime.value++;
|
|
@@ -850,7 +851,7 @@ const websocket_connect = () => {
|
|
ola.close();
|
|
ola.close();
|
|
}
|
|
}
|
|
ola.onConnect = onConnect;
|
|
ola.onConnect = onConnect;
|
|
- ola.onclose = onclose;
|
|
|
|
|
|
+ ola.onClose = onClose;
|
|
ola.onMessage = onMessage;
|
|
ola.onMessage = onMessage;
|
|
ola.connect(import.meta.env.VITE_CALLCENTER_SOCKET_URL, currentTel.value.telNo, currentTel.value.password);
|
|
ola.connect(import.meta.env.VITE_CALLCENTER_SOCKET_URL, currentTel.value.telNo, currentTel.value.password);
|
|
};
|
|
};
|
|
@@ -874,7 +875,6 @@ const onConnect = () => {
|
|
ola.login(array_ola_queue, currentTel.value.telNo, { type: 'onhook' });
|
|
ola.login(array_ola_queue, currentTel.value.telNo, { type: 'onhook' });
|
|
connectVoiceAssistant(currentTel.value.telNo); // 坐席助手开启
|
|
connectVoiceAssistant(currentTel.value.telNo); // 坐席助手开启
|
|
}
|
|
}
|
|
-
|
|
|
|
Local.set('telNo', currentTel.value.telNo);
|
|
Local.set('telNo', currentTel.value.telNo);
|
|
};
|
|
};
|
|
// 业务系统发送消息
|
|
// 业务系统发送消息
|
|
@@ -1155,23 +1155,42 @@ const onMessage = async (event: any) => {
|
|
// console.log('command/reply', data);
|
|
// console.log('command/reply', data);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+// 记录日志
|
|
|
|
+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 isReconnect = ref(true); // 呼叫中心是否需要重连
|
|
const isReconnect = ref(true); // 呼叫中心是否需要重连
|
|
-const onclose = (e: any) => {
|
|
|
|
- console.log(e, 'ws断开');
|
|
|
|
- console.log('呼叫中心断开链接', isReconnect.value ? '需要重连' : '不需要重连');
|
|
|
|
|
|
+const onClose = async(event: any) => {
|
|
removeTimerOnDuty(); // 移除签入时长定时器
|
|
removeTimerOnDuty(); // 移除签入时长定时器
|
|
removeTimer(); // 移除通话计时器
|
|
removeTimer(); // 移除通话计时器
|
|
clearTimeout(talkDealTimer.value); // 清除话后整理定时器
|
|
clearTimeout(talkDealTimer.value); // 清除话后整理定时器
|
|
clearInterval(pingTimer.value); // 清除心跳定时器
|
|
clearInterval(pingTimer.value); // 清除心跳定时器
|
|
clearInterval(onDutyTimer.value); // 清除签入时长定时器
|
|
clearInterval(onDutyTimer.value); // 清除签入时长定时器
|
|
clearInterval(talkTimer.value); // 清除通话时长定时器
|
|
clearInterval(talkTimer.value); // 清除通话时长定时器
|
|
|
|
+ console.log('呼叫中心断开链接', isReconnect.value ? '需要重连' : '不需要重连');
|
|
if (isReconnect.value) {
|
|
if (isReconnect.value) {
|
|
- reConnect(); // 重新链接呼叫中心
|
|
|
|
|
|
+ await reConnect(); // 重新链接呼叫中心
|
|
Local.set('currentTelNo', currentTel.value.telNo);
|
|
Local.set('currentTelNo', currentTel.value.telNo);
|
|
}
|
|
}
|
|
// 重置所有状态
|
|
// 重置所有状态
|
|
useTelStatusStore.resetState();
|
|
useTelStatusStore.resetState();
|
|
|
|
+ await submitLogFn(event);
|
|
};
|
|
};
|
|
// 重新链接呼叫中心
|
|
// 重新链接呼叫中心
|
|
let reconnectAttempts = 0; // 重连次数
|
|
let reconnectAttempts = 0; // 重连次数
|
|
@@ -1273,6 +1292,10 @@ const offDutyFn = () => {
|
|
state.loading = true;
|
|
state.loading = true;
|
|
dutyOff()
|
|
dutyOff()
|
|
.then(() => {
|
|
.then(() => {
|
|
|
|
+ console.log('业务系统:签出成功')
|
|
|
|
+
|
|
|
|
+ isReconnect.value = false; // 不需要重连
|
|
|
|
+ Local.set('isReconnect1',false)
|
|
sendMsg('logout');
|
|
sendMsg('logout');
|
|
ola.logout(currentTel.value.telNo); //签出
|
|
ola.logout(currentTel.value.telNo); //签出
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -1286,8 +1309,7 @@ const offDutyFn = () => {
|
|
clearInterval(pingTimer.value); // 清除心跳定时器
|
|
clearInterval(pingTimer.value); // 清除心跳定时器
|
|
clearInterval(onDutyTimer.value); // 清除签入时长定时器
|
|
clearInterval(onDutyTimer.value); // 清除签入时长定时器
|
|
clearInterval(talkTimer.value); // 清除通话时长定时器
|
|
clearInterval(talkTimer.value); // 清除通话时长定时器
|
|
- isReconnect.value = false; // 不需要重连
|
|
|
|
- state.loading = false;
|
|
|
|
|
|
+
|
|
state.dutyOnSrc = getImageUrl('phoneControls/dutyOn_blue.png'); //签入图片
|
|
state.dutyOnSrc = getImageUrl('phoneControls/dutyOn_blue.png'); //签入图片
|
|
state.loading = false;
|
|
state.loading = false;
|
|
})
|
|
})
|