JobLog.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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>{{ parseTime(row.beginTime) + ' ~ ' + parseTime(row.endTime) }}</span>
  16. </template>
  17. <template #duration_default="{ row }">
  18. <span>{{ row.duration + ' 毫秒' }}</span>
  19. </template>
  20. <template #actionbtns_default="{ row }">
  21. <XTextButton
  22. preIcon="ep:view"
  23. :title="t('action.detail')"
  24. v-hasPermi="['infra:job:query']"
  25. @click="handleDetail(row)"
  26. />
  27. </template>
  28. </XTable>
  29. </ContentWrap>
  30. <XModal v-model="dialogVisible" :title="dialogTitle">
  31. <!-- 对话框(详情) -->
  32. <Descriptions :schema="allSchemas.detailSchema" :data="detailData">
  33. <template #retryInterval="{ row }">
  34. <span>{{ row.retryInterval + '毫秒' }} </span>
  35. </template>
  36. <template #monitorTimeout="{ row }">
  37. <span>{{ row.monitorTimeout > 0 ? row.monitorTimeout + ' 毫秒' : '未开启' }}</span>
  38. </template>
  39. </Descriptions>
  40. <!-- 操作按钮 -->
  41. <template #footer>
  42. <XButton :title="t('dialog.close')" @click="dialogVisible = false" />
  43. </template>
  44. </XModal>
  45. </template>
  46. <script setup lang="ts" name="JobLog">
  47. import { parseTime } from '@/utils/formatTime'
  48. import * as JobLogApi from '@/api/infra/jobLog'
  49. import { allSchemas } from './jobLog.data'
  50. const { t } = useI18n() // 国际化
  51. // 列表相关的变量
  52. const [registerTable, { exportList }] = useXTable({
  53. allSchemas: allSchemas,
  54. getListApi: JobLogApi.getJobLogPageApi,
  55. exportListApi: JobLogApi.exportJobLogApi
  56. })
  57. // ========== CRUD 相关 ==========
  58. const dialogVisible = ref(false) // 是否显示弹出层
  59. const dialogTitle = ref('') // 弹出层标题
  60. // ========== 详情相关 ==========
  61. const detailData = ref() // 详情 Ref
  62. // 详情操作
  63. const handleDetail = async (row: JobLogApi.JobLogVO) => {
  64. // 设置数据
  65. const res = await JobLogApi.getJobLogApi(row.id)
  66. detailData.value = res
  67. dialogTitle.value = t('action.detail')
  68. dialogVisible.value = true
  69. }
  70. </script>