forgeplus-react/src/forge/Order/OrderItem.js

124 lines
4.3 KiB
JavaScript
Raw Normal View History

2020-05-07 10:10:13 +08:00
import React, { Component } from 'react';
2020-03-16 14:12:11 +08:00
import { Link } from 'react-router-dom';
2020-10-27 14:38:44 +08:00
import { Popconfirm } from 'antd'
2020-05-28 11:35:57 +08:00
import { TagInfo } from '../Utils/TagColor';
2020-05-07 10:10:13 +08:00
class OrderItem extends Component {
constructor(props) {
2020-03-31 21:36:27 +08:00
super(props);
2020-05-07 10:10:13 +08:00
this.state = {
2020-03-31 21:36:27 +08:00
//显示 隐藏
2020-05-07 10:10:13 +08:00
isdisplay: false,
orderid: '',
2020-03-31 21:36:27 +08:00
}
}
2020-05-07 10:10:13 +08:00
set_issue_tags = (issue_tags) => {
if (issue_tags && issue_tags.length > 0) {
return (
issue_tags.map((item, key) => {
return (
2020-07-16 11:21:56 +08:00
<span className="mr10" key={key}>{item.name}</span>
2020-03-16 14:12:11 +08:00
)
})
)
2020-05-07 10:10:13 +08:00
} else {
return ("--")
2020-03-16 14:12:11 +08:00
}
}
2020-05-07 10:10:13 +08:00
deletedetail = (id) => {
2020-03-31 21:36:27 +08:00
this.props.deletedetail(id);
}
2020-05-07 10:10:13 +08:00
onMouseMove = (type) => {
this.setState({
isdisplay: true,
orderid: type
})
2020-03-31 21:36:27 +08:00
}
2020-05-07 10:10:13 +08:00
onMouseOut = () => {
2020-03-31 21:36:27 +08:00
this.setState({
2020-05-07 10:10:13 +08:00
isdisplay: false
})
2020-03-31 21:36:27 +08:00
}
2020-05-07 10:10:13 +08:00
render() {
const { item , checkbox , mile , user_admin_or_member } = this.props;
2020-08-13 11:42:44 +08:00
const { projectsId , owner } = this.props.match.params;
2021-09-02 16:39:35 +08:00
const { orderid , isdisplay } = this.state;
const { current_user } = this.props;
2020-05-07 10:10:13 +08:00
return (
2020-07-06 14:21:48 +08:00
item &&
2020-07-16 11:21:56 +08:00
<div className="issueItem">
2020-07-06 14:21:48 +08:00
{current_user && current_user.login && checkbox}
<div className="flex-1">
2020-08-18 16:56:52 +08:00
<p className="mb10 df" style={{alignItems:"center"}}>
2021-09-01 09:33:22 +08:00
<Link to={`/${owner}/${projectsId}/issues/${item.id}/detail`} target="_blank" title={item.name} className="hide-1 font-16 color-grey-3 lineh-30 mr10" style={{maxWidth:"370px"}}>{item.name}</Link>
2020-07-06 14:21:48 +08:00
{TagInfo(item.priority,"mr10")}
</p>
<p className="color-grey-6 font-12">
<span>{item.format_time}</span><span className="ml5"></span>
{
item.updated_at === item.format_time ? "" :
<span className="ml20"><span>{item.updated_at}</span><span className="ml5"></span></span>
}
</p>
</div>
<ul className="topWrapper_select no-cursor" onMouseMove={() => this.onMouseMove(item.id)} onMouseOut={() => this.onMouseOut()} >
<li>{this.set_issue_tags(item.issue_tags)}</li>
<li>
{
item.author_name ?
2021-08-30 10:31:51 +08:00
<Link to={`/${item.author_login}`} className="show-user-link">
2020-07-06 14:21:48 +08:00
{item.author_name}
</Link>
: "--"
}
</li>
<li>
{
item.assign_user_name ?
2021-08-30 10:31:51 +08:00
<Link to={`/${item.assign_user_login}`} className="show-user-link">
2020-07-06 14:21:48 +08:00
{item.assign_user_name}
</Link>
: "--"
}
</li>
<li>{item.tracker || "--"}</li>
{ !mile ?<li>{item.version || "--"}</li>:""}
<li>{item.issue_status || "--"}</li>
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
<li>
<div className="milepostleft">
2021-09-01 09:33:22 +08:00
<Link to={`/${owner}/${projectsId}/issues/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
2020-07-06 14:21:48 +08:00
{
user_admin_or_member ?
2021-09-02 16:39:35 +08:00
<div style={{ display: orderid === item.id && isdisplay ? 'flex' : 'none' }}>
2020-07-06 14:21:48 +08:00
<div className="mr8 ml8 color-grey-9">
2021-09-02 16:39:35 +08:00
<Link to={`/${owner}/${projectsId}/issues/${item.id}/updatedetail`} className="color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
</Link>
2020-07-06 14:21:48 +08:00
</div>
<div className="color-grey-9">
2021-09-02 16:39:35 +08:00
<Popconfirm
placement="bottom"
overlayClassName={orderid === item.id && isdisplay ? "overlayBox" : "overlayBox hideOverlay" }
title={'您确定要删除当前易修吗?'}
okText="是"
cancelText="否"
onConfirm={() => this.deletedetail(item.id)}
>
2020-07-06 14:21:48 +08:00
<i className="iconfont icon-yiguanbi1 font-14"></i>
</Popconfirm>
</div>
</div>
: ""
}
</div>
</li>
</ul>
</div>
2020-03-16 14:12:11 +08:00
)
}
}
export default OrderItem;