//外部药品目录维护
import React from 'react';
import { Table, Popconfirm, Icon, message, Modal, Form, Divider, Select, Row, Col, Button, Input, DatePicker } from 'antd';
import { $http } from '../../containers/config/https';
import moment from 'moment';
import store from '../../store';

import CommonPagination from 'components/pagination/index';

const { Option } = Select;
const dateFormat = 'YYYY-MM-DD'; //定义全局日期格式
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 14, offset: 2 },
};

class MaintainExternalDrugBasicData extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            loading: false, //加载状态标志
            visible: false, //弹窗显示状态标志
            motalTitle: '', //弹窗标题
            modalState: '', //弹窗点击提交时判断是否修改或增加标志
            total: 0,  // 表格数据总条数
            page: 1, //当前页数
            pageSize: 10, //每页显示条数
            startValue: null, //日期选择器开始时间
            endValue: null, //日期选择器结束时间
            tableData: [],
            startDate: null,
            endDate: null,
            code: '', //代码
            descripts: '', //描述
            ContrastDictionaryData: [], //字典类型下拉框
            DataCompOrgData: [], //机构下拉框
        };
        this.columns = [
            {
                title: '药品代码',
                dataIndex: 'code',
                key: 'code',
                width: '100px',
                align: "center",
            },
            {
                title: '产品名称',
                dataIndex: 'descripts',
                key: 'descripts',
                width: '100px',
                align: "center",
            },
            {
                title: '生产企业名称',
                dataIndex: 'manfDesc',
                key: 'manfDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '企业编码',
                dataIndex: 'manfCode',
                key: 'manfCode',
                width: '100px',
                align: "center",
            },
            {
                title: '批准文号',
                dataIndex: 'approvalNo',
                key: 'approvalNo',
                width: '100px',
                align: "center",
            },
            {
                title: '大类',
                dataIndex: 'stkCatDesc',
                key: 'stkCatDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '大类码',
                dataIndex: 'stkCatCode',
                key: 'stkCatCode',
                width: '100px',
                align: "center",
            },
            {
                title: '药理/功效分类',
                dataIndex: 'phCatDesc',
                key: 'phCatDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '药理/功效分类码',
                dataIndex: 'phCatCode',
                key: 'phCatCode',
                width: '100px',
                align: "center",
            },
            {
                title: '品种名(中文)',
                dataIndex: 'genericDesc',
                key: 'genericDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '品种名(英文)',
                dataIndex: 'genericEnDesc',
                key: 'genericEnDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '品种名代码',
                dataIndex: 'genericCode',
                key: 'genericCode',
                width: '100px',
                align: "center",
            },
            {
                title: '剂型分类名称',
                dataIndex: 'formDesc',
                key: 'formDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '剂型分类码',
                dataIndex: 'formCode',
                key: 'formCode',
                width: '100px',
                align: "center",
            },
            {
                title: '规格',
                dataIndex: 'spec',
                key: 'spec',
                width: '100px',
                align: "center",
            },
            {
                title: '转换系数',
                dataIndex: 'factor',
                key: 'factor',
                width: '100px',
                align: "center",
            },
            {
                title: '转换系数编码',
                dataIndex: 'factorCode',
                key: 'factorCode',
                width: '100px',
                align: "center",
            },
            {
                title: '材质包装',
                dataIndex: 'materialpackaging',
                key: 'materialpackaging',
                width: '100px',
                align: "center",
            },
            {
                title: '最小包装单位',
                dataIndex: 'baseUnitDesc',
                key: 'baseUnitDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '最小制剂单位',
                dataIndex: 'miniPreparationDesc',
                key: 'miniPreparationDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '批准文号开始日期',
                dataIndex: 'approvalstDate',
                key: 'approvalstDate',
                width: '100px',
                align: "center",
            },
            {
                title: '批准文号注销日期',
                dataIndex: 'approvalendDate',
                key: 'approvalendDate',
                width: '100px',
                align: "center",
            },
            {
                title: '药品分类',
                dataIndex: 'stkSubCatDesc',
                key: 'stkSubCatDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '药品分类代码',
                dataIndex: 'stkSubCatCode',
                key: 'stkSubCatCode',
                width: '100px',
                align: "center",
            },
            {
                title: '操作',
                key: 'op',
                align: "center",
                width: '100px',
                render: (text, record) => (
                    <span>
                        <span className='span' onClick={() => this.showModal(record)}><Icon type="edit" />修改</span>
                    </span>
                ),
            },
        ];
    }


    componentDidMount() {
        //初始化列表数据
        this.handleQuery();
        //字典类型下拉框数据
        this.getContrastDictionaryData();
        //机构下拉框
        this.getDataCompOrgData();
    }

    //初始化列表数据
    handleQuery = () => {
        let { page, pageSize, code, descripts } = this.state;
        let data = {}
        data = {
            params: [{
                code: code,
                descripts: descripts
            }],
            pagination: [{
                pageSize: pageSize,
                currentPage: page,
                sortColumn: 'code',
                sortOrder: 'asc'
            }]
        }
        $http.post('urlS', this, {
            code: '05100314',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result) {
                    for (var i = 0; i < res.result.length; i++) {
                        res.result[i].key = i;
                    }
                    this.setState({ tableData: res.result.data, total: res.result.totalCount, loading: false })
                } else {
                    this.setState({ tableData: [], total: 0, loading: false })
                }
            }
        })
    }

    //字典类型下拉框数据
    getContrastDictionaryData = () => {
        var data = {
            params: [{
            }]
        }
        let ContrastDictionaryData = []
        $http.post("urlS", this, {
            code: '05100315',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result.data) {
                    for (var i = 0; i < res.result.data.length; i++) {
                        ContrastDictionaryData.push(<Option value={String(res.result.data[i].id)} key={i + "H"} >{res.result.data[i].descripts}</Option>)
                    }
                    this.setState({ ContrastDictionaryData: ContrastDictionaryData })
                }
            },
            error: function (err) {
                this.setState({ errMsg: "数据加载失败，请重试！" })
            }
        })
    }

    getDataCompOrgData = () => {
        var data = {
            params: [{
            }]
        }
        let DataCompOrgData = []
        $http.post("urlS", this, {
            code: '05100321',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result.data) {
                    for (var i = 0; i < res.result.data.length; i++) {
                        DataCompOrgData.push(<Option value={String(res.result.data[i].id)} key={i + "H"} >{res.result.data[i].descripts}</Option>)
                    }
                    this.setState({ DataCompOrgData: DataCompOrgData })
                }
            },
            error: function (err) {
                this.setState({ errMsg: "数据加载失败，请重试！" })
            }
        })
    }

    // 页码改变的回调，参数是改变后的页码及每页条数
    appPageChange = (page, pageSize) => {
        this.setState({
            page: page,
            pageSize: pageSize,
        }, () => {
            // 重新调用查询方法
            this.handleQuery();
        });
    }

    // 条数改变的回调
    apponShowSizeChange = (current, size) => {
        this.setState({
            page: current,
            pageSize: size,
        }, () => {
            // 重新调用查询方法
            this.handleQuery();
        });
    }

    //弹窗显示
    showModal = (params) => {
        if (params === 'add') {
            this.setState({
                visible: true,
                motalTitle: "新增",
                modalState: "add",
                updateID: "",
            });
            this.props.form.setFieldsValue({
                DictionaryTypeID: null,
                CompOrgID: null,
                code: null,
                descripts: null,
                manfDesc: null,
                manfCode: null,
                approvalNo: null,
                stkCatDesc: null,
                stkCatCode: null,
                phCatDesc: null,
                phCatCode: null,
                genericDesc: null,
                genericEnDesc: null,
                genericCode: null,
                formDesc: null,
                formCode: null,
                spec: null,
                factor: null,
                factorCode: null,
                materialpackaging: null,
                baseUnitDesc: null,
                miniPreparationDesc: null,
                startDate: null,
                endDate: null,
                stkSubCatDesc: null,
                stkSubCatCode: null,
            });
        } else {
            this.setState({
                updateID: params.id,
                visible: true,
                motalTitle: "修改",
                modalState: "update",
            });
            this.props.form.setFieldsValue({
                CompOrgDictionaryDataID: params.CompOrgDictionaryDataID,
                DictionaryTypeID: params.DictionaryTypeID,
                CompOrgID: params.CompOrgID,
                code: params.code,
                descripts: params.descripts,
                manfDesc: params.manfDesc,
                manfCode: params.manfCode,
                approvalNo: params.approvalNo,
                stkCatDesc: params.stkCatDesc,
                stkCatCode: params.stkCatCode,
                phCatDesc: params.phCatDesc,
                phCatCode: params.phCatCode,
                genericDesc: params.genericDesc,
                genericEnDesc: params.genericEnDesc,
                genericCode: params.genericCode,
                formDesc: params.formDesc,
                formCode: params.formCode,
                spec: params.spec,
                factor: params.factor,
                factorCode: params.factorCode,
                materialpackaging: params.materialpackaging,
                baseUnitDesc: params.baseUnitDesc,
                miniPreparationDesc: params.miniPreparationDesc,
                startDate: params.approvalstDate ? moment(params.approvalstDate, 'YYYY-MM-DD') : null,
                endDate: params.approvalendDate ? moment(params.approvalendDate, 'YYYY-MM-DD') : null,
                stkSubCatDesc: params.stkSubCatDesc,
                stkSubCatCode: params.stkSubCatCode,
            });
        }
    };

    //弹窗点击取消
    handleCancel = () => {
        this.setState({ visible: false, });
    };

    //弹窗点击确定
    handleOk = () => {
        this.props.form.validateFields((err, values) => {
            if (err) {
                return;
            }
            let data = {};
            let code = '';
            if (this.state.modalState === 'add') {
                code = '05100319';
            } else if (this.state.modalState === 'update') {
                code = '05100320';
            }
            data = {
                params: [{
                    id: this.state.updateID,
                    userID: JSON.parse(window.sessionStorage.userData).userID,
                    CompOrgDictionaryDataID: values.CompOrgDictionaryDataID,
                    DictionaryTypeID: values.DictionaryTypeID,
                    CompOrgID: values.CompOrgID,
                    code: values.code,
                    descripts: values.descripts,
                    manfDesc: values.manfDesc,
                    manfCode: values.manfCode,
                    approvalNo: values.approvalNo,
                    stkCatDesc: values.stkCatDesc,
                    stkCatCode: values.stkCatCode,
                    phCatDesc: values.phCatDesc,
                    phCatCode: values.phCatCode,
                    genericDesc: values.genericDesc,
                    genericEnDesc: values.genericEnDesc,
                    genericCode: values.genericCode,
                    formDesc: values.formDesc,
                    formCode: values.formCode,
                    spec: values.spec,
                    factor: values.factor,
                    factorCode: values.factorCode,
                    materialpackaging: values.materialpackaging,
                    baseUnitDesc: values.baseUnitDesc,
                    miniPreparationDesc: values.miniPreparationDesc,
                    approvalstDate: values.startDate && values.startDate != "" ? moment(values.startDate).utcOffset(480).format('YYYY-MM-DD') : null,
                    approvalendDate: values.endDate && values.endDate != "" ? moment(values.endDate).utcOffset(480).format('YYYY-MM-DD') : null,
                    stkSubCatDesc: values.stkSubCatDesc,
                    stkSubCatCode: values.stkSubCatCode,
                }]
            }
            $http.post('urlS', this, {
                code: code,
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        message.success(res.errorMessage);
                        this.handleQuery();
                        this.setState({ loading: false, visible: false });
                    }
                }
            })
        })
    };


    //开始日期选择器选择限制
    disabledStartDate = startValue => {
        const { endValue } = this.state;
        if (!startValue || !endValue) {
            return false;
        }
        return startValue.valueOf() > endValue.valueOf();
    };

    //失效日期选择器选择限制
    disabledEndDate = endValue => {
        const { startValue } = this.state;
        if (!endValue || !startValue) {
            return false;
        }
        return endValue.valueOf() <= startValue.valueOf();
    };

    onChange = (field, value) => {
        this.setState({
            [field]: value,
        });
    };

    //开始日期变化
    onStartChange = value => {
        this.onChange('startValue', value);
    };

    //结束日期变化
    onEndChange = value => {
        this.onChange('endValue', value);
    };

    //代码改变
    onChangeCode = (e) => {
        this.setState({ code: e.target.value })
    }

    //产品名称改变
    onChangeDescripts = (e) => {
        this.setState({ descripts: e.target.value })
    }

    render() {
        let { startValue, endValue, ContrastDictionaryData, modalState, DataCompOrgData } = this.state;
        const { getFieldDecorator } = this.props.form;
        return (
            <div>
                <div style={{ width: '100%', height: '100%' }}>
                    <Row style={{ minHeight: '80px', padding: '24px 24px 24px 24px' }}>
                        <Col span={4}>
                            <span>药品代码：</span>
                            <Input style={{ width: '180px' }} allowClear placeholder="请输入药品代码" onChange={this.onChangeCode} />
                        </Col>
                        <Col span={4}>
                            <span>产品名称：</span>
                            <Input style={{ width: '180px' }} allowClear placeholder="请输入产品名称" onChange={this.onChangeDescripts} />
                        </Col>
                        <Col span={4}>
                        </Col>
                        <Col span={4}>
                        </Col>
                        <Col span={4}>
                        </Col>
                        <Col span={2} style={{ textAlign: 'right' }}>
                            <Button type="primary" onClick={() => this.handleQuery()} icon="search" >查询</Button>
                        </Col>
                        <Col span={2} style={{ textAlign: 'center' }}>
                            <Button type="primary" onClick={() => this.showModal('add')} icon="plus" style={{ background: '#F7805D', color: '#FFFFFF', borderColor: '#F7805D' }} >
                                新增
                            </Button>
                            <Form layout="inline">
                                <Modal
                                    visible={this.state.visible}
                                    title={this.state.motalTitle}
                                    onOk={() => this.handleOk()}
                                    onCancel={this.handleCancel}
                                    width='1000px'
                                    footer={[
                                        <Button key="back" onClick={this.handleCancel}>返回</Button>,
                                        <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>提交</Button>,
                                    ]}
                                >
                                    <Row>
                                        <Col span={24} style={{ display: 'none' }}>
                                            <Form.Item label="机构字典" {...formItemLayout} >
                                                {getFieldDecorator("CompOrgDictionaryDataID", {
                                                    initialValue: undefined,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请选择字典类型" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="字典类型" {...formItemLayout} >
                                                {getFieldDecorator("DictionaryTypeID", {
                                                    initialValue: undefined,
                                                    rules: [{ required: true, message: '字典类型不能为空' }]
                                                })(
                                                    <Select style={{ width: '200px' }} allowClear placeholder="请选择字典类型">
                                                        {ContrastDictionaryData}
                                                    </Select>
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12} >
                                            <Form.Item label="机构" {...formItemLayout} >
                                                {getFieldDecorator("CompOrgID", {
                                                    initialValue: undefined,
                                                    rules: [{ required: true, message: '机构不能为空' }]
                                                })(
                                                    <Select style={{ width: '200px' }} allowClear placeholder="请选择机构">
                                                        {DataCompOrgData}
                                                    </Select>
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="药品代码" {...formItemLayout}>
                                                {getFieldDecorator("code", {
                                                    initialValue: null,
                                                    rules: [{ required: true, message: '药品代码不能为空' }]
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入药品代码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="产品名称" {...formItemLayout}>
                                                {getFieldDecorator("descripts", {
                                                    initialValue: null,
                                                    rules: [{ required: true, message: '产品名称不能为空' }]
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入产品名称" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="生产企业名称" {...formItemLayout}>
                                                {getFieldDecorator("manfDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入生产企业名称" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="企业编码" {...formItemLayout}>
                                                {getFieldDecorator("manfCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入企业编码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="批准文号" {...formItemLayout}>
                                                {getFieldDecorator("approvalNo", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入批准文号" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="大类" {...formItemLayout}>
                                                {getFieldDecorator("stkCatDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入大类" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="大类码" {...formItemLayout}>
                                                {getFieldDecorator("stkCatCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入大类码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="药理/功效分类" {...formItemLayout}>
                                                {getFieldDecorator("phCatDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入药理/功效分类" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="药理/功效分类码" {...formItemLayout}>
                                                {getFieldDecorator("phCatCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入药理/功效分类码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="品种名(中文)" {...formItemLayout}>
                                                {getFieldDecorator("genericDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入品种名(中文)" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="品种名(英文)" {...formItemLayout}>
                                                {getFieldDecorator("genericEnDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入品种名(英文)" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="品种名代码" {...formItemLayout}>
                                                {getFieldDecorator("genericCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入品种名代码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="剂型分类名称" {...formItemLayout}>
                                                {getFieldDecorator("formDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入剂型分类名称" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="剂型分类码" {...formItemLayout}>
                                                {getFieldDecorator("formCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入剂型分类码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="规格" {...formItemLayout}>
                                                {getFieldDecorator("spec", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入规格" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="转换系数" {...formItemLayout}>
                                                {getFieldDecorator("factor", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入转换系数" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="转换系数编码" {...formItemLayout}>
                                                {getFieldDecorator("factorCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入转换系数编码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="材质包装" {...formItemLayout}>
                                                {getFieldDecorator("materialpackaging", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入材质包装" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="最小包装单位" {...formItemLayout}>
                                                {getFieldDecorator("baseUnitDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入最小包装单位" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="最小制剂单位" {...formItemLayout}>
                                                {getFieldDecorator("miniPreparationDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入最小制剂单位" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="批准文号开始日期" {...formItemLayout}>
                                                {getFieldDecorator("startDate", {
                                                    initialValue: startValue,
                                                })(
                                                    <DatePicker
                                                        style={{ width: '200px' }}
                                                        format={dateFormat}
                                                        disabledDate={this.disabledStartDate}
                                                        onChange={this.onStartChange}
                                                    />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="批准文号注销日期" {...formItemLayout}>
                                                {getFieldDecorator("endDate", {
                                                    initialValue: endValue,
                                                })(
                                                    <DatePicker
                                                        style={{ width: '200px' }}
                                                        format={dateFormat}
                                                        disabledDate={this.disabledEndDate}
                                                        onChange={this.onEndChange}
                                                    />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="药品分类" {...formItemLayout}>
                                                {getFieldDecorator("stkSubCatDesc", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入药品分类" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={12}>
                                            <Form.Item label="药品分类代码" {...formItemLayout}>
                                                {getFieldDecorator("stkSubCatCode", {
                                                    initialValue: null,
                                                })(
                                                    <Input style={{ width: '200px' }} allowClear placeholder="请输入药品分类代码" />
                                                )}
                                            </Form.Item>
                                        </Col>
                                    </Row>
                                </Modal>
                            </Form>
                        </Col>
                    </Row>
                </div>
                <div style={{ widht: '100%', height: '10px', background: '#f0f2f5' }}></div>
                <div style={{ padding: 24 }}>
                    <Table
                        style={{ height: store.getState().tableHeight.y + 65 + 'px' }}
                        dataSource={this.state.tableData}
                        columns={this.columns}
                        className='TableA'
                        //rowClassName="editable-row"
                        pagination={false}
                        scroll={{ x: 900, y: store.getState().tableHeight.y }}
                        bordered
                        loading={this.state.loading}
                    />
                    <CommonPagination size="small" current={this.state.page} total={this.state.total} search='search'
                        onShowSizeChange={this.apponShowSizeChange} complete={true} dataSource={this.state.tableData}
                        onChange={this.appPageChange} />
                </div>
            </div>
        )
    }
}

const MaintainExternalDrugBasicDataForm = Form.create()(MaintainExternalDrugBasicData);
export default MaintainExternalDrugBasicDataForm;