From 7fc1f7a2529dc3d589f03e7f42efe9eff07120f2 Mon Sep 17 00:00:00 2001
From: b2baccline <23131013+b2baccline@users.noreply.github.com>
Date: Mon, 29 Jun 2020 17:52:24 +0800
Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0=E5=A2=9E=E6=A8=A1?=
=?UTF-8?q?=E6=9D=BF=E7=BB=84=E6=96=B0=E5=BB=BA=E3=80=81=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E3=80=81=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/gen/datasourceconfig.js | 2 +-
.../src/api/gen/templategroup.js | 7 +
.../src/mixins/formMixin.js | 10 +-
.../src/mixins/formModalMixin.js | 13 +-
.../src/router/index.js | 2 +-
.../src/views/gen/codegen/GenerateModal.vue | 149 ++++++++++++++++++
.../{CodeGenPage.vue => GeneratePage.vue} | 49 +++---
...ateGroupForm.vue => TemplateEntryForm.vue} | 93 +++++++++--
...eTree.vue => TemplateEntryRemoveModal.vue} | 0
...Model.vue => TemplateEntryRenameModal.vue} | 0
.../templategroup/TemplateGroupFormModal.vue | 56 +++++++
.../gen/templategroup/TemplateGroupPage.vue | 48 ++++--
12 files changed, 372 insertions(+), 57 deletions(-)
create mode 100644 ballcat-codegen/ballcat-codegen-frontend/src/views/gen/codegen/GenerateModal.vue
rename ballcat-codegen/ballcat-codegen-frontend/src/views/gen/codegen/{CodeGenPage.vue => GeneratePage.vue} (79%)
rename ballcat-codegen/ballcat-codegen-frontend/src/views/gen/templategroup/{TemplateGroupForm.vue => TemplateEntryForm.vue} (84%)
rename ballcat-codegen/ballcat-codegen-frontend/src/views/gen/templategroup/{TemplateGroupRemoveTree.vue => TemplateEntryRemoveModal.vue} (100%)
rename ballcat-codegen/ballcat-codegen-frontend/src/views/gen/templategroup/{TemplateGroupRenameModel.vue => TemplateEntryRenameModal.vue} (100%)
create mode 100644 ballcat-codegen/ballcat-codegen-frontend/src/views/gen/templategroup/TemplateGroupFormModal.vue
diff --git a/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/datasourceconfig.js b/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/datasourceconfig.js
index 2ac6a62e..8ee6a1b1 100644
--- a/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/datasourceconfig.js
+++ b/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/datasourceconfig.js
@@ -40,7 +40,7 @@ export function putObj(obj) {
export function getSelectData() {
return axios({
- url: '/gen/datasource/config/select',
+ url: '/gen/datasource-config/select',
method: 'get'
})
}
diff --git a/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/templategroup.js b/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/templategroup.js
index 80c842ae..67f7a7dd 100644
--- a/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/templategroup.js
+++ b/ballcat-codegen/ballcat-codegen-frontend/src/api/gen/templategroup.js
@@ -37,3 +37,10 @@ export function putObj(obj) {
data: obj
})
}
+
+export function getSelectData() {
+ return axios({
+ url: '/gen/template/group/select',
+ method: 'get'
+ })
+}
diff --git a/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formMixin.js b/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formMixin.js
index 81d5816d..9730ace8 100644
--- a/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formMixin.js
+++ b/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formMixin.js
@@ -16,8 +16,10 @@ export default {
// 提交按钮防止重复提交
submitLoading: false,
- addObj: function() {},
- putObj: function() {}
+ reqFunctions: {
+ create: function() {},
+ update: function() {}
+ }
}
},
methods: {
@@ -65,12 +67,12 @@ export default {
handleSubmit(e) {
// 钩子函数 处理提交之前处理的事件
this.beforeStartSubmit()
- const req = this.formAction === this.FORM_ACTION.CREATE ? this.addObj : this.putObj
+ const reqFunction = this.reqFunctions[this.formAction]
e.preventDefault()
this.form.validateFields((err, values) => {
if (!err) {
this.submitLoading = true
- req(this.submitDataProcess(values))
+ reqFunction(this.submitDataProcess(values))
.then(res => {
if (res.code === 200) {
this.$message.success(res.msg)
diff --git a/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formModalMixin.js b/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formModalMixin.js
index 9e3e697d..393549be 100644
--- a/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formModalMixin.js
+++ b/ballcat-codegen/ballcat-codegen-frontend/src/mixins/formModalMixin.js
@@ -4,6 +4,7 @@ export default {
mixins: [FormMixin],
data() {
return {
+ title: '',
visible: false,
labelCol: {
xs: { span: 8 },
@@ -18,17 +19,19 @@ export default {
}
},
methods: {
- show() {
+ show(title) {
this.visible = true
this.submitLoading = false
+
+ this.title = title
},
- add() {
+ add(title) {
this.buildCreatedForm()
- this.show()
+ this.show(title)
},
- update(record) {
+ update(record, title) {
this.buildUpdatedForm(record)
- this.show()
+ this.show(title)
},
/*eslint-disable*/
submitSuccess(res) {
diff --git a/ballcat-codegen/ballcat-codegen-frontend/src/router/index.js b/ballcat-codegen/ballcat-codegen-frontend/src/router/index.js
index bf316f04..82460f78 100644
--- a/ballcat-codegen/ballcat-codegen-frontend/src/router/index.js
+++ b/ballcat-codegen/ballcat-codegen-frontend/src/router/index.js
@@ -29,7 +29,7 @@ const routes = [
path: '/gen/codegen',
name: 'CodeGen',
meta: { title: '代码生成器' },
- component: () => import(/* webpackChunkName: "gen" */ '../views/gen/codegen/CodeGenPage')
+ component: () => import(/* webpackChunkName: "gen" */ '../views/gen/codegen/GeneratePage')
},
{
path: '/gen/template/group',
diff --git a/ballcat-codegen/ballcat-codegen-frontend/src/views/gen/codegen/GenerateModal.vue b/ballcat-codegen/ballcat-codegen-frontend/src/views/gen/codegen/GenerateModal.vue
new file mode 100644
index 00000000..e822a8be
--- /dev/null
+++ b/ballcat-codegen/ballcat-codegen-frontend/src/views/gen/codegen/GenerateModal.vue
@@ -0,0 +1,149 @@
+
+