Browse Source

reactor:自贡呼叫中心新增心跳消息;

zhangchong 7 months ago
parent
commit
fbd9c1f672
1 changed files with 17 additions and 16 deletions
  1. 17 16
      src/layout/navBars/breadcrumb/zgTel.vue

+ 17 - 16
src/layout/navBars/breadcrumb/zgTel.vue

@@ -387,11 +387,13 @@ const { themeConfig } = storeToRefs(storesThemeConfig);
 const initWs = () => {
 	wsRef.value = useWebSocket(themeConfig.value.callCenterSocketUrl, {
 		heartbeat: {
-			message: JSON.stringify({ "Action": "ReqHealthCheck", "Param": {"Extension": m_strUserNo.value} }),
+			message: JSON.stringify({ Action: 'ReqHealthCheck', Param: { Extension: m_strUserNo.value } }),
 			interval: 5000,
 			pongTimeout: 5000,
 		},
-		autoReconnect: true, // 自动重连
+		autoReconnect: {
+			delay: 2000,
+		}, // 自动重连
 		immediate: false, // 是否立即链接
 		onMessage: e_TelMsgReceive, // 消息接收
 		onError: e_websocketError, // 错误
@@ -1123,7 +1125,7 @@ const onBusy = () => {
 Result:0-1
 0:成功 1:失败
 */
-const retBusy = (data) => {
+const retBusy = (data: any) => {
 	if (data.Param.Result === '0') {
 		m_bTelBusy.value = true;
 		m_strTelState.value = '201';
@@ -1166,7 +1168,7 @@ const onIdle = () => {
 Result:0-1
 0:成功 1:失败
 */
-const retIdle = (data) => {
+const retIdle = (data: any) => {
 	if (data.Param.Result == '0') {
 		m_bTelBusy.value = false;
 		m_strTelState.value = '200';
@@ -1206,7 +1208,7 @@ const onHold = () => {
 /*
  * 保持返回
  */
-const retHold = (data) => {
+const retHold = (data: any) => {
 	if (data.Param.Result == '0') {
 		m_IsHold.value = true;
 		m_strTelState.value = '310';
@@ -1246,7 +1248,7 @@ const onReHold = () => {
 /*
  * 取消保持返回状态
  */
-const retRehold = (data) => {
+const retRehold = (data: any) => {
 	if (data.Param.Result == '0') {
 		// 是否是保持通话
 		m_IsHold.value = false;
@@ -1288,7 +1290,7 @@ const outboundFormClose = () => {
  * Called:被叫
  * CustomerId:客户ID
  */
-const callout = (strCallNumber) => {
+const callout = (strCallNumber: string | number | null) => {
 	if (!strCallNumber) {
 		ElMessage.error('电话号码不能为空');
 		return;
@@ -1313,7 +1315,7 @@ const callout = (strCallNumber) => {
 Result:0-1
 0:成功 1:失败
 */
-const retCallOut = (data) => {
+const retCallOut = (data: any) => {
 	state.loading = false;
 	if (data.Param.Result == '0') {
 		// 是否外呼
@@ -1350,8 +1352,8 @@ const consultFormClose = () => {
 	consultFormRef.value?.resetFields();
 	consultFormRef.value?.clearValidate();
 };
-const onConsult = (strCallNumber: string, strType: string) => {
-	let strObj;
+const onConsult = (strCallNumber: string | number | null, strType: string) => {
+	let strObj: EmptyObjectType;
 	switch (strType) {
 		// 内线
 		case '0':
@@ -1480,7 +1482,7 @@ const blindFormClose = () => {
 	blindFormRef.value?.resetFields();
 	blindFormRef.value?.clearValidate();
 };
-const onTransferMz = (strCallNumber) => {
+const onTransferMz = (strCallNumber: string) => {
 	const objMsg = {
 		Action: 'ReqBlindTransfer',
 		Param: {
@@ -1547,7 +1549,7 @@ const stopConferenceTime = () => {
  * 三方会议返回
  * { "Action": "ReqConference", "Param": {"Extension": "1002"} }
  */
-const retResConference = (data) => {
+const retResConference = (data: any) => {
 	state.loading = false;
 	if (data.Param.Result == '0') {
 		// 咨询成功
@@ -1698,7 +1700,7 @@ const reqStopListen = (strTargetNum: string) => {
 /*
  * 取消监听返回
  */
-const retResStopListen = (data) => {
+const retResStopListen = (data: any) => {
 	if (data.Param.Result == '0') {
 		m_IsMonListen.value = '1';
 		// 成功
@@ -2149,7 +2151,6 @@ const e_TelSignIn = async (telNo: string, groupId: string) => {
 		console.log(`${getNowDateTime()}:业务系统:签入成功`, result);
 	} catch (e) {
 		console.log(e);
-		sendSignOut(); // 签出
 	}
 };
 /*
@@ -2173,7 +2174,7 @@ const e_TelSignOut = async (telNo: string, groupId: string) => {
  * @param {any} strUserNum
  * @param strQueueInfo
  */
-const e_SetQueryWait = (strUserNum, strQueueInfo) => {
+const e_SetQueryWait = (strUserNum: string | number, strQueueInfo: any) => {
 	const data = {
 		Action: 'SaveQueueNumNew',
 		QueueNum: strUserNum,
@@ -2230,7 +2231,7 @@ onMounted(async () => {
 	initWs();
 	await checkLogin();
 	// 是否在通话中
-	window.onbeforeunload = function (e) {
+	window.onbeforeunload = function (e: any) {
 		if (m_bCallConnect.value) {
 			const dialogText = '正在通话中,您确定要刷新吗?';
 			e.returnValue = dialogText;