|
|
|
@ -1,19 +1,44 @@
|
|
|
|
|
import React , { Component } from "react";
|
|
|
|
|
import {Link} from 'react-router-dom';
|
|
|
|
|
import { Input ,Dropdown , Menu , Icon } from 'antd';
|
|
|
|
|
import { Input ,Dropdown , Menu , Icon , Pagination , Spin } from 'antd';
|
|
|
|
|
import './order.css';
|
|
|
|
|
|
|
|
|
|
import NoneData from '../../modules/courses/coursesPublic/NoneData';
|
|
|
|
|
import Nav from './Nav';
|
|
|
|
|
import OrderItem from './OrderItem';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
const Search = Input.Search;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* issue_chosen:下拉的筛选列表,
|
|
|
|
|
* data:列表接口返回的所有数据,
|
|
|
|
|
* issues:列表数组,
|
|
|
|
|
* isSpin:加载中,
|
|
|
|
|
* search:搜索关键字,
|
|
|
|
|
* author_id:发布者id,
|
|
|
|
|
* assigned_to_id:指派给。。。的id,
|
|
|
|
|
* limit:每页条数,
|
|
|
|
|
* page:当前页,
|
|
|
|
|
* search_count:列表总条数
|
|
|
|
|
* issue_type:搜索条件
|
|
|
|
|
*/
|
|
|
|
|
class order extends Component{
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props);
|
|
|
|
|
this.state={
|
|
|
|
|
issue_chosen:undefined
|
|
|
|
|
issue_chosen:undefined,
|
|
|
|
|
data:undefined,
|
|
|
|
|
issues:undefined,
|
|
|
|
|
isSpin:false,
|
|
|
|
|
search:undefined,
|
|
|
|
|
author_id:undefined,
|
|
|
|
|
assigned_to_id:undefined,
|
|
|
|
|
limit:15,
|
|
|
|
|
page:1,
|
|
|
|
|
search_count:undefined,
|
|
|
|
|
issue_type:undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -37,43 +62,120 @@ class order extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getIssueList=()=>{
|
|
|
|
|
// 获取列表数据
|
|
|
|
|
getIssueList=(page,limit,search,author_id,assigned_to_id,issue_type)=>{
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
|
|
|
|
const url = `/projects/${projectsId}/issues.json`;
|
|
|
|
|
axios.get(url,{
|
|
|
|
|
params:{}
|
|
|
|
|
params:{
|
|
|
|
|
page,limit,search,author_id,assigned_to_id,issue_type
|
|
|
|
|
}
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
data:result.data,
|
|
|
|
|
issues:result.data.issues,
|
|
|
|
|
search_count:result.data.search_count,
|
|
|
|
|
isSpin:false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getOption=(e)=>{
|
|
|
|
|
console.log(e);
|
|
|
|
|
getOption=(e,id)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
[id]:e.key
|
|
|
|
|
})
|
|
|
|
|
const { page,limit,search,author_id,assigned_to_id } = this.state;
|
|
|
|
|
this.getIssueList(page,limit,search,author_id,assigned_to_id,e.key);
|
|
|
|
|
}
|
|
|
|
|
renderMenu =(array,name)=>{
|
|
|
|
|
|
|
|
|
|
renderMenu =(array,name,id)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Menu>
|
|
|
|
|
<Menu.Item key="0" onClick={this.getOption}>{name}</Menu.Item>
|
|
|
|
|
<Menu.Item key="0" onClick={(e)=>this.getOption(e,id)}>{name}</Menu.Item>
|
|
|
|
|
{
|
|
|
|
|
array && array.length > 0 && array.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<Menu.Item key={item.id} onClick={this.getOption}>{item.name}</Menu.Item>
|
|
|
|
|
<Menu.Item key={item.id} onClick={(e)=>this.getOption(e,id)}>{item.name}</Menu.Item>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</Menu>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 翻页
|
|
|
|
|
ChangePage=(page)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
page,
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
const {limit,search} = this.state;
|
|
|
|
|
this.getIssueList(page,limit,search);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 搜索
|
|
|
|
|
searchFunc=(value)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
search:value,
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
const {page,limit} = this.state;
|
|
|
|
|
this.getIssueList(page,limit,value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 筛选:全部、指派给我、由我创建
|
|
|
|
|
ChangeAssign=(type)=>{
|
|
|
|
|
const { limit, search} = this.state;
|
|
|
|
|
this.setState({
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
if(type){
|
|
|
|
|
const { current_user } = this.props;
|
|
|
|
|
if(type===1){
|
|
|
|
|
this.setState({
|
|
|
|
|
page:1,
|
|
|
|
|
author_id:current_user.user_id,
|
|
|
|
|
assigned_to_id:undefined
|
|
|
|
|
})
|
|
|
|
|
this.getIssueList(1,limit,search,current_user.user_id,undefined);
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
page:1,
|
|
|
|
|
author_id:undefined,
|
|
|
|
|
assigned_to_id:current_user.user_id
|
|
|
|
|
})
|
|
|
|
|
this.getIssueList(1,limit,search,undefined,current_user.user_id);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
page:1,
|
|
|
|
|
author_id:undefined,
|
|
|
|
|
assigned_to_id:undefined
|
|
|
|
|
})
|
|
|
|
|
this.getIssueList(1,limit,search,undefined,undefined);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
|
|
|
|
|
const { issue_chosen } = this.state;
|
|
|
|
|
const { issue_chosen , issues , limit , page , search_count , data , assigned_to_id , author_id , isSpin } = this.state;
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
|
|
|
|
const Paginations = (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{
|
|
|
|
|
search_count > limit ?
|
|
|
|
|
<div className="mt30 mb50 edu-txt-center">
|
|
|
|
|
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
|
|
|
|
|
</div>:""
|
|
|
|
|
}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
)
|
|
|
|
|
return(
|
|
|
|
|
<div className="main">
|
|
|
|
|
<div className="topWrapper">
|
|
|
|
@ -82,86 +184,73 @@ class order extends Component{
|
|
|
|
|
</div>
|
|
|
|
|
<div className="topWrapper" style={{borderBottom:"none"}}>
|
|
|
|
|
<p className="topWrapper_nav">
|
|
|
|
|
<span>2个开启中</span>
|
|
|
|
|
<span>100个已关闭</span>
|
|
|
|
|
<span>{data && data.open_count}个开启中</span>
|
|
|
|
|
<span>{data && data.close_count}个已关闭</span>
|
|
|
|
|
</p>
|
|
|
|
|
<div>
|
|
|
|
|
<Search
|
|
|
|
|
placeholder="搜索"
|
|
|
|
|
enterButton
|
|
|
|
|
onSearch={value => console.log(value)}
|
|
|
|
|
onSearch={this.searchFunc}
|
|
|
|
|
style={{ width: 300 }}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="f-wrap-between mb20">
|
|
|
|
|
<ul className="topWrapper_type">
|
|
|
|
|
<li className="active">全部</li>
|
|
|
|
|
<li>指派给我</li>
|
|
|
|
|
<li>由我创建</li>
|
|
|
|
|
<li>@我的</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<ul className="topWrapper_select">
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag,'标签')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>标签<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_type,'所有类型')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>类型<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker,'所有分类')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>分类<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user,'发布人')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>发布人<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user,'指派人')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>指派人<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.priority,'优先度')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>优先度<Icon type="caret-down" className="ml5"/></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio,'完成度')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>完成度<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div className="issueItem">
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
<p className="mb15 df">
|
|
|
|
|
<span className="issueNo">#10</span>
|
|
|
|
|
<span className="flex-1 hide-1 font-16 color-grey-3 lineh-30">forge重构:issue列表issue列表issue列表issue列表</span>
|
|
|
|
|
</p>
|
|
|
|
|
<p className="color-grey-6">
|
|
|
|
|
<span>1小时前创建</span>
|
|
|
|
|
<span className="ml20"><i className="iconfont icon-pinglun1 mr3 font-16"></i>3</span>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<Spin spinning={isSpin}>
|
|
|
|
|
<div className="f-wrap-between mb20">
|
|
|
|
|
<ul className="topWrapper_type">
|
|
|
|
|
<li className={!author_id && !assigned_to_id ? "active":""} onClick={()=>this.ChangeAssign()}>全部</li>
|
|
|
|
|
<li className={author_id ? "active":""} onClick={()=>this.ChangeAssign(1)}>指派给我</li>
|
|
|
|
|
<li className={assigned_to_id ? "active":""} onClick={()=>this.ChangeAssign(2)}>由我创建</li>
|
|
|
|
|
{/* <li>@我的</li> */}
|
|
|
|
|
</ul>
|
|
|
|
|
<ul className="topWrapper_select">
|
|
|
|
|
<li>release</li>
|
|
|
|
|
<li>普通</li>
|
|
|
|
|
<li>缺陷</li>
|
|
|
|
|
<li>猜猜</li>
|
|
|
|
|
<li>猜猜猜</li>
|
|
|
|
|
<li>高</li>
|
|
|
|
|
<li>0%</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag,'标签','issue_tag_id')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>标签<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_type,'所有类型','issue_type')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>类型<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker,'所有分类','tracker_id')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>分类<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user,'发布人','author_id')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>发布人<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user,'指派人','assigned_to_id')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>指派人<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.priority,'优先度','priority_id')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>优先度<Icon type="caret-down" className="ml5"/></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio,'完成度','done_ratio')} trigger={['click']} placement="bottomCenter">
|
|
|
|
|
<span>完成度<Icon type="caret-down" className="ml5" /></span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
search_count === 0 ?
|
|
|
|
|
<NoneData></NoneData>
|
|
|
|
|
:
|
|
|
|
|
<OrderItem issues={issues} search_count={search_count} page={page} limit={limit}></OrderItem>
|
|
|
|
|
}
|
|
|
|
|
{ Paginations }
|
|
|
|
|
</Spin>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|