import React, { useCallback, useEffect, useState } from 'react'
import styles from './index.module.scss'
import { Button, Modal } from 'antd'
import { I4_APIgetProGetUser } from '@/store/action/Isystem/I4processSet'

type Props = {
  sId: number
  closeFu: () => void
}

function I4lookPro({ sId, closeFu }: Props) {
  const [list, setList] = useState<string[]>([])

  const getInfoFu = useCallback(async () => {
    const res = await I4_APIgetProGetUser(sId)
    if (res.code === 0) {
      setList((res.data || []).map((v: any) => v.realName))
    }
  }, [sId])

  useEffect(() => {
    getInfoFu()
  }, [getInfoFu])

  return (
    <Modal
      wrapClassName={styles.I4lookPro}
      destroyOnClose
      open={true}
      title='查看办理人'
      footer={
        [] // 设置footer为空，去掉 取消 确定默认按钮
      }
    >
      <div className='I4lMain'>
        {list.length ? list.map(v => <span key={v}>{v}</span>) : <span>暂无</span>}
      </div>

      <div className='I4lBtn'>
        <Button onClick={closeFu}>关闭</Button>
      </div>
    </Modal>
  )
}

const MemoI4lookPro = React.memo(I4lookPro)

export default MemoI4lookPro
