import React from 'react';

import {
  ProFormText,
  ModalForm,
} from '@ant-design/pro-form';



const UpdateForm = (props) => {
  const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
  return (
    <>
      {
        JSON.stringify(values) !== '{}' && <ModalForm
          title="编辑成本项目"
          width="800px"
          initialValues={{ ...values }}
          labelCol={{ span:5,offset: 3 }}
          layout={'horizontal'}
          visible={updateModalVisible}
          onVisibleChange={(visible) => updateModalVisibleChange(visible)}
          onFinish={(value) => onSubmit({ ...values, ...value })}
        >
          <ProFormText
          label="成本项目编码"
          rules={[
            {
              required: true,
              message:'成本项目编码是必填项',
            },
          ]}
          width="sm"
          name="productCode"
        />
        <ProFormText
          label="成本项目名"
          rules={[
            {
              required: true,
              message:'成本项目名是必填项',
            },
          ]}
          width="sm"
          name="productName"
        />
        </ModalForm>
      }
    </>
  );
};

export default UpdateForm;
