TimeNode.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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={`审批角色:${item?.AuditRoleInfo.Name || '-'}`}
  24. />
  25. ))}
  26. </Steps>
  27. <div className={styles.btns} style={{ marginLeft: 80 }}>
  28. {isAuditor && active != 0 && (
  29. <>
  30. <Button type="primary" onClick={() => onApprove(true)}>
  31. 审批通过
  32. </Button>
  33. <Button onClick={() => onApprove(false)} danger>
  34. 审批拒绝
  35. </Button>
  36. </>
  37. )}
  38. </div>
  39. </div>
  40. );
  41. }
  42. // else {
  43. // if (!flowDetail?.nodes) return;
  44. // const node = flowDetail.nodes.find(item => item.Id == nodeId);
  45. // return `当前节点:${node?.label || '-'}`;
  46. // }
  47. return null;
  48. }
  49. export default TimeNode;