cases.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div class="table-box button-table">
  3. <ProTable
  4. ref="proTable"
  5. :columns="columns"
  6. :request-api="getTableList"
  7. :init-param="initParam"
  8. :data-callback="dataCallback"
  9. :refresh-reset-page="true"
  10. >
  11. <template #operation="scope">
  12. <el-button type="primary" link @click="toDetail(scope.row)"> 查看详情 </el-button>
  13. </template>
  14. </ProTable>
  15. </div>
  16. </template>
  17. <script setup lang="tsx" name="cases">
  18. import { reactive, ref } from "vue";
  19. import { useRouter } from "vue-router";
  20. import { ElLoading } from "element-plus";
  21. import ProTable from "@/components/ProTable/index.vue";
  22. import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface";
  23. import { getPersonCaseList } from "@/api/modules/operationManagement";
  24. import { localGet } from "@/utils";
  25. const router = useRouter();
  26. const proTable = ref<ProTableInstance>();
  27. const columns = reactive<ColumnProps<any>[]>([
  28. { prop: "signupName", label: "姓名", minWidth: 300 },
  29. { prop: "signupPhone", label: "联系方式", width: 300 },
  30. {
  31. prop: "activityName",
  32. label: "所属活动",
  33. minWidth: 300,
  34. search: {
  35. el: "input",
  36. props: { placeholder: "请输入" },
  37. order: 2
  38. }
  39. },
  40. { prop: "operation", label: "操作", fixed: "right", width: 300 }
  41. ]);
  42. const initParam = reactive({
  43. storeId: localGet("createdId")
  44. });
  45. const dataCallback = (data: any) => ({
  46. list: data?.records ?? [],
  47. total: data?.total ?? 0
  48. });
  49. const getTableList = async (params: any) => {
  50. // 显示全屏loading
  51. const loadingInstance = ElLoading.service({
  52. lock: true,
  53. text: "加载中...",
  54. background: "rgba(0, 0, 0, 0.7)"
  55. });
  56. try {
  57. // 转换参数格式以匹配新接口
  58. const newParams: any = {
  59. storeId: params.storeId || localGet("createdId"),
  60. pageNum: params.page || params.pageNum || 1,
  61. pageSize: params.size || params.pageSize || 10
  62. };
  63. // 上传情况筛选(未上传0 / 已上传1)
  64. newParams.hasResult = params.hasResult;
  65. // 所属活动(活动名称)筛选
  66. if (params.activityName) {
  67. newParams.activityName = params.activityName.trim();
  68. }
  69. const result = await getPersonCaseList(newParams);
  70. return result;
  71. } finally {
  72. // 关闭loading
  73. loadingInstance.close();
  74. }
  75. };
  76. const toDetail = (row: any) => {
  77. router.push(`/operationManagement/caseDetail?activityId=${row.activityId}&userId=${row.userId}`);
  78. };
  79. </script>