JobLog.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <ContentWrap>
  3. <!-- 列表 -->
  4. <XTable @register="registerTable">
  5. <template #toolbar_buttons>
  6. <XButton
  7. type="warning"
  8. preIcon="ep:download"
  9. :title="t('action.export')"
  10. v-hasPermi="['infra:job:export']"
  11. @click="exportList('定时任务详情.xls')"
  12. />
  13. </template>
  14. <template #beginTime_default="{ row }">
  15. <span>{{
  16. dayjs(row.beginTime).format('YYYY-MM-DD HH:mm:ss') +
  17. ' ~ ' +
  18. dayjs(row.endTime).format('YYYY-MM-DD HH:mm:ss')
  19. }}</span>
  20. </template>
  21. <template #duration_default="{ row }">
  22. <span>{{ row.duration + ' 毫秒' }}</span>
  23. </template>
  24. <template #actionbtns_default="{ row }">
  25. <XTextButton
  26. preIcon="ep:view"
  27. :title="t('action.detail')"
  28. v-hasPermi="['infra:job:query']"
  29. @click="handleDetail(row)"
  30. />
  31. </template>
  32. </XTable>
  33. </ContentWrap>
  34. <XModal v-model="dialogVisible" :title="dialogTitle">
  35. <!-- 对话框(详情) -->
  36. <Descriptions :schema="allSchemas.detailSchema" :data="detailData">
  37. <template #retryInterval="{ row }">
  38. <span>{{ row.retryInterval + '毫秒' }} </span>
  39. </template>
  40. <template #monitorTimeout="{ row }">
  41. <span>{{ row.monitorTimeout > 0 ? row.monitorTimeout + ' 毫秒' : '未开启' }}</span>
  42. </template>
  43. </Descriptions>
  44. <!-- 操作按钮 -->
  45. <template #footer>
  46. <XButton :title="t('dialog.close')" @click="dialogVisible = false" />
  47. </template>
  48. </XModal>
  49. </template>
  50. <script setup lang="ts" name="JobLog">
  51. import dayjs from 'dayjs'
  52. import * as JobLogApi from '@/api/infra/jobLog'
  53. import { allSchemas } from './jobLog.data'
  54. const { t } = useI18n() // 国际化
  55. // 列表相关的变量
  56. const [registerTable, { exportList }] = useXTable({
  57. allSchemas: allSchemas,
  58. getListApi: JobLogApi.getJobLogPageApi,
  59. exportListApi: JobLogApi.exportJobLogApi
  60. })
  61. // ========== CRUD 相关 ==========
  62. const dialogVisible = ref(false) // 是否显示弹出层
  63. const dialogTitle = ref('') // 弹出层标题
  64. // ========== 详情相关 ==========
  65. const detailData = ref() // 详情 Ref
  66. // 详情操作
  67. const handleDetail = async (row: JobLogApi.JobLogVO) => {
  68. // 设置数据
  69. const res = JobLogApi.getJobLogApi(row.id)
  70. detailData.value = res
  71. dialogTitle.value = t('action.detail')
  72. dialogVisible.value = true
  73. }
  74. </script>