From 16bc226bad3d8c6ce43f8f4903453f65d2400a22 Mon Sep 17 00:00:00 2001 From: zhangxinruu <101965509+zhangxinruu@users.noreply.github.com> Date: Mon, 21 Mar 2022 09:22:05 +0800 Subject: [PATCH] [Fix][UI Next][V1.0.0-Alpha] When creating a new project, the last created project information is not cleared (#9037) --- .../views/projects/list/components/project-modal.tsx | 2 ++ .../src/views/projects/list/components/use-form.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/dolphinscheduler-ui-next/src/views/projects/list/components/project-modal.tsx b/dolphinscheduler-ui-next/src/views/projects/list/components/project-modal.tsx index 3c66aa16f8..5cf725816b 100644 --- a/dolphinscheduler-ui-next/src/views/projects/list/components/project-modal.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/list/components/project-modal.tsx @@ -52,6 +52,8 @@ const ProjectModal = defineComponent({ variables.model.description = '' } else { variables.model.userName = props.row.userName + variables.model.projectName = props.row.name + variables.model.description = props.row.description } ctx.emit('cancelModal', props.showModalRef) } diff --git a/dolphinscheduler-ui-next/src/views/projects/list/components/use-form.ts b/dolphinscheduler-ui-next/src/views/projects/list/components/use-form.ts index fc0e7eba77..a3c96c43d9 100644 --- a/dolphinscheduler-ui-next/src/views/projects/list/components/use-form.ts +++ b/dolphinscheduler-ui-next/src/views/projects/list/components/use-form.ts @@ -29,6 +29,14 @@ export function useForm( const { t } = useI18n() const userStore = useUserStore() + const resetForm = () => { + variables.model = { + projectName: '', + description: '', + userName: (userStore.getUserInfo as UserInfoRes).userName + } + } + const variables = reactive({ projectFormRef: ref(), model: { @@ -75,6 +83,7 @@ export function useForm( try { await createProject(variables.model) variables.saving = false + resetForm() ctx.emit('confirmModal', props.showModalRef) } catch (err) { variables.saving = false @@ -87,6 +96,7 @@ export function useForm( try { await updateProject(variables.model, props.row.code) variables.saving = false + resetForm() ctx.emit('confirmModal', props.showModalRef) } catch (err) { variables.saving = false