浏览代码

reactor:优化在签出是确保了呼叫中心签出后才会退出系统;

zhangchong 6 月之前
父节点
当前提交
2c45ff5424

+ 1 - 1
src/components/ProcessAudit/ZGProcess.vue

@@ -674,7 +674,7 @@ const handleResult = (res: any) => {
 			state.ruleForm.nextStepCode = state.nextStepOptions[0].key; // 下一节点code
 			state.ruleForm.nextStepName = state.nextStepOptions[0].value; // 下一节点name
 			state.ruleForm.backToCountersignEnd = state.nextStepOptions[0].backToCountersignEnd ?? false; // 是否回到会签结束节点
-		}, 0);
+		}, 100);
 		selectNextStep(state.nextStepOptions[0].key); // 查询流程下一节点参数
 	} else {
 		state.ruleForm.nextStepCode = '';

+ 1 - 1
src/components/ProcessAudit/index.vue

@@ -1213,7 +1213,7 @@ const handleResult = (res: any) => {
 			state.ruleForm.nextStepCode = state.nextStepOptions[0].key; // 下一节点code
 			state.ruleForm.nextStepName = state.nextStepOptions[0].value; // 下一节点name
 			state.ruleForm.backToCountersignEnd = state.nextStepOptions[0].backToCountersignEnd ?? false; // 是否回到会签结束节点
-		}, 0);
+		}, 100);
 		selectNextStep(state.nextStepOptions[0].key); // 查询流程下一节点参数
 	} else {
 		state.ruleForm.nextStepCode = '';

+ 27 - 16
src/layout/navBars/breadcrumb/user.vue

@@ -341,16 +341,22 @@ const onLogOut = () => {
 			},
 		})
 			.then(() => {
-				callCenterLogout(); // 呼叫中心退出
-				setTimeout(() => {
-					signalR.leaveAllGroupAndStop(); // 退出所有组
-					// 清除缓存/token等
-					Local.clear();
-					Session.clear();
-					Cookie.clear();
-					// 使用 reload 时,不需要调用 resetRoute() 重置路由
-					window.location.reload();
-				}, 300);
+				callCenterLogout().then(()=>{
+					console.log('呼叫中心ws退出成功');
+					signalR.leaveAllGroupAndStop().then(()=>{
+						console.log('业务中心ws退出成功');
+						setTimeout(() => {
+							// 清除缓存/token等
+							Local.clear();
+							Session.clear();
+							Cookie.clear();
+							// 使用 reload 时,不需要调用 resetRoute() 重置路由
+							window.location.reload();
+						}, 300);
+					}) // 退出所有组
+				}).catch(()=>{
+
+				})
 			})
 			.catch(() => {});
 		return;
@@ -385,12 +391,17 @@ const onLogOut = () => {
 		},
 	})
 		.then(async () => {
-			// 清除缓存/token等
-			Local.clear();
-			Session.clear();
-			Cookie.clear();
-			// 使用 reload 时,不需要调用 resetRoute() 重置路由
-			window.location.reload();
+			signalR.leaveAllGroupAndStop().then(()=>{
+				console.log('业务中心ws退出成功');
+				setTimeout(() => {
+					// 清除缓存/token等
+					Local.clear();
+					Session.clear();
+					Cookie.clear();
+					// 使用 reload 时,不需要调用 resetRoute() 重置路由
+					window.location.reload();
+				}, 300);
+			}) // 退出所有组
 		})
 		.catch(() => {});
 };

+ 20 - 17
src/utils/callCenter.ts

@@ -91,7 +91,7 @@ const signOutFn = () => {
 	};
 	// 发送请求
 	e_TelSendMsg(objMsg);
