vue-pro/yudao-ui-admin-vue3/src/views/infra/job/JobLog.vue

88 lines
2.7 KiB
Vue
Raw Normal View History

2022-07-18 19:06:37 +08:00
<template>
<ContentWrap>
<!-- 列表 -->
2022-11-22 17:07:30 +08:00
<vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar">
<template #toolbar_buttons>
<XButton
type="warning"
preIcon="ep:download"
:title="t('action.export')"
v-hasPermi="['infra:job:export']"
@click="handleExport()"
/>
</template>
<template #beginTime_default="{ row }">
2022-07-18 19:06:37 +08:00
<span>{{
dayjs(row.beginTime).format('YYYY-MM-DD HH:mm:ss') +
' ~ ' +
dayjs(row.endTime).format('YYYY-MM-DD HH:mm:ss')
}}</span>
</template>
2022-11-22 17:07:30 +08:00
<template #duration_default="{ row }">
2022-07-18 19:06:37 +08:00
<span>{{ row.duration + ' 毫秒' }}</span>
</template>
2022-11-22 17:07:30 +08:00
<template #actionbtns_default="{ row }">
<XTextButton
preIcon="ep:view"
:title="t('action.detail')"
v-hasPermi="['infra:job:query']"
@click="handleDetail(row)"
/>
2022-07-18 19:06:37 +08:00
</template>
2022-11-22 17:07:30 +08:00
</vxe-grid>
2022-07-18 19:06:37 +08:00
</ContentWrap>
2022-11-15 12:25:19 +08:00
<XModal v-model="dialogVisible" :title="dialogTitle">
2022-07-18 19:06:37 +08:00
<!-- 对话框(详情) -->
<Descriptions :schema="allSchemas.detailSchema" :data="detailRef">
<template #retryInterval="{ row }">
<span>{{ row.retryInterval + '毫秒' }} </span>
</template>
<template #monitorTimeout="{ row }">
<span>{{ row.monitorTimeout > 0 ? row.monitorTimeout + ' 毫秒' : '未开启' }}</span>
</template>
</Descriptions>
<!-- 操作按钮 -->
<template #footer>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
2022-11-15 12:25:19 +08:00
</XModal>
2022-07-18 19:06:37 +08:00
</template>
2022-11-22 17:07:30 +08:00
<script setup lang="ts">
import { ref } from 'vue'
import dayjs from 'dayjs'
import { useI18n } from '@/hooks/web/useI18n'
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
import { VxeGridInstance } from 'vxe-table'
import * as JobLogApi from '@/api/infra/jobLog'
import { allSchemas } from './jobLog.data'
const { t } = useI18n() // 国际化
// 列表相关的变量
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
const { gridOptions, exportList } = useVxeGrid<JobLogApi.JobLogVO>({
allSchemas: allSchemas,
getListApi: JobLogApi.getJobLogPageApi,
exportListApi: JobLogApi.exportJobLogApi
})
// ========== CRUD 相关 ==========
const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('') // 弹出层标题
// ========== 详情相关 ==========
const detailRef = ref() // 详情 Ref
// 详情操作
2022-11-22 17:12:45 +08:00
const handleDetail = async (row: JobLogApi.JobLogVO) => {
2022-11-22 17:07:30 +08:00
// 设置数据
const res = JobLogApi.getJobLogApi(row.id)
detailRef.value = res
dialogTitle.value = t('action.detail')
dialogVisible.value = true
}
// 导出操作
const handleExport = async () => {
await exportList(xGrid, '定时任务详情.xls')
}
</script>