From 9eda5bb74f76d368dc9d55d643f88ee5e01a15f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Wed, 5 Jan 2022 17:38:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=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
---
.../wwwroot/CodeGenTemplate/TplControllers.txt | 6 ++++++
.../wwwroot/CodeGenTemplate/TplVue.txt | 2 +-
ZR.CodeGenerator/CodeGeneratorTool.cs | 8 ++++----
ZR.CodeGenerator/FileHelper.cs | 5 -----
ZR.CodeGenerator/Model/GenerateDto.cs | 2 +-
ZR.Vue/src/views/tool/gen/genInfoForm.vue | 6 +++---
ZR.Vue/src/views/tool/gen/index.vue | 16 ++++++----------
7 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
index 0a5a915..2d0dab2 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplControllers.txt
@@ -80,6 +80,7 @@ $end
return SUCCESS(response);
}
+$if(replaceDto.ShowBtnAdd)
///
/// 添加${genTable.FunctionName}
///
@@ -106,7 +107,9 @@ ${end}
});
return ToResponse(response);
}
+$end
+$if(replaceDto.ShowBtnEdit)
///
/// 更新${genTable.FunctionName}
///
@@ -135,7 +138,9 @@ ${end}
return ToResponse(response);
}
+$end
+$if(replaceDto.ShowBtnDelete)
///
/// 删除${genTable.FunctionName}
///
@@ -152,6 +157,7 @@ ${end}
return ToResponse(response);
}
+$end
$if(replaceDto.ShowBtnExport)
///
diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
index 4302984..a9d5b49 100644
--- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
+++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt
@@ -34,7 +34,7 @@ ${VueViewListContent}
+ @click="handleUpdate(scope.row)">
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index 45ccf5f..3f8e1b5 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -46,10 +46,10 @@ namespace ZR.CodeGenerator
replaceDto.ModelTypeName = dto.GenTable.ClassName;//表名对应C# 实体类名
replaceDto.PermissionPrefix = $"{dto.GenTable.ModuleName.ToLower()}:{dto.GenTable.ClassName.ToLower()}";//权限
replaceDto.Author = dto.GenTable.FunctionAuthor;
- replaceDto.ShowBtnAdd = dto.CheckedBtn.Any(f => f == 1);
- replaceDto.ShowBtnEdit = dto.CheckedBtn.Any(f => f == 2);
- replaceDto.ShowBtnDelete = dto.CheckedBtn.Any(f => f == 3);
- replaceDto.ShowBtnExport = dto.CheckedBtn.Any(f => f == 4);
+ replaceDto.ShowBtnAdd = dto.GenTable.CheckedBtn.Any(f => f == 1);
+ replaceDto.ShowBtnEdit = dto.GenTable.CheckedBtn.Any(f => f == 2);
+ replaceDto.ShowBtnDelete = dto.GenTable.CheckedBtn.Any(f => f == 3);
+ replaceDto.ShowBtnExport = dto.GenTable.CheckedBtn.Any(f => f == 4);
//循环表字段信息
foreach (GenTableColumn dbFieldInfo in dto.GenTable.Columns.OrderBy(x => x.Sort))
diff --git a/ZR.CodeGenerator/FileHelper.cs b/ZR.CodeGenerator/FileHelper.cs
index b342b07..fd675d0 100644
--- a/ZR.CodeGenerator/FileHelper.cs
+++ b/ZR.CodeGenerator/FileHelper.cs
@@ -1,13 +1,8 @@
using JinianNet.JNTemplate;
using System;
-using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-using ZR.CodeGenerator.Model;
namespace ZR.CodeGenerator
{
diff --git a/ZR.CodeGenerator/Model/GenerateDto.cs b/ZR.CodeGenerator/Model/GenerateDto.cs
index 6502159..91e99a8 100644
--- a/ZR.CodeGenerator/Model/GenerateDto.cs
+++ b/ZR.CodeGenerator/Model/GenerateDto.cs
@@ -41,7 +41,7 @@ namespace ZR.CodeGenerator.Model
/// 生成代码方式(0zip压缩包 1自定义路径)
///
public string GenType { get; set; }
- public string GenPath { get; set; } = "/";
+ public string GenPath { get; set; } = "";
#endregion
}
diff --git a/ZR.Vue/src/views/tool/gen/genInfoForm.vue b/ZR.Vue/src/views/tool/gen/genInfoForm.vue
index 30fa869..fb36cfb 100644
--- a/ZR.Vue/src/views/tool/gen/genInfoForm.vue
+++ b/ZR.Vue/src/views/tool/gen/genInfoForm.vue
@@ -127,13 +127,13 @@
-
+
添加
-
+
修改
-
+
删除
diff --git a/ZR.Vue/src/views/tool/gen/index.vue b/ZR.Vue/src/views/tool/gen/index.vue
index cadf2d9..03ade24 100644
--- a/ZR.Vue/src/views/tool/gen/index.vue
+++ b/ZR.Vue/src/views/tool/gen/index.vue
@@ -183,17 +183,13 @@ export default {
codeGenerator(seachdata)
.then((res) => {
- const { code, data } = res;
- if (code == 200) {
- this.showGenerate = false;
- if (row.genType === "1") {
- this.msgSuccess("成功生成到自定义路径:" + row.genPath);
- } else {
- this.msgSuccess("恭喜你,代码生成完成!");
- this.download(data.path);
- }
+ const { data } = res;
+ this.showGenerate = false;
+ if (row.genType === "1") {
+ this.msgSuccess("成功生成到自定义路径:" + row.genPath);
} else {
- this.msgError(res.msg);
+ this.msgSuccess("恭喜你,代码生成完成!");
+ this.download(data.path);
}
pageLoading.close();
})