update 优化 代码生成页面模板 校验不必要的表单数据

This commit is contained in:
疯狂的狮子Li 2023-02-07 23:13:11 +08:00
parent 6c928c9b60
commit a8a79f4778
4 changed files with 16 additions and 0 deletions

View File

@ -333,6 +333,7 @@ export default {
// 表单校验
rules: {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.required)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
@ -344,6 +345,7 @@ export default {
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
]#if($foreach.count != $columns.size()),#end
#end
#end
#end
}
};
@ -404,11 +406,13 @@ export default {
reset() {
this.form = {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.htmlType == "checkbox")
$column.javaField: []#if($foreach.count != $columns.size()),#end
#else
$column.javaField: null#if($foreach.count != $columns.size()),#end
#end
#end
#end
};
this.resetForm("form");

View File

@ -343,6 +343,7 @@ export default {
// 表单校验
rules: {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.required)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
@ -354,6 +355,7 @@ export default {
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
]#if($foreach.count != $columns.size()),#end
#end
#end
#end
}
};
@ -395,11 +397,13 @@ export default {
reset() {
this.form = {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.htmlType == "checkbox")
$column.javaField: []#if($foreach.count != $columns.size()),#end
#else
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
#end
#end
#end
};
this.resetForm("form");

View File

@ -304,6 +304,7 @@ const data = reactive({
},
rules: {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.required)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
@ -315,6 +316,7 @@ const data = reactive({
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
]#if($foreach.count != $columns.size()),#end
#end
#end
#end
}
});
@ -365,11 +367,13 @@ function cancel() {
function reset() {
form.value = {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.htmlType == "checkbox")
$column.javaField: []#if($foreach.count != $columns.size()),#end
#else
$column.javaField: null#if($foreach.count != $columns.size()),#end
#end
#end
#end
};
proxy.resetForm("${businessName}Ref");

View File

@ -315,6 +315,7 @@ const data = reactive({
},
rules: {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.required)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
@ -326,6 +327,7 @@ const data = reactive({
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end }
]#if($foreach.count != $columns.size()),#end
#end
#end
#end
}
});
@ -367,11 +369,13 @@ function cancel() {
function reset() {
form.value = {
#foreach ($column in $columns)
#if($column.isInsert || $column.isEdit)
#if($column.htmlType == "checkbox")
$column.javaField: []#if($foreach.count != $columns.size()),#end
#else
$column.javaField: null#if($foreach.count != $columns.size()),#end
#end
#end
#end
};
proxy.resetForm("${businessName}Ref");