talkTime.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="statistics-call-talk-time-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  5. <el-form-item prop="crTime">
  6. <statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading"/>
  7. </el-form-item>
  8. <el-form-item label="热线号码" prop="source">
  9. <el-select v-model="state.queryParams.source" placeholder="请选择热线号码" clearable @change="handleQuery">
  10. <el-option v-for="item in state.callForwardingSource" :value="item.dicDataValue" :key="item.dicDataValue" :label="item.dicDataName" />
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label-width="0">
  14. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  15. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  16. <SvgIcon name="ele-Refresh" class="mr5" />重置
  17. </el-button>
  18. <el-popover :width="500" trigger="click">
  19. <template #reference>
  20. <el-button type="primary" title="口径说明"><SvgIcon name="ele-QuestionFilled" class="mr5"/>口径说明</el-button>
  21. </template>
  22. <el-descriptions title="" :column="1" border style="max-height: 400px; overflow: auto">
  23. <el-descriptions-item label="时间段">以每小时为时间段</el-descriptions-item>
  24. <el-descriptions-item label="呼入总量">呼入总数量</el-descriptions-item>
  25. <el-descriptions-item label="有效接通">呼入时长大于15秒的接通量</el-descriptions-item>
  26. <el-descriptions-item label="接通秒挂">(无效接通):呼入时长小于15秒的接通量</el-descriptions-item>
  27. <el-descriptions-item label="挂机量">呼入未接通量</el-descriptions-item>
  28. <el-descriptions-item label="队列挂断">在队列等待中挂断</el-descriptions-item>
  29. <el-descriptions-item label="IVR挂断">语音提示等待中挂断</el-descriptions-item>
  30. </el-descriptions>
  31. </el-popover>
  32. <el-button type="primary" @click="onDetail" :loading="state.loading"> 通话时段分析 </el-button>
  33. </el-form-item>
  34. </el-form>
  35. <vxe-toolbar
  36. ref="toolbarRef"
  37. :loading="state.loading"
  38. custom
  39. :refresh="{
  40. queryMethod: handleQuery
  41. }"
  42. :tools="[{ toolRender: { name: 'exportAll' } }]"
  43. >
  44. </vxe-toolbar>
  45. <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
  46. <vxe-table
  47. border
  48. :loading="state.loading"
  49. :data="state.tableData"
  50. :column-config="{ resizable: true }"
  51. :row-config="{ isCurrent: true, isHover: true, height: 30, keyField: 'id',useKey: true }"
  52. ref="tableRef"
  53. height="auto"
  54. auto-resize
  55. show-overflow
  56. :scrollY="{ enabled: true, gt: 100 }"
  57. id="statisticsCallTalkTime"
  58. :custom-config="{ storage: true }"
  59. showHeaderOverflow
  60. :params="{ exportMethod: callPeriodExport, exportParams: requestParams }"
  61. show-footer
  62. :footer-method="footerMethod"
  63. >
  64. <vxe-column field="hourTo" title="时间段"></vxe-column>
  65. <vxe-column field="count" title="呼入总量">
  66. <template #default="scope">
  67. <el-button type="primary" link @click="linkDetail(scope)">
  68. {{scope.row.count}}
  69. </el-button>
  70. </template>
  71. </vxe-column>
  72. <vxe-column field="effectiveCount" title="有效接通">
  73. <template #default="scope">
  74. <el-button type="primary" link @click="linkDetail(scope)">
  75. {{scope.row.effectiveCount}}
  76. </el-button>
  77. </template>
  78. </vxe-column>
  79. <vxe-column field="connectByeCount" title="接通秒挂">
  80. <template #default="scope">
  81. <el-button type="primary" link @click="linkDetail(scope)">
  82. {{scope.row.connectByeCount}}
  83. </el-button>
  84. </template>
  85. </vxe-column>
  86. <vxe-column field="noConnectByeCount" title="未接通秒挂">
  87. <template #default="scope">
  88. <el-button type="primary" link @click="linkDetail(scope)">
  89. {{scope.row.noConnectByeCount}}
  90. </el-button>
  91. </template>
  92. </vxe-column>
  93. <vxe-column field="queueByeCount" title="队列挂断">
  94. <template #default="scope">
  95. <el-button type="primary" link @click="linkDetail(scope)">
  96. {{scope.row.queueByeCount}}
  97. </el-button>
  98. </template>
  99. </vxe-column>
  100. <vxe-column field="ivrByeCount" title="IVR挂断">
  101. <template #default="scope">
  102. <el-button type="primary" link @click="linkDetail(scope)">
  103. {{scope.row.ivrByeCount}}
  104. </el-button>
  105. </template>
  106. </vxe-column>
  107. </vxe-table>
  108. </div>
  109. </div>
  110. </div>
  111. </template>
  112. <script setup lang="tsx" name="statisticsCallTalkTime">
  113. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  114. import { FormInstance } from 'element-plus';
  115. import { callPeriod, callPeriodBase, callPeriodExport } from '@/api/statistics/call';
  116. import { defaultDate } from '@/utils/constants';
  117. import { useRouter } from 'vue-router';
  118. import Other from '@/utils/other';
  119. import XEUtils from 'xe-utils';
  120. const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
  121. // 定义变量内容
  122. const ruleFormRef = ref<RefType>(); // 表单ref
  123. const state = reactive<any>({
  124. queryParams: {
  125. // 查询条件
  126. Keyword: null, // 关键词
  127. crTime: defaultDate, //
  128. source: null,
  129. },
  130. tableData: [], //表单
  131. loading: false, // 加载
  132. total: 0, // 总数
  133. callForwardingSource: [],
  134. });
  135. /** 搜索按钮操作 */
  136. const handleQuery = () => {
  137. // state.queryParams.PageIndex = 1;
  138. queryList();
  139. };
  140. /** 获取列表 */
  141. const requestParams = ref<EmptyObjectType>({});
  142. const queryList = () => {
  143. state.loading = true;
  144. requestParams.value = Other.deepClone(state.queryParams);
  145. requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  146. requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  147. Reflect.deleteProperty(requestParams.value, 'crTime');
  148. callPeriod(requestParams.value)
  149. .then((res: any) => {
  150. state.tableData = res.result;
  151. state.loading = false;
  152. })
  153. .catch(() => {
  154. state.loading = false;
  155. });
  156. };
  157. /** 重置按钮操作 */
  158. const statisticalTimeRef = ref<RefType>();
  159. const resetQuery = (formEl: FormInstance | undefined) => {
  160. if (!formEl) return;
  161. formEl.resetFields();
  162. statisticalTimeRef.value.reset();
  163. queryList();
  164. };
  165. // 通话时段分析
  166. const router = useRouter();
  167. const onDetail = () => {
  168. const StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  169. const EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  170. router.push({
  171. name: 'statisticsCallDetailTalkTime',
  172. query: {
  173. showSearch: 'true',
  174. StartTime,
  175. EndTime,
  176. },
  177. });
  178. };
  179. // 查看详情
  180. const linkDetail = (scope: any) => {
  181. const StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  182. const EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  183. router.push({
  184. name: 'statisticsCallDetailTalkTime',
  185. query: {
  186. type: scope.column.property,
  187. StartTime,
  188. EndTime,
  189. startHourTo: scope.row.startHourTo,
  190. },
  191. });
  192. };
  193. // 获取基础信息
  194. const getBaseInfo = async () => {
  195. try {
  196. const { result } = await callPeriodBase();
  197. state.callForwardingSource = result.callForwardingSource ?? [];
  198. } catch (e) {
  199. console.log(e);
  200. }
  201. };
  202. // 计算合计
  203. const footerMethod = ({ columns, data }) => {
  204. return [
  205. columns.map((column: any, columnIndex: number) => {
  206. if (columnIndex === 0) {
  207. return '合计';
  208. }
  209. if (['count', 'effectiveCount', 'connectByeCount','noConnectByeCount','queueByeCount','ivrByeCount'].includes(column.property)) {
  210. return XEUtils.sum(data, column.property);
  211. }
  212. }),
  213. ];
  214. };
  215. const toolbarRef = ref<RefType>();
  216. const tableRef = ref<RefType>();
  217. onMounted(() => {
  218. queryList();
  219. if (tableRef.value && toolbarRef.value) {
  220. tableRef.value.connect(toolbarRef.value);
  221. }
  222. getBaseInfo();
  223. });
  224. </script>