feat: codegen finish
parent
fa92a1c2da
commit
2572e1db8a
|
@ -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<any[]>([])
|
|||
|
||||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="step2">
|
||||
<div class="step2-form">
|
||||
<div class="step2-table">
|
||||
<BasicTable :dataSource="columnsInfo" @register="registerTable" @row-click="handleEdit" />
|
||||
</div>
|
||||
<Divider />
|
||||
|
@ -33,8 +33,9 @@ defineProps({
|
|||
}
|
||||
})
|
||||
|
||||
const [registerTable] = useTable({
|
||||
const [registerTable, { getDataSource }] = useTable({
|
||||
columns,
|
||||
maxHeight: 700,
|
||||
pagination: false,
|
||||
useSearchForm: false,
|
||||
showTableSetting: false,
|
||||
|
@ -46,9 +47,8 @@ async function customResetFunc() {
|
|||
}
|
||||
|
||||
async function customSubmitFunc() {
|
||||
try {
|
||||
emit('next', null)
|
||||
} catch (error) {}
|
||||
const tableValue = getDataSource()
|
||||
emit('next', tableValue)
|
||||
}
|
||||
|
||||
function handleEdit(record: EditRecordRow) {
|
||||
|
@ -57,7 +57,7 @@ function handleEdit(record: EditRecordRow) {
|
|||
</script>
|
||||
<style lang="less" scoped>
|
||||
.step2 {
|
||||
&-form {
|
||||
&-table {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
<template><span>123</span></template>
|
||||
<template><span>保存成功</span></template>
|
||||
|
|
Loading…
Reference in New Issue