2023-02-11 00:44:00 +08:00
|
|
|
|
<template>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<content-wrap>
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
|
<el-form
|
|
|
|
|
class="-mb-15px"
|
|
|
|
|
:model="queryParams"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:inline="true"
|
|
|
|
|
label-width="120px"
|
|
|
|
|
>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<el-form-item label="处理器的名字" prop="handlerName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.handlerName"
|
|
|
|
|
placeholder="请输入处理器的名字"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
2023-04-01 14:26:29 +08:00
|
|
|
|
class="!w-240px"
|
2023-03-27 11:46:33 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开始执行时间" prop="beginTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.beginTime"
|
|
|
|
|
type="date"
|
2023-04-01 14:26:29 +08:00
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
2023-03-27 11:46:33 +08:00
|
|
|
|
placeholder="选择开始执行时间"
|
2023-04-01 14:26:29 +08:00
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
2023-02-11 00:44:00 +08:00
|
|
|
|
/>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="结束执行时间" prop="endTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.endTime"
|
|
|
|
|
type="date"
|
2023-04-01 14:26:29 +08:00
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
2023-03-27 11:46:33 +08:00
|
|
|
|
placeholder="选择结束执行时间"
|
2023-04-01 14:26:29 +08:00
|
|
|
|
clearable
|
|
|
|
|
:default-time="new Date('1 23:59:59')"
|
|
|
|
|
class="!w-240px"
|
2023-02-11 00:44:00 +08:00
|
|
|
|
/>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="任务状态" prop="status">
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.status"
|
|
|
|
|
placeholder="请选择任务状态"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<el-option
|
2023-04-01 14:26:29 +08:00
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_JOB_LOG_STATUS)"
|
2023-03-27 11:46:33 +08:00
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
type="success"
|
|
|
|
|
plain
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
:loading="exportLoading"
|
|
|
|
|
v-hasPermi="['infra:job:export']"
|
|
|
|
|
>
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
2023-04-01 14:26:29 +08:00
|
|
|
|
</content-wrap>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<content-wrap>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<el-table v-loading="loading" :data="list">
|
|
|
|
|
<el-table-column label="日志编号" align="center" prop="id" />
|
|
|
|
|
<el-table-column label="任务编号" align="center" prop="jobId" />
|
|
|
|
|
<el-table-column label="处理器的名字" align="center" prop="handlerName" />
|
|
|
|
|
<el-table-column label="处理器的参数" align="center" prop="handlerParam" />
|
|
|
|
|
<el-table-column label="第几次执行" align="center" prop="executeIndex" />
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<el-table-column label="执行时间" align="center" width="170s">
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<template #default="scope">
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<span>{{ formatDate(scope.row.beginTime) + ' ~ ' + formatDate(scope.row.endTime) }}</span>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="执行时长" align="center" prop="duration">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ scope.row.duration + ' 毫秒' }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="任务状态" align="center" prop="status">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :type="DICT_TYPE.INFRA_JOB_LOG_STATUS" :value="scope.row.status" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<el-table-column label="操作" align="center">
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button
|
2023-04-01 14:26:29 +08:00
|
|
|
|
type="primary"
|
2023-03-27 11:46:33 +08:00
|
|
|
|
link
|
2023-04-01 14:26:29 +08:00
|
|
|
|
@click="openDetail(scope.row.id)"
|
2023-03-27 11:46:33 +08:00
|
|
|
|
v-hasPermi="['infra:job:query']"
|
2023-04-01 14:26:29 +08:00
|
|
|
|
>
|
|
|
|
|
详细
|
2023-03-27 11:46:33 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<!-- 分页组件 -->
|
|
|
|
|
<Pagination
|
2023-03-27 11:46:33 +08:00
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</content-wrap>
|
2023-04-01 14:26:29 +08:00
|
|
|
|
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<!-- 表单弹窗:查看 -->
|
2023-04-01 14:26:29 +08:00
|
|
|
|
<JobLogDetail ref="detailRef" />
|
2023-02-11 00:44:00 +08:00
|
|
|
|
</template>
|
2023-03-27 11:46:33 +08:00
|
|
|
|
<script setup lang="ts" name="JobLog">
|
2023-04-01 14:26:29 +08:00
|
|
|
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
|
|
|
|
import { formatDate } from '@/utils/formatTime'
|
2023-03-27 11:46:33 +08:00
|
|
|
|
import download from '@/utils/download'
|
2023-04-01 14:26:29 +08:00
|
|
|
|
import JobLogDetail from './JobLogDetail.vue'
|
2023-02-11 00:44:00 +08:00
|
|
|
|
import * as JobLogApi from '@/api/infra/jobLog'
|
2023-03-27 11:46:33 +08:00
|
|
|
|
const message = useMessage() // 消息弹窗
|
2023-04-01 14:26:29 +08:00
|
|
|
|
const { query } = useRoute() // 查询参数
|
2023-03-27 11:46:33 +08:00
|
|
|
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
|
|
const list = ref([]) // 列表的数据
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
2023-04-01 14:26:29 +08:00
|
|
|
|
jobId: query.id,
|
2023-03-27 11:46:33 +08:00
|
|
|
|
handlerName: undefined,
|
|
|
|
|
beginTime: undefined,
|
|
|
|
|
endTime: undefined,
|
|
|
|
|
status: undefined
|
2023-02-11 00:44:00 +08:00
|
|
|
|
})
|
2023-03-27 11:46:33 +08:00
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
2023-02-11 00:44:00 +08:00
|
|
|
|
|
2023-03-27 11:46:33 +08:00
|
|
|
|
/** 查询参数列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
2023-04-01 14:26:29 +08:00
|
|
|
|
const data = await JobLogApi.getJobLogPage(queryParams)
|
2023-03-27 11:46:33 +08:00
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-11 00:44:00 +08:00
|
|
|
|
|
2023-03-27 11:46:33 +08:00
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
getList()
|
2023-02-11 00:44:00 +08:00
|
|
|
|
}
|
2023-03-27 11:46:33 +08:00
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
queryFormRef.value.resetFields()
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 查看操作 */
|
2023-04-01 14:26:29 +08:00
|
|
|
|
const detailRef = ref()
|
|
|
|
|
const openDetail = (rowId?: number) => {
|
|
|
|
|
detailRef.value.open(rowId)
|
2023-03-27 11:46:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
// 导出的二次确认
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
// 发起导出
|
|
|
|
|
exportLoading.value = true
|
2023-04-01 14:26:29 +08:00
|
|
|
|
const data = await JobLogApi.exportJobLog(queryParams)
|
2023-03-27 11:46:33 +08:00
|
|
|
|
download.excel(data, '定时任务执行日志.xls')
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
exportLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList()
|
|
|
|
|
})
|
2023-02-11 00:44:00 +08:00
|
|
|
|
</script>
|