From fecc5d8bcb2f757869da385dd87254fa7be64564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Mon, 15 Jul 2024 23:17:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90):=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81anyline=20=E5=8A=A8=E6=80=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=A1=A8=E5=85=83=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 1. 支持代码生成模板 从 github获取 - 2. 重构代码生成的默认值从配置类获取 --- src/api/gen/template.ts | 15 ++ src/utils/validate.ts | 7 + src/views/admin/dict/i18n/en.ts | 1 + src/views/admin/dict/i18n/zh-cn.ts | 1 + src/views/gen/datasource/form.vue | 274 +++++++++++++++-------------- src/views/gen/datasource/index.vue | 4 +- src/views/gen/design/form.vue | 71 ++++++++ src/views/gen/design/index.vue | 132 ++++++++++++++ src/views/gen/field-type/form.vue | 118 ++++++------- src/views/gen/gener/index.vue | 43 +++-- src/views/gen/group/form.vue | 141 ++++++++------- src/views/gen/table/add-dict.vue | 151 ++++++++++++++++ src/views/gen/table/edit.vue | 171 +++++++++++------- src/views/gen/table/generator.vue | 147 +++++++++++++--- src/views/gen/table/index.vue | 203 ++++++++++----------- src/views/gen/table/preview.vue | 202 ++++++++++----------- src/views/gen/template/form.vue | 137 ++++++++------- src/views/gen/template/index.vue | 224 ++++++++++++----------- 18 files changed, 1296 insertions(+), 746 deletions(-) create mode 100644 src/views/gen/design/form.vue create mode 100644 src/views/gen/design/index.vue create mode 100644 src/views/gen/table/add-dict.vue diff --git a/src/api/gen/template.ts b/src/api/gen/template.ts index b3416426..c3dc98ed 100644 --- a/src/api/gen/template.ts +++ b/src/api/gen/template.ts @@ -15,6 +15,21 @@ export function list() { }); } +export function online() { + return request({ + url: '/gen/template/online', + method: 'get', + }); +} + +export function checkVersion() { + return request({ + url: '/gen/template/checkVersion', + method: 'get', + }); +} + + export function addObj(obj?: Object) { return request({ url: '/gen/template', diff --git a/src/utils/validate.ts b/src/utils/validate.ts index 5e38b9a0..0ef6de21 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -21,6 +21,13 @@ export const validateNull = (val: any) => { }; export const rule = { + overLength(rule: any, value: any, callback: any) { + if (value?.length > 255) { + callback(new Error('输入内容过长,请重新输入')); + } else { + callback(); + } + }, /** * 校验 请输入中文、英文、数字包括下划线 * 名称校验 diff --git a/src/views/admin/dict/i18n/en.ts b/src/views/admin/dict/i18n/en.ts index 7a75dc02..84954840 100644 --- a/src/views/admin/dict/i18n/en.ts +++ b/src/views/admin/dict/i18n/en.ts @@ -26,6 +26,7 @@ export default { }, dictItem: { index: '#', + name: 'dict item', importsysDictItemTip: 'import SysDictItem', id: 'id', dictId: 'dictId', diff --git a/src/views/admin/dict/i18n/zh-cn.ts b/src/views/admin/dict/i18n/zh-cn.ts index dd9b9c69..a4cf25a4 100644 --- a/src/views/admin/dict/i18n/zh-cn.ts +++ b/src/views/admin/dict/i18n/zh-cn.ts @@ -29,6 +29,7 @@ export default { }, dictItem: { index: '#', + name: '字典项', importsysDictItemTip: '导入字典项', id: '编号', dictId: ' dictId', diff --git a/src/views/gen/datasource/form.vue b/src/views/gen/datasource/form.vue index dd7881e2..783fe172 100644 --- a/src/views/gen/datasource/form.vue +++ b/src/views/gen/datasource/form.vue @@ -1,81 +1,85 @@ diff --git a/src/views/gen/datasource/index.vue b/src/views/gen/datasource/index.vue index 2e10bc59..0cf1fb10 100644 --- a/src/views/gen/datasource/index.vue +++ b/src/views/gen/datasource/index.vue @@ -4,13 +4,13 @@ - + {{ $t('common.queryBtn') }} - {{ $t('common.resetBtn') }} + {{ $t('common.resetBtn') }} diff --git a/src/views/gen/design/form.vue b/src/views/gen/design/form.vue new file mode 100644 index 00000000..3b1652cb --- /dev/null +++ b/src/views/gen/design/form.vue @@ -0,0 +1,71 @@ + + + diff --git a/src/views/gen/design/index.vue b/src/views/gen/design/index.vue new file mode 100644 index 00000000..370d93b7 --- /dev/null +++ b/src/views/gen/design/index.vue @@ -0,0 +1,132 @@ + + + + diff --git a/src/views/gen/field-type/form.vue b/src/views/gen/field-type/form.vue index 1131f155..86540aef 100644 --- a/src/views/gen/field-type/form.vue +++ b/src/views/gen/field-type/form.vue @@ -1,33 +1,32 @@ diff --git a/src/views/gen/gener/index.vue b/src/views/gen/gener/index.vue index 6a9bde84..7bca2175 100644 --- a/src/views/gen/gener/index.vue +++ b/src/views/gen/gener/index.vue @@ -2,16 +2,16 @@
- - + + - + - +
下一步 @@ -22,17 +22,17 @@ - +
diff --git a/src/views/gen/table/add-dict.vue b/src/views/gen/table/add-dict.vue new file mode 100644 index 00000000..c82223ef --- /dev/null +++ b/src/views/gen/table/add-dict.vue @@ -0,0 +1,151 @@ + + + diff --git a/src/views/gen/table/edit.vue b/src/views/gen/table/edit.vue index a7d7d4ba..40446ed7 100644 --- a/src/views/gen/table/edit.vue +++ b/src/views/gen/table/edit.vue @@ -2,10 +2,11 @@ - + @@ -23,21 +24,25 @@ - + @@ -50,30 +55,33 @@ @@ -86,38 +94,44 @@ + + + diff --git a/src/views/gen/table/preview.vue b/src/views/gen/table/preview.vue index 2ef80131..d964e63e 100644 --- a/src/views/gen/table/preview.vue +++ b/src/views/gen/table/preview.vue @@ -1,33 +1,33 @@ diff --git a/src/views/gen/template/form.vue b/src/views/gen/template/form.vue index 05ffa80f..b3e61ff5 100644 --- a/src/views/gen/template/form.vue +++ b/src/views/gen/template/form.vue @@ -1,33 +1,33 @@ diff --git a/src/views/gen/template/index.vue b/src/views/gen/template/index.vue index ddc6e826..8ac7b7e8 100644 --- a/src/views/gen/template/index.vue +++ b/src/views/gen/template/index.vue @@ -1,92 +1,101 @@