Files
fe_service_ebtp_frontend/src/utils/comFormItem.tsx

37 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-03-10 14:24:13 +08:00
import { DatePicker, Form, Input, Radio } from 'antd';
import React from 'react';
const FormItem = Form.Item;
const { TextArea } = Input;
//Input
export function returnInput(name: any, label: string, edit: boolean, rules?: any, width?: any) {
return (
<FormItem name={name} label={label} rules={rules}>
<Input bordered={edit} readOnly={!edit} style={{ width: width }} />
</FormItem>
)
}
//TextArea
export function returnArea(name: any, edit: boolean, label?: string,) {
const wrapperCol = { offset: label == undefined ? 6 : 0, span: 14 };
return (
<FormItem name={name} label={label} wrapperCol={wrapperCol}>
<TextArea bordered={edit} readOnly={!edit} />
</FormItem>
)
}
//DatePicker
export function returnDatePicker(name: any, label: string, edit: boolean,) {
return (
<FormItem name={name} label={label}>
<DatePicker showNow={false} showTime format="YYYY-MM-DD HH:mm:ss" bordered={edit} disabled={!edit} />
</FormItem>
)
}
// //RadioGroup
// export function returnRadioGroup(name: any, label: string, options: any, value: any, edit: boolean, onChange:()=>void) {
// return (
// <FormItem name={name} label={label}>
// <Radio.Group disabled={!edit} options={options} value={value} onChange={(e) => onChange(e, name)} />
// </FormItem>
// )
// }