import ProForm, { ProFormDatePicker, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
import React from 'react'
import CenterForm from '../../../components/crud/CenterForm'
import { DEF_INPUT_LEN } from '../../../components/crud/FormLayoutProps'
import { CrudContext } from '../../../components/crud/useCrud'


type IProps = {
  crudCtx: CrudContext;
};

const DataForm: React.FC<IProps> = ({ crudCtx }) => {

  let record = crudCtx.record || {};

  record = {
    ...record,
    ...record.props
  }

  return (
    <CenterForm>
      <ProForm initialValues={record}>

        <ProFormSelect name="projname" label="项目名称" width={DEF_INPUT_LEN} rules={[{ required: true }]} />

        <ProFormText name="projadmin" label="项目经理" width={DEF_INPUT_LEN} rules={[{ required: true }]} />

        <ProForm.Group>
          <ProFormDatePicker name="stm" label="计划开工日期" width="sm" rules={[{ required: true }]} />
          <ProFormDatePicker name="etm" label="计划完工日期" width="sm" rules={[{ required: true }]} />
        </ProForm.Group>

        <ProFormText name="工期" label="工期" width='sm' />

      </ProForm>
    </CenterForm>
  )
}

export default DataForm;
