seatsDate.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="statistics-call-seats-date-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. <template #toolbar_buttons>
  19. <el-popover :width="500" trigger="click">
  20. <template #reference>
  21. <el-button type="primary" title="口径说明"><SvgIcon name="ele-QuestionFilled" class="mr5"/>口径说明</el-button>
  22. </template>
  23. <el-descriptions title="" :column="1" border style="max-height: 400px; overflow: auto">
  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="呼入队列挂断"> 呼入但是队列中挂断的总量 </el-descriptions-item>
  29. <el-descriptions-item label="呼入IVR挂断"> 呼入但是在IVR中挂断的总量 </el-descriptions-item>
  30. <el-descriptions-item label="呼出接通"> 呼出已接通的总量 </el-descriptions-item>
  31. <el-descriptions-item label="呼出未接通">呼出未接通的总量 </el-descriptions-item>
  32. </el-descriptions>
  33. </el-popover>
  34. </template>
  35. </vxe-grid>
  36. </div>
  37. </div>
  38. </template>
  39. <script setup lang="tsx" name="statisticsCallSeatsDate">
  40. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  41. import { FormInstance } from 'element-plus';
  42. import { defaultDate } from '@/utils/constants';
  43. import Other from '@/utils/other';
  44. import { callDateSimple, callDateSimpleExport } from '@/api/statistics/call';
  45. import { useRouter } from 'vue-router';
  46. import dayjs from 'dayjs';
  47. import XEUtils from 'xe-utils';
  48. const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
  49. // 定义变量内容
  50. const ruleFormRef = ref<RefType>(); // 表单ref
  51. const state = reactive<any>({
  52. queryParams: {
  53. // 查询条件
  54. crTime: defaultDate,
  55. },
  56. tableData: [], //表单
  57. loading: false, // 加载
  58. total: 0, // 总数
  59. callForwardingSource: [],
  60. totalCount: {},
  61. });
  62. const requestParams = ref<EmptyObjectType>({});
  63. const gridOptions = reactive<any>({
  64. loading: false,
  65. border: true,
  66. showOverflow: true,
  67. columnConfig: {
  68. resizable: true,
  69. },
  70. scrollY: {
  71. enabled: true,
  72. gt: 100,
  73. },
  74. toolbarConfig: {
  75. zoom: true,
  76. custom: true,
  77. refresh: {
  78. queryMethod: () => {
  79. handleQuery();
  80. },
  81. },
  82. tools: [{ toolRender: { name: 'exportAll' } }],
  83. slots: {
  84. buttons: 'toolbar_buttons',
  85. },
  86. },
  87. customConfig: {
  88. storage: true,
  89. },
  90. id: 'statisticsCallSeatsDate',
  91. rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
  92. height: 'auto',
  93. columns: [
  94. {
  95. field: 'date',
  96. title: '日期',
  97. },
  98. {
  99. field: 'inTotal',
  100. title: '呼入总量',
  101. slots:{
  102. default (scope:any) {
  103. return (
  104. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  105. {scope.row.inTotal}
  106. </el-button>
  107. )
  108. }
  109. }
  110. },
  111. {
  112. field: 'inConnectionRate',
  113. title: '接通率',
  114. },
  115. {
  116. field: 'inConnectionQuantity',
  117. title: '呼入接通',
  118. slots:{
  119. default (scope:any) {
  120. return (
  121. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  122. {scope.row.inConnectionQuantity}
  123. </el-button>
  124. )
  125. }
  126. }
  127. },
  128. {
  129. field: 'inNotAnswered',
  130. title: '挂机量',
  131. slots:{
  132. default (scope:any) {
  133. return (
  134. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  135. {scope.row.inNotAnswered}
  136. </el-button>
  137. )
  138. }
  139. }
  140. },
  141. {
  142. field: 'notAcceptedHang',
  143. title: '呼入队列挂断',
  144. slots:{
  145. default (scope:any) {
  146. return (
  147. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  148. {scope.row.notAcceptedHang}
  149. </el-button>
  150. )
  151. }
  152. }
  153. },
  154. {
  155. field: 'ivrByeCount',
  156. title: '呼入IVR挂断',
  157. slots:{
  158. default (scope:any) {
  159. return (
  160. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  161. {scope.row.ivrByeCount}
  162. </el-button>
  163. )
  164. }
  165. }
  166. },
  167. {
  168. field: 'outConnectionQuantity',
  169. title: '呼出接通',
  170. slots:{
  171. default (scope:any) {
  172. return (
  173. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  174. {scope.row.outConnectionQuantity}
  175. </el-button>
  176. )
  177. }
  178. }
  179. },
  180. {
  181. field: 'outNotAnswered',
  182. title: '呼出未接通',
  183. slots:{
  184. default (scope:any) {
  185. return (
  186. <el-button type="primary" onClick={() => linkDetail(scope)} link>
  187. {scope.row.outNotAnswered}
  188. </el-button>
  189. )
  190. }
  191. }
  192. },
  193. ],
  194. data: [],
  195. params: {
  196. exportMethod: callDateSimpleExport,
  197. exportParams: requestParams,
  198. },
  199. sortConfig: {
  200. remote: true,
  201. },
  202. showFooter:true,
  203. footerMethod: ({ columns, data }) => {
  204. return [
  205. columns.map((column: any, columnIndex: number) => {
  206. if (columnIndex === 0) {
  207. return '合计';
  208. }
  209. // 后端返回了数据集合 state.totalCount 所以不需要计算 直接进行赋值
  210. return XEUtils.get(state.totalCount, column.property);
  211. }),
  212. ];
  213. }
  214. });
  215. /** 搜索按钮操作 */
  216. const handleQuery = () => {
  217. // state.queryParams.PageIndex = 1;
  218. queryList();
  219. };
  220. /** 获取列表 */
  221. const queryList = async () => {
  222. state.loading = true;
  223. gridOptions.loading = true;
  224. try {
  225. requestParams.value = Other.deepClone(state.queryParams);
  226. requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
  227. requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  228. Reflect.deleteProperty(requestParams.value, 'crTime');
  229. const { result } = await callDateSimple(requestParams.value);
  230. state.tableData = result.list ?? [];
  231. state.totalCount = result.total;
  232. gridOptions.data = state.tableData;
  233. state.loading = false;
  234. gridOptions.loading = false;
  235. } catch (e) {
  236. state.loading = false;
  237. gridOptions.loading = false;
  238. console.log(e);
  239. }
  240. };
  241. /** 重置按钮操作 */
  242. const statisticalTimeRef = ref<RefType>();
  243. const resetQuery = (formEl: FormInstance | undefined) => {
  244. if (!formEl) return;
  245. formEl.resetFields();
  246. statisticalTimeRef.value.reset();
  247. queryList();
  248. };
  249. // 查看详情
  250. const router = useRouter();
  251. const linkDetail = (scope: any) => {
  252. router.push({
  253. path: '/statistics/call/detailSeatDate',
  254. query: {
  255. StartTime: dayjs(scope.row.date).startOf('day').format('YYYY-MM-DD[T]HH:mm:ss'),
  256. EndTime: dayjs(scope.row.date).endOf('day').format('YYYY-MM-DD[T]HH:mm:ss'),
  257. FieldName:scope.column.property
  258. },
  259. });
  260. };
  261. onMounted(() => {
  262. queryList();
  263. });
  264. </script>