-	e_TelSignOut(globalState.currentTel.telNo, globalState.currentTel.telGroup)
+	e_TelSignOut(globalState.currentTel.telNo, globalState.currentTel.telGroup);
 };
 /*
  * 用户分机签出(用户分机分离业务)
@@ -127,20 +127,23 @@ export function callCenterOutbound(phoneNumber: number | string) {
 	}
 }
 // 统一调用退出登录并关闭链接方法 兼容不同的呼叫中心
-export function callCenterLogout() {
-	if (!globalState.callCenterWs) {
-		ElMessage.warning('请先签入');
-		return;
-	}
-	switch (themeConfig.value.appScope) {
-		case 'YiBin':
-			globalState.callCenterWs?.logout();
-			dutyOff(); // 呼叫中心签出
-			break;
-		case 'ZiGong':
-		case 'LuZhou':
-			signOutFn();
-			break;
-		default:
-	}
+export function callCenterLogout(){
+	return new Promise(( resolve, reject)=>{
+		if (!globalState.callCenterWs) {
+			ElMessage.warning('请先签入');
+			return reject();
+		}
+		switch (themeConfig.value.appScope) {
+			case 'YiBin':
+				globalState.callCenterWs?.logout();
+				dutyOff(); // 呼叫中心签出
+			 	return resolve(true);
+			case 'ZiGong':
+			case 'LuZhou':
+				signOutFn();
+				return resolve(true);
+			default:
+				return resolve(true);
+		}
+	})
 }

+ 19 - 13
src/utils/signalR.ts

@@ -39,7 +39,9 @@ export default {
 			await submitLogFn(request);
 			console.log(`${getNowDateTime()}:业务系统signal当前链接状态:${connection.state}`);
 			// 建议用户重新刷新浏览器
-			await this.start();
+			setTimeout(async () => {
+				await this.start();
+			}, 1000);
 		});
 		connection.onreconnected(async () => {
 			const name: string = `业务系统websocket断线重连成功`;
@@ -61,15 +63,15 @@ export default {
 		});
 		// 服务端推送消息
 		connection.on('Send', (message: any) => {
-			console.log(`${getNowDateTime()}:有用户加入分组:`,message);
+			console.log(`${getNowDateTime()}:有用户加入分组:`, message);
 		});
 		// 服务端推送消息
 		connection.on('CircularRecord', (message: any) => {
-			console.log(`${getNowDateTime()}:小红点消息:`,message);
+			console.log(`${getNowDateTime()}:小红点消息:`, message);
 		});
 		// 服务端推送消息
 		connection.on('SeatState', (message: any) => {
-			console.log(`${getNowDateTime()}:座席状态:`,message);
+			console.log(`${getNowDateTime()}:座席状态:`, message);
 		});
 		// 服务端推送消息
 		connection.on('RestApplyPass', (message: any) => {
@@ -199,14 +201,18 @@ export default {
 	 * @returns
 	 */
 	async leaveAllGroupAndStop() {
-		try {
-			//使用async和await 或 promise的then 和catch 处理来自服务端的异常
-			await this.leaveGroup('CallCenter');
-			await this.leaveGroup('BigScreen-SeatState');
-			await this.stop();
-			console.log(`${getNowDateTime()}:断开链接:${this.SR.state}`);
-		} catch (error) {
-			console.log('signalR', error);
-		}
+		return new Promise(async (resolve, reject) => {
+			try {
+				//使用async和await 或 promise的then 和catch 处理来自服务端的异常
+				await this.leaveGroup('CallCenter');
+				await this.leaveGroup('BigScreen-SeatState');
+				await this.stop();
+				console.log(`${getNowDateTime()}:断开链接:${this.SR.state}`);
+				return resolve(true);
+			} catch (error) {
+				console.log('signalR', error);
+				return reject(error);
+			}
+		});
 	},
 };

+ 6 - 10
src/views/business/visit/components/Visit-detail.vue

@@ -626,7 +626,12 @@ const isTelSource = computed(() => {
 	return state.orderDetail?.sourceChannelCode === 'RGDH';
 });
 // 打开弹窗
