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 @@
-