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' + } +]; + -