|
@@ -36,7 +36,8 @@
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu>
|
|
|
<el-dropdown-item command="listen">监 听</el-dropdown-item>
|
|
|
- <el-dropdown-item command="interject">插 话</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="interject">强 插</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="cut">强 拆</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
@@ -93,7 +94,7 @@
|
|
|
import { onMounted, ref, nextTick, onBeforeUnmount, watch } from "vue";
|
|
|
import { getImageUrl, throttle } from "@/utils/tools";
|
|
|
import signalR from "@/utils/signalR";
|
|
|
-import { ClickOutside as vClickOutside } from "element-plus";
|
|
|
+import { ClickOutside as vClickOutside, ElMessage } from "element-plus";
|
|
|
import { formatDuration } from "@/utils/formatTime";
|
|
|
import dayjs from "dayjs";
|
|
|
import { getExtensionStatus } from "api/seats";
|
|
@@ -101,6 +102,7 @@ import { useIntervalFn } from "@vueuse/core";
|
|
|
import { useGlobalState } from "@/utils/callCenter";
|
|
|
import { Operation } from "@element-plus/icons-vue";
|
|
|
import mittBus from "@/utils/mitt";
|
|
|
+import { getNowDateTime } from "@/utils/constants";
|
|
|
|
|
|
const props = defineProps({
|
|
|
data: {
|
|
@@ -114,7 +116,6 @@ const textRef = ref();
|
|
|
const popoverRef = ref();
|
|
|
const hidePopover = ref(false);
|
|
|
const call = ref<EmptyObjectType>({});
|
|
|
-const globalState = useGlobalState();
|
|
|
// 开始签入时长
|
|
|
const talkTime = ref<any>(0); // 通话时长
|
|
|
const talkTimer = ref<any>(null); // 通话时长定时器
|
|
@@ -280,21 +281,77 @@ onMounted(async () => {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+// 发送消息
|
|
|
+const globalState = useGlobalState();
|
|
|
+const e_TelSendMsg = (strObj: Object) => {
|
|
|
+ // 客户端当前时间
|
|
|
+ const strMsg = JSON.stringify(strObj);
|
|
|
+ console.log(
|
|
|
+ `${getNowDateTime()} 发送消息:`,
|
|
|
+ strMsg,
|
|
|
+ globalState.callCenterWs.status
|
|
|
+ );
|
|
|
+ if (globalState.callCenterWs.ws?.readyState === 1) {
|
|
|
+ // 已经链接并且可以通讯,则发放文本消息
|
|
|
+ globalState.callCenterWs.send(strMsg);
|
|
|
+ } else {
|
|
|
+ ElMessage.error("请先签入");
|
|
|
+ }
|
|
|
+};
|
|
|
+/*
|
|
|
+ * 监听
|
|
|
+ */
|
|
|
+const reqMonListen = (strTargetNum: string) => {
|
|
|
+ const objMsg = {
|
|
|
+ Action: "ReqMonListen",
|
|
|
+ Param: {
|
|
|
+ Extension: globalState.currentTel.telNo,
|
|
|
+ TargetExtension: strTargetNum,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ // 发送请求
|
|
|
+ e_TelSendMsg(objMsg);
|
|
|
+};
|
|
|
+/*
|
|
|
+ * 强插
|
|
|
+ */
|
|
|
+const reqMonInterpose = (strTargetNum: string) => {
|
|
|
+ const objMsg = {
|
|
|
+ Action: "ReqMonInterpose",
|
|
|
+ Param: {
|
|
|
+ Extension: globalState.currentTel.telNo,
|
|
|
+ TargetExtension: strTargetNum,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ // 发送请求
|
|
|
+ e_TelSendMsg(objMsg);
|
|
|
+};
|
|
|
+/*
|
|
|
+ * 强拆
|
|
|
+ */
|
|
|
+const reqMonCut = (strTargetNum: string) => {
|
|
|
+ const objMsg = {
|
|
|
+ Action: "reqMonCut",
|
|
|
+ Param: {
|
|
|
+ Extension: globalState.currentTel.telNo,
|
|
|
+ TargetExtension: strTargetNum,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ // 发送请求
|
|
|
+ e_TelSendMsg(objMsg);
|
|
|
+};
|
|
|
// 监听和插话消息
|
|
|
const handleCommand = (command: string, item: any) => {
|
|
|
console.log(command, item);
|
|
|
if (command === "listen") {
|
|
|
// 监听
|
|
|
- globalState.callCenterWs.monitor(
|
|
|
- item.telNo,
|
|
|
- globalState.callCenterWs.username
|
|
|
- );
|
|
|
+ reqMonListen(item.telNo);
|
|
|
} else if (command === "interject") {
|
|
|
// 强插
|
|
|
- globalState.callCenterWs.intercept(
|
|
|
- item.telNo,
|
|
|
- globalState.callCenterWs.username
|
|
|
- );
|
|
|
+ reqMonInterpose(item.telNo);
|
|
|
+ } else if (command === "cut") {
|
|
|
+ // 强拆
|
|
|
+ reqMonCut(item.telNo);
|
|
|
}
|
|
|
};
|
|
|
onBeforeUnmount(() => {
|