Bläddra i källkod

reactor:话机动作新增静音;签入模式默认为外呼模式;

zhangchong 10 månader sedan
förälder
incheckning
d42f265334
2 ändrade filer med 192 tillägg och 71 borttagningar
  1. 165 70
      src/layout/navBars/breadcrumb/telControl.vue
  2. 27 1
      src/stores/telStatus.ts

+ 165 - 70
src/layout/navBars/breadcrumb/telControl.vue

@@ -149,6 +149,27 @@
 				</div>
 			</template>
 
+			<!-- 静音和取消静音 可用 -->
+			<template v-if="telStatusInfo.isDutyOn && activeArr.includes('mute')">
+				<div
+					class="item active"
+					:title="telStatusInfo.isMute ? '取消静音' : '静音'"
+					@click="onControlClick(telStatusInfo.isMute ? 'unMute' : 'mute')"
+					@mouseenter="onHover('muteSrc', 'phoneControls/mute_white.png')"
+					@mouseleave="onHover('muteSrc', 'phoneControls/mute_blue.png')"
+				>
+					<img :src="state.muteSrc" alt="" />
+					<span>{{ telStatusInfo.isMute ? '取消静音' : '静音' }}</span>
+				</div>
+			</template>
+			<!-- 灰色静音不可用 -->
+			<template v-else>
+				<div class="item disabled" title="静音">
+					<img :src="getImageUrl('phoneControls/mute_grey.png')" alt="" />
+					<span>静音</span>
+				</div>
+			</template>
+
 			<!-- 话后整理和取消话后整理中 可用-->
 			<template v-if="telStatusInfo.isDutyOn && activeArr.includes('TalkingDeal')">
 				<div
