redo.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="snapshot-statistics-redo-container layout-padding">
  3. <div class="layout-padding-auto layout-padding-view pd20">
  4. <vxe-grid v-bind="gridOptions" ref="gridRef">
  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 lang="tsx" setup name="snapshotStatisticsRedo">
  23. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
  24. import { FormInstance } from 'element-plus';
  25. import { defaultDate } from '@/utils/constants';
  26. import { getSSPStatisticsReprocessing, getSSPStatisticsReprocessingExport } from '@/api/snapshot/statistics';
  27. import Other from '@/utils/other';
  28. import { useRouter } from 'vue-router';
  29. // 引入组件
  30. const StatisticalTime = defineAsyncComponent(() => import('@/components/StatisticalTime/index.vue')); // 日期类型选择组件
  31. // 定义变量内容
  32. const state = reactive<any>({
  33. loading: false,
  34. queryParams: {
  35. // 查询参数
  36. crTime: defaultDate, // 时间默认今天开始到今天结束
  37. StartTime: null,
  38. EndTime: null,
  39. },
  40. });
  41. const requestParams = ref<EmptyObjectType>({});
  42. const gridOptions = reactive<any>({
  43. loading: false,
  44. border: true,
  45. showOverflow: true,
  46. columnConfig: {
  47. resizable: true,
  48. },
  49. scrollY: {
  50. enabled: true,
  51. gt: 100,
  52. },
  53. toolbarConfig: {
  54. zoom: true,
  55. custom: true,
  56. refresh: {
  57. queryMethod: () => {
  58. handleQuery();
  59. },
  60. },
  61. tools: [{ toolRender: { name: 'exportAll' } }],
  62. },
  63. customConfig: {
  64. storage: true,
  65. },
  66. id: 'snapshotStatisticsRedo',
  67. rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
  68. height: 'auto',
  69. align: 'center',
  70. columns: [],
  71. data: [],
  72. params: {
  73. exportMethod: getSSPStatisticsReprocessingExport,
  74. exportParams: requestParams,
  75. },
  76. });
  77. /** 搜索按钮操作 节流操作 */
  78. const handleQuery = () => {
  79. queryList();
  80. };
  81. // 获取参数列表
  82. const queryList = () => {
  83. state.loading = true;
  84. gridOptions.loading = true;
  85. requestParams.value = Other.deepClone(state.queryParams);
  86. requestParams.value.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0]; // 受理时间
  87. requestParams.value.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
  88. Reflect.deleteProperty(requestParams.value, 'crTime'); // 删除无用的参数
  89. getSSPStatisticsReprocessing(requestParams.value)
  90. .then((res) => {
  91. let columns = res.result.headers?.map((item: any) => {
  92. return {
  93. align: 'center',
  94. field: item.dicDataValue,
  95. title: item.dicDataValue,
  96. slots: {
  97. default(scope: any) {
  98. return (
  99. <el-button type="primary" onClick={() => linkDetail(scope.row, item.dicDataValue)} link>
  100. {scope.row[item.dicDataValue] ? scope.row[item.dicDataValue] : 0}
  101. </el-button>
  102. );
  103. },
  104. },
  105. };
  106. });
  107. columns.unshift({
  108. field: 'OrgName',
  109. title: '部门名称',
  110. fixed: 'left',
  111. minWidth: 120,
  112. });
  113. state.loading = false;
  114. gridOptions.data = res.result?.data ?? [];
  115. gridOptions.columns = columns;
  116. gridOptions.loading = false;
  117. })
  118. .finally(() => {
  119. state.loading = false;
  120. gridOptions.loading = false;
  121. });
  122. };
  123. // 重置表单
  124. const ruleFormRef = ref<any>(null); // 表单ref
  125. const statisticalTimeRef = ref<RefType>();
  126. const resetQuery = (formEl: FormInstance | undefined) => {
  127. if (!formEl) return;
  128. formEl.resetFields();
  129. statisticalTimeRef.value.reset();
  130. queryList();
  131. };
  132. // 跳转详情
  133. const router = useRouter();
  134. const linkDetail = (row: any, FieldName: string) => {
  135. router.push({
  136. path: '/snapshot/statistic/detailRedo',
  137. query: {
  138. FieldName,
  139. OrgCode: row.OrgCode,
  140. StartTime: state.queryParams.crTime[0],
  141. EndTime: state.queryParams.crTime[1],
  142. },
  143. });
  144. };
  145. // 页面加载时
  146. onMounted(() => {
  147. queryList();
  148. });
  149. </script>