import React from 'react';
import {Button, Modal} from 'antd';
import AreaTable from './AreaTable';
import StorageTable from './StorageTable';
import SeriesTable from './SeriesTable';
import SpecTable from './SpecTable';
import PartTable from './PartTable';
import OutFlowModal from './OutFlowModal';

interface Props {
  visible: boolean,
  onCancel: Function,
  type?: number, // 类型1区域库2库房3车系4车型5配件
  detailType?: number, // 类型1区域库2库房3车系4车型5配件
  id?: number, // 上一个列表ID
}

export default function Index(props: Props) {
  const {visible, onCancel, type, detailType, id} = props;

  return (
    <Modal
      title="分析"
      width={1000}
      visible={visible}
      maskClosable={false}
      onCancel={() => onCancel()}
      footer={
        <Button onClick={() => onCancel()}>取消</Button>
      }
    >
      {detailType == 1 && <AreaTable type={type} detailType={detailType} id={id} showAnalyse={false} />}
      {detailType == 2 && <StorageTable type={type} detailType={detailType} id={id} showAnalyse={false} />}
      {detailType == 3 && <SeriesTable type={type} detailType={detailType} id={id} showAnalyse={false} />}
      {detailType == 4 && <SpecTable type={type} detailType={detailType} id={id} />}
      {detailType == 5 && <PartTable type={type} detailType={detailType} id={id} showAnalyse={false} />}
      <OutFlowModal />
    </Modal>
  );
}
