|
@@ -504,7 +504,7 @@
|
|
|
class="w100"
|
|
|
allow-create
|
|
|
default-first-option
|
|
|
- :props="{
|
|
|
+ :props="{
|
|
|
label: 'dicDataName',
|
|
|
value: 'dicDataValue',
|
|
|
}"
|
|
@@ -521,7 +521,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="telControl">
|
|
|
-import { reactive, ref, computed, defineAsyncComponent, onMounted, onBeforeUnmount } from 'vue';
|
|
|
+import { reactive, ref, computed, defineAsyncComponent, onMounted, onBeforeUnmount, watch } from 'vue';
|
|
|
import { ElMessageBox, ElNotification, ElMessage, FormInstance } from 'element-plus';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { useTelStatus, TelStates, RestStates } from '@/stores/telStatus';
|
|
@@ -557,7 +557,7 @@ import mittBus from '@/utils/mitt';
|
|
|
import { voiceAssistant } from '@/api/todo/voiceAssistant';
|
|
|
import { submitLog } from '@/api/public/log';
|
|
|
import { B } from '@vueuse/motion/dist/shared/motion.5ee44005';
|
|
|
-import { getDataByCode } from "@/api/system/dict";
|
|
|
+import { getDataByCode } from '@/api/system/dict';
|
|
|
// 引入组件
|
|
|
const CommonAdvice = defineAsyncComponent(() => import('@/components/CommonAdvice/index.vue')); // 常用意见
|
|
|
const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue'));
|
|
@@ -571,7 +571,7 @@ const state = reactive<any>({
|
|
|
telNo: null, //分机号
|
|
|
},
|
|
|
telsList: <EmptyArrayType>[], // 分机列表
|
|
|
- threeWayAndTransfer: <EmptyArrayType>[], // 三方通话和转接
|
|
|
+ threeWayAndTransfer: <EmptyArrayType>[], // 三方通话和转接
|
|
|
loading: false,
|
|
|
showHangupList: false, //是否展示挂断列表
|
|
|
restDialogVisible: false, //小休弹窗
|
|
@@ -738,7 +738,7 @@ const RestApplyPassFn = (data: any) => {
|
|
|
const getTelsLists = async () => {
|
|
|
state.loading = true;
|
|
|
try {
|
|
|
- const {result} = await getTelList();
|
|
|
+ const { result } = await getTelList();
|
|
|
state.telsList = result ?? [];
|
|
|
state.loading = false;
|
|
|
return state.telsList;
|
|
@@ -750,12 +750,12 @@ const getTelsLists = async () => {
|
|
|
// 查询三方会议和转接的号码
|
|
|
const getThreeWayAndTransfer = async () => {
|
|
|
try {
|
|
|
- const {result} = await getDataByCode('TransferNumber');
|
|
|
- state.threeWayAndTransfer = result ?? [];
|
|
|
+ const { result } = await getDataByCode('TransferNumber');
|
|
|
+ state.threeWayAndTransfer = result ?? [];
|
|
|
} catch (err) {
|
|
|
- console.log(err);
|
|
|
- }
|
|
|
-}
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+};
|
|
|
// 鼠标移入移出改变图标
|
|
|
const onHover = (val: string, path: string) => {
|
|
|
state[val] = getImageUrl(path);
|
|
@@ -856,7 +856,6 @@ const onConnect = () => {
|
|
|
// 普通模式才链接语音助手
|
|
|
connectVoiceAssistant(currentTel.value.telNo); // 坐席助手开启
|
|
|
}
|
|
|
- // isReconnect.value = true;
|
|
|
};
|
|
|
// 业务系统发送消息
|
|
|
const sendMsg = (msg: any) => {
|
|
@@ -1262,31 +1261,22 @@ const onClose = async (event: any) => {
|
|
|
await submitLogFn(event);
|
|
|
};
|
|
|
// 重新链接呼叫中心
|
|
|
-let reconnectAttempts = 0; // 重连次数
|
|
|
-let maxReconnectAttempts = 99; // 最大重连次数
|
|
|
-let reconnectInterval = 2; // 重连间隔
|
|
|
const reconnectTimeout = ref(); // 重连定时器
|
|
|
+// 避免重复连接
|
|
|
+let lockReconnect = false;
|
|
|
const reConnect = async () => {
|
|
|
- /* ElNotification({
|
|
|
- title: '重连提示',
|
|
|
- message: `检测到与呼叫中心链接断开,${reconnectInterval}秒后将重新链接`,
|
|
|
- type: 'warning',
|
|
|
- duration: reconnectInterval * 1000,
|
|
|
- });*/
|
|
|
- console.log('开始重连', `已重连${reconnectAttempts}次,最大重连次数${maxReconnectAttempts}次,重连间隔${reconnectInterval}秒`);
|
|
|
- if (reconnectAttempts < maxReconnectAttempts) {
|
|
|
- reconnectTimeout.value = setTimeout(() => {
|
|
|
- reconnectAttempts++;
|
|
|
- websocket_connect();
|
|
|
- }, reconnectInterval * 1000);
|
|
|
- } else {
|
|
|
- ElNotification({
|
|
|
- title: '呼叫中心重连失败',
|
|
|
- message: '已到达重连次数最高,请手动刷新重连',
|
|
|
- type: 'warning',
|
|
|
- });
|
|
|
- console.error('已到达重连次数最高,请手动刷新重连');
|
|
|
+ console.log(`是否锁定重连: ${lockReconnect}`);
|
|
|
+ if (lockReconnect) {
|
|
|
+ return;
|
|
|
}
|
|
|
+ lockReconnect = true;
|
|
|
+ //没连接上会一直重连,设置延迟避免请求过多
|
|
|
+ reconnectTimeout.value && clearTimeout(reconnectTimeout.value);
|
|
|
+ console.log('开始重连');
|
|
|
+ reconnectTimeout.value = setTimeout(() => {
|
|
|
+ websocket_connect();
|
|
|
+ lockReconnect = false;
|
|
|
+ }, 2 * 1000);
|
|
|
};
|
|
|
// 链接成功 停止重连
|
|
|
const stopReconnect = () => {
|
|
@@ -2013,11 +2003,18 @@ onMounted(async () => {
|
|
|
await signalRStart(); //开启消息监听
|
|
|
await resetState(); // 先重置状态
|
|
|
await getTelsLists(); // 查询所有分机
|
|
|
- await getThreeWayAndTransfer(); // 查询转接和三方
|
|
|
+ await getThreeWayAndTransfer(); // 查询转接和三方
|
|
|
await callCenterConnect(); // 呼叫中心链接
|
|
|
// 加入分组
|
|
|
await signalR.joinGroup('CallCenter');
|
|
|
});
|
|
|
+watch(
|
|
|
+ () => isReconnect.value,
|
|
|
+ (val: boolean) => {
|
|
|
+ console.log(`是否需要重连:${isReconnect.value}`);
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+);
|
|
|
onBeforeUnmount(() => {
|
|
|
mittBus.off('RestApplyPass');
|
|
|
if (ola.ws) ola.close();
|