-
+
$foreach(column in genTable.Columns)
$set(labelName = "")
$set(columnName = "")
$set(numLabel = "")
$if(column.IsQuery == true)
- $set(columnName = column.CsharpFieldFl)
- $if(column.ColumnComment != "")
- $set(labelName = column.ColumnComment)
- $else
- $set(labelName = column.CsharpFieldFl)
- $end
- $if(column.CsharpType == "int" || column.CsharpType == "long")
- $set(numLabel = ".number")
- $end
-
+$set(columnName = column.CsharpFieldFl)
+$if(column.ColumnComment != "")
+ $set(labelName = column.ColumnComment)
+$else
+ $set(labelName = column.CsharpFieldFl)
+$end
+$if(column.CsharpType == "int" || column.CsharpType == "long")
+ $set(numLabel = ".number")
+$end
$if(column.HtmlType == "datetime")
-
+
+
$elseif(column.HtmlType == "select" || column.HtmlType == "radio")
-
+
$else
@@ -112,9 +120,9 @@ $elseif(column.HtmlType == "checkbox" || column.HtmlType == "select" || column.H
$if(column.HtmlType == "checkbox")
-
+
$else
-
+
$end
@@ -203,7 +211,7 @@ $elseif(column.HtmlType == "radio")
- {{item.dictLabel}}
+ {{item.dictLabel}}
@@ -223,7 +231,7 @@ $elseif(column.HtmlType == "select")
-
+
@@ -231,7 +239,7 @@ $elseif(column.HtmlType == "checkbox")
- {{item.dictLabel}}
+ {{item.dictLabel}}
@@ -295,12 +303,10 @@ const open = ref(false)
const state = reactive({
form: {},
rules: {
- $foreach(column in genTable.Columns)
+$foreach(column in genTable.Columns)
$if(column.IsRequired && column.IsIncrement == false)
- ${column.CsharpFieldFl}: [
- { required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end
-$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number"$end }
- ],
+ ${column.CsharpFieldFl}: [{ required: true, message: "${column.ColumnComment}不能为空", trigger: $if(column.htmlType == "select")"change"$else"blur"$end
+$if(column.CsharpType == "int" || column.CsharpType == "long"), type: "number"$end }],
$end
$end
}
@@ -315,7 +321,7 @@ const formRef = ref()
$foreach(item in genTable.Columns)
$if((item.HtmlType == "radio" || item.HtmlType == "select" || item.HtmlType == "checkbox"))
// ${item.ColumnComment}选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
-const ${item.DictType} = ref([])
+const $if(item.DictType != "")${item.DictType}$else${item.CsharpFieldFl}Options$end = ref([])
$elseif(item.HtmlType == "datetime" && item.IsQuery == true)
// ${item.ColumnComment}时间范围
const dateRange${item.CsharpField} = ref([])
diff --git a/ZR.CodeGenerator/CodeGeneratorTool.cs b/ZR.CodeGenerator/CodeGeneratorTool.cs
index 872d789..c58c6d5 100644
--- a/ZR.CodeGenerator/CodeGeneratorTool.cs
+++ b/ZR.CodeGenerator/CodeGeneratorTool.cs
@@ -452,7 +452,7 @@ namespace ZR.CodeGenerator
TableId = genTable.TableId,
TableName = genTable.TableName,
CsharpType = GetCSharpDatatype(column.DataType),
- CsharpField = column.DbColumnName.UnderScoreToCamelCase().FirstUpperCase(),
+ CsharpField = column.DbColumnName.ConvertToPascal("_"),
IsRequired = !column.IsNullable,
IsIncrement = column.IsIdentity,
Create_by = genTable.Create_by,
diff --git a/ZR.Service/System/SysDeptService.cs b/ZR.Service/System/SysDeptService.cs
index 28a021c..4ea6fb0 100644
--- a/ZR.Service/System/SysDeptService.cs
+++ b/ZR.Service/System/SysDeptService.cs
@@ -71,12 +71,15 @@ namespace ZR.Service.System
{
SysDept info = DeptRepository.GetFirst(it => it.DeptId == dept.ParentId);
//如果父节点不为正常状态,则不允许新增子节点
- if (!UserConstants.DEPT_NORMAL.Equals(info.Status))
+ if (info != null && !UserConstants.DEPT_NORMAL.Equals(info?.Status))
{
throw new CustomException("部门停用,不允许新增");
}
-
- dept.Ancestors = info.Ancestors + "," + dept.ParentId;
+ dept.Ancestors = "";
+ if (info != null)
+ {
+ dept.Ancestors = info.Ancestors + "," + dept.ParentId;
+ }
return DeptRepository.Add(dept);
}
diff --git a/ZR.Vue/public/index.html b/ZR.Vue/public/index.html
index ad1a290..4c8ac8e 100644
--- a/ZR.Vue/public/index.html
+++ b/ZR.Vue/public/index.html
@@ -126,6 +126,7 @@
+