talkTime.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="statistics-call-talk-time-container layout-pd">
  3. <!-- 搜索 -->
  4. <el-card shadow="never">
  5. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
  6. <el-form-item label="时间段" prop="crTime">
  7. <el-date-picker
  8. v-model="state.queryParams.crTime"
  9. type="datetimerange"
  10. unlink-panels
  11. range-separator="至"
  12. start-placeholder="开始时间"
  13. end-placeholder="结束时间"
  14. :shortcuts="shortcuts"
  15. @change="queryList"
  16. value-format="YYYY-MM-DD[T]HH:mm:ss"
  17. />
  18. </el-form-item>
  19. <el-form-item label-width="0">
  20. <el-button type="primary" @click="queryList" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  21. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  22. <SvgIcon name="ele-Refresh" class="mr5" />重置
  23. </el-button>
  24. </el-form-item>
  25. </el-form>
  26. </el-card>
  27. <el-card shadow="never">
  28. <ProTable
  29. ref="proTableRef"
  30. :columns="columns"
  31. :data="state.tableData"
  32. @updateTable="queryList"
  33. :loading="state.loading"
  34. :pagination="false"
  35. border
  36. show-summary
  37. >
  38. </ProTable>
  39. </el-card>
  40. </div>
  41. </template>
  42. <script setup lang="tsx" name="statisticsCallTalkTime">
  43. import { onMounted, reactive, ref } from 'vue';
  44. import { ElButton, FormInstance } from 'element-plus';
  45. import { throttle } from '@/utils/tools';
  46. import { callPeriod } from '@/api/statistics/call';
  47. import { shortcuts } from '@/utils/constants';
  48. import dayjs from 'dayjs';
  49. const proTableRef = ref<RefType>(); // 表格ref
  50. // 表格配置项
  51. const columns = ref<any[]>([
  52. { type: 'index', fixed: 'left', width: 55, label: '序号', align: 'center' },
  53. { prop: 'hourTo', label: '时间段', align: 'center' },
  54. { prop: 'count', label: '呼入总量', align: 'center' },
  55. { prop: 'effectiveCount', label: '有效接通', align: 'center' },
  56. { prop: 'connectByeCount', label: '接通秒挂', align: 'center' },
  57. { prop: 'noConnectByeCount', label: '未接通秒挂', align: 'center' },
  58. { prop: 'queueByeCount', label: '队列挂断', align: 'center' },
  59. { prop: 'ivrByeCount', label: 'IVR挂断', align: 'center' },
  60. ]);
  61. // 定义变量内容
  62. const ruleFormRef = ref<RefType>(); // 表单ref
  63. const state = reactive({
  64. queryParams: {
  65. // 查询条件
  66. Keyword: null, // 关键词
  67. crTime: [dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'), dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')], //
  68. },
  69. tableData: [], //表单
  70. loading: false, // 加载
  71. total: 0, // 总数
  72. });
  73. // 受理时间
  74. /** 获取列表 */
  75. const queryList = throttle(() => {
  76. state.loading = true;
  77. let beginDate = null;
  78. let endDate = null;
  79. if (state.queryParams?.crTime) {
  80. beginDate = state.queryParams?.crTime[0];
  81. endDate = state.queryParams?.crTime[1];
  82. }
  83. const request = {
  84. beginDate,
  85. endDate,
  86. DelayState: state.queryParams.DelayState,
  87. PageIndex: state.queryParams.PageIndex,
  88. PageSize: state.queryParams.PageSize,
  89. Keyword: state.queryParams.Keyword,
  90. };
  91. callPeriod(request)
  92. .then((res: any) => {
  93. state.tableData = res.result;
  94. state.loading = false;
  95. })
  96. .catch(() => {
  97. state.loading = false;
  98. });
  99. }, 300);
  100. /** 重置按钮操作 */
  101. const resetQuery = throttle((formEl: FormInstance | undefined) => {
  102. if (!formEl) return;
  103. formEl.resetFields();
  104. queryList();
  105. }, 300);
  106. // 表格多选
  107. const multipleTableRef = ref<RefType>();
  108. const multipleSelection = ref<any>([]);
  109. const handleSelectionChange = (val: any[]) => {
  110. multipleSelection.value = val;
  111. };
  112. onMounted(() => {
  113. queryList();
  114. });
  115. </script>