🔨 优化异常处理逻辑.

This commit is contained in:
lijiahangmax
2025-12-04 15:31:40 +08:00
parent d1cb056adf
commit 6c6f69ae24
18 changed files with 12 additions and 77 deletions

View File

@@ -106,7 +106,6 @@
} else {
taskStatus.value = UploadTaskStepStatus.UPLOADING;
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -159,7 +158,6 @@
taskStatus.value = UploadTaskStepStatus.WAITING;
Message.success('已取消');
taskId.value = undefined;
} catch (e) {
} finally {
setLoading(false);
}
@@ -207,7 +205,6 @@
// 开始上传
await cancelUploadTask(taskId.value, true);
taskStatus.value = UploadTaskStepStatus.FAILED;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -163,7 +163,6 @@
record.startTime = data.startTime;
record.finishTime = data.finishTime;
record.refreshed = true;
} catch (e) {
} finally {
setLoading(false);
}
@@ -185,7 +184,6 @@
});
Message.success('已中断');
record.status = ExecHostStatus.INTERRUPTED;
} catch (e) {
} finally {
setLoading(false);
}
@@ -199,7 +197,6 @@
await deleteExecCommandHostLog(id);
Message.success('删除成功');
emits('refreshHost', logId);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -129,7 +129,6 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -151,7 +150,6 @@
// 清空
setVisible(false);
handlerClear();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -279,7 +279,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -294,7 +293,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -310,7 +308,6 @@
});
Message.success('已重新执行');
fetchTableData();
} catch (e) {
} finally {
setLoading(false);
}
@@ -326,7 +323,6 @@
});
Message.success('已中断');
record.status = ExecStatus.COMPLETED;
} catch (e) {
} finally {
setLoading(false);
}
@@ -411,7 +407,6 @@
pagination.pageSize = request.limit;
selectedKeys.value = [];
tableRef.value.expandAll(false);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -99,7 +99,6 @@
try {
const { data } = await getExecCommandLogHistory(historyCount);
historyLogs.value = data;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -194,7 +194,6 @@
} else {
parameterFormModel.value = {};
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -252,8 +251,6 @@
historyRef.value.add(request);
Message.success('已开始执行');
emits('submit', data);
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -163,7 +163,6 @@
record.startTime = data.startTime;
record.finishTime = data.finishTime;
record.refreshed = true;
} catch (e) {
} finally {
setLoading(false);
}
@@ -185,7 +184,6 @@
});
Message.success('已中断');
record.status = ExecHostStatus.INTERRUPTED;
} catch (e) {
} finally {
setLoading(false);
}
@@ -199,7 +197,6 @@
await deleteExecJobHostLog(id);
Message.success('删除成功');
emits('refreshHost', logId);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -124,7 +124,6 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -146,7 +145,6 @@
// 清空
setVisible(false);
handlerClear();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -288,7 +288,6 @@
});
Message.success('已中断');
record.status = ExecStatus.COMPLETED;
} catch (e) {
} finally {
setLoading(false);
}
@@ -363,7 +362,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -379,7 +377,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -404,7 +401,6 @@
pagination.pageSize = request.limit;
selectedKeys.value = [];
tableRef.value.expandAll(false);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -99,7 +99,6 @@
<script lang="ts" setup>
import type { ExecJobQueryResponse } from '@/api/exec/exec-job';
import { ref } from 'vue';
import useLoading from '@/hooks/loading';
import useVisible from '@/hooks/visible';
import { useDictStore } from '@/store';
import { dateFormat } from '@/utils';
@@ -108,45 +107,32 @@
import { EnabledStatus } from '@/types/const';
import { execJobStatusKey } from '../types/const';
const { getDictValue, toOptions } = useDictStore();
const { getDictValue } = useDictStore();
const { visible, setVisible } = useVisible();
const { loading, setLoading } = useLoading();
const record = ref<ExecJobQueryResponse>({} as ExecJobQueryResponse);
// 打开
const open = async (id: any) => {
try {
// 查询计划任务
setLoading(true);
const { data } = await getExecJob(id);
record.value = data;
// 设置参数值
if (data.parameterSchema) {
const value = JSON.parse(data.parameterSchema);
if (value?.length) {
data.parameterSchema = JSON.stringify(value, undefined, 4);
} else {
data.parameterSchema = undefined as unknown as string;
}
const { data } = await getExecJob(id);
record.value = data;
// 设置参数值
if (data.parameterSchema) {
const value = JSON.parse(data.parameterSchema);
if (value?.length) {
data.parameterSchema = JSON.stringify(value, undefined, 4);
} else {
data.parameterSchema = undefined as unknown as string;
}
setVisible(true);
} catch (e) {
} finally {
setLoading(false);
}
setVisible(true);
};
defineExpose({ open });
// 关闭
const handleClose = () => {
handlerClear();
};
// 清空
const handlerClear = () => {
setLoading(false);
setVisible(false);
};
</script>

View File

@@ -251,7 +251,6 @@
setLoading(true);
const { data } = await getExecJob(id);
renderForm({ ...defaultForm(), ...data });
} catch (e) {
} finally {
setLoading(false);
}
@@ -316,7 +315,6 @@
} else {
parameter.value = [];
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -359,8 +357,6 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -264,7 +264,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -280,7 +279,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -314,7 +312,6 @@
try {
await triggerExecJob(id);
Message.success('已触发');
} catch (e) {
} finally {
setLoading(false);
}
@@ -330,7 +327,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -79,8 +79,6 @@
Message.success('修改成功');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -161,7 +161,6 @@
// 查询模板信息
const { data } = await getExecTemplateWithAuthorized(id);
renderForm(data);
} catch (e) {
} finally {
setLoading(false);
}
@@ -226,8 +225,6 @@
Message.success('已开始执行');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -214,7 +214,6 @@
// 查询模板信息
const { data } = await getExecTemplateWithAuthorized(id);
renderForm({ ...defaultForm(), ...data });
} catch (e) {
} finally {
setLoading(false);
}
@@ -282,8 +281,6 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -173,7 +173,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -189,7 +188,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -213,7 +211,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -128,7 +128,6 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
} finally {
setLoading(false);
}
@@ -150,7 +149,6 @@
// 清空
setVisible(false);
handlerClear();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -237,7 +237,6 @@
await cancelUploadTask(record.id, false);
// 设置状态
record.status = UploadTaskStatus.CANCELED;
} catch (e) {
} finally {
setLoading(false);
}
@@ -253,7 +252,6 @@
selectedKeys.value = [];
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -268,7 +266,6 @@
Message.success('删除成功');
// 重新加载
reload();
} catch (e) {
} finally {
setLoading(false);
}
@@ -311,7 +308,6 @@
pagination.current = request.page;
pagination.pageSize = request.limit;
selectedKeys.value = [];
} catch (e) {
} finally {
setLoading(false);
}