detailIndexCall.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <div class="statistics-call-detail-index-call-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <vxe-toolbar
  5. ref="toolbarRef"
  6. :loading="state.loading"
  7. custom
  8. :refresh="{
  9. queryMethod: queryList,
  10. }"
  11. :tools="[{ toolRender: { name: 'exportCurrent' } }, { toolRender: { name: 'exportAll' } }]"
  12. >
  13. </vxe-toolbar>
  14. <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
  15. <vxe-table
  16. border
  17. :loading="state.loading"
  18. :data="state.tableData"
  19. :column-config="{ resizable: true }"
  20. :row-config="{ isCurrent: true, isHover: true, height: 30,useKey: true }"
  21. ref="tableRef"
  22. height="auto"
  23. auto-resize
  24. show-overflow
  25. :scrollY="{ enabled: true, gt: 100 }"
  26. id="statisticsCallDetailIndexCall"
  27. :custom-config="{ storage: true }"
  28. :params="{ exportMethod: callDetailListDetailExport, exportParams: requestParams }"
  29. showHeaderOverflow
  30. >
  31. <vxe-column field="orderNo" title="工单编码" width="140"></vxe-column>
  32. <vxe-column field="title" title="工单标题" width="200">
  33. <template #default="{ row }">
  34. <order-detail :order="{ ...row, id: row.orderId }" @updateList="queryList">{{ row.orderTitle }}</order-detail>
  35. </template>
  36. </vxe-column>
  37. <vxe-column field="cpn" title="主叫号码" width="120"></vxe-column>
  38. <vxe-column field="cdpn" title="被叫号码" width="120"></vxe-column>
  39. <vxe-column field="telNo" title="响应分机" width="120"></vxe-column>
  40. <vxe-column field="endByText" title="挂断状态" width="120"></vxe-column>
  41. <vxe-column field="userName" title="话务员" width="120"></vxe-column>
  42. <vxe-column field="createdTime" title="开始时间" width="160">
  43. <template #default="{ row }">
  44. {{ formatDate(row.createdTime, 'YYYY-mm-dd HH:MM:SS') }}
  45. </template>
  46. </vxe-column>
  47. <vxe-column field="answeredTime" title="接通时间" width="160">
  48. <template #default="{ row }">
  49. {{ formatDate(row.answeredTime, 'YYYY-mm-dd HH:MM:SS') }}
  50. </template>
  51. </vxe-column>
  52. <vxe-column field="overTime" title="挂断时间" width="160">
  53. <template #default="{ row }">
  54. {{ formatDate(row.overTime, 'YYYY-mm-dd HH:MM:SS') }}
  55. </template>
  56. </vxe-column>
  57. <vxe-column field="duration" title="通话时间(秒)" width="120"></vxe-column>
  58. <vxe-column title="操作" fixed="right" width="160" align="center" :show-overflow="false">
  59. <template #default="{ row }">
  60. <el-button type="primary" @click="onPlaySoundRecording(row)" title="播放录音" link v-if="row.recordingAbsolutePath">播放录音</el-button>
  61. <el-button link type="primary" @click="onDownload(row)" title="下载录音" v-if="row.recordingAbsolutePath">下载录音</el-button>
  62. </template>
  63. </vxe-column>
  64. </vxe-table>
  65. </div>
  66. <pagination
  67. @pagination="queryList"
  68. :total="state.total"
  69. v-model:current-page="state.queryParams.PageIndex"
  70. v-model:page-size="state.queryParams.PageSize"
  71. :disabled="state.loading"
  72. />
  73. </div>
  74. <!-- 播放录音 -->
  75. <play-record ref="playRecordRef" />
  76. </div>
  77. </template>
  78. <script setup lang="tsx" name="statisticsCallDetailIndexCall">
  79. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  80. import { ElMessageBox } from 'element-plus';
  81. import { callDetailListDetail, callDetailListDetailExport } from '@/api/statistics/call';
  82. import { useRoute } from 'vue-router';
  83. import { formatDate } from '@/utils/formatTime';
  84. import { fileDownload } from '@/api/public/file';
  85. import { downloadFileBySrc, downloadFileByStream } from '@/utils/tools';
  86. import { useThemeConfig } from '@/stores/themeConfig';
  87. import { storeToRefs } from 'pinia';
  88. import { exportOrder } from '@/api/business/order';
  89. import { useAppConfig } from '@/stores/appConfig';
  90. const PlayRecord = defineAsyncComponent(() => import('@/components/PlayRecord/index.vue')); // 播放录音
  91. const OrderDetail = defineAsyncComponent(() => import('@/components/OrderDetail/index.vue')); // 工单详情
  92. const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
  93. const state = reactive<any>({
  94. queryParams: {
  95. PageIndex: 1,
  96. PageSize: 20,
  97. },
  98. tableData: [], //表单
  99. loading: false, // 加载
  100. total: 0, // 总数
  101. callForwardingSource: [],
  102. totalCount: {},
  103. });
  104. /** 获取列表 */
  105. const requestParams = ref<EmptyObjectType>({});
  106. const route = useRoute();
  107. const routeQueryParams = route.query;
  108. const queryList = async () => {
  109. state.loading = true;
  110. try {
  111. requestParams.value = {
  112. StartTime: routeQueryParams.StartTime,
  113. EndTime: routeQueryParams.EndTime,
  114. TypeCode: routeQueryParams.TypeCode,
  115. pageIndex: state.queryParams.PageIndex,
  116. pageSize: state.queryParams.PageSize,
  117. };
  118. const { result } = await callDetailListDetail(requestParams.value);
  119. state.tableData = result?.items ?? [];
  120. state.tableData = state.tableData.map((item: any) => {
  121. return {
  122. id: item.orderId,
  123. ...item,
  124. };
  125. });
  126. state.total = result.total ?? 0;
  127. state.loading = false;
  128. } catch (e) {
  129. state.loading = false;
  130. console.log(e);
  131. }
  132. };
  133. // 播放录音
  134. const playRecordRef = ref<RefType>();
  135. const storesThemeConfig = useThemeConfig();
  136. const { themeConfig } = storeToRefs(storesThemeConfig);
  137. const appConfigStore = useAppConfig();
  138. const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
  139. const onPlaySoundRecording = (val: any) => {
  140. playRecordRef.value.playRecord(val.otherAccept);
  141. };
  142. // 下载录音
  143. const onDownload = (row: any) => {
  144. ElMessageBox.confirm(`您确定要下载此录音吗?`, '提示', {
  145. confirmButtonText: '确认',
  146. cancelButtonText: '取消',
  147. type: 'warning',
  148. draggable: true,
  149. cancelButtonClass: 'default-button',
  150. autofocus: false,
  151. })
  152. .then(() => {
  153. switch (themeConfig.value.appScope) {
  154. case 'YiBin':
  155. fileDownload({ path: AppConfigInfo.value.recordDownLoadPrefix + row.audioFile })
  156. .then((res: any) => {
  157. downloadFileByStream(res, row.audioFile);
  158. })
  159. .catch(() => {});
  160. break;
  161. case 'ZiGong':
  162. case 'LuZhou':
  163. downloadFileBySrc(AppConfigInfo.value.recordPrefix + row.audioFile, row.audioFile);
  164. // window.open(AppConfigInfo.value.recordPrefix + row.audioFile)
  165. break;
  166. }
  167. })
  168. .catch(() => {});
  169. };
  170. const toolbarRef = ref<RefType>();
  171. const tableRef = ref<RefType>();
  172. onMounted(() => {
  173. queryList();
  174. if (tableRef.value && toolbarRef.value) {
  175. tableRef.value.connect(toolbarRef.value);
  176. }
  177. });
  178. </script>