auth-web/src/views/monitor/schedulerExecuteLog/utils/hooks.ts

59 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-10-18 23:09:48 +08:00
import { useQuartzExecuteLogStore } from '@/store/monitor/quartzExecuteLog';
import { ref } from 'vue';
2024-10-18 13:51:03 +08:00
import { messageBox } from '@/utils/message';
import { $t } from '@/plugins/i18n';
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;
}
/**
* *
*/
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();
};