From 2572e1db8a84e10f025003a73a6ad813cb14d71a Mon Sep 17 00:00:00 2001 From: xingyu Date: Fri, 24 Mar 2023 00:39:06 +0800 Subject: [PATCH] feat: codegen finish --- src/views/infra/codegen/EditTable.vue | 19 ++++++++++++++++--- .../codegen/components/CloumInfoForm.vue | 12 ++++++------ .../infra/codegen/components/FinishForm.vue | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/views/infra/codegen/EditTable.vue b/src/views/infra/codegen/EditTable.vue index 5b38fe7a..15749dca 100644 --- a/src/views/infra/codegen/EditTable.vue +++ b/src/views/infra/codegen/EditTable.vue @@ -29,7 +29,7 @@ import BasicInfoForm from './components/BasicInfoForm.vue' import CloumInfoForm from './components/CloumInfoForm.vue' import FinishForm from './components/FinishForm.vue' import { useRoute } from 'vue-router' -import { getCodegenTable } from '@/api/infra/codegen' +import { getCodegenTable, updateCodegenTable } from '@/api/infra/codegen' const Step = Steps.Step @@ -42,6 +42,8 @@ const columnsInfo = ref([]) const basicInfoValue = ref() +const columnsInfoValue = ref() + const current = ref(0) const state = reactive({ initSetp2: false, @@ -50,8 +52,8 @@ const state = reactive({ function handleStep1Next(step1Values: any) { current.value++ - state.initSetp2 = true basicInfoValue.value = step1Values + state.initSetp2 = true console.info(step1Values) } @@ -59,12 +61,23 @@ function handleStepPrev() { current.value-- } -function handleStep2Next(step2Values: any) { +async function handleStep2Next(step2Values: any) { current.value++ + columnsInfoValue.value = step2Values + await handleSubmit() state.initSetp3 = true console.log(step2Values) } +async function handleSubmit() { + basicInfoValue.value.id = query.id as unknown as number + const genTable = { + table: basicInfoValue.value, + columns: columnsInfoValue.value + } + await updateCodegenTable(genTable) +} + function handleRedo() { current.value = 0 state.initSetp2 = false diff --git a/src/views/infra/codegen/components/CloumInfoForm.vue b/src/views/infra/codegen/components/CloumInfoForm.vue index f0f645d7..8cd8e6a4 100644 --- a/src/views/infra/codegen/components/CloumInfoForm.vue +++ b/src/views/infra/codegen/components/CloumInfoForm.vue @@ -1,6 +1,6 @@