index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <template>
  2. <div class="tels-callLog-container layout-pd">
  3. <el-card shadow="never">
  4. <el-tabs v-model="state.queryParams.type" @tab-change="changeTba">
  5. <el-tab-pane name="0" label="全部"></el-tab-pane>
  6. <el-tab-pane name="1" label="呼入已接"></el-tab-pane>
  7. <el-tab-pane name="2" label="呼出已接"></el-tab-pane>
  8. <el-tab-pane name="3" label="未接"></el-tab-pane>
  9. <el-tab-pane name="4" label="智能应答"></el-tab-pane>
  10. </el-tabs>
  11. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent label-width="20px">
  12. <el-row :gutter="10">
  13. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  14. <el-form-item prop="CPN">
  15. <el-input v-model="state.queryParams.CPN" placeholder="主叫号码" clearable @keyup.enter="handleQuery" />
  16. </el-form-item>
  17. </el-col>
  18. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
  19. <el-form-item prop="CDPN">
  20. <el-input v-model="state.queryParams.CDPN" placeholder="被叫号码" clearable @keyup.enter="handleQuery" />
  21. </el-form-item>
  22. </el-col>
  23. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="['0', '1', '2', '3'].includes(state.queryParams.type)">
  24. <el-form-item prop="TelNo">
  25. <el-input v-model="state.queryParams.TelNo" placeholder="响应分机" clearable @keyup.enter="handleQuery" />
  26. </el-form-item>
  27. </el-col>
  28. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="['0', '1', '2', '3'].includes(state.queryParams.type)">
  29. <el-form-item prop="UserName">
  30. <el-input v-model="state.queryParams.UserName" placeholder="话务员名称" clearable @keyup.enter="handleQuery" />
  31. </el-form-item>
  32. </el-col>
  33. <transition name="el-zoom-in-top">
  34. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol || ['4'].includes(state.queryParams.type)">
  35. <el-form-item prop="gateway">
  36. <el-input v-model="state.queryParams.gateway" placeholder="中继号码" clearable @keyup.enter="handleQuery" />
  37. </el-form-item>
  38. </el-col>
  39. </transition>
  40. <transition name="el-zoom-in-top">
  41. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '3'].includes(state.queryParams.type)">
  42. <el-form-item prop="CallDirection">
  43. <el-select v-model="state.queryParams.CallDirection" placeholder="电话方向" clearable class="w100" @change="handleQuery">
  44. <el-option v-for="item in state.callDirection" :value="item.key" :key="item.key" :label="item.value" />
  45. </el-select>
  46. </el-form-item>
  47. </el-col>
  48. </transition>
  49. <transition name="el-zoom-in-top">
  50. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0'].includes(state.queryParams.type)">
  51. <el-form-item prop="OnState">
  52. <el-select v-model="state.queryParams.OnState" placeholder="通话结果" clearable class="w100" @change="handleQuery">
  53. <el-option v-for="item in state.onState" :value="item.key" :key="item.key" :label="item.value" />
  54. </el-select>
  55. </el-form-item>
  56. </el-col>
  57. </transition>
  58. <transition name="el-zoom-in-top">
  59. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol || ['4'].includes(state.queryParams.type)">
  60. <el-form-item prop="EndBy">
  61. <el-select v-model="state.queryParams.EndBy" placeholder="挂机类型" clearable class="w100" @change="handleQuery">
  62. <el-option v-for="item in state.endByOptions" :value="item.key" :key="item.key" :label="item.value" />
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. </transition>
  67. <transition name="el-zoom-in-top">
  68. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  69. <el-form-item prop="callTime">
  70. <el-date-picker
  71. v-model="state.queryParams.callTime"
  72. type="datetimerange"
  73. unlink-panels
  74. range-separator="至"
  75. start-placeholder="开始开始时间"
  76. end-placeholder="开始结束时间"
  77. :shortcuts="shortcuts"
  78. @change="callTimeChange"
  79. value-format="YYYY-MM-DD[T]HH:mm:ss"
  80. />
  81. </el-form-item>
  82. </el-col>
  83. </transition>
  84. <transition name="el-zoom-in-top">
  85. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '2'].includes(state.queryParams.type)">
  86. <el-form-item prop="answeredTime">
  87. <el-date-picker
  88. v-model="state.queryParams.answeredTime"
  89. type="datetimerange"
  90. unlink-panels
  91. range-separator="至"
  92. start-placeholder="接通开始时间"
  93. end-placeholder="接通结束时间"
  94. :shortcuts="shortcuts"
  95. @change="answeredTimeChange"
  96. value-format="YYYY-MM-DD[T]HH:mm:ss"
  97. />
  98. </el-form-item>
  99. </el-col>
  100. </transition>
  101. <transition name="el-zoom-in-top">
  102. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol">
  103. <el-form-item prop="overTime">
  104. <el-date-picker
  105. v-model="state.queryParams.overTime"
  106. type="datetimerange"
  107. unlink-panels
  108. range-separator="至"
  109. start-placeholder="挂断开始时间"
  110. end-placeholder="挂断结束时间"
  111. :shortcuts="shortcuts"
  112. @change="overTimeChange"
  113. value-format="YYYY-MM-DD[T]HH:mm:ss"
  114. />
  115. </el-form-item>
  116. </el-col>
  117. </transition>
  118. <transition name="el-zoom-in-top">
  119. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '3'].includes(state.queryParams.type)">
  120. <el-form-item prop="beginIvrTime">
  121. <el-date-picker
  122. v-model="state.queryParams.beginIvrTime"
  123. type="datetimerange"
  124. unlink-panels
  125. range-separator="至"
  126. start-placeholder="ivr开始开始时间"
  127. end-placeholder="ivr开始结束时间"
  128. :shortcuts="shortcuts"
  129. @change="beginIvrTimeChange"
  130. value-format="YYYY-MM-DD[T]HH:mm:ss"
  131. />
  132. </el-form-item>
  133. </el-col>
  134. </transition>
  135. <transition name="el-zoom-in-top">
  136. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '3'].includes(state.queryParams.type)">
  137. <el-form-item prop="endIvrTime">
  138. <el-date-picker
  139. v-model="state.queryParams.endIvrTime"
  140. type="datetimerange"
  141. unlink-panels
  142. range-separator="至"
  143. start-placeholder="ivr结束开始时间"
  144. end-placeholder="ivr结束结束时间"
  145. :shortcuts="shortcuts"
  146. @change="endIvrTimeChange"
  147. value-format="YYYY-MM-DD[T]HH:mm:ss"
  148. />
  149. </el-form-item>
  150. </el-col>
  151. </transition>
  152. <transition name="el-zoom-in-top">
  153. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '3'].includes(state.queryParams.type)">
  154. <el-form-item prop="beginQueueTime">
  155. <el-date-picker
  156. v-model="state.queryParams.beginQueueTime"
  157. type="datetimerange"
  158. unlink-panels
  159. range-separator="至"
  160. start-placeholder="队列开始开始时间"
  161. end-placeholder="队列开始结束时间"
  162. :shortcuts="shortcuts"
  163. @change="beginQueueTimeChange"
  164. value-format="YYYY-MM-DD[T]HH:mm:ss"
  165. />
  166. </el-form-item>
  167. </el-col>
  168. </transition>
  169. <transition name="el-zoom-in-top">
  170. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '3'].includes(state.queryParams.type)">
  171. <el-form-item prop="endQueueTime">
  172. <el-date-picker
  173. v-model="state.queryParams.endQueueTime"
  174. type="datetimerange"
  175. unlink-panels
  176. range-separator="至"
  177. start-placeholder="队列结束开始时间"
  178. end-placeholder="队列结束结束时间"
  179. :shortcuts="shortcuts"
  180. @change="endQueueTimeChange"
  181. value-format="YYYY-MM-DD[T]HH:mm:ss"
  182. />
  183. </el-form-item>
  184. </el-col>
  185. </transition>
  186. <transition name="el-zoom-in-top">
  187. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '3'].includes(state.queryParams.type)">
  188. <el-form-item prop="beginRingTime">
  189. <el-date-picker
  190. v-model="state.queryParams.beginRingTime"
  191. type="datetimerange"
  192. unlink-panels
  193. range-separator="至"
  194. start-placeholder="振铃开始开始时间"
  195. end-placeholder="振铃开始结束时间"
  196. :shortcuts="shortcuts"
  197. @change="beginRingTimeChange"
  198. value-format="YYYY-MM-DD[T]HH:mm:ss"
  199. />
  200. </el-form-item>
  201. </el-col>
  202. </transition>
  203. <transition name="el-zoom-in-top">
  204. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1', '3'].includes(state.queryParams.type)">
  205. <el-form-item prop="endRingTime">
  206. <el-date-picker
  207. v-model="state.queryParams.endRingTime"
  208. type="datetimerange"
  209. unlink-panels
  210. range-separator="至"
  211. start-placeholder="振铃结束开始时间"
  212. end-placeholder="振铃结束结束时间"
  213. :shortcuts="shortcuts"
  214. @change="endRingTimeChange"
  215. value-format="YYYY-MM-DD[T]HH:mm:ss"
  216. />
  217. </el-form-item>
  218. </el-col>
  219. </transition>
  220. <transition name="el-zoom-in-top">
  221. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1'].includes(state.queryParams.type)">
  222. <el-form-item prop="OrderNo">
  223. <el-input v-model="state.queryParams.OrderNo" placeholder="工单编码" clearable @keyup.enter="handleQuery" />
  224. </el-form-item>
  225. </el-col>
  226. </transition>
  227. <transition name="el-zoom-in-top">
  228. <el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6" v-show="!searchCol && ['0', '1'].includes(state.queryParams.type)">
  229. <el-form-item prop="Title">
  230. <el-input v-model="state.queryParams.Title" placeholder="工单标题" clearable @keyup.enter="handleQuery" />
  231. </el-form-item>
  232. </el-col>
  233. </transition>
  234. </el-row>
  235. <div class="w100 ml20">
  236. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  237. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  238. <SvgIcon name="ele-Refresh" class="mr5" />重置
  239. </el-button>
  240. <el-button link type="primary" @click="closeSearch" :loading="state.loading">
  241. {{ searchCol ? '展开' : '收起' }}
  242. <SvgIcon :class="{ 'is-reverse': searchCol }" name="ele-ArrowUp" class="mr5 arrow" size="18px" />
  243. </el-button>
  244. </div>
  245. </el-form>
  246. </el-card>
  247. <el-card shadow="never">
  248. <ProTable
  249. ref="proTableRef"
  250. :columns="columns"
  251. :data="state.tableData"
  252. @updateTable="queryList"
  253. :loading="state.loading"
  254. :total="state.total"
  255. v-model:page-index="state.queryParams.PageIndex"
  256. v-model:page-size="state.queryParams.PageSize"
  257. :key="Math.random()"
  258. >
  259. <!-- 表格操作 -->
  260. <template #operation="{ row }">
  261. <template v-if="['1'].includes(state.queryParams.type)">
  262. <el-button link type="primary" @click="onCreate(row)" title="创建失联工单" v-auth="'tels:callLog:connectOrder'" v-if="!row.externalId">
  263. 失联工单
  264. </el-button>
  265. <el-button link type="primary" @click="onConnect(row)" title="关联业务" v-auth="'tels:callLog:connect'" v-if="!row.externalId">
  266. 关联业务
  267. </el-button>
  268. <el-button type="primary" @click="onPlaySoundRecording(row)" title="播放录音" link v-if="row.recordingAbsolutePath">播放录音</el-button>
  269. <el-button link type="primary" @click="onDownload(row)" title="下载录音" v-if="row.recordingAbsolutePath"> 下载录音 </el-button>
  270. </template>
  271. <template v-else>
  272. <el-button type="primary" @click="onPlaySoundRecording(row)" title="播放录音" link v-if="row.recordingAbsolutePath">播放录音</el-button>
  273. <el-button link type="primary" @click="onDownload(row)" title="下载录音" v-if="row.recordingAbsolutePath"> 下载录音 </el-button>
  274. </template>
  275. </template>
  276. <template #title="{ row }">
  277. <order-detail :order="row.order" @updateList="queryList">{{ row.order?.title }}</order-detail>
  278. </template>
  279. </ProTable>
  280. </el-card>
  281. <!-- 播放录音 -->
  282. <play-record ref="playRecordRef" />
  283. <!-- 业务关联 -->
  284. <connect-business ref="connectBusinessRef" @updateList="queryList" />
  285. </div>
  286. </template>
  287. <script lang="tsx" setup name="callLog">
  288. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  289. import type { FormInstance } from 'element-plus';
  290. import { ElMessageBox } from 'element-plus';
  291. import { downloadFileByStream } from '@/utils/tools';
  292. import { callBaseData, callLogPaged } from '@/api/tels/callLog';
  293. import { formatDate } from '@/utils/formatTime';
  294. import { shortcuts } from '@/utils/constants';
  295. import other from '@/utils/other';
  296. import { useRouter } from 'vue-router';
  297. import { fileDownload } from '@/api/public/file';
  298. // 引入组件
  299. const PlayRecord = defineAsyncComponent(() => import('@/views/tels/callLog/component/Play-record.vue')); // 播放录音
  300. const ConnectBusiness = defineAsyncComponent(() => import('@/views/tels/callLog/component/Connect-business.vue')); // 关联工单还是回访
  301. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  302. const proTableRef = ref<RefType>(); // 表格ref
  303. // 表格配置项
  304. const columns = ref<any[]>([]);
  305. // 定义变量内容
  306. const state = reactive({
  307. queryParams: {
  308. PageIndex: 1, // 当前页
  309. PageSize: 10, // 每页条数
  310. type: '0',
  311. StaffNo: null, // 分机号
  312. CPN: null, // 主叫号码
  313. CDPN: null, // 被叫号码
  314. TelNo: null, // 响应分机
  315. CallDirection: null, // 呼叫类型
  316. UserName: null, // 话务员名称
  317. gateway: null, //中继号码
  318. OnState: null, // 结果
  319. IsAiAnswered: null, // 是否智能应答
  320. callTime: [], // 通话时间
  321. answeredTime: [], // 接通时间
  322. overTime: [], // 挂断时间段
  323. beginIvrTime: [], // ivr开始时间段
  324. endIvrTime: [], // ivr结束时间段
  325. beginQueueTime: [], // 队列开始时间段
  326. endQueueTime: [], // 队列结束时间段
  327. beginRingTime: [], // 振铃开始时间段
  328. endRingTime: [], // 振铃结束时间段
  329. CallTimeStart: null, // 通话开始时间
  330. CallTimeEnd: null, // 通话结束时间
  331. OverTimeStart: null, // 挂断开始时间
  332. OverTimeEnd: null, // 挂断结束时间
  333. AnsweredTimeStart: null, // 接通开始时间
  334. AnsweredTimeEnd: null, // 接通结束时间
  335. BeginIvrTimeStart: null, // ivr开始开始时间
  336. BeginIvrTimeEnd: null, // ivr开始结束时间
  337. EndIvrTimeStart: null, // ivr结束开始时间
  338. EndIvrTimeEnd: null, // ivr结束结束时间
  339. BeginQueueTimeStart: null, // 队列开始开始时间
  340. BeginQueueTimeEnd: null, // 队列开始结束时间
  341. EndQueueTimeStart: null, // 队列结束开始时间
  342. EndQueueTimeEnd: null, // 队列结束结束时间
  343. BeginRingTimeStart: null, // 振铃开始开始时间
  344. BeginRingTimeEnd: null, // 振铃开始结束时间
  345. EndRingTimeStart: null, // 振铃结束开始时间
  346. EndRingTimeEnd: null, // 振铃结束结束时间
  347. },
  348. tableData: [], // 列表数据
  349. loading: false, // 加载
  350. total: 0, // 总条数
  351. callDirection: [],
  352. onState: [],
  353. endByOptions: [],
  354. });
  355. const ruleFormRef = ref<FormInstance>(); // 表单ref
  356. const searchCol = ref(true); // 展开/收起
  357. // 展开/收起
  358. const closeSearch = () => {
  359. searchCol.value = !searchCol.value;
  360. };
  361. const handleTimeChange = (val: string[], startKey: string, endKey: string) => {
  362. if (val) {
  363. state.queryParams[startKey] = val[0];
  364. state.queryParams[endKey] = val[1];
  365. } else {
  366. state.queryParams[startKey] = null;
  367. state.queryParams[endKey] = null;
  368. }
  369. handleQuery();
  370. };
  371. // 通话开始和结束时间段
  372. const callTimeChange = (val: string[]) => {
  373. handleTimeChange(val, 'CallTimeStart', 'CallTimeEnd');
  374. };
  375. // 接通开始和结束时间段
  376. const answeredTimeChange = (val: string[]) => {
  377. handleTimeChange(val, 'AnsweredTimeStart', 'AnsweredTimeEnd');
  378. };
  379. // 挂断开始和结束时间段
  380. const overTimeChange = (val: string[]) => {
  381. handleTimeChange(val, 'OverTimeStart', 'OverTimeEnd');
  382. };
  383. // IVR开始时间段
  384. const beginIvrTimeChange = (val: string[]) => {
  385. handleTimeChange(val, 'BeginIvrTimeStart', 'BeginIvrTimeEnd');
  386. };
  387. // IVR结束时间段
  388. const endIvrTimeChange = (val: string[]) => {
  389. handleTimeChange(val, 'EndIvrTimeStart', 'EndIvrTimeEnd');
  390. };
  391. // 队列开始时间段
  392. const beginQueueTimeChange = (val: string[]) => {
  393. handleTimeChange(val, 'BeginQueueTimeStart', 'BeginQueueTimeEnd');
  394. };
  395. // 队列结束时间段
  396. const endQueueTimeChange = (val: string[]) => {
  397. handleTimeChange(val, 'EndQueueTimeStart', 'EndQueueTimeEnd');
  398. };
  399. // 振铃开始和结束时间段
  400. const beginRingTimeChange = (val: string[]) => {
  401. handleTimeChange(val, 'BeginRingTimeStart', 'BeginRingTimeEnd');
  402. };
  403. // 振铃结束时间段
  404. const endRingTimeChange = (val: string[]) => {
  405. handleTimeChange(val, 'EndRingTimeStart', 'EndRingTimeEnd');
  406. };
  407. // 全部表头
  408. const allColumns = [
  409. { prop: 'cpn', label: '主叫号码', width: 120 },
  410. { prop: 'cdpn', label: '被叫号码', width: 120 },
  411. { prop: 'order.no', label: '工单编码', width: 150 },
  412. { prop: 'title', label: '工单标题', width: 300 },
  413. { prop: 'telNo', label: '响应分机', width: 120 },
  414. { prop: 'gateway', label: '中继号码', width: 120 },
  415. { prop: 'userName', label: '话务员', width: 120 },
  416. { prop: 'duration', label: '通话时间(秒)', width: 120 },
  417. { prop: 'onStateText', label: '通话结果' },
  418. { prop: 'callDirectionText', label: '电话方向' },
  419. { prop: 'endByText', label: '挂机类型', width: 120 },
  420. {
  421. prop: 'beginIvrTime',
  422. label: 'ivr开始时间',
  423. width: 170,
  424. render: (scope) => <span>{formatDate(scope.row.beginIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  425. },
  426. {
  427. prop: 'endIvrTime',
  428. label: 'ivr结束时间',
  429. width: 170,
  430. render: (scope) => <span>{formatDate(scope.row.endIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  431. },
  432. {
  433. prop: 'beginQueueTime',
  434. label: '队列开始时间',
  435. width: 170,
  436. render: (scope) => <span>{formatDate(scope.row.beginQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  437. },
  438. {
  439. prop: 'endQueueTime',
  440. label: '队列结束时间',
  441. width: 170,
  442. render: (scope) => {
  443. return <span>{formatDate(scope.row.endQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  444. },
  445. },
  446. {
  447. prop: 'beginRingTime',
  448. label: '开始振铃时间',
  449. width: 170,
  450. render: (scope) => {
  451. return <span>{formatDate(scope.row.beginRingTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  452. },
  453. },
  454. {
  455. prop: 'endRingTimg',
  456. label: '结束振铃时间',
  457. width: 170,
  458. render: (scope) => {
  459. return <span>{formatDate(scope.row.endRingTimg, 'YYYY-mm-dd HH:MM:SS')}</span>;
  460. },
  461. },
  462. {
  463. prop: 'createdTime',
  464. label: '开始时间',
  465. width: 170,
  466. render: (scope) => <span>{formatDate(scope.row.createdTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  467. },
  468. {
  469. prop: 'answeredTime',
  470. label: '接通时间',
  471. width: 170,
  472. render: (scope) => <span>{formatDate(scope.row.answeredTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  473. },
  474. { prop: 'overTime', label: '挂断时间', width: 170, render: (scope) => <span>{formatDate(scope.row.overTime, 'YYYY-mm-dd HH:MM:SS')}</span> },
  475. { prop: 'operation', label: '操作', fixed: 'right', width: 160, align: 'center' },
  476. ];
  477. // 呼入表头
  478. const inColumns = [
  479. { prop: 'cpn', label: '主叫号码', width: 120 },
  480. { prop: 'cdpn', label: '被叫号码', width: 120 },
  481. { prop: 'order.no', label: '工单编码', width: 150 },
  482. { prop: 'title', label: '工单标题', width: 300 },
  483. { prop: 'telNo', label: '响应分机', width: 120 },
  484. { prop: 'gateway', label: '中继号码', width: 120 },
  485. { prop: 'userName', label: '话务员', width: 120 },
  486. { prop: 'duration', label: '通话时间(秒)', width: 120 },
  487. { prop: 'endByText', label: '挂机类型', width: 120 },
  488. {
  489. prop: 'beginIvrTime',
  490. label: 'ivr开始时间',
  491. width: 170,
  492. render: (scope) => <span>{formatDate(scope.row.beginIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  493. },
  494. {
  495. prop: 'endIvrTime',
  496. label: 'ivr结束时间',
  497. width: 170,
  498. render: (scope) => <span>{formatDate(scope.row.endIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  499. },
  500. {
  501. prop: 'beginQueueTime',
  502. label: '队列开始时间',
  503. width: 170,
  504. render: (scope) => <span>{formatDate(scope.row.beginQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  505. },
  506. {
  507. prop: 'endQueueTime',
  508. label: '队列结束时间',
  509. width: 170,
  510. render: (scope) => {
  511. return <span>{formatDate(scope.row.endQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  512. },
  513. },
  514. {
  515. prop: 'beginRingTime',
  516. label: '开始振铃时间',
  517. width: 170,
  518. render: (scope) => {
  519. return <span>{formatDate(scope.row.beginRingTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  520. },
  521. },
  522. {
  523. prop: 'endRingTimg',
  524. label: '结束振铃时间',
  525. width: 170,
  526. render: (scope) => {
  527. return <span>{formatDate(scope.row.endRingTimg, 'YYYY-mm-dd HH:MM:SS')}</span>;
  528. },
  529. },
  530. {
  531. prop: 'createdTime',
  532. label: '开始时间',
  533. width: 170,
  534. render: (scope) => <span>{formatDate(scope.row.createdTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  535. },
  536. {
  537. prop: 'answeredTime',
  538. label: '接通时间',
  539. width: 170,
  540. render: (scope) => <span>{formatDate(scope.row.answeredTime, ' YYYY-mm-dd HH:MM:SS')}</span>,
  541. },
  542. { prop: 'overTime', label: '挂断结束时间', width: 170, render: (scope) => <span>{formatDate(scope.row.overTime, 'YYYY-mm-dd HH:MM:SS')}</span> },
  543. { prop: 'operation', label: '操作', fixed: 'right', width: 310, align: 'center' },
  544. ];
  545. // 呼出表头
  546. const outColumns = [
  547. { prop: 'cpn', label: '主叫号码', width: 120 },
  548. { prop: 'cdpn', label: '被叫号码', width: 120 },
  549. { prop: 'telNo', label: '响应分机' },
  550. { prop: 'gateway', label: '中继号码', width: 120 },
  551. { prop: 'userName', label: '话务员' },
  552. { prop: 'duration', label: '通话时间(秒)', width: 120 },
  553. { prop: 'endByText', label: '挂机类型', width: 120 },
  554. {
  555. prop: 'createdTime',
  556. label: '开始时间',
  557. width: 170,
  558. render: (scope) => <span>{formatDate(scope.row.createdTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  559. },
  560. {
  561. prop: 'answeredTime',
  562. label: '接通时间',
  563. width: 170,
  564. render: (scope) => <span>{formatDate(scope.row.answeredTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  565. },
  566. { prop: 'overTime', label: '挂断时间', width: 170, render: (scope) => <span>{formatDate(scope.row.overTime, 'YYYY-mm-dd HH:MM:SS')}</span> },
  567. { prop: 'operation', label: '操作', fixed: 'right', width: 180, align: 'center' },
  568. ];
  569. // 未接表头
  570. const noColumns = [
  571. { prop: 'cpn', label: '主叫号码', width: 120 },
  572. { prop: 'cdpn', label: '被叫号码', width: 120 },
  573. { prop: 'telNo', label: '响应分机' },
  574. { prop: 'gateway', label: '中继号码', width: 120 },
  575. { prop: 'userName', label: '话务员' },
  576. { prop: 'callDirectionText', label: '电话方向' },
  577. {
  578. prop: 'beginIvrTime',
  579. label: 'ivr开始时间',
  580. width: 170,
  581. render: (scope) => <span>{formatDate(scope.row.beginIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  582. },
  583. {
  584. prop: 'endIvrTime',
  585. label: 'ivr结束时间',
  586. width: 170,
  587. render: (scope) => <span>{formatDate(scope.row.endIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  588. },
  589. {
  590. prop: 'beginQueueTime',
  591. label: '队列开始时间',
  592. width: 170,
  593. render: (scope) => <span>{formatDate(scope.row.beginQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  594. },
  595. {
  596. prop: 'endQueueTime',
  597. label: '队列结束时间',
  598. width: 170,
  599. render: (scope) => {
  600. return <span>{formatDate(scope.row.endQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  601. },
  602. },
  603. {
  604. prop: 'beginRingTime',
  605. label: '开始振铃时间',
  606. width: 170,
  607. render: (scope) => {
  608. return <span>{formatDate(scope.row.beginRingTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  609. },
  610. },
  611. {
  612. prop: 'endRingTimg',
  613. label: '结束振铃时间',
  614. width: 170,
  615. render: (scope) => {
  616. return <span>{formatDate(scope.row.endRingTimg, 'YYYY-mm-dd HH:MM:SS')}</span>;
  617. },
  618. },
  619. {
  620. prop: 'createdTime',
  621. label: '开始时间',
  622. width: 170,
  623. render: (scope) => <span>{formatDate(scope.row.createdTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  624. },
  625. { prop: 'overTime', label: '挂断时间', width: 170, render: (scope) => <span>{formatDate(scope.row.overTime, 'YYYY-mm-dd HH:MM:SS')}</span> },
  626. ];
  627. // 智能应答
  628. const smartColumns = [
  629. { prop: 'cpn', label: '主叫号码', width: 120 },
  630. { prop: 'cdpn', label: '被叫号码', width: 120 },
  631. { prop: 'gateway', label: '中继号码', width: 120 },
  632. { prop: 'duration', label: '通话时间(秒)', width: 120 },
  633. { prop: 'endByText', label: '挂机类型', width: 120 },
  634. {
  635. prop: 'beginIvrTime',
  636. label: 'ivr开始时间',
  637. width: 170,
  638. render: (scope) => <span>{formatDate(scope.row.beginIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  639. },
  640. {
  641. prop: 'endIvrTime',
  642. label: 'ivr结束时间',
  643. width: 170,
  644. render: (scope) => <span>{formatDate(scope.row.endIvrTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  645. },
  646. {
  647. prop: 'beginQueueTime',
  648. label: '队列开始时间',
  649. width: 170,
  650. render: (scope) => <span>{formatDate(scope.row.beginQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  651. },
  652. {
  653. prop: 'endQueueTime',
  654. label: '队列结束时间',
  655. width: 170,
  656. render: (scope) => {
  657. return <span>{formatDate(scope.row.endQueueTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  658. },
  659. },
  660. {
  661. prop: 'beginRingTime',
  662. label: '开始振铃时间',
  663. width: 170,
  664. render: (scope) => {
  665. return <span>{formatDate(scope.row.beginRingTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  666. },
  667. },
  668. {
  669. prop: 'endRingTimg',
  670. label: '结束振铃时间',
  671. width: 170,
  672. render: (scope) => {
  673. return <span>{formatDate(scope.row.endRingTimg, 'YYYY-mm-dd HH:MM:SS')}</span>;
  674. },
  675. },
  676. {
  677. prop: 'createdTime',
  678. label: '开始时间',
  679. width: 170,
  680. render: (scope) => <span>{formatDate(scope.row.createdTime, 'YYYY-mm-dd HH:MM:SS')}</span>,
  681. },
  682. {
  683. prop: 'answeredTime',
  684. label: '接通时间',
  685. width: 170,
  686. render: (scope) => <span>{formatDate(scope.row.answeredTime, ' YYYY-mm-dd HH:MM:SS')}</span>,
  687. },
  688. { prop: 'overTime', label: '挂断结束时间', width: 170, render: (scope) => <span>{formatDate(scope.row.overTime, 'YYYY-mm-dd HH:MM:SS')}</span> },
  689. { prop: 'operation', label: '操作', fixed: 'right', width: 180, align: 'center' },
  690. ];
  691. const changeTba = () => {
  692. ruleFormRef.value.resetFields();
  693. handleQuery();
  694. };
  695. // 手动查询,将页码设置为1
  696. const handleQuery = () => {
  697. state.queryParams.PageIndex = 1;
  698. queryList();
  699. };
  700. /** 通话记录列表 */
  701. const queryList = async () => {
  702. state.loading = true;
  703. try {
  704. let request = other.deepClone(state.queryParams);
  705. Reflect.deleteProperty(request, 'callTime'); // 删除无用的参数
  706. Reflect.deleteProperty(request, 'answeredTime'); // 删除无用的参数
  707. Reflect.deleteProperty(request, 'overTime'); // 删除无用的参数
  708. Reflect.deleteProperty(request, 'beginIvrTime'); // 删除无用的参数
  709. Reflect.deleteProperty(request, 'endIvrTime'); // 删除无用的参数
  710. Reflect.deleteProperty(request, 'beginQueueTime'); // 删除无用的参数
  711. Reflect.deleteProperty(request, 'endQueueTime'); // 删除无用的参数
  712. Reflect.deleteProperty(request, 'beginRingTime'); // 删除无用的参数
  713. Reflect.deleteProperty(request, 'endRingTime'); // 删除无用的参数
  714. Reflect.deleteProperty(request, 'type'); // 删除无用的参数
  715. switch (state.queryParams.type) {
  716. case '0':
  717. columns.value = allColumns;
  718. break;
  719. case '1':
  720. columns.value = inColumns;
  721. request.CallDirection = 0;
  722. request.OnState = 1;
  723. break;
  724. case '2':
  725. columns.value = outColumns;
  726. request.CallDirection = 1;
  727. request.OnState = 1;
  728. break;
  729. case '3':
  730. columns.value = noColumns;
  731. request.OnState = 2;
  732. break;
  733. case '4':
  734. columns.value = smartColumns;
  735. request.IsAiAnswered = true;
  736. request.OnState = 1;
  737. request.CallDirection = 0;
  738. break;
  739. default:
  740. columns.value = allColumns;
  741. break;
  742. }
  743. const response = await callLogPaged(request);
  744. state.tableData = response.result?.items ?? [];
  745. state.total = response.result?.total ?? 0;
  746. state.loading = false;
  747. } catch (e) {
  748. state.loading = false;
  749. console.log(e);
  750. }
  751. };
  752. /** 重置按钮操作 */
  753. const resetQuery = (formEl: FormInstance | undefined) => {
  754. if (!formEl) return;
  755. formEl.resetFields();
  756. state.queryParams.CallTimeStart = null;
  757. state.queryParams.CallTimeEnd = null;
  758. state.queryParams.AnsweredTimeStart = null;
  759. state.queryParams.AnsweredTimeEnd = null;
  760. state.queryParams.OverTimeStart = null;
  761. state.queryParams.OverTimeEnd = null;
  762. state.queryParams.BeginIvrTimeStart = null;
  763. state.queryParams.BeginIvrTimeEnd = null;
  764. state.queryParams.EndIvrTimeStart = null;
  765. state.queryParams.EndIvrTimeEnd = null;
  766. state.queryParams.BeginQueueTimeStart = null;
  767. state.queryParams.BeginQueueTimeEnd = null;
  768. state.queryParams.EndQueueTimeStart = null;
  769. state.queryParams.EndQueueTimeEnd = null;
  770. state.queryParams.BeginRingTimeStart = null;
  771. state.queryParams.BeginRingTimeEnd = null;
  772. state.queryParams.EndRingTimeStart = null;
  773. state.queryParams.EndRingTimeEnd = null;
  774. queryList();
  775. };
  776. // 播放录音
  777. const playRecordRef = ref<RefType>();
  778. const onPlaySoundRecording = (val: any) => {
  779. playRecordRef.value.openDialog(
  780. import.meta.env.VITE_RECORD_PREFIX + val.recordingAbsolutePath,
  781. val.recordingFileName,
  782. val.recordingAbsolutePath,
  783. val.cpn,
  784. val.createdTime
  785. );
  786. };
  787. // 下载录音
  788. const onDownload = (row: any) => {
  789. ElMessageBox.confirm(`您确定要下载此录音吗?`, '提示', {
  790. confirmButtonText: '确认',
  791. cancelButtonText: '取消',
  792. type: 'warning',
  793. draggable: true,
  794. cancelButtonClass: 'default-button',
  795. autofocus: false,
  796. })
  797. .then(() => {
  798. fileDownload({ path: import.meta.env.VITE_RECORD_DOWNLOAD_PREFIX + row.recordingAbsolutePath }).then((res: any) => {
  799. downloadFileByStream(res, row.recordingFileName);
  800. });
  801. })
  802. .catch(() => {});
  803. };
  804. // 关联业务
  805. const connectBusinessRef = ref<RefType>();
  806. const onConnect = (row: any) => {
  807. connectBusinessRef.value.openDialog(row);
  808. };
  809. // 失联工单
  810. const router = useRouter();
  811. const onCreate = (row: any) => {
  812. router.push({
  813. name: 'orderAccept',
  814. state: {
  815. createBy: 'tel',
  816. fromTel: row.cpn,
  817. telGuid: row.otherAccept,
  818. transfer: row.gateway,
  819. telArea: '',
  820. },
  821. params: {
  822. callId: row.otherAccept,
  823. tagsViewName: '创建失联工单',
  824. },
  825. });
  826. };
  827. // 基础信息
  828. const getBaseData = async () => {
  829. const response = await callBaseData();
  830. state.callDirection = response.result.callDirection;
  831. state.onState = response.result.onState;
  832. state.endByOptions = response.result.endBy;
  833. };
  834. onMounted(() => {
  835. getBaseData();
  836. queryList();
  837. });
  838. </script>
  839. <style lang="scss" scoped>
  840. .arrow {
  841. transition: transform var(--el-transition-duration);
  842. cursor: pointer;
  843. }
  844. .arrow.is-reverse {
  845. transform: rotateZ(-180deg);
  846. }
  847. </style>