import React, {
  useState, useEffect, useContext
} from 'react';
import { Form, Input, Select, Button, Switch, TreeSelect, message, Space,Table } from 'antd';
import apiObj from '@api/index';
import { getCookie,setCookie } from '@utils/index';
import DiagContext from './Diag-context';
import { useSelector } from 'react-redux'
import Item from 'antd/lib/list/Item';
const { post, api } = apiObj;
const { TextArea } = Input;

function AddDiag(props) {
  const [size, setSize] = useState(15);//每页显示条数
  const [total, setTotal] = useState(0);
  const [current, setCurrent] = useState(1);//当前页
  const [params, setParams] = useState({
    pages: 1,
  	current: 1,
    size: 15
  });
  const [form] = Form.useForm();
  const staticInfo = useSelector(state => {
    return state.staticInfo;
  });
console.log(props.row)
 
 const columns = [
   { title: 'ICD-10编码', dataIndex: 'icd10',},
   { title: '标准诊断名称', dataIndex: 'standard',},
   { title: '同义词', dataIndex: 'isMapping',},
 ]
 const rowSelection = {
   onChange: (selectedRowKeys, selectedRows) => {
     console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
   },
   getCheckboxProps: (record) => ({
     disabled: record.name === 'Disabled User',
     // Column configuration not to be checked
     name: record.name,
   }),
 };
 //每页显示条数切换
 function onSizeChange(current, pageSize) {
   params.current = current
   params.size = pageSize
   setSize(pageSize)
   setCurrent(current)
   setParams(params)
   getPage()
 }
 //翻页
 function changePage(page, pageSize) {
   params.current = page
   params.size = pageSize
   setCurrent(page)
   setParams(params)
   getPage()
 }
 function getPage() {
   
 }
 const list=[]
  

  return (
    <>
      <Table
        rowSelection={{type: 'checkbox',...rowSelection,}}
        columns={columns}
        scroll={{ y: 'calc(100vh - 320px)' }}
        dataSource={list}
        rowKey={record => record.code}
        pagination={{
          current: current,
          pageSize: size,
          size: 'small',
          showSizeChanger: true,
          pageSizeOptions: ['15', '30', '60', '120'],
          showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
          onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
          onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
          total: total
        }} />
        
          

    </>
  );
}

export default AddDiag;