diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..fd4e4c1 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,52 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +382,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +395,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +403,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +561,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +580,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +666,15 @@ sendStr += '\n' } return sendStr + }, + // 判断状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } } } }