taskDetail.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="dataShare-taskDetail-container layout-pd">
  3. <el-card shadow="never">
  4. <ProTable
  5. ref="proTableRef"
  6. :columns="columns"
  7. :data="state.tableData"
  8. @updateTable="queryList"
  9. :loading="state.loading"
  10. :total="state.total"
  11. v-model:page-index="state.queryParams.PageIndex"
  12. v-model:page-size="state.queryParams.PageSize"
  13. border
  14. >
  15. </ProTable>
  16. </el-card>
  17. </div>
  18. </template>
  19. <script setup lang="tsx" name="dataShareTaskDetail">
  20. import { onMounted, reactive, ref } from 'vue';
  21. import { getPushTaskDetail } from "@/api/dataShare";
  22. import { useRoute } from "vue-router";
  23. import { formatDate } from "@/utils/formatTime";
  24. const proTableRef = ref<RefType>(); // 表格ref
  25. // 表格配置项
  26. const columns = ref<any[]>([
  27. {
  28. prop: 'isSuccess',
  29. label: '推送状态',
  30. align: 'center',
  31. render: (scope) => {
  32. return <span>{scope.row.isSuccess ? '成功' : '失败'}</span>;
  33. },
  34. },
  35. { prop: 'result', label: '返回数据', align: 'center' },
  36. { prop: 'requestInfo', label: '其他平台返回数据', align: 'center' },
  37. {
  38. prop: 'creationTime',
  39. label: '创建时间',
  40. align: 'center',
  41. width: 170,
  42. render: (scope) => {
  43. return <span>{formatDate(scope.row.creationTime, 'YYYY-mm-dd HH:MM:SS')}</span>;
  44. },
  45. },
  46. ]);
  47. // 定义变量内容
  48. const ruleFormRef = ref<RefType>(); // 表单ref
  49. const state = reactive({
  50. queryParams: {
  51. // 查询条件
  52. PageIndex: 1,
  53. PageSize: 10,
  54. },
  55. tableData: [], //表单
  56. loading: false, // 加载
  57. total: 0, // 总数
  58. });
  59. /** 获取列表 */
  60. const historyParams = history.state;
  61. const route = useRoute();
  62. const queryList = () => {
  63. state.loading = true;
  64. const request = {
  65. PageIndex: state.queryParams.PageIndex,
  66. PageSize: state.queryParams.PageSize,
  67. StartTime: historyParams.StartTime,
  68. EndTime: historyParams.EndTime,
  69. IsSuccess: historyParams.IsSuccess,
  70. Id: route.params.id
  71. }
  72. getPushTaskDetail(request)
  73. .then((res: any) => {
  74. state.tableData = res.result?.items ?? [];
  75. state.total = res.result?.total ?? 0;
  76. state.loading = false;
  77. })
  78. .catch(() => {
  79. state.loading = false;
  80. });
  81. };
  82. onMounted(() => {
  83. queryList();
  84. });
  85. </script>