From f33935868db6ce4afda865aa712fcc595e53c00d Mon Sep 17 00:00:00 2001 From: dlarmor <121919810@qq.com> Date: Mon, 27 Mar 2023 14:06:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Vue3=20=E9=87=8D=E6=9E=84=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=20->=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/codegen/index.ts | 22 +- src/api/infra/codegen/types.ts | 2 +- src/locales/zh-CN.ts | 3 +- src/views/infra/codegen/EditTable.vue | 95 +++-- .../codegen/components/BasicInfoForm.vue | 220 +++------- .../codegen/components/CloumInfoForm.vue | 137 ------- .../codegen/components/ColumInfoForm.vue | 157 ++++++++ .../codegen/components/GenerateInfoForm.vue | 379 ++++++++++++++++++ .../infra/codegen/components/ImportTable.vue | 110 ++--- .../infra/codegen/components/Preview.vue | 65 +-- src/views/infra/codegen/components/index.ts | 5 +- src/views/infra/codegen/index.vue | 261 +++++++++--- 12 files changed, 966 insertions(+), 490 deletions(-) delete mode 100644 src/views/infra/codegen/components/CloumInfoForm.vue create mode 100644 src/views/infra/codegen/components/ColumInfoForm.vue create mode 100644 src/views/infra/codegen/components/GenerateInfoForm.vue diff --git a/src/api/infra/codegen/index.ts b/src/api/infra/codegen/index.ts index 54f00ff0..993bd552 100644 --- a/src/api/infra/codegen/index.ts +++ b/src/api/infra/codegen/index.ts @@ -2,56 +2,56 @@ import request from '@/config/axios' import type { CodegenUpdateReqVO, CodegenCreateListReqVO } from './types' // 查询列表代码生成表定义 -export const getCodegenTablePageApi = (params) => { +export const getCodegenTablePage = (params) => { return request.get({ url: '/infra/codegen/table/page', params }) } // 查询详情代码生成表定义 -export const getCodegenTableApi = (id: number) => { +export const getCodegenTable = (id: number) => { return request.get({ url: '/infra/codegen/detail?tableId=' + id }) } // 新增代码生成表定义 -export const createCodegenTableApi = (data: CodegenCreateListReqVO) => { +export const createCodegenTable = (data: CodegenCreateListReqVO) => { return request.post({ url: '/infra/codegen/create', data }) } // 修改代码生成表定义 -export const updateCodegenTableApi = (data: CodegenUpdateReqVO) => { +export const updateCodegenTable = (data: CodegenUpdateReqVO) => { return request.put({ url: '/infra/codegen/update', data }) } // 基于数据库的表结构,同步数据库的表和字段定义 -export const syncCodegenFromDBApi = (id: number) => { +export const syncCodegenFromDB = (id: number) => { return request.put({ url: '/infra/codegen/sync-from-db?tableId=' + id }) } // 基于 SQL 建表语句,同步数据库的表和字段定义 -export const syncCodegenFromSQLApi = (id: number, sql: string) => { +export const syncCodegenFromSQL = (id: number, sql: string) => { return request.put({ url: '/infra/codegen/sync-from-sql?tableId=' + id + '&sql=' + sql }) } // 预览生成代码 -export const previewCodegenApi = (id: number) => { +export const previewCodegen = (id: number) => { return request.get({ url: '/infra/codegen/preview?tableId=' + id }) } // 下载生成代码 -export const downloadCodegenApi = (id: number) => { +export const downloadCodegen = (id: number) => { return request.download({ url: '/infra/codegen/download?tableId=' + id }) } // 获得表定义 -export const getSchemaTableListApi = (params) => { +export const getSchemaTableList = (params) => { return request.get({ url: '/infra/codegen/db/table/list', params }) } // 基于数据库的表结构,创建代码生成器的表定义 -export const createCodegenListApi = (data) => { +export const createCodegenList = (data) => { return request.post({ url: '/infra/codegen/create-list', data }) } // 删除代码生成表定义 -export const deleteCodegenTableApi = (id: number) => { +export const deleteCodegenTable = (id: number) => { return request.delete({ url: '/infra/codegen/delete?tableId=' + id }) } diff --git a/src/api/infra/codegen/types.ts b/src/api/infra/codegen/types.ts index be6a66ed..e4e78843 100644 --- a/src/api/infra/codegen/types.ts +++ b/src/api/infra/codegen/types.ts @@ -52,7 +52,7 @@ export type CodegenPreviewVO = { code: string } export type CodegenUpdateReqVO = { - table: CodegenTableVO + table: CodegenTableVO | any columns: CodegenColumnVO[] } export type CodegenCreateListReqVO = { diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 6f46f1ab..ea1392c4 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -298,7 +298,8 @@ export default { typeUpdate: '字典类型编辑', dataCreate: '字典数据新增', dataUpdate: '字典数据编辑', - fileUpload: '上传文件' + fileUpload: '上传文件', + back: '返回' }, dialog: { dialog: '弹窗', diff --git a/src/views/infra/codegen/EditTable.vue b/src/views/infra/codegen/EditTable.vue index 820d23ca..34ba3bd6 100644 --- a/src/views/infra/codegen/EditTable.vue +++ b/src/views/infra/codegen/EditTable.vue @@ -1,67 +1,74 @@ diff --git a/src/views/infra/codegen/components/BasicInfoForm.vue b/src/views/infra/codegen/components/BasicInfoForm.vue index 2009553f..21b280ee 100644 --- a/src/views/infra/codegen/components/BasicInfoForm.vue +++ b/src/views/infra/codegen/components/BasicInfoForm.vue @@ -1,183 +1,93 @@ diff --git a/src/views/infra/codegen/components/CloumInfoForm.vue b/src/views/infra/codegen/components/CloumInfoForm.vue deleted file mode 100644 index 5a60c546..00000000 --- a/src/views/infra/codegen/components/CloumInfoForm.vue +++ /dev/null @@ -1,137 +0,0 @@ - - diff --git a/src/views/infra/codegen/components/ColumInfoForm.vue b/src/views/infra/codegen/components/ColumInfoForm.vue new file mode 100644 index 00000000..33d29978 --- /dev/null +++ b/src/views/infra/codegen/components/ColumInfoForm.vue @@ -0,0 +1,157 @@ + + diff --git a/src/views/infra/codegen/components/GenerateInfoForm.vue b/src/views/infra/codegen/components/GenerateInfoForm.vue new file mode 100644 index 00000000..9a64c800 --- /dev/null +++ b/src/views/infra/codegen/components/GenerateInfoForm.vue @@ -0,0 +1,379 @@ + + diff --git a/src/views/infra/codegen/components/ImportTable.vue b/src/views/infra/codegen/components/ImportTable.vue index 38a81541..7eebbe65 100644 --- a/src/views/infra/codegen/components/ImportTable.vue +++ b/src/views/infra/codegen/components/ImportTable.vue @@ -1,9 +1,8 @@ + diff --git a/src/views/infra/codegen/components/index.ts b/src/views/infra/codegen/components/index.ts index b84c5a03..71d0587f 100644 --- a/src/views/infra/codegen/components/index.ts +++ b/src/views/infra/codegen/components/index.ts @@ -1,5 +1,6 @@ import BasicInfoForm from './BasicInfoForm.vue' -import CloumInfoForm from './CloumInfoForm.vue' +import ColumInfoForm from './ColumInfoForm.vue' +import GenerateInfoForm from './GenerateInfoForm.vue' import ImportTable from './ImportTable.vue' import Preview from './Preview.vue' -export { BasicInfoForm, CloumInfoForm, ImportTable, Preview } +export { BasicInfoForm, ColumInfoForm, GenerateInfoForm, ImportTable, Preview } diff --git a/src/views/infra/codegen/index.vue b/src/views/infra/codegen/index.vue index 8337d2d4..591f99d3 100644 --- a/src/views/infra/codegen/index.vue +++ b/src/views/infra/codegen/index.vue @@ -1,56 +1,124 @@