+const callId = ref<string>('');
 const openDialog = (row: any, type: string = '回访') => {
+	mittBus.on('outboundConnect', (data) => {
+		console.log(data, '外呼已经接通辣');
+		if (data.callNumber === state.orderDetail.contact) callId.value = data.callId;
+	});
 	if (!row.id || !row) {
 		ElMessage.warning('传入回访ID不正确');
 		return;
@@ -680,6 +685,7 @@ const selectReason = (val: any, index: number | string) => {
 const close = () => {
 	ruleFormRef.value?.clearValidate();
 	ruleFormRef.value?.resetFields();
+	mittBus.off('outboundConnect');
 };
 // 提交
 const onSubmit = (formEl: FormInstance | undefined) => {
@@ -756,16 +762,6 @@ const columns = ref<any[]>([
 		},
 	},
 ]);
-const callId = ref<string>('');
-onMounted(() => {
-	mittBus.on('outboundConnect', (data) => {
-		console.log(data, '外呼已经接通辣');
-		if (data.callNumber === state.orderDetail.contact) callId.value = data.callId;
-	});
-});
-onBeforeUnmount(() => {
-	mittBus.off('outboundConnect');
-});
 defineExpose({
 	openDialog,
 	closeDialog,

+ 1 - 1
src/views/knowledge/components/Knowledge-keywords.vue

@@ -109,7 +109,7 @@ const queryList = () => {
 						if (i === j.id) {
 							setTimeout(() => {
                 proTableRef.value!.element.toggleRowSelection(j, true);
-							}, 0);
+							}, 100);
 						}
 					}
 				}

+ 1 - 1
src/views/quality/index/components/Quality-inspection.vue

@@ -397,7 +397,7 @@ const onDeleteItem = (row: any) => {
 			tableData.value = tableData.value.filter((v: any) => v.name !== row.name);
 			setTimeout(() => {
 				getEnableAcceptType();
-			}, 0);
+			}, 100);
 		})
 		.catch(() => {});
 };

+ 2 - 2
src/views/todo/edit/components/Edit-order.vue

@@ -727,7 +727,7 @@ const clearRepeat = () => {
 			setTimeout(() => {
 				state.ruleForm.duplicateTitle = null;
 				state.ruleForm.duplicateIds = [];
-			}, 0);
+			}, 100);
 		})
 		.catch(() => {
 			state.ruleForm.isRepeat = 'true';
@@ -761,7 +761,7 @@ const changeTransPond = (val: any) => {
 					state.ruleForm.transpondCityName = null;
 					state.ruleForm.transpondCityId = null;
 					state.ruleForm.transpondCityObj = null;
-				}, 0);
+				}, 100);
 			})
 			.catch(() => {
 				state.ruleForm.transpond = true;

+ 1 - 1
src/views/todo/seats/accept/Voice-assistant.vue

@@ -207,7 +207,7 @@ const wsReceive = (message: any) => {
 					talkEnd.value = true;
 					scrollToBottom(); //滚动到底部
 					stopScroll(); //停止滚动
-				}, 1000);
+				}, 500);
 				console.log('通话转写结束了');
 				const name: string = `通话转写结束了,分机号:${telStatusInfo.value.telsNo},来电号码:${fromTel},callID:${data.body.content.callId}`;
 				const remark: string = `通话转写结束了,分机号:${telStatusInfo.value.telsNo},,来电号码:${fromTel},callID:${data.body.content.callId}`;

+ 2 - 2
src/views/todo/seats/accept/ybAccept.vue

@@ -834,7 +834,7 @@ const clearRepeat = () => {
 			setTimeout(() => {
 				state.ruleForm.duplicateTitle = null;
 				state.ruleForm.duplicateIds = [];
-			}, 0);
+			}, 100);
 		})
 		.catch(() => {
 			state.ruleForm.isRepeat = 'true';
@@ -868,7 +868,7 @@ const changeTransPond = (val: any) => {
 					state.ruleForm.transpondCityName = null;
 					state.ruleForm.transpondCityId = null;
 					state.ruleForm.transpondCityObj = null;
-				}, 0);
+				}, 100);
 			})
 			.catch(() => {
 				state.ruleForm.transpond = true;

+ 2 - 2
src/views/todo/seats/accept/zgAccept.vue

@@ -635,7 +635,7 @@ const changeTransPond = (val: any) => {
 					state.ruleForm.transpondCityName = null;
 					state.ruleForm.transpondCityId = null;
 					state.ruleForm.transpondCityObj = null;
-				}, 0);
+				}, 100);
 			})
 			.catch(() => {
 				state.ruleForm.transpond = true;
@@ -788,7 +788,7 @@ const clearRepeat = () => {
 			setTimeout(() => {
 				state.ruleForm.duplicateTitle = null;
 				state.ruleForm.duplicateIds = [];
-			}, 0);
+			}, 100);
 		})
 		.catch(() => {
 			state.ruleForm.isRepeat = 'true';