Bladeren bron

Merge branch 'master' of http://192.168.1.222:3000/jiayi/base-callcenter-web

闪电 10 maanden geleden
bovenliggende
commit
f777132912
1 gewijzigde bestanden met toevoegingen van 15 en 12 verwijderingen
  1. 15 12
      src/views/main/telephone/seatMonitor/seatMonitor.vue

+ 15 - 12
src/views/main/telephone/seatMonitor/seatMonitor.vue

45
                 <div class="ml-3 flex-1">
45
                 <div class="ml-3 flex-1">
46
                   <div class="font-medium">{{ agent.name }}</div>
46
                   <div class="font-medium">{{ agent.name }}</div>
47
                   <div class="text-sm text-gray-500">工号: {{ agent.workId }}</div>
47
                   <div class="text-sm text-gray-500">工号: {{ agent.workId }}</div>
48
+                  <div class="text-sm text-gray-500">姓名: {{ agent.nickName }}</div>
48
                   <div class="text-sm text-gray-500">分机: {{ agent.extension }}</div>
49
                   <div class="text-sm text-gray-500">分机: {{ agent.extension }}</div>
49
                 </div>
50
                 </div>
50
                 <div :class="`status-dot ${agent.status}`" />
51
                 <div :class="`status-dot ${agent.status}`" />
88
   </div>
89
   </div>
89
 </template>
90
 </template>
90
 
91
 
91
-<script lang="ts" setup>
92
+<script lang="ts" setup name="SeatMonitor">
92
 import { ref, computed, onMounted, watch, onBeforeUnmount } from 'vue';
93
 import { ref, computed, onMounted, watch, onBeforeUnmount } from 'vue';
93
 import { Monitor, Search, Mute, VideoPlay } from '@element-plus/icons-vue';
94
 import { Monitor, Search, Mute, VideoPlay } from '@element-plus/icons-vue';
94
 import { getPageListData } from '@/api/main/system/system';
95
 import { getPageListData } from '@/api/main/system/system';
109
 })
110
 })
110
 
111
 
111
 watch(lineState, (newValue, oldValue) => {
112
 watch(lineState, (newValue, oldValue) => {
112
-  console.log(newValue);
113
+  // console.log(newValue);
113
   scoketState.value = newValue
114
   scoketState.value = newValue
114
 })
115
 })
115
 
116
 
116
-const statistics = [
117
+const statistics = ref([
117
   { key: 'online', label: '空闲', count: 0, bgColor: 'bg-green-50' },
118
   { key: 'online', label: '空闲', count: 0, bgColor: 'bg-green-50' },
118
   { key: 'idle', label: '小休', count: 0, bgColor: 'bg-yellow-50' },
119
   { key: 'idle', label: '小休', count: 0, bgColor: 'bg-yellow-50' },
119
   { key: 'ringing', label: '振铃', count: 0, bgColor: 'bg-blue-50' },
120
   { key: 'ringing', label: '振铃', count: 0, bgColor: 'bg-blue-50' },
120
   { key: 'calling', label: '通话中', count: 0, bgColor: 'bg-blue-100' },
121
   { key: 'calling', label: '通话中', count: 0, bgColor: 'bg-blue-100' },
121
   { key: 'afterCall', label: '话后处理', count: 0, bgColor: 'bg-purple-50' },
122
   { key: 'afterCall', label: '话后处理', count: 0, bgColor: 'bg-purple-50' },
122
   { key: 'offline', label: '离线', count: 0, bgColor: 'bg-red-50' },
123
   { key: 'offline', label: '离线', count: 0, bgColor: 'bg-red-50' },
123
-];
124
+]);
124
 
125
 
