feat: codegen finish

pull/3/head
xingyu 2023-03-24 00:39:06 +08:00
parent fa92a1c2da
commit 2572e1db8a
3 changed files with 23 additions and 10 deletions

View File

@ -29,7 +29,7 @@ import BasicInfoForm from './components/BasicInfoForm.vue'
import CloumInfoForm from './components/CloumInfoForm.vue' import CloumInfoForm from './components/CloumInfoForm.vue'
import FinishForm from './components/FinishForm.vue' import FinishForm from './components/FinishForm.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { getCodegenTable } from '@/api/infra/codegen' import { getCodegenTable, updateCodegenTable } from '@/api/infra/codegen'
const Step = Steps.Step const Step = Steps.Step
@ -42,6 +42,8 @@ const columnsInfo = ref<any[]>([])
const basicInfoValue = ref() const basicInfoValue = ref()
const columnsInfoValue = ref()
const current = ref(0) const current = ref(0)
const state = reactive({ const state = reactive({
initSetp2: false, initSetp2: false,
@ -50,8 +52,8 @@ const state = reactive({
function handleStep1Next(step1Values: any) { function handleStep1Next(step1Values: any) {
current.value++ current.value++
state.initSetp2 = true
basicInfoValue.value = step1Values basicInfoValue.value = step1Values
state.initSetp2 = true
console.info(step1Values) console.info(step1Values)
} }
@ -59,12 +61,23 @@ function handleStepPrev() {
current.value-- current.value--
} }
function handleStep2Next(step2Values: any) { async function handleStep2Next(step2Values: any) {
current.value++ current.value++
columnsInfoValue.value = step2Values
await handleSubmit()
state.initSetp3 = true state.initSetp3 = true
console.log(step2Values) 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() { function handleRedo() {
current.value = 0 current.value = 0
state.initSetp2 = false state.initSetp2 = false

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="step2"> <div class="step2">
<div class="step2-form"> <div class="step2-table">
<BasicTable :dataSource="columnsInfo" @register="registerTable" @row-click="handleEdit" /> <BasicTable :dataSource="columnsInfo" @register="registerTable" @row-click="handleEdit" />
</div> </div>
<Divider /> <Divider />
@ -33,8 +33,9 @@ defineProps({
} }
}) })
const [registerTable] = useTable({ const [registerTable, { getDataSource }] = useTable({
columns, columns,
maxHeight: 700,
pagination: false, pagination: false,
useSearchForm: false, useSearchForm: false,
showTableSetting: false, showTableSetting: false,
@ -46,9 +47,8 @@ async function customResetFunc() {
} }
async function customSubmitFunc() { async function customSubmitFunc() {
try { const tableValue = getDataSource()
emit('next', null) emit('next', tableValue)
} catch (error) {}
} }
function handleEdit(record: EditRecordRow) { function handleEdit(record: EditRecordRow) {
@ -57,7 +57,7 @@ function handleEdit(record: EditRecordRow) {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.step2 { .step2 {
&-form { &-table {
width: 100%; width: 100%;
margin: 0 auto; margin: 0 auto;
} }

View File

@ -1 +1 @@
<template><span>123</span></template> <template><span>保存成功</span></template>