From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/infra/codegen/EditTable.vue | 87 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/src/views/infra/codegen/EditTable.vue b/src/views/infra/codegen/EditTable.vue
new file mode 100644
index 0000000..f8473e3
--- /dev/null
+++ b/src/views/infra/codegen/EditTable.vue
@@ -0,0 +1,87 @@
+<template>
+ <ContentWrap v-loading="formLoading">
+ <el-tabs v-model="activeName">
+ <el-tab-pane label="鍩烘湰淇℃伅" name="basicInfo">
+ <basic-info-form ref="basicInfoRef" :table="formData.table" />
+ </el-tab-pane>
+ <el-tab-pane label="瀛楁淇℃伅" name="colum">
+ <colum-info-form ref="columInfoRef" :columns="formData.columns" />
+ </el-tab-pane>
+ <el-tab-pane label="鐢熸垚淇℃伅" name="generateInfo">
+ <generate-info-form
+ ref="generateInfoRef"
+ :table="formData.table"
+ :columns="formData.columns"
+ />
+ </el-tab-pane>
+ </el-tabs>
+ <el-form>
+ <el-form-item style="float: right">
+ <el-button :loading="formLoading" type="primary" @click="submitForm">淇濆瓨</el-button>
+ <el-button @click="close">杩斿洖</el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+</template>
+<script lang="ts" setup>
+import { useTagsViewStore } from '@/store/modules/tagsView'
+import { BasicInfoForm, ColumInfoForm, GenerateInfoForm } from './components'
+import * as CodegenApi from '@/api/infra/codegen'
+
+defineOptions({ name: 'InfraCodegenEditTable' })
+
+const { t } = useI18n() // 鍥介檯鍖�
+const message = useMessage() // 娑堟伅寮圭獥
+const { push, currentRoute } = useRouter() // 璺敱
+const { query } = useRoute() // 鏌ヨ鍙傛暟
+const { delView } = useTagsViewStore() // 瑙嗗浘鎿嶄綔
+
+const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑锛�1锛変慨鏀规椂鐨勬暟鎹姞杞斤紱2锛夋彁浜ょ殑鎸夐挳绂佺敤
+const activeName = ref('colum') // Tag 婵�娲荤殑绐楀彛
+const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>()
+const columInfoRef = ref<ComponentRef<typeof ColumInfoForm>>()
+const generateInfoRef = ref<ComponentRef<typeof GenerateInfoForm>>()
+const formData = ref<CodegenApi.CodegenUpdateReqVO>({
+ table: {},
+ columns: []
+})
+
+/** 鑾峰緱璇︽儏 */
+const getDetail = async () => {
+ const id = query.id as unknown as number
+ if (!id) {
+ return
+ }
+ formLoading.value = true
+ try {
+ formData.value = await CodegenApi.getCodegenTable(id)
+ } finally {
+ formLoading.value = false
+ }
+}
+
+/** 鎻愪氦鎸夐挳 */
+const submitForm = async () => {
+ // 鍙傛暟鏍¢獙
+ if (!unref(formData)) return
+ await unref(basicInfoRef)?.validate()
+ await unref(generateInfoRef)?.validate()
+ try {
+ // 鎻愪氦璇锋眰
+ await CodegenApi.updateCodegenTable(formData.value)
+ message.success(t('common.updateSuccess'))
+ close()
+ } catch {}
+}
+
+/** 鍏抽棴鎸夐挳 */
+const close = () => {
+ delView(unref(currentRoute))
+ push('/infra/codegen')
+}
+
+/** 鍒濆鍖� */
+onMounted(() => {
+ getDetail()
+})
+</script>
--
Gitblit v1.8.0