index.vue 28 KB

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