From 367371bfc1c896f28ace407808e80a3c662d4d80 Mon Sep 17 00:00:00 2001 From: xlsea Date: Tue, 30 Apr 2024 17:40:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=88=86=E7=89=87?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/modules/job-task-operate-drawer.vue | 66 +++++++++++++++++-- 1 file changed, 59 insertions(+), 7 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 bf41cd1..5353540 100644 --- a/src/views/job/task/modules/job-task-operate-drawer.vue +++ b/src/views/job/task/modules/job-task-operate-drawer.vue @@ -33,6 +33,10 @@ const emit = defineEmits(); const visible = defineModel('visible', { default: false }); +// const argsTags = ref([]); +const dynamicForm = reactive({ + args: [{ arg: '' }] +}); const { formRef, validate, restoreValidation } = useNaiveForm(); const { defaultRequiredRule } = useFormRules(); @@ -136,6 +140,13 @@ function handleUpdateModelWhenEdit() { if (props.operateType === 'edit' && props.rowData) { Object.assign(model, props.rowData); + if (model.taskType === 3 && model.argsStr) { + Object.assign(dynamicForm, { + args: JSON.parse(model.argsStr).map((item: string) => { + return { arg: item }; + }) + }); + } } } @@ -150,7 +161,6 @@ async function handleSubmit() { const { groupName, jobName, - argsStr, argsType, jobStatus, routeKey, @@ -169,7 +179,7 @@ async function handleSubmit() { const { error } = await fetchAddJob({ groupName, jobName, - argsStr, + argsStr: parseArgsStr(), argsType, jobStatus, routeKey, @@ -194,7 +204,6 @@ async function handleSubmit() { id, groupName, jobName, - argsStr, argsType, jobStatus, routeKey, @@ -214,7 +223,7 @@ async function handleSubmit() { id, groupName, jobName, - argsStr, + argsStr: parseArgsStr(), argsType, jobStatus, routeKey, @@ -238,6 +247,21 @@ async function handleSubmit() { emit('submitted'); } +function parseArgsStr() { + if (model.taskType === 3 && dynamicForm.args) { + return JSON.stringify(dynamicForm.args.map(item => item.arg)); + } + return model.argsStr; +} + +const removeItem = (index: number) => { + dynamicForm.args.splice(index, 1); +}; + +const addItem = () => { + dynamicForm.args.push({ arg: '' }); +}; + watch(visible, () => { if (visible.value) { handleUpdateModelWhenEdit(); @@ -284,12 +308,40 @@ watch(visible, () => { - - - + + + + + + + + + + + +