2024-10-18 23:09:48 +08:00
|
|
|
import { useQuartzExecuteLogStore } from '@/store/monitor/quartzExecuteLog';
|
2024-10-19 02:37:05 +08:00
|
|
|
import { h, ref } from 'vue';
|
2024-10-18 13:51:03 +08:00
|
|
|
import { messageBox } from '@/utils/message';
|
|
|
|
import { $t } from '@/plugins/i18n';
|
2024-10-19 02:37:05 +08:00
|
|
|
import { addDialog } from '@/components/BaseDialog/index';
|
|
|
|
import ScheduleExecuteLog from '@/views/monitor/schedulerExecuteLog/schedule-execute-log.vue';
|
2024-10-18 13:51:03 +08:00
|
|
|
|
|
|
|
export const formRef = ref();
|
|
|
|
// 删除ids
|
|
|
|
export const deleteIds = ref([]);
|
|
|
|
const quartzExecuteLogStore = useQuartzExecuteLogStore();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* * 搜索初始化调度任务执行日志
|
|
|
|
*/
|
|
|
|
export async function onSearch() {
|
|
|
|
quartzExecuteLogStore.loading = true;
|
|
|
|
await quartzExecuteLogStore.getQuartzExecuteLogList();
|
|
|
|
quartzExecuteLogStore.loading = false;
|
|
|
|
}
|
|
|
|
|
2024-10-19 02:37:05 +08:00
|
|
|
/**
|
|
|
|
* * 查看用户登录日志
|
|
|
|
* @param row
|
|
|
|
*/
|
|
|
|
export function onView(row: any) {
|
|
|
|
addDialog({
|
2024-10-20 21:44:01 +08:00
|
|
|
title: `${$t('view')}${$t('quartzExecuteLog')}`,
|
2024-10-19 02:37:05 +08:00
|
|
|
width: '30%',
|
|
|
|
props: {
|
|
|
|
formInline: {
|
|
|
|
jobName: row.jobName,
|
|
|
|
jobGroup: row.jobGroup,
|
|
|
|
jobClassName: row.jobClassName,
|
|
|
|
cronExpression: row.cronExpression,
|
|
|
|
triggerName: row.triggerName,
|
|
|
|
executeResult: row.executeResult,
|
|
|
|
duration: row.duration,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
draggable: true,
|
|
|
|
fullscreenIcon: true,
|
|
|
|
closeOnClickModal: false,
|
|
|
|
contentRenderer: () => h(ScheduleExecuteLog, { ref: formRef }),
|
|
|
|
beforeSure: async done => {
|
|
|
|
done();
|
|
|
|
await onSearch();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-10-18 13:51:03 +08:00
|
|
|
/**
|
|
|
|
* * 删除调度任务执行日志
|
|
|
|
*/
|
|
|
|
export const onDelete = async (row: any) => {
|
|
|
|
const id = row.id;
|
|
|
|
|
|
|
|
// 是否确认删除
|
|
|
|
const result = await messageBox({
|
|
|
|
title: $t('confirm_delete'),
|
|
|
|
showMessage: false,
|
|
|
|
confirmMessage: undefined,
|
|
|
|
cancelMessage: $t('cancel_delete'),
|
|
|
|
});
|
|
|
|
if (!result) return;
|
|
|
|
|
|
|
|
// 删除数据
|
|
|
|
await quartzExecuteLogStore.deleteQuartzExecuteLog([id]);
|
|
|
|
await onSearch();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 批量删除
|
|
|
|
*/
|
|
|
|
export const onDeleteBatch = async () => {
|
|
|
|
const ids = deleteIds.value;
|
|
|
|
|
|
|
|
// 是否确认删除
|
|
|
|
const result = await messageBox({
|
|
|
|
title: $t('confirm_delete'),
|
|
|
|
showMessage: false,
|
|
|
|
confirmMessage: undefined,
|
|
|
|
cancelMessage: $t('cancel_delete'),
|
|
|
|
});
|
|
|
|
if (!result) return;
|
|
|
|
|
|
|
|
// 删除数据
|
|
|
|
await quartzExecuteLogStore.deleteQuartzExecuteLog(ids);
|
|
|
|
await onSearch();
|
|
|
|
};
|