diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index b4fdfca..118d5eb 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -10,6 +10,8 @@ 会议 退出示忙 示忙 + 退出工作态 + 进入工作态 @@ -84,6 +86,7 @@ import { getToday } from '@/utils/dateutils' import ChooseSeats from './chooseSeats' import { getProject } from '@/utils/baseConfig' +import { seatReport } from '@/api/call' export default { name: 'IvrBar', @@ -147,12 +150,15 @@ btnGetCallState: true, btnGetRegState: true, btnGetNumber: true, - btnInject: true + btnInject: true, + btnWorkState: false, // 进入工作态 + btnQuitWorkState: true // 退出工作态 }, status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 + isInComing: false, // 是否来电 reg: '', // 话机状态 number: '', // 通话号码 diaStatus: '', // 拨号状态 @@ -261,7 +267,8 @@ this.status = '已签入' this.call = '空闲' this.$store.commit('SET_ONLINE', '1') - // TODO: 通知后台已签入 + // 通知后台已签入 + this.sendRecord('1', '签入') // 心跳监测定时器 // if (this.webVariable.web_heartbeatInterval > 0) { // this.webVariable.web_heartbeatID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_heartbeatID * 1000) @@ -309,7 +316,8 @@ this.btnStatus.btnHangUp = true this.$store.commit('SET_ONLINE', '0') this.resetWs() - // TODO: 通知后台已签出 + // 通知后台已签入 + this.sendRecord('1', '签出') // 清除定时器 // clearInterval(this.webVariable.web_heartbeatID) clearInterval(this.heartbeatID) @@ -390,6 +398,7 @@ if (this.judgeCallStatus()) { // 判断通话状态 const strSend = this.createCommand('hold') this.webSocket.send(strSend) + this.sendRecord('3', '进入保持') } } }, @@ -398,10 +407,12 @@ if (this.judgeStatus()) { const strSend = this.createCommand('unhold') this.webSocket.send(strSend) + this.sendRecord('3', '解除保持') } }, // 处理接通来电事宜 incommingAnswerd(object) { + this.isInComing = true this.notify.close() // 关闭来电提醒 // 处理按钮显示问题 this.btnStatus.btnDialOut = true @@ -431,12 +442,19 @@ }, // 进入工作态 goWorkState() { - // TODO:通知后台进入工作态 - + // this.$message.info('已进入工作态') + this.btnStatus.btnWorkState = true + this.btnStatus.btnQuitWorkState = false + this.sendRecord('2', '进入工作态') + this.onbusy() // 置忙 }, // 退出工作态 quitWorkState() { - // TODO:通知后台退出工作态 + // this.$message.info('已退出工作态') + this.btnStatus.btnWorkState = false + this.btnStatus.btnQuitWorkState = true + this.sendRecord('2', '退出工作态') + this.onidle() // 置闲 }, // 点击会议,打开会议弹窗 meeting() { @@ -533,7 +551,11 @@ this.timeInterval = null this.time = 0 } - // TODO:向后台添加通话记录 + // 如果是来电,进入工作态 + if (this.isInComing) { + this.goWorkState() + } + this.isInCall = false } } else if (object.call === '外呼通话' || object.call === '呼入通话' || object.call === '自动外呼接入') { this.call = '通话中' @@ -565,6 +587,7 @@ this.btnStatus.btnHangUp = false } if (name === 'outbound answered') { // 外呼接通,允许保持 + this.isInComing = false this.btnStatus.btnDialOut = true this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false @@ -741,6 +764,10 @@ this.$message.warning('未在通话中') return false } + }, + // 向后台写记录 + sendRecord(type, recordName) { + seatReport(type, recordName) } } }