diff --git a/src/pages/layout/components/LayoutHeader.vue b/src/pages/layout/components/LayoutHeader.vue index 214f206..1613ff9 100644 --- a/src/pages/layout/components/LayoutHeader.vue +++ b/src/pages/layout/components/LayoutHeader.vue @@ -397,22 +397,28 @@ export default { }, - handleCommand(command) { + async handleCommand(command) { console.log(command) if (this.agentStatus === command) { return } - this.agentStatus = command - if (command === 'free') { - this.agentStatusName = '空闲' - } else if (command === 'arrange') { - this.agentStatusName = '话后整理' - } else if (command === 'notReady') { - this.agentStatusName = '示忙' - } else if (command === 'rest') { - this.agentStatusName = '小休' + try { + let res = await window.tccc.Agent.setStatus({status: command}) + console.log('设置座席状态:', res) + this.agentStatus = command + if (command === 'free') { + this.agentStatusName = '空闲' + } else if (command === 'arrange') { + this.agentStatusName = '话后整理' + } else if (command === 'notReady') { + this.agentStatusName = '示忙' + } else if (command === 'rest') { + this.agentStatusName = '小休' + } + } catch (error) { + this.$message.error('设置座席状态失败' + error.message) + console.log('设置座席状态失败',error.message) } - this.setStatus() }, // 关闭 handleClose() { @@ -447,16 +453,6 @@ export default { console.log('获取座席状态失败',error.message) } }, - // 设置座席状态 - async setStatus() { - try { - let res = await window.tccc.Agent.setStatus({status: this.agentStatus}) - console.log('设置座席状态:', res) - } catch (err) { - this.$message.error('设置座席状态失败' + err.message) - console.log('设置座席状态失败',err.message) - } - } } }