TimeNode.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import React, { useEffect, useState, useRef } from 'react';
  2. import { Form } from '@ant-design/compatible';
  3. import '@ant-design/compatible/assets/index.css';
  4. import { connect } from 'dva';
  5. import { Steps, Button } from 'antd';
  6. import styles from './Index.less';
  7. const { Step } = Steps;
  8. // 时间节点
  9. function TimeNode(props) {
  10. const {
  11. flow: { current, list, active },
  12. isAuditor,
  13. onApprove,
  14. } = props;
  15. if (!list || list.FlowNodes?.length != 0) {
  16. return (
  17. <div className={styles.top}>
  18. <Steps current={current} status={active == 0 ? 'error' : 'process'}>
  19. {list.FlowNodes.map(item => (
  20. <Step
  21. key={item.id}
  22. title={item.node}
  23. description={
  24. item?.AuditRoleInfo
  25. ? `审批人:${item?.AuditRoleInfo.Name || '-'}`
  26. : `审批人:${item?.AuditorUser.CName || '-'}`
  27. }
  28. />
  29. ))}
  30. </Steps>
  31. <div className={styles.btns} style={{ marginLeft: 80 }}>
  32. {isAuditor && active != 0 && (
  33. <>
  34. <Button type="primary" onClick={() => onApprove(true)}>
  35. 审批通过
  36. </Button>
  37. <Button onClick={() => onApprove(false)} danger>
  38. 审批拒绝
  39. </Button>
  40. </>
  41. )}
  42. </div>
  43. </div>
  44. );
  45. }
  46. // else {
  47. // if (!flowDetail?.nodes) return;
  48. // const node = flowDetail.nodes.find(item => item.Id == nodeId);
  49. // return `当前节点:${node?.label || '-'}`;
  50. // }
  51. return null;
  52. }
  53. export default TimeNode;