slproj-web/src/views/design/DesignAssets/DataForm.tsx

50 lines
1.9 KiB
TypeScript

import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
import { Typography } from 'antd'
import React, { useMemo } from 'react'
import CenterForm from '../../../components/crud/CenterForm'
import { DEF_INPUT_LEN } from '../../../components/crud/FormLayoutProps'
import { CrudContext } from '../../../components/crud/useCrud'
import { DesignAssets } from '../../../service/def'
type IProps = {
crudContext: CrudContext;
}
const DataForm: React.FC<IProps> = ({ crudContext }) => {
const record: DesignAssets | null = crudContext.record ?? null;
const initDemoVals = useMemo(() => ({
projs: ['test项目'],
packs: [record?.packname || 'test设计包'],
}), [])
return (
<CenterForm>
<ProForm initialValues={record || {}}>
<Typography.Title level={5} type="secondary"></Typography.Title>
<ProFormSelect name="proj" width={DEF_INPUT_LEN} label="项目" options={initDemoVals.projs} />
<ProFormSelect name="packname" width={DEF_INPUT_LEN} label="任务包" options={initDemoVals.packs} />
<ProForm.Group>
<ProFormText name="code" label="成果编号" width="sm" rules={[{ required: true }]} />
<ProFormSelect name="type" label="成果类型" width="sm" rules={[{ required: true }]} options={['科研试验成果类']} />
</ProForm.Group>
<ProFormText name="no" label="图号" width="sm" rules={[{ required: true }]} />
<ProFormText name="name" label="成果名称" width={DEF_INPUT_LEN} rules={[{ required: true }]} />
<ProFormText name="keyword" label="关键字" width={DEF_INPUT_LEN} />
<ProForm.Group>
<ProFormText name="desperosnel" label="设计人" width="sm" />
<ProFormText name="commiter" label="提交人" width="sm" />
</ProForm.Group>
<ProFormTextArea name="remark" label="备注" width={DEF_INPUT_LEN} />
</ProForm>
</CenterForm>
)
}
export default DataForm;