import * as React from 'react';
import { Button, Drawer, Input, Form } from 'kts-xui';
import { FormInstance } from 'kts-components-antd-x4/lib/form';
/** Props接口 */
interface IProps {
    onClose: () => void;
    onSuccess: (values) => void;
    list: string[];
}

export default class UIComponents extends React.Component<IProps, any> {
    formRef:any = React.createRef<FormInstance>();
    constructor(props) {
        super(props);
        this.state = {
            list: props.list
        }
    }
    onClose = () => {
        this.props.onClose();
    }
    onSubmit = () => {
        this.formRef.current?.submit();

    }
    onFinish = values => {
        this.props.onSuccess(values);
    }
    render() {
        return (
            <div>

                <Drawer
                    title="拒绝"
                    onClose={this.onClose}
                    visible={true}
                    footer={
                        <div
                            style={{
                                textAlign: 'right',
                            }}
                        >
                            <Button style={{ marginRight: 8 }} key='1' type="primary" onClick={this.onSubmit}>提交</Button>
                            <Button key='2' onClick={this.onClose}>取消</Button>
                        </div>}
                >
                    <Form
                        ref={this.formRef}
                        layout='vertical'
                        onFinish={this.onFinish}
                    >
                        <Form.Item
                            name='appealRefusalCause'
                            label='拒绝原因'
                            rules={[
                                { required: true, max: 80 }
                            ]}
                        >
                            <Input />
                        </Form.Item>
                    </Form>
                </Drawer>

            </div>
        );
    }
}
