HistoryDrawer.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import React, { useEffect, useState, useRef, useMemo } from 'react';
  2. import { UserOutlined } from '@ant-design/icons';
  3. import { Form } from '@ant-design/compatible';
  4. import '@ant-design/compatible/assets/index.css';
  5. import { Drawer, Descriptions, Card, Table } from 'antd';
  6. import moment from 'moment';
  7. import { connect } from 'dva';
  8. import CommentContent from '@/components/CommentContent';
  9. // 评论
  10. function HistoryDrawer(props) {
  11. const {
  12. visible,
  13. onClose,
  14. version,
  15. loading,
  16. dispatch,
  17. versionTree,
  18. onChangeVersion,
  19. } = props;
  20. const columns = useMemo(() => {
  21. return [
  22. {
  23. title: '名称',
  24. width: '33%',
  25. render: item => (
  26. <div style={{ color: '#9b9b9b'}}>
  27. {/* {item.id == version.id && <dix style={{ marginRight: 10 }} />} */}
  28. {`${item.version_name}.${item.version_no}`}
  29. </div>
  30. ),
  31. },
  32. // {
  33. // title: '状态',
  34. // width: '33%',
  35. // render: item => {
  36. // let style = { color: getColor(item) };
  37. // let txt = '';
  38. // switch (item.audit_status) {
  39. // case 0:
  40. // txt = '未提交';
  41. // break;
  42. // case 1:
  43. // txt = '待审批';
  44. // break;
  45. // case 2:
  46. // txt = '拒绝';
  47. // break;
  48. // case 3:
  49. // txt = '通过';
  50. // break;
  51. // case 4:
  52. // txt = '已提交';
  53. // break;
  54. // }
  55. // return <span style={style}>{txt}</span>;
  56. // },
  57. // },
  58. {
  59. title: '操作',
  60. render: item =>
  61. item.id != version.id && (
  62. <a
  63. onClick={() => {
  64. onChangeVersion(item);
  65. onClose();
  66. }}
  67. >
  68. 切换
  69. </a>
  70. ),
  71. },
  72. ];
  73. }, [version]);
  74. // const [commentList, setCommentList] = useState([]);
  75. // const handleSubmitBom = (value, callback) => {
  76. // if (!value) return;
  77. // dispatch({
  78. // type: 'detail/addBomComment',
  79. // payload: {
  80. // excel_id: version.id,
  81. // comment: value,
  82. // },
  83. // callback,
  84. // });
  85. // };
  86. // const handleSubmitCell = (value, callback) => {
  87. // if (!value) return;
  88. // dispatch({
  89. // type: 'detail/addComment',
  90. // payload: {
  91. // ...cellPosition.current,
  92. // comment: value,
  93. // },
  94. // callback,
  95. // });
  96. // };
  97. useEffect(() => {
  98. console.log("====================================",versionTree)
  99. }, [version.id]);
  100. return (
  101. <Drawer
  102. width={600}
  103. title="历史版本"
  104. mask={false}
  105. placement="right"
  106. onClose={onClose}
  107. visible={visible}
  108. >
  109. <Table columns={columns} dataSource={versionTree} bordered={false} />
  110. </Drawer>
  111. );
  112. }
  113. export default connect(({ detail, user, loading }) => ({
  114. comment: detail.comment,
  115. userList: user.list,
  116. bomComment: detail.bomComment,
  117. loading: loading,
  118. }))(HistoryDrawer);