From 84802a02ce89a416436aea7aa19b3125c0ef45c1 Mon Sep 17 00:00:00 2001 From: opensnail <598092184@qq.com> Date: Sat, 28 Dec 2024 20:37:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(1.3.0-beta1):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/modules/job-task-trigger-modal.vue | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/src/views/job/task/modules/job-task-trigger-modal.vue b/src/views/job/task/modules/job-task-trigger-modal.vue index 5c507c9..210e985 100644 --- a/src/views/job/task/modules/job-task-trigger-modal.vue +++ b/src/views/job/task/modules/job-task-trigger-modal.vue @@ -109,40 +109,52 @@ function createDefaultScriptParams() { } function handleUpdateModelWhenEdit() { - if (props.rowData) { - Object.assign(model, props.rowData); - // 任务类型 1:集群 2:广播 3:切片 4:Map 5:MapReduce - if (props.rowData.taskType === 3 && props.rowData.argsStr) { - Object.assign(dynamicForm, { - args: JSON.parse(props.rowData.argsStr).map((item: string) => { - return { arg: item }; - }) - }); - } - - if (props.rowData.taskType === 5 && props.rowData.argsStr) { - const argsJson = JSON.parse(props.rowData.argsStr); - shardNum.value = argsJson.shardNum; - model.tmpArgsStr = argsJson.argsStr; - } - - if (executorCustomOptions.map(item => item.value).includes(props.rowData.executorInfo)) { - if (props.rowData.executorInfo === 'snailJobHttpExecutor') { - Object.assign(httpParams, JSON.parse(props.rowData.argsStr)); - if (httpParams.headers) { - httpHeaders.value = Object.keys(httpParams.headers).map((item: string) => { - return { key: item, value: httpParams.headers![item] }; - }); - } - } else { - Object.assign(scriptParams, JSON.parse(props.rowData.argsStr)); - } - } - } else { + if (!props.rowData) { Object.assign(model, createDefaultModel()); httpHeaders.value = []; Object.assign(httpParams, createDefaultHttpParams()); Object.assign(scriptParams, createDefaultScriptParams()); + return; + } + + Object.assign(model, props.rowData); + + const taskType = props.rowData.taskType; + const argsStr = props.rowData.argsStr; + if (!argsStr) { + return; + } + + // 1:集群 2:广播 4:Map + model.tmpArgsStr = argsStr; + + // 任务类型 3:切片 + if (taskType === 3) { + Object.assign(dynamicForm, { + args: JSON.parse(argsStr).map((item: string) => { + return { arg: item }; + }) + }); + } + + // 5:MapReduce + if (taskType === 5) { + const argsJson = JSON.parse(argsStr); + shardNum.value = argsJson.shardNum; + model.tmpArgsStr = argsJson.argsStr; + } + + if (executorCustomOptions.map(item => item.value).includes(props.rowData.executorInfo)) { + if (props.rowData.executorInfo === 'snailJobHttpExecutor') { + Object.assign(httpParams, JSON.parse(argsStr)); + if (httpParams.headers) { + httpHeaders.value = Object.keys(httpParams.headers).map((item: string) => { + return { key: item, value: httpParams.headers![item] }; + }); + } + } else { + Object.assign(scriptParams, JSON.parse(argsStr)); + } } }