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

const DataForm: React.FC<{
  crudCtx: CrudContext
}> = ({ crudCtx }) => {
  const record = crudCtx.record || {};
  return (
    <CenterForm>
      <ProForm initialValues={record}>
        <Typography.Title level={5} type="secondary">基本信息</Typography.Title>
        <ProFormSelect name="proj" width={DEF_INPUT_LEN} label="项目" disabled={record.proj} rules={[{ required: true }]} />
        <ProFormSelect name="descontract" width={DEF_INPUT_LEN} label="设计合同" />
        <ProForm.Group>
          <ProFormText name="code" label="编码" width={DEF_INPUT_LEN} rules={[{ required: true }]} />
          <ProFormText name="name" label="名称" width={DEF_INPUT_LEN} rules={[{ required: true }]} />
        </ProForm.Group>
        <ProFormDigit name="imgnum" label="图纸张数" width="sm" rules={[{ required: true }]} />
        <ProFormRadio.Group name="status" label="状态" radioType="button" rules={[{ required: true }]} options={['设计', '评审', '完成']} />

        <ProFormRadio.Group name="evalmethod" label="评审方式" radioType="button" rules={[{ required: true }]} options={['在线评审', '线下评审']} />
        <ProForm.Group>
          <ProFormDatePicker name="evaltm" label="计划评审时间" width="sm" rules={[{ required: true }]} />
          <ProFormDatePicker name="evaldonetm" label="实际评审时间" width="sm" />
        </ProForm.Group>
        <ProForm.Group>
          <ProFormDatePicker name="pubtm" label="计划发布时间" width="sm" rules={[{ required: true }]} />
          <ProFormDatePicker name="pubdonetm" label="实际发布时间" width="sm" />
        </ProForm.Group>


        <Typography.Title level={5} type="secondary">其他信息</Typography.Title>

        <ProFormText name="desorg" label="设计单位" width={DEF_INPUT_LEN} rules={[{ required: true }]} />
        <ProFormText name="despersonel" label="设计人" width={DEF_INPUT_LEN} rules={[{ required: true }]} />
        <ProFormSelect name="desorg" label="施工合同" width={DEF_INPUT_LEN} rules={[{ required: true }]} />

      </ProForm>
    </CenterForm>
  )
}

export default DataForm;