125
 const statusOptions = [
126
 const statusOptions = [
126
   { label: '全部', value: '' },
127
   { label: '全部', value: '' },
139
 const getAgents = () => {
140
 const getAgents = () => {
140
   getPageListData('/UserExtension/userextension').then((res) => {
141
   getPageListData('/UserExtension/userextension').then((res) => {
141
     if (res.data.length > 0) {
142
     if (res.data.length > 0) {
142
-      const info = statistics.find((item) => item.key === 'offline');
143
+      const info = statistics.value.find((item) => item.key === 'offline');
143
       if (info) info.count = res.data.length;
144
       if (info) info.count = res.data.length;
144
       res.data.forEach((ele) => {
145
       res.data.forEach((ele) => {
145
         agents.value.push({
146
         agents.value.push({
147
           name: ele.username,
148
           name: ele.username,
148
           workId: ele.usercode,
149
           workId: ele.usercode,
149
           extension: ele.extension, // 分机号
150
           extension: ele.extension, // 分机号
151
+          nickName:ele.nickName,
150
           status: 'unknown', // 线路状态
152
           status: 'unknown', // 线路状态
151
           duration: '',
153
           duration: '',
152
           time: '',
154
           time: '',
257
 
259
 
258
 
260
 
259
 const monitorBack = (data) => {
261
 const monitorBack = (data) => {
260
-  console.log(data, 'monitorBack')
262
+  // console.log(data, 'monitorBack')
261
   
263
   
262
   const status = stateMap[data.State]
264
   const status = stateMap[data.State]
263
   if (data.AgentId && status) {
265
   if (data.AgentId && status) {
266
     if (status === 'calling') info.time = new Date().getTime()
268
     if (status === 'calling') info.time = new Date().getTime()
267
     else if (info.time) info.time = ''
269
     else if (info.time) info.time = ''
268
     const oldStatus = info.status
270
     const oldStatus = info.status
269
-    console.log(info.time, status, 'info.time')
271
+    // console.log(info.time, status, 'info.time')
270
     info.status = status
272
     info.status = status
271
 
273
 
272
     calculatCount(oldStatus, status)
274
     calculatCount(oldStatus, status)
290
 const isStartMonitor = ref(false) // 是否开始监控
292
 const isStartMonitor = ref(false) // 是否开始监控
291
 
293
 
292
 const startMonitor = () => {
294
 const startMonitor = () => {
293
-  console.log(scoketState.value, 'scoketState.value')
295
+  // console.log(scoketState.value, 'scoketState.value')
294
   if (scoketState.value !== '签出') {
296
   if (scoketState.value !== '签出') {
295
     isStartMonitor.value = true
297
     isStartMonitor.value = true
296
     if (!timer.value) {
298
     if (!timer.value) {
337
   agents.value.forEach(ele => {
339
   agents.value.forEach(ele => {
338
     ele.status = 'unknown'
340
     ele.status = 'unknown'
339
   })
341
   })
340
-  statistics.forEach(ele => {
342
+  statistics.value.forEach(ele => {
341
     calculatCount('', ele.key, true)
343
     calculatCount('', ele.key, true)
342
   })
344
   })
343
 }
345
 }
344
 
346
 
345
 const calculatCount = (oldStata, stateCode, isInit = false) => {
347
 const calculatCount = (oldStata, stateCode, isInit = false) => {
346
-  console.log(oldStata, stateCode, 'stateCode')
348
+  // console.log(oldStata, stateCode, 'stateCode')
347
   if (oldStata === stateCode) return;
349
   if (oldStata === stateCode) return;
348
-  const info = statistics.find(item => item.key === stateCode);
350
+  const info = statistics.value.find(item => item.key === stateCode);
351
+ 
349
   if (!info) return;
352
   if (!info) return;
350
   if (isInit) {
353
   if (isInit) {
351
     if (stateCode !== 'offline') info.count = 0
354
     if (stateCode !== 'offline') info.count = 0
353
     return;
356
     return;
354
   }
357
   }
355
   info.count++;
358
   info.count++;
356
-  const oldInfo = statistics.find(item => item.key === oldStata);
359
+  const oldInfo = statistics.value.find(item => item.key === oldStata);
357
   if (oldInfo) oldInfo.count--;
360
   if (oldInfo) oldInfo.count--;
358
   
361
   
359
 }
362
 }