index.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import React, { useMemo, useState } from 'react'
  2. import styles from './index.module.scss'
  3. // import { useParams } from 'react-router-dom'
  4. import MyTable from '@/components/MyTable'
  5. import { Button } from 'antd'
  6. import { B3FtableC } from '@/utils/tableData'
  7. import X2lookText from '@/pages/X_stock/X2lookText'
  8. import { textFu } from '@/utils/history'
  9. export type B3flowTableType = {
  10. createTime: string
  11. creatorId: number
  12. creatorName: string
  13. id: number
  14. isAuto?: any
  15. name: string
  16. orderId: number
  17. rtfOpinion: string
  18. status?: any
  19. updateTime: string
  20. }
  21. type Props = {
  22. tableArr: B3flowTableType[]
  23. }
  24. function B3flowTable({ tableArr }: Props) {
  25. // const { key, id } = useParams<any>()
  26. const tableLastBtn = useMemo(() => {
  27. return [
  28. {
  29. title: '审批意见',
  30. render: (item: B3flowTableType) => {
  31. if (textFu(item.rtfOpinion)) {
  32. return (
  33. <Button size='small' type='text' onClick={() => setLook(textFu(item.rtfOpinion))}>
  34. 查看
  35. </Button>
  36. )
  37. } else return '-'
  38. }
  39. }
  40. ]
  41. }, [])
  42. //查看富文本信息
  43. const [look, setLook] = useState('')
  44. return (
  45. <div className={styles.B3flowTable}>
  46. <div className='B3Ftop'>申请流程</div>
  47. {/* 表格 */}
  48. <MyTable list={tableArr} columnsTemp={B3FtableC} lastBtn={tableLastBtn} pagingInfo={false} />
  49. {/* 查看富文本 */}
  50. {look ? <X2lookText closeFu={() => setLook('')} text={look} /> : null}
  51. </div>
  52. )
  53. }
  54. const MemoB3flowTable = React.memo(B3flowTable)
  55. export default MemoB3flowTable