detailIndexTime.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="statistics-call-detail-index-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: handleQuery,
  10. }"
  11. :tools="[{ 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, keyField: 'id',useKey: true }"
  21. ref="tableRef"
  22. height="auto"
  23. auto-resize
  24. :scrollY="{ enabled: true, gt: 100 }"
  25. show-overflow
  26. id="statisticsCallDetailIndexTime"
  27. :custom-config="{ storage: true }"
  28. show-footer
  29. :footer-method="footerMethod"
  30. :params="{ exportMethod: callDetailListDateExport, exportParams: requestParams }"
  31. >
  32. <vxe-column field="hour" title="时间" width="110"> </vxe-column>
  33. <vxe-column field="inTotal" title="呼入总量"> </vxe-column>
  34. <vxe-column field="inConnectionQuantity" title="接通总量"> </vxe-column>
  35. <vxe-column field="notAcceptedHang" title="未接通秒挂"></vxe-column>
  36. <vxe-column field="inConnectionRate" title="接通率"></vxe-column>
  37. <vxe-column field="averageDuration" title="平均时长"></vxe-column>
  38. <vxe-column field="inAvailableAnswer" title="有效接通量"></vxe-column>
  39. <vxe-column field="inHangupImmediateWhenAnswered" title="接通秒挂"></vxe-column>
  40. <vxe-column field="effectiveConnectionRate" title="有效接通率"></vxe-column>
  41. <vxe-column field="timeoutConnection" title="超时接通量"></vxe-column>
  42. <vxe-column field="timeoutSuspension" title="超时挂断量"></vxe-column>
  43. <vxe-column field="onTimeConnectionRate" title="按时接通率"></vxe-column>
  44. <vxe-column field="queueByeCount" title="队列挂断"></vxe-column>
  45. <vxe-column field="ivrByeCount" title="IVR挂断"></vxe-column>
  46. <vxe-column field="outTotal" title="呼出总量"></vxe-column>
  47. <vxe-column field="outConnectionQuantity" title="呼出接通量"></vxe-column>
  48. <vxe-column field="outConnectionRate" title="呼出接通率"></vxe-column>
  49. </vxe-table>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script setup lang="tsx" name="statisticsCallDetailIndexTime">
  55. import { onMounted, reactive, ref } from 'vue';
  56. import { FormInstance } from 'element-plus';
  57. import { callDateListDate, callDetailListDateExport, callPeriodBase } from '@/api/statistics/call';
  58. import { useRoute } from 'vue-router';
  59. import XEUtils from 'xe-utils';
  60. const state = reactive<any>({
  61. queryParams: {
  62. // 查询条件
  63. Keyword: null,
  64. },
  65. tableData: [], //表单
  66. loading: false, // 加载
  67. total: 0, // 总数
  68. callForwardingSource: [],
  69. totalCount: {},
  70. });
  71. /** 搜索按钮操作 */
  72. const handleQuery = () => {
  73. // state.queryParams.PageIndex = 1;
  74. queryList();
  75. };
  76. /** 获取列表 */
  77. const requestParams = ref<EmptyObjectType>({});
  78. const route = useRoute();
  79. const routeQueryParams = route.query;
  80. const queryList = async () => {
  81. state.loading = true;
  82. try {
  83. requestParams.value = {
  84. StartTime: routeQueryParams.StartTime,
  85. EndTime: routeQueryParams.EndTime,
  86. Keyword: state.queryParams.Keyword,
  87. };
  88. const { result } = await callDateListDate(requestParams.value);
  89. state.tableData = result.list ?? [];
  90. state.totalCount = result.total;
  91. state.loading = false;
  92. } catch (e) {
  93. state.loading = false;
  94. console.log(e);
  95. }
  96. };
  97. // 获取基础信息
  98. const getBaseInfo = async () => {
  99. try {
  100. const { result } = await callPeriodBase();
  101. state.callForwardingSource = result.callForwardingSource ?? [];
  102. } catch (e) {
  103. console.log(e);
  104. }
  105. };
  106. /** 重置按钮操作 */
  107. const resetQuery = (formEl: FormInstance | undefined) => {
  108. if (!formEl) return;
  109. formEl.resetFields();
  110. queryList();
  111. };
  112. // 计算合计
  113. const footerMethod = ({ columns, data }) => {
  114. return [
  115. columns.map((column: any, columnIndex: number) => {
  116. if (columnIndex === 0) {
  117. return '合计';
  118. }
  119. // 后端返回了数据集合 state.totalCount 所以不需要计算 直接进行赋值
  120. return XEUtils.get(state.totalCount, column.property);
  121. }),
  122. ];
  123. };
  124. // 合计
  125. const getSummaries = (param: any) => {
  126. const { columns } = param;
  127. const sums: string[] = [];
  128. columns.forEach((column: { property: string }, index: number) => {
  129. if (index === 0) {
  130. sums[index] = '合计';
  131. return;
  132. }
  133. switch (column.property) {
  134. case 'inTotal':
  135. sums[index] = state.totalCount?.inTotal;
  136. break;
  137. case 'inConnectionQuantity':
  138. sums[index] = state.totalCount?.inConnectionQuantity;
  139. break;
  140. case 'notAcceptedHang':
  141. sums[index] = state.totalCount?.notAcceptedHang;
  142. break;
  143. case 'inConnectionRate':
  144. sums[index] = state.totalCount?.inConnectionRate;
  145. break;
  146. case 'averageDuration':
  147. sums[index] = state.totalCount?.averageDuration;
  148. break;
  149. case 'inAvailableAnswer':
  150. sums[index] = state.totalCount?.inAvailableAnswer;
  151. break;
  152. case 'inHangupImmediateWhenAnswered':
  153. sums[index] = state.totalCount?.inHangupImmediateWhenAnswered;
  154. break;
  155. case 'effectiveConnectionRate':
  156. sums[index] = state.totalCount?.effectiveConnectionRate;
  157. break;
  158. case 'timeoutConnection':
  159. sums[index] = state.totalCount?.timeoutConnection;
  160. break;
  161. case 'timeoutSuspension':
  162. sums[index] = state.totalCount?.timeoutSuspension;
  163. break;
  164. case 'onTimeConnectionRate':
  165. sums[index] = state.totalCount?.onTimeConnectionRate;
  166. break;
  167. case 'queueByeCount':
  168. sums[index] = state.totalCount?.queueByeCount;
  169. break;
  170. case 'ivrByeCount':
  171. sums[index] = state.totalCount?.ivrByeCount;
  172. break;
  173. case 'outTotal':
  174. sums[index] = state.totalCount?.outTotal;
  175. break;
  176. case 'outConnectionQuantity':
  177. sums[index] = state.totalCount?.outConnectionQuantity;
  178. break;
  179. case 'outConnectionRate':
  180. sums[index] = state.totalCount?.outConnectionRate;
  181. break;
  182. default:
  183. sums[index] = '';
  184. break;
  185. }
  186. });
  187. return sums;
  188. };
  189. const toolbarRef = ref<RefType>();
  190. const tableRef = ref<RefType>();
  191. onMounted(() => {
  192. queryList();
  193. if (tableRef.value && toolbarRef.value) {
  194. tableRef.value.connect(toolbarRef.value);
  195. }
  196. getBaseInfo();
  197. });
  198. </script>