import React from 'react';
import { Modal } from 'antd';
import {
  ProFormSelect,
  ProFormText,
  ModalForm,
} from '@ant-design/pro-form';
import { useIntl, FormattedMessage } from 'umi';


const UpdateForm = (props) => {
  const { updateModalVisible, updateModalVisibleChange, values, onSubmit } = props;
  // console.log({values});
  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: (
                  <FormattedMessage id="pages.searchTable.shareParamName" defaultMessage="成本分摊参数名是必填项" />
                ),
              },
            ]}
            width="sm"
            name="shareParamName"
          />
          <ProFormText
            label="成本分摊参数编号"
            rules={[
              {
                required: true,
                message: (
                  <FormattedMessage id="pages.searchTable.shareParamCode" defaultMessage="成本分摊参数编号是必填项" />
                ),
              },
            ]}
            width="sm"
            name="shareParamCode"
          />
        </ModalForm>
      }
    </>
  );
};

export default UpdateForm;
