子表增加表单验证提示、代码格式化

This commit is contained in:
thinkgem
2024-09-11 10:13:34 +08:00
parent 7787d7ce0a
commit f3ea863e76
4 changed files with 29 additions and 23 deletions

View File

@@ -133,7 +133,7 @@ for(c in table.columnList){
allowClear: true, allowClear: true,
style: 'width: calc(50% - 60px)', style: 'width: calc(50% - 60px)',
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
<% } <% }
for (c in table.columnList){ for (c in table.columnList){
@@ -309,7 +309,7 @@ for (c in table.columnList){
<% <%
} }
if (isNewLine){ %> if (isNewLine){ %>
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
<% <%
} }
%> %>
@@ -329,7 +329,7 @@ for (c in table.columnList){
bizType: '${className}_image', bizType: '${className}_image',
uploadType: 'image', uploadType: 'image',
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
<% <%
} }
@@ -345,7 +345,7 @@ for (c in table.columnList){
bizType: '${className}_file', bizType: '${className}_file',
uploadType: 'all', uploadType: 'all',
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
<% <%
} }
@@ -354,7 +354,7 @@ for (c in table.columnList){
label: t('${child.comments}'), label: t('${child.comments}'),
field: '${@StringUtils.uncap(child.className)}List', field: '${@StringUtils.uncap(child.className)}List',
component: 'Input', component: 'Input',
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
slot: '${@StringUtils.uncap(child.className)}List', slot: '${@StringUtils.uncap(child.className)}List',
}, },
<% <%
@@ -368,14 +368,14 @@ for (c in table.columnList){
componentProps: { componentProps: {
maxlength: 500, maxlength: 500,
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
show: () => record.value.bpm.status != '2', show: () => record.value.bpm.status != '2',
}, },
{ {
label: t('下一步流程信息'), label: t('下一步流程信息'),
field: 'nextTaskInfo', field: 'nextTaskInfo',
component: 'FormGroup', component: 'FormGroup',
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
{ {
label: t('要求完成时间'), label: t('要求完成时间'),
@@ -442,7 +442,7 @@ for (c in table.columnList){
labelWidth: 120, labelWidth: 120,
schemas: inputFormSchemas, schemas: inputFormSchemas,
<% var formColNum = table.optionMap['formColNum']; %> <% var formColNum = table.optionMap['formColNum']; %>
baseColProps: { lg: ${formColNum=="1"?24:formColNum=="3"?8:12}, md: 24 }, baseColProps: { md: 24, lg: ${formColNum=="1"?24:formColNum=="3"?8:12} },
}); });
<% for (child in table.childList){ %> <% for (child in table.childList){ %>
@@ -616,7 +616,10 @@ for (c in table.columnList){
}); });
} }
if (!${@StringUtils.uncap(child.className)}ListValid) { if (!${@StringUtils.uncap(child.className)}ListValid) {
throw { errorFields: [{ name: ['${@StringUtils.uncap(child.className)}List'] }] }; throw {
errorFields: [{ name: ['${@StringUtils.uncap(child.className)}List'] }],
message: t('${child.comments}填写有误,请根据提示修正'),
};
} }
return ${@StringUtils.uncap(child.className)}List; return ${@StringUtils.uncap(child.className)}List;
} }
@@ -697,7 +700,7 @@ for (c in table.columnList){
emit('success', data); emit('success', data);
} catch (error: any) { } catch (error: any) {
if (error && error.errorFields) { if (error && error.errorFields) {
showMessage(t('common.validateError')); showMessage(error.message || t('common.validateError'));
} }
console.log('error', error); console.log('error', error);
} finally { } finally {

View File

@@ -147,7 +147,7 @@ for(c in table.columnList){
allowClear: true, allowClear: true,
style: 'width: calc(50% - 60px)', style: 'width: calc(50% - 60px)',
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
<% } <% }
for (c in table.columnList){ for (c in table.columnList){
@@ -323,7 +323,7 @@ for (c in table.columnList){
<% <%
} }
if (isNewLine){ %> if (isNewLine){ %>
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
<% <%
} }
%> %>
@@ -343,7 +343,7 @@ for (c in table.columnList){
bizType: '${className}_image', bizType: '${className}_image',
uploadType: 'image', uploadType: 'image',
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
<% <%
} }
@@ -359,7 +359,7 @@ for (c in table.columnList){
bizType: '${className}_file', bizType: '${className}_file',
uploadType: 'all', uploadType: 'all',
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
<% <%
} }
@@ -372,7 +372,7 @@ for (c in table.columnList){
{ {
field: '${@StringUtils.uncap(child.className)}List', field: '${@StringUtils.uncap(child.className)}List',
component: 'Input', component: 'Input',
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
slot: '${@StringUtils.uncap(child.className)}List', slot: '${@StringUtils.uncap(child.className)}List',
}, },
]; ];
@@ -389,14 +389,14 @@ for (c in table.columnList){
componentProps: { componentProps: {
maxlength: 500, maxlength: 500,
}, },
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
show: () => record.value.bpm.status != '2', show: () => record.value.bpm.status != '2',
}, },
{ {
label: t('下一步流程信息'), label: t('下一步流程信息'),
field: 'nextTaskInfo', field: 'nextTaskInfo',
component: 'FormGroup', component: 'FormGroup',
colProps: { lg: 24, md: 24 }, colProps: { md: 24, lg: 24 },
}, },
{ {
label: t('要求完成时间'), label: t('要求完成时间'),
@@ -463,14 +463,14 @@ for (c in table.columnList){
labelWidth: 120, labelWidth: 120,
schemas: inputFormSchemas, schemas: inputFormSchemas,
<% var formColNum = table.optionMap['formColNum']; %> <% var formColNum = table.optionMap['formColNum']; %>
baseColProps: { lg: ${formColNum=="1"?24:formColNum=="3"?8:12}, md: 24 }, baseColProps: { md: 24, lg: ${formColNum=="1"?24:formColNum=="3"?8:12} },
}); });
<% for (child in table.childList){ %> <% for (child in table.childList){ %>
const [register${child.className}Form, ${@StringUtils.uncap(child.className)}Form] = useForm({ const [register${child.className}Form, ${@StringUtils.uncap(child.className)}Form] = useForm({
labelWidth: 120, labelWidth: 120,
schemas: input${child.className}FormSchemas, schemas: input${child.className}FormSchemas,
baseColProps: { lg: 24, md: 24 }, baseColProps: { md: 24, lg: 24 },
}); });
const [register${child.className}Table, ${@StringUtils.uncap(child.className)}Table] = useTable({ const [register${child.className}Table, ${@StringUtils.uncap(child.className)}Table] = useTable({
@@ -643,7 +643,10 @@ for (c in table.columnList){
}); });
} }
if (!${@StringUtils.uncap(child.className)}ListValid) { if (!${@StringUtils.uncap(child.className)}ListValid) {
throw { errorFields: [{ name: ['${@StringUtils.uncap(child.className)}List'] }] }; throw {
errorFields: [{ name: ['${@StringUtils.uncap(child.className)}List'] }],
message: t('${child.comments}填写有误,请根据提示修正'),
};
} }
return ${@StringUtils.uncap(child.className)}List; return ${@StringUtils.uncap(child.className)}List;
} }
@@ -751,7 +754,7 @@ for (c in table.columnList){
handleClose(); handleClose();
} catch (error: any) { } catch (error: any) {
if (error && error.errorFields) { if (error && error.errorFields) {
showMessage(t('common.validateError')); showMessage(error.message || t('common.validateError'));
} }
console.log('error', error); console.log('error', error);
} finally { } finally {

View File

@@ -181,7 +181,7 @@ for(c in table.columnList){
<% } %> <% } %>
const searchForm: FormProps = { const searchForm: FormProps = {
baseColProps: { lg: 6, md: 8 }, baseColProps: { md: 8, lg: 6 },
labelWidth: 90, labelWidth: 90,
schemas: [ schemas: [
<% for(c in table.columnList){ %> <% for(c in table.columnList){ %>

View File

@@ -45,7 +45,7 @@ const modalProps = {
}; };
const searchForm: FormProps = { const searchForm: FormProps = {
baseColProps: { lg: 6, md: 8 }, baseColProps: { md: 8, lg: 6 },
labelWidth: 90, labelWidth: 90,
schemas: [ schemas: [
<% for(c in table.columnList){ %> <% for(c in table.columnList){ %>