@@ -577,6 +598,7 @@ const state = reactive<any>({
 	hangupSrc: getImageUrl('phoneControls/hangup_blue.png'), //挂断图片
 	restSrc: getImageUrl('phoneControls/rest_blue.png'), //小休图片
 	holdSrc: getImageUrl('phoneControls/hold_blue.png'), //保持图片
+	muteSrc: getImageUrl('phoneControls/mute_blue.png'), // 静音图片
 	talkingDealSrc: getImageUrl('phoneControls/talkingDeal_blue.png'), //话后整理图片
 	transferSrc: getImageUrl('phoneControls/transfer_blue.png'), //转接图片
 	conferenceSrc: getImageUrl('phoneControls/conference_blue.png'), //三方会议图片
@@ -667,7 +689,8 @@ const activeArr = computed(() => {
 		onCallOut: ['callOut', 'outbound'], // 外呼模式中
 		rest: ['rest'], // 小休中状态
 		ring: ['hangup'], //振铃中
-		onCall: ['hangup', 'hold', 'transfer', 'conference'], // 单个通话中
+		onCall: ['hangup', 'hold', 'transfer', 'conference', 'mute'], // 单个通话中
+		onMute: ['hangup', 'transfer', 'mute'], // 静音中
 		onHold: ['hangup', 'hold', 'transfer'], // 保持中
 		onTalkingDeal: ['dutyOff', 'rest', 'TalkingDeal'], // 话后整理中
 		onConference: ['hangup'], // 三方会议中 只能挂断
@@ -688,6 +711,7 @@ const currentStatusText = computed(() => {
 		rest: '小休中',
 		ring: '振铃中',
 		onHold: '保持中',
+		onMute: '静音中',
 		onCall: '通话中',
 		onTalkingDeal: '整理中',
 		onConference: '会议中',
@@ -753,8 +777,11 @@ const onControlClick = (val: string) => {
 		case 'unHold': //取消保持
 			onUnHold();
 			break;
-		case 'TalkingDeal': //话后整理
-			onTalkingDeal();
+		case 'mute': //保持
+			onMute();
+			break;
+		case 'unMute': //取消保持
+			onUnMute();
 			break;
 		case 'unTalkingDeal': // 取消话后整理
 			unTalkingDeal();
@@ -1026,10 +1053,43 @@ const onMessage = async (event: any) => {
 		if (data.state == 'busy') {
 			call_direction.value = data.call_direction; // 保存呼叫方向
 			if (['held', 'unheld'].includes(data.private_data)) {
-				// 保持
-				holdStatus(data.private_data); //处理保持
-				if (data.private_data == 'held') await holdStart(); // 保持开始 业务系统统计需要
-				else await holdEnd();
+				console.log(muteModel.value, '21321');
+				if (muteModel.value || isTelMute.value) {
+					// 如果是静音状态
+					// 静音
+					if (data.private_data == 'held') {
+						// 设置电话状态
+						useTelStatusStore.setMute(true);
+						// 设置电话状态 静音中
+						useTelStatusStore.setPhoneControlState(TelStates.onMute);
+						sendMsg('mute');
+						await muteStart();
+					} else {
+						// 设置电话状态  取消单个静音为通话中
+						useTelStatusStore.setMute(false);
+						// 设置电话状态
+						useTelStatusStore.setPhoneControlState(TelStates.onCall);
+						sendMsg('busy');
+						await muteEnd();
+					}
+				} else {
+					// 保持
+					if (data.private_data == 'held') {
+						// 设置电话状态
+						useTelStatusStore.setHold(true);
+						// 设置电话状态 保持中
+						useTelStatusStore.setPhoneControlState(TelStates.onHold);
+						sendMsg('held');
+						await holdStart(); // 保持开始 业务系统统计需要
+					} else {
+						// 设置电话状态  取消单个保持为通话中
+						useTelStatusStore.setHold(false);
+						// 设置电话状态
+						useTelStatusStore.setPhoneControlState(TelStates.onCall);
+						sendMsg('busy');
+						await holdEnd();
+					}
+				}
 			} else {
 				// 非保持状态
 				if (data.private_data == 'monitoring') {
@@ -1223,67 +1283,6 @@ const stopReconnect = () => {
 	}, 3000);
 	console.log('停止重连');
 };
-// 小休原因
-const restReason = ref(''); // 小休原因
-const break_reason = (reason: string) => {
-	switch (reason) {
-		case 'away':
-			restReason.value = '外出中';
-			break;
-		case 'rest':
-			restReason.value = '休息中';
-			break;
-		case 'conference':
-			restReason.value = '会议中';
-			break;
-		case 'train':
-			restReason.value = '培训中';
-			break;
-		case 'eat':
-			restReason.value = '用餐中';
-			break;
-		default:
-			restReason.value = '休息中';
-			break;
-	}
-	if (telStatusInfo.value.isRest !== 'resting' && !isRest.value) {
-		// 如果不在在小休中
-		const restReasons = state.restReasonOptions.find((item: any) => item.dicDataValue === reason);
-		busyOn({ reason: restReasons?.dicDataName ?? '' }) // 开始小休 设置示忙 业务系统统计需要
-			.then(() => {
-				console.log('业务系统调用示忙成功');
-				state.loading = false;
-			})
-			.catch((err) => {
-				console.log('业务系统调用示忙失败', err);
-				state.loading = false;
-			});
-	} else {
-		state.loading = false;
-	}
-};
-// 保持状态处理
-const holdStatus = (status: string) => {
-	switch (status) {
-		case 'held':
-			// 设置电话状态
-			useTelStatusStore.setHold(true);
-			// 设置电话状态 保持中
-			useTelStatusStore.setPhoneControlState(TelStates.onHold);
-			sendMsg('held');
-			break;
-		case 'unheld':
-			// 设置电话状态 通话中
-			// 设置电话状态  取消单个保持为通话中
-			useTelStatusStore.setHold(false);
-			// 设置电话状态
-			useTelStatusStore.setPhoneControlState(TelStates.onCall);
-			sendMsg('busy');
-			break;
-		default:
-			break;
-	}
-};
 const dutyFormRef = ref<RefType>();
 const currentTel = ref<any>({}); // 当前分机
 const isRest = ref<boolean>(false); // 是否小休
@@ -1340,17 +1339,20 @@ const clickOnDuty = (formEl: FormInstance | undefined) => {
 			request = {
 				telNo: state.dutyForm.telNo,
 				telPwd: state.dutyForm.password,
+				telModelState: 2, // 默认呼出模式
 			};
 		} else if (AppConfigInfo.value.isNeedTelNo) {
 			//需要分机号
 			request = {
 				telNo: state.dutyForm.telNo,
+				telModelState: 2, // 默认呼出模式
 			};
 		} else if (AppConfigInfo.value.isTelNeedVerify) {
 			// 需要密码
 			request = {
 				telNo: state.dutyForm.telNo,
 				telPwd: userInfos.value.defaultTelNo,
+				telModelState: 2, // 默认呼出模式
 			};
 		}
 		dutyOn(request)
@@ -1502,6 +1504,45 @@ const onHangup = () => {
 		})
 		.catch(() => {});
 };
+// 小休原因
+const restReason = ref(''); // 小休原因
+const break_reason = (reason: string) => {
+	switch (reason) {
+		case 'away':
+			restReason.value = '外出中';
+			break;
+		case 'rest':
+			restReason.value = '休息中';
+			break;
+		case 'conference':
+			restReason.value = '会议中';
+			break;
+		case 'train':
+			restReason.value = '培训中';
+			break;
+		case 'eat':
+			restReason.value = '用餐中';
+			break;
+		default:
+			restReason.value = '休息中';
+			break;
+	}
+	if (telStatusInfo.value.isRest !== 'resting' && !isRest.value) {
+		// 如果不在在小休中
+		const restReasons = state.restReasonOptions.find((item: any) => item.dicDataValue === reason);
+		busyOn({ reason: restReasons?.dicDataName ?? '' }) // 开始小休 设置示忙 业务系统统计需要
+			.then(() => {
+				console.log('业务系统调用示忙成功');
+				state.loading = false;
+			})
+			.catch((err) => {
+				console.log('业务系统调用示忙失败', err);
+				state.loading = false;
+			});
+	} else {
+		state.loading = false;
+	}
+};
 // 小休
 const restFormRef = ref<RefType>(); //小休表单
 const onRest = async () => {
@@ -1647,6 +1688,7 @@ const onHold = () => {
 		autofocus: false,
 	})
 		.then(() => {
+			muteModel.value = false;
 			ola.hold(); //保持
 		})
 		.catch(() => {});
@@ -1662,12 +1704,62 @@ const onUnHold = () => {
 		autofocus: false,
 	})
 		.then(() => {
+			muteModel.value = false;
+			ola.unhold(); //取消保持
+		})
+		.catch(() => {});
+};
+// 业务系统静音开始
+const muteStart = async () => {
+	try {
+		const res: any = await startAfterCall({ actionType: 4 });
+		console.log(res, '业务系统记录静音开始');
+	} catch (err) {
+		console.log(err);
+	}
+};
+// 业务系统静音结束
+const muteEnd = async () => {
+	try {
+		const res: any = await endAfterCall({ actionType: 4 });
+		console.log(res, '业务系统记录静音结束');
+	} catch (err) {
+		console.log(err);
+	}
+};
+// 静音
+const muteModel = ref(false);
+const onMute = () => {
+	ElMessageBox.confirm(`确定要静音,是否继续?`, '提示', {
+		confirmButtonText: '确认',
+		cancelButtonText: '取消',
+		type: 'warning',
+		draggable: true,
+		cancelButtonClass: 'default-button',
+		autofocus: false,
+	})
+		.then(() => {
+			muteModel.value = true;
+			ola.hold(); //保持
+		})
+		.catch(() => {});
+};
+// 静音取消
+const onUnMute = () => {
+	ElMessageBox.confirm(`确定要取消静音,是否继续?`, '提示', {
+		confirmButtonText: '确认',
+		cancelButtonText: '取消',
+		type: 'warning',
+		draggable: true,
+		cancelButtonClass: 'default-button',
+		autofocus: false,
+	})
+		.then(() => {
+			muteModel.value = true;
 			ola.unhold(); //取消保持
 		})
 		.catch(() => {});
 };
-// 话后整理(系统默认进入)
-const onTalkingDeal = () => {};
 // 取消话后整理
 const unTalkingDeal = () => {
 	ElMessageBox.confirm(`确定要取消话后整理,是否继续?`, '提示', {
@@ -1835,6 +1927,7 @@ const resetState = () => {
 // 获取当前分机状态
 const isCallHold = ref(false); // 是否是保持中
 const isAcw = ref(false); // 是否是话后整理中
+const isTelMute = ref(false); // 是否是静音中
 const getTelStatusFn = async () => {
 	try {
 		const { result } = await getTelStatus();
@@ -1847,6 +1940,7 @@ const getTelStatusFn = async () => {
 		isRest.value = result.isRest;
 		isCallHold.value = result.isCallHold;
 		isAcw.value = result.isCallEndArrange; // 是否话后整理中
+		isTelMute.value = result.isTelMute; // 是否静音中
 	} catch (e) {
 		console.log(e);
 	}
@@ -1870,6 +1964,7 @@ const callCenterConnect = async () => {
 			isCallHold.value = result.isCallHold;
 			isRest.value = result.isRest;
 			isAcw.value = result.isCallEndArrange; // 是否话后整理中
+			isTelMute.value = result.isTelMute; // 是否静音中
 			state.loading = false;
 		} else {
 			// 没有查询到当前用户上班状态  直接重置

+ 27 - 1
src/stores/telStatus.ts

@@ -19,6 +19,7 @@ export enum TelStates {
 	rest = 'rest',  // 小休
 	ring = 'ring', // 来电响铃
 	onHold = 'onHold', // 保持中
+	onMute = 'onMute', // 静音中
 	onCall = 'onCall', // 一通电话通话中
 	onTalkingDeal = 'onTalkingDeal', 		// 事后处理中
 	onConference = 'onConference', // 三方会议中
@@ -30,13 +31,33 @@ export enum RestStates {
 	unRest = 'unRest' // 未小休
 }
 export const useTelStatus = defineStore('telStatus', {
-	state: (): TelsStateInfos => ({
+	state: (): {
+		telStatusInfo: {
+			isCallOut: boolean;
+			fromTel: string;
+			telGuid: string;
+			isMute: boolean;
+			isMeeting: boolean;
+			isDutyOn: boolean;
+			isHold: boolean;
+			isTalkingDeal: boolean;
+			telsNo: string;
+			groupName: string;
+			telGongHao: string;
+			telType: string;
+			telArea: string;
+			isRest: RestStates;
+			phoneControlState: TelStates;
+			telIVR: string
+		}
+	} => ({
 		telStatusInfo: {
 			isDutyOn: false, // 是否签入
 			isRest: RestStates.unRest, // 是否休息  'resting'|'InReview'|'unRest'; 休息中  审核中 其他状态
 			isTalkingDeal: false, //是否事后处理
 			isMeeting: false, //是否三方会议中
 			isHold: false, // 是否保持中
+			isMute: false,
 			isCallOut: false, // 是否是外呼模式
 			phoneControlState: TelStates.dutyOff, //当前状态 默认签出
 			telsNo: "", // 分机号
@@ -66,6 +87,10 @@ export const useTelStatus = defineStore('telStatus', {
 		setHold(data: boolean): void {
 			this.telStatusInfo.isHold = data;
 		},
+		// 设置静音状态
+		setMute(data: boolean): void {
+			this.telStatusInfo.isMute = data;
+		},
 		// 设置外呼模式
 		setCallOut(data: boolean): void {
 			this.telStatusInfo.isCallOut = data;
@@ -93,6 +118,7 @@ export const useTelStatus = defineStore('telStatus', {
 				isTalkingDeal: false, //是否事后处理
 				isMeeting: false, //是否三方会议中
 				isHold:false, // 是否保持中
+				isMute: false, // 是否静音
 				isCallOut:false, // 是否是外呼模式
 				phoneControlState: TelStates.dutyOff, //当前状态 默认签出
 				telsNo: "", // 分机号