hotNumber.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="statistics-call-hot-number-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="gateway">
  9. <el-select v-model="state.queryParams.gateway" 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="接通">接通的电话数量</el-descriptions-item>
  26. <el-descriptions-item label="挂机">挂断的电话数量</el-descriptions-item>
  27. <el-descriptions-item label="接通率">接通总量/呼入总量</el-descriptions-item>
  28. <el-descriptions-item label="有效接通">呼入时长大于15秒的接通量</el-descriptions-item>
  29. <el-descriptions-item label="平均时长">呼入总时长/呼入接通量入</el-descriptions-item>
  30. <el-descriptions-item label="无效接通">呼入时长小于3秒的接通量</el-descriptions-item>
  31. <el-descriptions-item label="有效率">有效接通/接通总量</el-descriptions-item>
  32. </el-descriptions>
  33. </el-popover>
  34. </el-form-item>
  35. </el-form>
  36. <vxe-toolbar
  37. ref="toolbarRef"
  38. :loading="state.loading"
  39. custom
  40. :refresh="{
  41. queryMethod: handleQuery,
  42. }"
  43. :tools="[{ toolRender: { name: 'exportAll' } }]"
  44. >
  45. </vxe-toolbar>
  46. <div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
  47. <vxe-table
  48. border
  49. :loading="state.loading"
  50. :data="state.tableData"
  51. :column-config="{ resizable: true }"
  52. :row-config="{ isCurrent: true, isHover: true, height: 30, keyField: 'id',useKey: true }"
  53. ref="tableRef"
  54. height="auto"
  55. auto-resize
  56. :scrollY="{ enabled: true, gt: 100 }"
  57. show-overflow
  58. id="statisticsCallHotNumber"
  59. :custom-config="{ storage: true }"
  60. show-footer
  61. :footer-method="footerMethod"
  62. :params="{ exportMethod: callHotlineExport, exportParams: requestParams }"
  63. >
  64. <vxe-column field="gateWay" title="热线号码"></vxe-column>
  65. <vxe-colgroup title="电话呼入汇总" align="center">
  66. <vxe-column title="呼入" field="callInCount" sortable></vxe-column>
  67. <vxe-column title="接通" field="connectCount" sortable></vxe-column>
  68. <vxe-column title="未接通秒挂" field="noConnectByeCount" sortable></vxe-column>
  69. <vxe-column title="接通率" field="callInConnectRate" sortable>
  70. <template #default="{ row }"> {{ row.callInConnectRate }}% </template>
  71. </vxe-column>
  72. </vxe-colgroup>
  73. <vxe-colgroup title="接通话务分析" align="center">
  74. <vxe-column title="有效接通" field="effectiveCount" sortable></vxe-column>
  75. <vxe-column title="平均时长" field="aveDuration" sortable></vxe-column>
  76. <vxe-column title="通话时总长" field="durationSum" sortable></vxe-column>
  77. <vxe-column title="接通秒挂" field="connectByeCount" sortable></vxe-column>
  78. <vxe-column title="及时应答数" field="timelyAnswerCount" sortable></vxe-column>
  79. <vxe-column title="有效率" field="effectiveRate" sortable>
  80. <template #default="{ row }"> {{ row.effectiveRate }}% </template>
  81. </vxe-column>
  82. </vxe-colgroup>
  83. </vxe-table>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script setup lang="tsx" name="statisticsCallHotNumber">
  89. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  90. import { FormInstance } from 'element-plus';
  91. import { callHotlineExport, callHotline, callPeriodBase } from '@/api/statistics/call';
  92. import { defaultDate } from '@/utils/constants';
  93. import Other from '@/utils/other';
  94. import XEUtils from 'xe-utils';
  95. const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
  96. // 定义变量内容
  97. const ruleFormRef = ref<RefType>(); // 表单ref
  98. const state = reactive<any>({
  99. queryParams: {
  100. // 查询条件
  101. gateway: null, // 热线号码
  102. crTime: defaultDate,
  103. },
  104. tableData: [], //表单
  105. loading: false, // 加载
  106. total: 0, // 总数
  107. callForwardingSource: [],
  108. });
  109. /** 搜索按钮操作 */
  110. const handleQuery = () => {
  111. // state.queryParams.PageIndex = 1;
  112. queryList();
  113. };
  114. /** 获取列表 */
  115. const requestParams = ref<EmptyObjectType>({});
  116. const queryList = () => {
  117. state.loading = true;
  118. requestParams.value = Other.deepClone(state.queryParams);
  119. requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  120. requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  121. Reflect.deleteProperty(requestParams.value, 'crTime');
  122. callHotline(requestParams.value)
  123. .then((res: any) => {
  124. state.tableData = res.result ?? [];
  125. state.total = res.result?.total ?? 0;
  126. state.loading = false;
  127. })
  128. .catch(() => {
  129. state.loading = false;
  130. });
  131. };
  132. /** 重置按钮操作 */
  133. const statisticalTimeRef = ref<RefType>();
  134. const resetQuery = (formEl: FormInstance | undefined) => {
  135. if (!formEl) return;
  136. formEl.resetFields();
  137. statisticalTimeRef.value.reset();
  138. queryList();
  139. };
  140. // 获取基础信息
  141. const getBaseInfo = async () => {
  142. try {
  143. const { result } = await callPeriodBase();
  144. state.callForwardingSource = result.callForwardingSource ?? [];
  145. } catch (e) {
  146. console.log(e);
  147. }
  148. };
  149. // 计算合计
  150. const footerMethod = ({ columns, data }) => {
  151. return [
  152. columns.map((column: any, columnIndex: number) => {
  153. if (columnIndex === 0) {
  154. return '合计';
  155. }
  156. if (
  157. [
  158. 'callInCount',
  159. 'connectCount',
  160. 'noConnectByeCount',
  161. 'effectiveCount',
  162. 'aveDuration',
  163. 'durationSum',
  164. 'connectByeCount',
  165. 'timelyAnswerCount',
  166. ].includes(column.property)
  167. ) {
  168. return XEUtils.sum(data, column.property);
  169. }
  170. }),
  171. ];
  172. };
  173. const toolbarRef = ref<RefType>();
  174. const tableRef = ref<RefType>();
  175. onMounted(() => {
  176. queryList();
  177. if (tableRef.value && toolbarRef.value) {
  178. tableRef.value.connect(toolbarRef.value);
  179. }
  180. getBaseInfo();
  181. });
  182. </script>