fix: 收敛模板编辑发布契约并还原餐饮页面视觉
This commit is contained in:
1 parent
20bcb43534
commit
f4061a24bd
102 files changed
+4510
-870
No files matched your search
@@ -10,8 +10,18 @@ export function TemplateListField({
|
||||
}) {
|
||||
return (
|
||||
<Form.Item label={field.label} help={field.help}>
|
||||
<Form.List name={name}>
|
||||
{(rows, { add, remove }) => (
|
||||
<Form.List
|
||||
name={name}
|
||||
rules={[
|
||||
{
|
||||
validator: (_rule, values: unknown) =>
|
||||
field.required && (!Array.isArray(values) || values.length === 0)
|
||||
? Promise.reject(new Error(`请至少填写一项${field.label}`))
|
||||
: Promise.resolve(),
|
||||
},
|
||||
]}
|
||||
>
|
||||
{(rows, { add, remove }, { errors }) => (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{rows.map((row, index) => (
|
||||
<Space key={row.key} align="start" wrap>
|
||||
@@ -32,6 +42,7 @@ export function TemplateListField({
|
||||
<Button onClick={() => remove(row.name)}>删除</Button>
|
||||
</Space>
|
||||
))}
|
||||
<Form.ErrorList errors={errors} />
|
||||
<Button onClick={() => add()}>新增{field.label}</Button>
|
||||
</Space>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user