Commit 1cd2b826 by zhaochengxiang

资产模版更新

parent 3a8b1679
import { Form, Input } from "antd";
const UpdateBasicInfo = (props) => {
const [form] = Form.useForm();
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 },
},
};
return (
<Form
form={form}
{...formItemLayout}
>
<Form.Item label='模版名称' name='name' rules={[{ required: true, message: '请填写模版名称' }]}>
<Input style={{ width: '87%' }} />
</Form.Item>
<Form.Item label='模版中文名称' name='cnName' rules={[{ required: true, message: '请填写模版中文名称' }]}>
<Input style={{ width: '87%' }} />
</Form.Item>
</Form>
);
}
export default UpdateBasicInfo;
\ No newline at end of file
import { Modal, Form, Input, Button } from "antd";
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import UpdateBasicInfo from "./UpdateBasicInfo";
import './UpdateTemplateModal.less';
const UpdateTemplateModal = (props) => {
......@@ -49,80 +50,7 @@ const UpdateTemplateModal = (props) => {
onCancel={onCancel}
onOk={onFormFinish}
>
<Form
form={form}
{...formItemLayout}
>
<Form.Item label='模版名称' name='name' rules={[{ required: true, message: '请填写模版名称' }]}>
<Input style={{ width: '87%' }} />
</Form.Item>
<Form.Item label='模版中文名称' name='cnName' rules={[{ required: true, message: '请填写模版中文名称' }]}>
<Input style={{ width: '87%' }} />
</Form.Item>
<Form.List
name="names"
rules={[
{
validator: async (_, names) => {
if (!names || names.length < 1) {
return Promise.reject(new Error('至少需要一个属性'));
}
},
},
]}
>
{(fields, { add, remove }, { errors }) => (
<>
{fields.map((field, index) => (
<Form.Item
label={`属性${index+1}`}
required={false}
key={field.key}
>
<Form.Item
{...field}
validateTrigger={['onChange', 'onBlur']}
rules={[
{
required: true,
whitespace: true,
message: "请输入属性名称",
},
]}
noStyle
>
<Input
placeholder="属性名称"
style={{
width: '87%',
}}
/>
</Form.Item>
{fields.length > 1 ? (
<MinusCircleOutlined
className="dynamic-delete-button"
onClick={() => remove(field.name)}
/>
) : null}
</Form.Item>
))}
<Form.Item {...formItemLayoutWithOutLabel}>
<Button
type="dashed"
onClick={() => add()}
style={{
width: '87%',
}}
icon={<PlusOutlined />}
>
添加属性
</Button>
<Form.ErrorList errors={errors} />
</Form.Item>
</>
)}
</Form.List>
</Form>
<UpdateBasicInfo />
</Modal>
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment