dispatch-statistics-drill-dialog.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <my-dialog
  3. :visible="visible"
  4. :header="`项目派单完成率`"
  5. :width="1200"
  6. :closeOnOverlayClick="false"
  7. @close="emit('update:visible', false)"
  8. >
  9. <div class="drill-search-box">
  10. <div class="field">
  11. <div class="label">服务单元:</div>
  12. <div class="value">{{ props.data?.serviceName }}</div>
  13. </div>
  14. <div class="field">
  15. <div class="label">时间:</div>
  16. <div class="value"
  17. >{{ dateFormat(props.timeParams?.startTime, 'yyyy-MM-dd') }} -
  18. {{ dateFormat(props.timeParams?.endTime, 'yyyy-MM-dd') }}</div
  19. >
  20. </div>
  21. </div>
  22. <t-table
  23. ref="tableRef"
  24. size="small"
  25. row-key="key"
  26. :columns="tableColumns"
  27. :data="tableData"
  28. bordered
  29. :pagination="{
  30. defaultCurrent: 1,
  31. defaultPageSize: 10,
  32. onChange,
  33. showJumper: true,
  34. showPageSize: false,
  35. total: pagination.total,
  36. current: pagination.pageNumber,
  37. }"
  38. v-loading="loading"
  39. >
  40. <template #custom-type="{ col, row }">
  41. {{ customerTypeFilter(row[col.colKey]) }}
  42. </template>
  43. <template #begin-time="{ col, row }">
  44. {{ timestampFilter(row[col.colKey]) }}
  45. </template>
  46. </t-table>
  47. </my-dialog>
  48. </template>
  49. <script setup name="DispatchStatisticsDrillDialog">
  50. import { ref, computed, reactive, watch } from 'vue';
  51. import { CUSTOMER_TYPE } from '@/config/constants';
  52. import { dateFormat } from '@/utils/tool';
  53. import useFetchTable from '@/hooks/useFetchTable';
  54. import { dispatchStatisticsDrill } from '@/api/report';
  55. import {customerTypeFilter, timestampFilter} from "@/utils/filter";
  56. const tableColumns = [
  57. { colKey: 'service', title: '服务单元' },
  58. { colKey: 'crmNo', title: '项目单号' },
  59. { colKey: 'beginTime', title: '派单时间' , cell: 'begin-time'},
  60. { colKey: 'crmUserName', title: '客户经理' },
  61. { colKey: 'customType', title: '客户类型' , cell: 'custom-type'},
  62. { colKey: 'custom', title: '客户名称' },
  63. { colKey: 'name', title: '项目名称' },
  64. { colKey: 'product', title: '实施产品' },
  65. ];
  66. const props = defineProps({
  67. visible: Boolean,
  68. data: Object,
  69. timeParams: Array,
  70. });
  71. const emit = defineEmits(['close']);
  72. watch(
  73. () => props.visible,
  74. () => {
  75. search();
  76. }
  77. );
  78. const transParams = computed(() => {
  79. return {
  80. serviceId: props.data?.serviceId,
  81. startTime: props.timeParams.startTime,
  82. endTime: props.timeParams.endTime,
  83. };
  84. });
  85. const { loading, pagination, tableData, search, onChange } = useFetchTable(
  86. dispatchStatisticsDrill,
  87. {
  88. params: transParams,
  89. },
  90. false
  91. );
  92. </script>