import React, { useMemo } from 'react'
import styles from './index.module.scss'
import MyTable from '@/components/MyTable'
import { D4tableC } from '@/utils/tableData'
import { Button } from 'antd'
import { FourTableType } from '@/pages/B_enterTibet/B1collect/type'

type Props = {
  list: FourTableType[]
}

function D6impRelation({ list }: Props) {
  const tableLastBtn2 = useMemo(() => {
    return [
      {
        title: '操作',
        render: (item: any) => {
          return (
            <Button
              size='small'
              type='text'
              onClick={() => {
                window.open(`/#/impStor_edit/4/${item.id}`, '_blank')
              }}
            >
              查看
            </Button>
          )
        }
      }
    ]
  }, [])

  return (
    <div className={styles.D6impRelation} hidden={list.length === 0}>
      <div className='D6RTit'>相关入库单</div>
      <MyTable list={list} columnsTemp={D4tableC} lastBtn={tableLastBtn2} pagingInfo={false} />
    </div>
  )
}

const MemoD6impRelation = React.memo(D6impRelation)

export default MemoD6impRelation
