From 107d447e638586b885e56be0a4bfa9ebde1af2c9 Mon Sep 17 00:00:00 2001 From: xlsea Date: Mon, 2 Sep 2024 11:36:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.2.0-beta1):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=84=9A=E6=9C=AC=E5=86=85=E7=BD=AE=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/modules/job-task-operate-drawer.vue | 85 ++++++++++++++----- 1 file changed, 64 insertions(+), 21 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 d3018d9..a3cce25 100644 --- a/src/views/job/task/modules/job-task-operate-drawer.vue +++ b/src/views/job/task/modules/job-task-operate-drawer.vue @@ -183,24 +183,19 @@ const executorCustomOptions = [ } ]; -const httpMethodOptions = [ - { - label: 'GET', - value: 'get' - }, - { - label: 'POST', - value: 'post' - }, - { - label: 'PUT', - value: 'put' - }, - { - label: 'DELETE', - value: 'delete' - } -]; +type ScriptParams = { + method: string; + scriptParams: string; +}; + +const scriptParams = reactive(createDefaultScriptParams()); + +function createDefaultScriptParams() { + return { + method: 'LOCAL_SCRIPT', + scriptParams: '' + }; +} function handleUpdateModelWhenEdit() { if (props.operateType === 'add') { @@ -235,6 +230,8 @@ function handleUpdateModelWhenEdit() { return { key: item, value: httpParams.headers![item] }; }); } + } else { + Object.assign(scriptParams, JSON.parse(model.argsStr)); } } } @@ -275,6 +272,8 @@ async function handleSubmit() { httpParams.headers[item.key] = item.value; }); argsStr = JSON.stringify(httpParams); + } else { + argsStr = JSON.stringify(scriptParams); } } @@ -394,6 +393,40 @@ function handleChangeExecutorCustomType() { } model.executorInfo = 'snailJobHttpExecutor'; } + +const httpMethodOptions = [ + { + label: 'GET', + value: 'get' + }, + { + label: 'POST', + value: 'post' + }, + { + label: 'PUT', + value: 'put' + }, + { + label: 'DELETE', + value: 'delete' + } +]; + +const scriptMethodOptions = [ + { + label: '需下载脚本', + value: 'DOWNLOAD' + }, + { + label: '脚本代码', + value: 'SCRIPT_CODE' + }, + { + label: '使用本地脚本', + value: 'LOCAL_SCRIPT' + } +]; + -