fix(sj_1.0.1): 定时任务,任务类型为切片,提交失败

This commit is contained in:
dhb52 2024-06-14 22:31:33 +08:00
parent a3897143a7
commit 960fca2070

View File

@ -162,6 +162,7 @@ async function handleSubmit() {
groupName, groupName,
jobName, jobName,
argsType, argsType,
argsStr,
jobStatus, jobStatus,
routeKey, routeKey,
executorType, executorType,
@ -179,7 +180,7 @@ async function handleSubmit() {
const { error } = await fetchAddJob({ const { error } = await fetchAddJob({
groupName, groupName,
jobName, jobName,
argsStr: parseArgsStr(), argsStr,
argsType, argsType,
jobStatus, jobStatus,
routeKey, routeKey,
@ -204,6 +205,7 @@ async function handleSubmit() {
id, id,
groupName, groupName,
jobName, jobName,
argsStr,
argsType, argsType,
jobStatus, jobStatus,
routeKey, routeKey,
@ -223,7 +225,7 @@ async function handleSubmit() {
id, id,
groupName, groupName,
jobName, jobName,
argsStr: parseArgsStr(), argsStr,
argsType, argsType,
jobStatus, jobStatus,
routeKey, routeKey,
@ -249,7 +251,8 @@ async function handleSubmit() {
function parseArgsStr() { function parseArgsStr() {
if (model.taskType === 3 && dynamicForm.args) { if (model.taskType === 3 && dynamicForm.args) {
return JSON.stringify(dynamicForm.args.map(item => item.arg)); const slices = dynamicForm.args.map(item => item.arg.trim()).filter(item => Boolean(item));
model.argsStr = slices.length > 0 ? JSON.stringify(slices) : '';
} }
return model.argsStr; return model.argsStr;
} }
@ -268,6 +271,26 @@ watch(visible, () => {
restoreValidation(); restoreValidation();
} }
}); });
/** 分片参数变化, 解析并序列化到model.argsStr */
watch(dynamicForm, () => {
if (visible.value && model.taskType === 3) {
parseArgsStr();
}
});
/** 任务类型变化, 清理分片参数/方法参数 */
watch(
() => model.taskType,
taskType => {
if (visible.value) {
if (taskType !== 3) {
dynamicForm.args = [];
}
model.argsStr = '';
}
}
);
</script> </script>
<template> <template>