From 3795b552ac718a948fd1249ee9242c07c026570f Mon Sep 17 00:00:00 2001 From: dhb52 Date: Fri, 14 Jun 2024 11:51:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(sj=5F1.1.0):=20=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=EF=BC=8C=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B=E4=B8=BA?= =?UTF-8?q?=E5=88=87=E7=89=87=EF=BC=8C=E6=8F=90=E4=BA=A4=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/modules/job-task-operate-drawer.vue | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/views/job/task/modules/job-task-operate-drawer.vue b/src/views/job/task/modules/job-task-operate-drawer.vue index 3bdb9b0..0def5c6 100644 --- a/src/views/job/task/modules/job-task-operate-drawer.vue +++ b/src/views/job/task/modules/job-task-operate-drawer.vue @@ -162,6 +162,7 @@ async function handleSubmit() { groupName, jobName, argsType, + argsStr, jobStatus, routeKey, executorType, @@ -179,7 +180,7 @@ async function handleSubmit() { const { error } = await fetchAddJob({ groupName, jobName, - argsStr: parseArgsStr(), + argsStr, argsType, jobStatus, routeKey, @@ -204,6 +205,7 @@ async function handleSubmit() { id, groupName, jobName, + argsStr, argsType, jobStatus, routeKey, @@ -223,7 +225,7 @@ async function handleSubmit() { id, groupName, jobName, - argsStr: parseArgsStr(), + argsStr, argsType, jobStatus, routeKey, @@ -249,7 +251,8 @@ async function handleSubmit() { function parseArgsStr() { 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; } @@ -268,6 +271,26 @@ watch(visible, () => { 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 = ''; + } + } +);