import React, { useCallback } from 'react'; import { Button, Form, Radio, Input, Space, Card, Col, Row, RadioGroupProps } from 'antd'; import { AdminServices, ApplyEntity } from 'matrix-ui-service'; import { ApplyLogList } from './ApplyLogList'; import { commonRules } from '../../../utils'; const { TextArea } = Input; export interface ApplyFormAction { value: string | number | boolean; label: React.ReactNode; info?: string; } export interface ApplyFormResult { info: string; action: string | number; } export interface ApplyFormProps { apply: ApplyEntity; applyDictType: string; adminServices: AdminServices; ownerRender?: React.ReactNode; onSubmit: (res: ApplyFormResult) => void; onCancel: () => void; actions: ApplyFormAction[]; } export function ApplyForm(props: ApplyFormProps) { const { apply, ownerRender, adminServices, applyDictType, onSubmit, onCancel, actions } = props; const { applyLogService, dictService } = adminServices; const [form] = Form.useForm(); const onActionChange = useCallback( (e) => { const map = actions.find((a) => a.value === e.target.value); map && form.setFieldsValue({ info: map.info }); }, [actions, form], ); return ( <> {ownerRender}