personalSeatsDetail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div class="statistics-call-personal-seats-date-detail-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <vxe-grid v-bind="gridOptions">
  5. <template #form>
  6. <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline :disabled="gridOptions.loading">
  7. <el-form-item prop="crTime">
  8. <statistical-time v-model="state.queryParams.crTime" @change="handleQuery" ref="statisticalTimeRef" :disabled="state.loading"/>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
  12. <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
  13. <SvgIcon name="ele-Refresh" class="mr5" />重置
  14. </el-button>
  15. </el-form-item>
  16. </el-form>
  17. </template>
  18. </vxe-grid>
  19. </div>
  20. </div>
  21. </template>
  22. <script setup lang="tsx" name="statisticsCallPersonalSeatDetail">
  23. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  24. import { FormInstance } from 'element-plus';
  25. import { defaultDate } from '@/utils/constants';
  26. import Other from '@/utils/other';
  27. import { callPersonal, callPersonalExport } from '@/api/statistics/call';
  28. import XEUtils from 'xe-utils';
  29. const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
  30. // 定义变量内容
  31. const ruleFormRef = ref<RefType>(); // 表单ref
  32. const state = reactive<any>({
  33. queryParams: {
  34. // 查询条件
  35. crTime: defaultDate,
  36. },
  37. tableData: [], //表单
  38. loading: false, // 加载
  39. total: 0, // 总数
  40. callForwardingSource: [],
  41. totalCount: {},
  42. });
  43. const requestParams = ref<EmptyObjectType>({});
  44. const gridOptions = reactive<any>({
  45. loading: false,
  46. border: true,
  47. showOverflow: true,
  48. columnConfig: {
  49. resizable: true,
  50. },
  51. scrollY: {
  52. enabled: true,
  53. gt: 100,
  54. },
  55. toolbarConfig: {
  56. zoom: true,
  57. custom: true,
  58. refresh: {
  59. queryMethod: () => {
  60. handleQuery();
  61. },
  62. },
  63. tools: [{ toolRender: { name: 'exportAll' } }],
  64. },
  65. customConfig: {
  66. storage: true,
  67. },
  68. id: 'statisticsCallPersonalSeatDetail',
  69. rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
  70. height: 'auto',
  71. align: 'center',
  72. columns: [
  73. {
  74. field: 'date',
  75. title: '日期',
  76. },
  77. {
  78. field: 'personCallInCount',
  79. title: '个人服务呼入总量',
  80. },
  81. {
  82. field: 'personCallInPutthroughCount',
  83. title: '个人服务接通量',
  84. },
  85. {
  86. field: 'personRingOffCount',
  87. title: '个人服务挂断总量',
  88. },
  89. {
  90. title: '挂断类型',
  91. children:[
  92. {
  93. field: 'personQueueOffCount',
  94. title: '个人服务队列挂断',
  95. },
  96. {
  97. field: 'personWaitOffCount',
  98. title: '个人服务等待挂断',
  99. }
  100. ]
  101. },
  102. {
  103. field: 'personCallPutthorughRateText',
  104. title: '个人服务接通率',
  105. },
  106. ],
  107. data: [],
  108. params: {
  109. exportMethod: callPersonalExport,
  110. exportParams: requestParams,
  111. },
  112. sortConfig: {
  113. remote: true,
  114. },
  115. showFooter:true,
  116. footerMethod: ({ columns, data }) => {
  117. return [
  118. columns.map((column: any, columnIndex: number) => {
  119. if (columnIndex === 0) {
  120. return '合计';
  121. }
  122. // 后端返回了数据集合 state.totalCount 所以不需要计算 直接进行赋值
  123. return XEUtils.get(state.totalCount, column.property);
  124. }),
  125. ];
  126. }
  127. });
  128. /** 搜索按钮操作 */
  129. const handleQuery = () => {
  130. // state.queryParams.PageIndex = 1;
  131. queryList();
  132. };
  133. /** 获取列表 */
  134. const queryList = async () => {
  135. state.loading = true;
  136. gridOptions.loading = true;
  137. try {
  138. requestParams.value = Other.deepClone(state.queryParams);
  139. requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  140. requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  141. Reflect.deleteProperty(requestParams.value, 'crTime');
  142. const { result } = await callPersonal(requestParams.value);
  143. state.tableData = result.list ?? [];
  144. state.totalCount = result.total;
  145. gridOptions.data = state.tableData;
  146. state.loading = false;
  147. gridOptions.loading = false;
  148. } catch (e) {
  149. state.loading = false;
  150. gridOptions.loading = false;
  151. console.log(e);
  152. }
  153. };
  154. /** 重置按钮操作 */
  155. const statisticalTimeRef = ref<RefType>();
  156. const resetQuery = (formEl: FormInstance | undefined) => {
  157. if (!formEl) return;
  158. formEl.resetFields();
  159. statisticalTimeRef.value.reset();
  160. queryList();
  161. };
  162. onMounted(() => {
  163. queryList();
  164. });
  165. </script>