index.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. const txt1 = item.status === 1 ? '同意' : item.status === 2 ? '不同意' : '(空)'
  32. const txt2 = item.isAuto === 1 ? '(自动)' : ''
  33. return txt1 + txt2
  34. }
  35. },
  36. {
  37. title: '审批意见',
  38. render: (item: B3flowTableType) => {
  39. if (textFu(item.rtfOpinion)) {
  40. return (
  41. <Button size='small' type='text' onClick={() => setLook(textFu(item.rtfOpinion))}>
  42. 查看
  43. </Button>
  44. )
  45. } else return '-'
  46. }
  47. }
  48. ]
  49. }, [])
  50. //查看富文本信息
  51. const [look, setLook] = useState('')
  52. return (
  53. <div className={styles.B3flowTable} hidden={tableArr.length === 0}>
  54. <div className='B3Ftop'>申请流程</div>
  55. {/* 表格 */}
  56. <MyTable list={tableArr} columnsTemp={B3FtableC} lastBtn={tableLastBtn} pagingInfo={false} />
  57. {/* 查看富文本 */}
  58. {look ? <X2lookText closeFu={() => setLook('')} text={look} /> : null}
  59. </div>
  60. )
  61. }
  62. const MemoB3flowTable = React.memo(B3flowTable)
  63. export default MemoB3flowTable