import React, { useEffect, useState, useRef } from 'react';
import { UserOutlined } from '@ant-design/icons';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Drawer, Descriptions, Card } from 'antd';
import moment from 'moment';
import { connect } from 'dva';
import CommentContent from '@/components/CommentContent';
// 评论
function RightDrawer(props) {
const {
visible,
onClose,
comment,
bomComment,
addComment,
version,
loading,
dispatch,
userList,
cellPosition,
} = props;
// const [commentList, setCommentList] = useState([]);
const handleSubmitBom = (value, callback) => {
if (!value) return;
dispatch({
type: 'detail/addBomComment',
payload: {
excel_id: version.id,
comment: value,
},
callback,
});
};
const handleSubmitCell = (value, callback) => {
if (!value) return;
dispatch({
type: 'detail/addComment',
payload: {
...cellPosition.current,
comment: value,
},
callback,
});
};
useEffect(() => {
if (!version.id || !visible) return;
dispatch({
type: 'detail/queryBomComment',
payload: { excel_id: version.id },
});
}, [version.id,visible]);
return (
);
}
function BomContetn(props) {
const { version, userList } = props;
console.log(userList)
return (
{version.version_name}
{userList.find(item => item.ID == version.author)?.CName}
{moment(version.c_time).format('YYYY-MM-DD')}
{version.desc}
);
}
export default connect(({ detail, user, loading }) => ({
comment: detail.comment,
userList: user.list,
bomComment: detail.bomComment,
loading: loading,
}))(RightDrawer);