This commit is contained in:
caishi 2020-05-07 10:10:13 +08:00
parent 116b2bf023
commit 847f8ad45d
22 changed files with 3565 additions and 3747 deletions

View File

@ -1,18 +1,18 @@
import React , { Component } from 'react';
import { Link} from 'react-router-dom';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
class DetailTop extends Component{
render(){
class DetailTop extends Component {
render() {
const { projectDetail } = this.props;
const { projectsId } = this.props.match.params;
const { pathname } = this.props.location;
return(
return (
<p className="branch-wrapper">
<Link to={`/projects/${projectsId}/coders/commit`} className={ pathname.indexOf("/coders/commit") > 0 ? "active" : ""}>
<Link to={`/projects/${projectsId}/coders/commit`} className={pathname.indexOf("/coders/commit") > 0 ? "active" : ""}>
<i className="iconfont icon-tijiaojilu font-18 mr3"></i>
<span className="mr3">{projectDetail && projectDetail.commits_count}</span>
</Link>
<Link to={`/projects/${projectsId}/coders/branch`} className={ pathname.indexOf("/coders/branch") > 0 ? "active" : ""}>
<Link to={`/projects/${projectsId}/coders/branch`} className={pathname.indexOf("/coders/branch") > 0 ? "active" : ""}>
<i className="iconfont icon-fenzhi font-18 mr3"></i>
<span className="mr3">{projectDetail && projectDetail.branches_count}</span>
</Link>

View File

@ -1,41 +1,38 @@
import React , { Component } from 'react';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Menu , Input , Dropdown , Icon, Spin , Pagination } from 'antd';
import { Menu, Input, Dropdown , Spin, Pagination } from 'antd';
import '../css/index.css'
import './list.css';
import ListItem from './IndexItem'
import axios from 'axios';
import img_new from '../Images/new.png';
import img_array from '../Images/array.png';
const Search = Input.Search;
class Index extends Component{
constructor(props){
class Index extends Component {
constructor(props) {
super(props);
this.state={
projectsList:undefined,
page:1,
limit:15,
search:undefined,
sort:undefined,
total:0,
isSpin:true,
project_type:undefined,
category_id:undefined,
this.state = {
projectsList: undefined,
page: 1,
limit: 15,
search: undefined,
sort: undefined,
total: 0,
isSpin: true,
project_type: undefined,
category_id: undefined,
typeList:undefined,
categoryList:undefined
typeList: undefined,
categoryList: undefined
}
}
componentDidMount=()=>{
const { page,limit, search , sort ,project_type,category_id} = this.state;
this.getListData(page,limit, search , sort,project_type,category_id);
componentDidMount = () => {
const { page, limit, search, sort, project_type, category_id } = this.state;
this.getListData(page, limit, search, sort, project_type, category_id);
this.getType();
@ -43,43 +40,45 @@ class Index extends Component{
}
// 获取列表
getListData=(page,limit, search , sort,project_type,category_id)=>{
getListData = (page, limit, search, sort, project_type, category_id) => {
const { current_user } = this.props;
const url = `/projects.json`;
axios.get(url,{params:{
user_id:current_user && current_user.user_id,
page,
limit,
search,
sort_by:sort,
project_type,
category_id
}}).then((result)=>{
if(result){
axios.get(url, {
params: {
user_id: current_user && current_user.user_id,
page,
limit,
search,
sort_by: sort,
project_type,
category_id
}
}).then((result) => {
if (result) {
this.setState({
projectsList:result.data.projects,
total:result.data.total_count,
isSpin:false
projectsList: result.data.projects,
total: result.data.total_count,
isSpin: false
})
}
}).catch((error)=>{})
}).catch((error) => { })
}
// 获取类型
getType=()=>{
getType = () => {
const url = `/projects/group_type_list.json`;
axios.get(url).then((result)=>{
if(result && result.data){
axios.get(url).then((result) => {
if (result && result.data) {
this.setTypeList(result.data, undefined)
}
}).catch((error)=>{})
}).catch((error) => { })
}
setTypeList=(list, active_type)=>{
setTypeList = (list, active_type) => {
this.setState({
typeList:list.map((item,key)=>{
return(
<li key={key} className={active_type && active_type === item.project_type ? 'active' : ''} onClick={()=>this.changeType(`${item.project_type}`, list)}>
typeList: list.map((item, key) => {
return (
<li key={key} className={active_type && active_type === item.project_type ? 'active' : ''} onClick={() => this.changeType(`${item.project_type}`, list)}>
<p>
<span className="font-16">{item.name}</span>
<span className="color-blue">{item.projects_count}</span>
@ -91,33 +90,33 @@ class Index extends Component{
}
// 切换类型
changeType=(type,list)=>{
changeType = (type, list) => {
this.setState({
isSpin:true,
project_type:type,
search:undefined
isSpin: true,
project_type: type,
search: undefined
})
this.setTypeList(list,type)
const { page,limit, sort,category_id } = this.state;
this.getListData(page,limit, undefined , sort, type ,category_id);
this.setTypeList(list, type)
const { page, limit, sort, category_id } = this.state;
this.getListData(page, limit, undefined, sort, type, category_id);
}
// 获取类型
getCategory=()=>{
getCategory = () => {
const url = `/project_categories/group_list.json`;
axios.get(url).then((result)=>{
if(result && result.data){
axios.get(url).then((result) => {
if (result && result.data) {
this.setCategoryList(result.data, undefined);
}
}).catch((error)=>{})
}).catch((error) => { })
}
setCategoryList=(list, active_id)=>{
setCategoryList = (list, active_id) => {
this.setState({
categoryList:list.map((item,key)=>{
return(
<li key={key} className={active_id && parseInt(active_id) === item.id ? 'active' : ''} onClick={()=>this.changeCategory(`${item.id}`,list)}>
categoryList: list.map((item, key) => {
return (
<li key={key} className={active_id && parseInt(active_id) === item.id ? 'active' : ''} onClick={() => this.changeCategory(`${item.id}`, list)}>
<p>
<span className="font-16">{item.name}</span>
<span className="color-blue">{item.projects_count}</span>
@ -128,58 +127,58 @@ class Index extends Component{
})
}
changeCategory=(id,list)=>{
changeCategory = (id, list) => {
this.setState({
category_id:id,
page:1
category_id: id,
page: 1
});
this.setCategoryList(list,id)
const { limit , sort, project_type } = this.state;
this.getListData(1,limit, undefined , sort, project_type ,id);
this.setCategoryList(list, id)
const { limit, sort, project_type } = this.state;
this.getListData(1, limit, undefined, sort, project_type, id);
}
// 排序
ChangeSoryBy=(e)=>{
ChangeSoryBy = (e) => {
this.setState({
sort_by:e.key,
page:1,
search:undefined,
isSpin:true
sort_by: e.key,
page: 1,
search: undefined,
isSpin: true
})
const { limit,project_type,category_id } = this.state;
this.getListData(1 ,limit , undefined , e.key,project_type,category_id);
const { limit, project_type, category_id } = this.state;
this.getListData(1, limit, undefined, e.key, project_type, category_id);
}
// 搜索
searchFun=(value)=>{
searchFun = (value) => {
// console.log(value)
this.setState({
page:1,
search:value,
isSpin:true,
project_type:undefined,
page: 1,
search: value,
isSpin: true,
project_type: undefined,
sort: "updated_on"
})
const { limit , sort , category_id } = this.state;
this.getListData(1 ,limit, value , sort , undefined,category_id);
const { limit, sort, category_id } = this.state;
this.getListData(1, limit, value, sort, undefined, category_id);
}
changeSearchValue=(e)=>{
changeSearchValue = (e) => {
this.setState({
search:e.target.value
search: e.target.value
})
}
// 翻页
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page
})
const { limit, search , sort,project_type,category_id } = this.state;
this.getListData(page,limit, search , sort,project_type,category_id);
const { limit, search, sort, project_type, category_id } = this.state;
this.getListData(page, limit, search, sort, project_type, category_id);
}
render(){
render() {
const { current_user } = this.props;
const menu=(
const menu = (
<Menu onClick={this.ChangeSoryBy}>
<Menu.Item key="updated_on">更新时间排序</Menu.Item>
<Menu.Item key="created_on">创建时间排序</Menu.Item>
@ -187,35 +186,35 @@ class Index extends Component{
<Menu.Item key="praises_count">点赞数量排序</Menu.Item>
</Menu>
)
const newItem=(
const newItem = (
<Menu>
<Menu.Item key="created_mirror"><Link to={`/projects/mirror/new`}>新建镜像项目</Link></Menu.Item>
<Menu.Item key="created_deposit"><Link to={`/projects/deposit/new`}>新建托管项目</Link></Menu.Item>
</Menu>
)
const { projectsList , isSpin , total , search , limit , page , typeList , categoryList } = this.state;
const { projectsList, isSpin, total, search, limit, page, typeList, categoryList } = this.state;
const pagination = (
total && total > limit ?
<div className="edu-txt-center pt30 mb30">
<Pagination simple defaultCurrent={page} total={total} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
<div className="edu-txt-center pt30 mb30">
<Pagination simple defaultCurrent={page} total={total} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
)
return(
<div style={{background:"#fafafa"}}>
return (
<div style={{ background: "#fafafa" }}>
<p className="t_project_banner"></p>
<div className="main ProjectListIndex">
<div className="list-left">
<ul className="list-l-Menu">
<li className="MenuTitle">项目类型</li>
{ typeList }
{typeList}
</ul>
<ul className="list-l-Menu">
<li className="MenuTitle">项目类别</li>
{ categoryList }
{categoryList}
</ul>
</div>
<div className="list-right boxShandow padding0-25">
@ -226,14 +225,14 @@ class Index extends Component{
current_user && current_user.login &&
<Dropdown overlay={newItem} trigger={["click"]} placement='bottomRight' className="mr30">
<a className="ant-dropdown-link">
<span className="color-blue font-16"><img src={img_new} alt="" width="13px"/> 新建</span>
<span className="color-blue font-16"><img src={img_new} alt="" width="13px" /> 新建</span>
</a>
</Dropdown>
}
<Dropdown overlay={menu} trigger={['click']} placement='bottomRight'>
<a className="ant-dropdown-link">
<span className="color-blue font-16">排序 <img src={img_array} alt="" width="10px"/></span>
<span className="color-blue font-16">排序 <img src={img_array} alt="" width="10px" /></span>
</a>
</Dropdown>
</div>
@ -248,7 +247,7 @@ class Index extends Component{
/>
</div>
<ListItem {...this.props} {...this.state} projects={projectsList}></ListItem>
{ pagination }
{pagination}
</Spin>
</div>
</div>

View File

@ -1,44 +1,37 @@
import React , { Component } from 'react';
import React, { Component } from 'react';
import { getImageUrl } from 'educoder';
import { Link } from 'react-router-dom';
import '../css/index.css'
import './list.css';
import img_parise from '../Images/parise.png';
import img_fork from '../Images/fork.png';
class IndexItem extends Component{
// constructor(props){
// super(props);
// }
TurnToDetail=(login,url)=>{
class IndexItem extends Component {
TurnToDetail = (login, url) => {
this.props.history.push({
pathname:url,
state:login
pathname: url,
state: login
})
}
render(){
render() {
const { projects } = this.props;
// item.author.login
const renderList = (
projects && projects.length >0 ? projects.map((item,key)=>{
return(
projects && projects.length > 0 ? projects.map((item, key) => {
return (
<div className="p-r-Item" key={key}>
<Link to={`/users/${item.author.login}/projects`} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`images/${item.author && item.author.image_url}`)} ></img>
</Link>
<div className="p-r-Infos">
<div className="p-r-name">
<Link to={`/projects/${item.id}/coders`} className="hide-1 color-grey-3 font-18 task-hide " style={{whiteSpace:"wrap",display:'flex',width:400}}>
<Link to={`/projects/${item.id}/coders`} className="hide-1 color-grey-3 font-18 task-hide " style={{ whiteSpace: "wrap", display: 'flex', width: 400 }}>
{item.author.name}/{item.name}
{
item.forked_from_project_id ?
<span className="ml5">
<img src={img_fork} alt="" width="14px"/>
<img src={img_fork} alt="" width="14px" />
</span>
: ""
}
</Link>
{
item.is_public ? "" :
@ -46,28 +39,27 @@ class IndexItem extends Component{
}
</div>
<div className="p-r-content">
<p className="break_word task-hide flex1" style={{maxHeight:"40px",width:"0"}}>{item.description}</p>
<p className="break_word task-hide flex1" style={{ maxHeight: "40px", width: "0" }}>{item.description}</p>
<span className="p-r-tags">
{/* { item.forked_count ? <span><label>Fork</label><span>{ item.forked_count}</span></span>:"" } */}
<span className="pariseTag"><img src={img_parise} alt="" className="pariseImg"/> ({ item.praises_count })</span>
{ item.language && item.language.id ? <span><label>{ item.language.name }</label></span>:"" }
<span className="pariseTag"><img src={img_parise} alt="" className="pariseImg" /> ({item.praises_count})</span>
{item.language && item.language.id ? <span><label>{item.language.name}</label></span> : ""}
</span>
</div>
<div className="p-r-about">
<span className="p-r-detail">
<span><label>浏览量</label>{item.visits}</span>
{ item.category && item.category.id && <span><label>项目类别</label>{item.category.name}</span>}
{item.last_update_time ? <span ><label>更新于</label>{item.time_ago}</span> : "" }
{item.category && item.category.id && <span><label>项目类别</label>{item.category.name}</span>}
{item.last_update_time ? <span ><label>更新于</label>{item.time_ago}</span> : ""}
</span>
</div>
</div>
</div>
)
}):""
}) : ""
)
return(
return (
<div className="project-list">
{ renderList }
{renderList}
</div>
)
}

View File

@ -1,343 +1,317 @@
import React , {Component} from 'react';
import {Link} from 'react-router-dom';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import Nav from '../Order/Nav';
import UploadComponent from '../Upload/Index';
import{ Modal,Col,Form,Input,Tooltip,Popconfirm } from 'antd'
import { Modal , Form, Input, Tooltip, Popconfirm } from 'antd'
import NoneData from '../Nodata';
const TextArea = Input.TextArea;
class MergeDetail extends Component{
constructor(props){
class MergeDetail extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
isShow:false,
imgsrc:'',
journalsdata:undefined,
this.state = {
data: undefined,
isShow: false,
imgsrc: '',
journalsdata: undefined,
//图片区域是否显示 none 隐藏 block 显示
display:'none',
titledisplay:'none',
countvalue:'',
display: 'none',
titledisplay: 'none',
countvalue: '',
//是否需要编辑
isedit:'block',
isedit: 'block',
showFiles: true
}
}
componentDidMount=()=>{
componentDidMount = () => {
this.getDetail();
}
getDetail=()=>{
const { projectsId , mergeid} = this.props.match.params;
getDetail = () => {
const { projectsId, mergeid } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeid}.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data,
data: result.data,
})
this.getjournalslist();
this.getjournalslist();
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
handleok=() => {
this.setState({
isShow:false
});
};
handleCancel=()=>{
this.setState({
isShow:false
});
}
handleok = () => {
this.setState({
isShow: false
});
};
handleCancel = () => {
this.setState({
isShow: false
});
}
imgshow=()=>{
this.setState({
isShow:true
});
};
imgshow = () => {
this.setState({
isShow: true
});
};
//添加评论
addjournals=()=>{
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { data } = this.state;
const url = `/issues/${data.pull_request.id}/journals.json`;
axios.post(url,{
...values,
issue_id:data.id,
}).then(result=>{
if(result){
this.setState({
showFiles: false
})
this.getjournalslist();
}
}).catch(error=>{
console.log(error);
})
}
})
}
//获取评论信息
getjournalslist=()=>{
const { data } = this.state;
const url = `/issues/${data.pull_request.id}/journals.json`;
let id=data.id;
axios.get(url,{
params:{
id
}
}).then(result=>{
if(result){
this.setState({
journalsdata:result.data
})
}
}).catch(error=>{
console.log(error);
})
}
//关闭任务
closedetail=(id)=>{
const {projectsId,orderId} = this.props.match.params;
//添加评论
addjournals = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { data } = this.state;
const url = `/issues/${data.pull_request.id}/journals.json`;
axios.post(url, {
...values,
issue_id: data.id,
}).then(result => {
if (result) {
this.setState({
showFiles: false
})
this.getjournalslist();
}
}).catch(error => {
console.log(error);
})
}
})
}
//获取评论信息
getjournalslist = () => {
const { data } = this.state;
const url = `/issues/${data.pull_request.id}/journals.json`;
let id = data.id;
axios.get(url, {
params: {
id
}
}).then(result => {
if (result) {
this.setState({
journalsdata: result.data
})
}
}).catch(error => {
console.log(error);
})
}
//关闭任务
closedetail = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/close_issue.json`;
axios.post(url,{
project_id:projectsId,
id:orderId,
status_id:id,
}).then(result=>{
if(result){
axios.post(url, {
project_id: projectsId,
id: orderId,
status_id: id,
}).then(result => {
if (result) {
this.getDetail();
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
}
//修改评论
updatedetail=(id)=>{
const {mergeid} = this.props.match.params;
const url = `/issues/${mergeid}/journals/${id}.json`;
axios.put(url,{
issue_id:mergeid,
id:id,
content:this.state.countvalue
}).then(result=>{
if(result){
this.setState({
isedit:'block'
})
this.getjournalslist();
}
}).catch(error=>{
console.log(error);
})
}
changmodelname=(e)=>{
this.setState({
countvalue:e.target.value
})
}
editdetail=(count,status)=>{
this.setState({
countvalue:count,
isedit:status
})
}
// 判断是否重新上传文件
changeIsComplete=(flag)=>{
this.setState({
showFiles:flag
//修改评论
updatedetail = (id) => {
const { mergeid } = this.props.match.params;
const url = `/issues/${mergeid}/journals/${id}.json`;
axios.put(url, {
issue_id: mergeid,
id: id,
content: this.state.countvalue
}).then(result => {
if (result) {
this.setState({
isedit: 'block'
})
this.getjournalslist();
}
}).catch(error => {
console.log(error);
})
}
render(){
const { projectsId , mergeid } = this.props.match.params;
const { data,journalsdata, showFiles } = this.state;
changmodelname = (e) => {
this.setState({
countvalue: e.target.value
})
}
editdetail = (count, status) => {
this.setState({
countvalue: count,
isedit: status
})
}
// 判断是否重新上传文件
changeIsComplete = (flag) => {
this.setState({
showFiles: flag
})
}
render() {
const { projectsId, mergeid } = this.props.match.params;
const { data, journalsdata, showFiles } = this.state;
const { getFieldDecorator } = this.props.form;
const url = this.props.history.location.pathname;
const renderList =()=>{
if(journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length>0 ){
return(
<div className="tagList">{
journalsdata.issue_journals.map((item,key)=>{
return(
<li>
<div className="df">
<Link to={``}><img class="user_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/></Link>
<div className="detail_context" >
<div className="topWrapper_detali">
<p className="detail_p">{item.user_name}
<Tooltip title={item.format_time} placement="bottom">
<span className="commenttitle">{item.created_at}</span>
</Tooltip>
评论</p>
<div className="detail_right">
<i className="iconfont icon-weibiaoti1 font-18 mr3" onClick={()=>this.editdetail(item.content,'none')}></i>
<div style={{width:20}}></div>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗'} okText="是" cancelText="否" onConfirm={()=>this.deletedetail(item.id)}>
<i className="iconfont icon-yiguanbi1 font-18 mr3"></i>
</Popconfirm>
</div>
</div>
<div className="detail_ptitlecount">
<p style={{display:this.state.isedit}} >{item.content}</p>
<div style={{display:this.state.isedit==='none'?'block':'none'}}>
<TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/>
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={()=>this.updatedetail(item.id)}>保存</a>
<a className="Closeor_btn fr" type="submit" onClick={()=>this.editdetail(item.content,'block')}>取消</a>
</p>
</div>
</div>
<div style={{display: this.state.display}}>
<div className="div_line" ></div>
{/* <List
grid={{ gutter: 16, column: 6 }}
dataSource={valuse}
renderItem={obj => (
<List.Item>
<img class="list_img" onClick={this.imgshow} src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</List.Item>
)}
/> */}
const renderList = () => {
if (journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length > 0) {
return (
<div className="tagList">{
journalsdata.issue_journals.map((item, key) => {
return (
<li>
<div className="df">
<Link to={``}><img class="user_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" /></Link>
<div className="detail_context" >
<div className="topWrapper_detali">
<p className="detail_p">{item.user_name}
<Tooltip title={item.format_time} placement="bottom">
<span className="commenttitle">{item.created_at}</span>
</Tooltip>
评论</p>
<div className="detail_right">
<i className="iconfont icon-weibiaoti1 font-18 mr3" onClick={() => this.editdetail(item.content, 'none')}></i>
<div style={{ width: 20 }}></div>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>
<i className="iconfont icon-yiguanbi1 font-18 mr3"></i>
</Popconfirm>
</div>
</div>
<div className="detail_ptitlecount">
<p style={{ display: this.state.isedit }} >{item.content}</p>
<div style={{ display: this.state.isedit === 'none' ? 'block' : 'none' }}>
<TextArea style={{ height: "200px" }} value={this.state.countvalue} onChange={this.changmodelname} />
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={() => this.updatedetail(item.id)}>保存</a>
<a className="Closeor_btn fr" type="submit" onClick={() => this.editdetail(item.content, 'block')}>取消</a>
</p>
</div>
</div>
<div style={{ display: this.state.display }}>
<div className="div_line" ></div>
</div>
</div>
</div>
</div>
<div className="order_line" style={{marginLeft:80}}></div>
</li>
)
})
}
</div>
)
}else{
return(
<NoneData _html="暂时还没有相关数据哦!" />
)
}
}
return(
<div className="main">
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state}/>*/}
{/*{*/}
{/*data && data.issue.user_permission ?*/}
{/*<Link to={`/projects/${projectsId}/merge/new`} className="topWrapper_btn">创建合并请求</Link>*/}
{/*: ''*/}
{/*}*/}
{/*</div>*/}
<div>
<div className="detailContent">
<p>
<span className="font-16" > { data && data.issue.subject}</span>
<div>
{
data && data.issue.user_permission ?
<Link to={`/projects/${projectsId}/merge/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
: ''
}
</div>
</p>
<p className="mt15">{ data && data.issue.description}</p>
<p className="mt10">
<div className={data&&data.issue_status==="关闭"?"closedetail":"opendetail"}>{data&&data.issue_status==="关闭"?"关闭中!":"开启中!"} </div>
<span className="color-grey-c">
{ data && data.issue.author_name} { data && data.issue.created_at }创建{ data && data.issue.journals_count && data.issue.journals_count > 0 ?` · ${data.issue.journals_count} 条评论`:""}
</span>
<span className="span_title ml10">
请求从<strong> {data && data.pull_request.head} </strong><strong> {data && data.pull_request.base} </strong>
</span>
</p>
</div>
<div className="detailHeader-wrapper">
<div className="normal f-wrap-between">
<ul className="headerMenu-wrapper">
<li className={url.indexOf("Messagecount")>0? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeid}/Messagecount`}>对话内容</Link></li>
<li className={url.indexOf("MergeSubmit")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeid}/MergeSubmit`}>代码提交</Link></li>
</ul>
<div className="order_line" style={{ marginLeft: 80 }}></div>
</li>
)
})
}
</div>
</div>
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
<div className="list-right df divwidth" >
<ul className="ul_width">
{renderList()}
<li>
<div className="df">
<Link to={``}><img class="user_img" onClick={this.imgshow} src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/> </Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('content', {
rules: [{
required: true, message: '请输入内容'
}],
})(
<TextArea placeholder="请输入描述内容..." style={{height:"200px"}}/>
)}
</Form.Item>
<UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
<a className="Closeor_btn fr" type="submit" onClick={()=>this.closedetail(data&&data.issue_status==="关闭"?2:5)}>{data&&data.issue_status==="关闭"?"开启":"关闭"}</a>
</p>
</div>
</div>
</li>
</ul>
</div>
<div className="list-left DetailRight">
<p>
<span className="span_title">当前状态</span>
<span>{data && data.issue.issue_status}</span>
</p>
<p>
<span className="span_title">优先级</span>
<span>{data && data.issue.priority}</span>
</p>
<p>
<span className="span_title">指派给</span>
<span>{data && data.issue.assign_user_name}</span>
</p>
<p style={{display: "inline-block",'white-space': "nowrap" }}>
<span className="span_title">里程碑</span>
<span className="title_overflow">{data&&data.issue.version===null?"未添加里程碑":data&&data.issue.version.length===0?data.issue.version:'未添加里程碑'}</span>
</p>
</div>
</div>
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
)
} else {
return (
<NoneData _html="暂时还没有相关数据哦!" />
)
}
bodyStyle={{textAlign:'center'}}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</Modal>
</div>
}
return (
<div className="main">
<div>
<div className="detailContent">
<p>
<span className="font-16" > {data && data.issue.subject}</span>
<div>
{
data && data.issue.user_permission ?
<Link to={`/projects/${projectsId}/merge/${mergeid}/updatemerge`} className="color-blue fr">编辑</Link>
: ''
}
</div>
</p>
<p className="mt15">{data && data.issue.description}</p>
<p className="mt10">
<div className={data && data.issue_status === "关闭" ? "closedetail" : "opendetail"}>{data && data.issue_status === "关闭" ? "关闭中!" : "开启中!"} </div>
<span className="color-grey-c">
{data && data.issue.author_name} {data && data.issue.created_at}创建{data && data.issue.journals_count && data.issue.journals_count > 0 ? ` · ${data.issue.journals_count} 条评论` : ""}
</span>
<span className="span_title ml10">
请求从<strong> {data && data.pull_request.head} </strong><strong> {data && data.pull_request.base} </strong>
</span>
</p>
</div>
<div className="detailHeader-wrapper">
<div className="normal f-wrap-between">
<ul className="headerMenu-wrapper">
<li className={url.indexOf("Messagecount") > 0 ? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeid}/Messagecount`}>对话内容</Link></li>
<li className={url.indexOf("MergeSubmit") > 0 ? "active" : ""}><Link to={`/projects/${projectsId}/merge/${mergeid}/MergeSubmit`}>代码提交</Link></li>
</ul>
</div>
</div>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df divwidth" >
<ul className="ul_width">
{renderList()}
<li>
<div className="df">
<Link to={``}><img class="user_img" onClick={this.imgshow} src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" /> </Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('content', {
rules: [{
required: true, message: '请输入内容'
}],
})(
<TextArea placeholder="请输入描述内容..." style={{ height: "200px" }} />
)}
</Form.Item>
<UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
<a className="Closeor_btn fr" type="submit" onClick={() => this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "开启" : "关闭"}</a>
</p>
</div>
</div>
</li>
</ul>
</div>
<div className="list-left DetailRight">
<p>
<span className="span_title">当前状态</span>
<span>{data && data.issue.issue_status}</span>
</p>
<p>
<span className="span_title">优先级</span>
<span>{data && data.issue.priority}</span>
</p>
<p>
<span className="span_title">指派给</span>
<span>{data && data.issue.assign_user_name}</span>
</p>
<p style={{ display: "inline-block", 'white-space': "nowrap" }}>
<span className="span_title">里程碑</span>
<span className="title_overflow">{data && data.issue.version === null ? "未添加里程碑" : data && data.issue.version.length === 0 ? data.issue.version : '未添加里程碑'}</span>
</p>
</div>
</div>
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{ textAlign: 'center' }}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" />
</Modal>
</div>
)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,294 +1,272 @@
import React , {Component} from 'react';
import {Link} from 'react-router-dom';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import Nav from '../Order/Nav';
import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder';
import{ Modal , Form , Input , Select, Spin } from 'antd'
import { Modal, Form, Input, Select, Spin } from 'antd'
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
import Attachments from '../Upload/attachment'
const Option = Select.Option;
const options = [
['bold', 'italic', 'underline'],
[{header: [1,2,3,false]}],
['blockquote', 'code-block'],
['link', 'image'],
['formula']
];
class UpdateMerge extends Component{
constructor(props){
class UpdateMerge extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
isShow:false,
imgsrc:'',
journalsdata:undefined,
this.state = {
data: undefined,
isShow: false,
imgsrc: '',
journalsdata: undefined,
//图片区域是否显示 none 隐藏 block 显示
display:'none',
titledisplay:'none',
subject:'',
branch_name:"",
issue_tag_ids:"",
fixed_version_id:"",
tracker_id:0,
issue_type:0,
status_id:0,
assigned_to_id:"",
priority_id:0,
done_ratio:0,
textcount:"",
fileList:undefined,
display: 'none',
titledisplay: 'none',
subject: '',
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: 0,
issue_type: 0,
status_id: 0,
assigned_to_id: "",
priority_id: 0,
done_ratio: 0,
textcount: "",
fileList: undefined,
get_attachments: undefined,
desc:undefined,
desc: undefined,
isSpin: false
}
}
componentDidMount=()=>{
this.InitData();
componentDidMount = () => {
this.getDetail();
//this.getSelectList();
}
InitData=()=>{
// this.props.form.setFieldsValue({
// ...this.state
// });
}
getDetail=()=>{
const { projectsId , mergeId} = this.props.match.params;
getDetail = () => {
const { projectsId, mergeId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests/${mergeId}/edit.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data,
subject:result.data.issue.subject,
issue_chosen:result.data.issue.issue_chosen,
branches:result.data.issue.branches,
tracker_id:result.data.issue.tracker_id,
issue_type:result.data.issue.issue_type,
status_id:result.data.issue.status_id,
priority_id:result.data.issue.priority_id,
done_ratio:result.data.issue.done_ratio,
textcount:result.data.issue.description,
data: result.data,
subject: result.data.issue.subject,
issue_chosen: result.data.issue.issue_chosen,
branches: result.data.issue.branches,
tracker_id: result.data.issue.tracker_id,
issue_type: result.data.issue.issue_type,
status_id: result.data.issue.status_id,
priority_id: result.data.issue.priority_id,
done_ratio: result.data.issue.done_ratio,
textcount: result.data.issue.description,
branch_name: result.data.issue.branch_name,
get_attachments: result.data.issue.attachments,
fileList:undefined,
fileList: undefined,
issue_tag_ids: result.data.issue.issue_tags && result.data.issue.issue_tags[0].id,
fixed_version_id: result.data.issue.fixed_version_id,
assigned_to_id: result.data.issue.assigned_to_id
})
// this.getjournalslist();
// this.getjournalslist();
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
handleok=() => {
this.setState({
isShow:false
});
};
handleCancel=()=>{
this.setState({
isShow:false
});
}
handleok = () => {
this.setState({
isShow: false
});
};
handleCancel = () => {
this.setState({
isShow: false
});
}
imgshow=()=>{
this.setState({
isShow:true
});
};
imgshow = () => {
this.setState({
isShow: true
});
};
onContentChange=(value)=>{
this.setState({
textcount:value
})
}
changmodelname=(e)=>{
this.setState({
subject:e.target.value
})
}
stringJson=(value) =>{
let _value = null;
try {
_value = JSON.parse(value);
} catch (e) {
_value = value;
}
return _value
}
onContentChange = (value) => {
this.setState({
textcount: value
})
}
changmodelname = (e) => {
this.setState({
subject: e.target.value
})
}
stringJson = (value) => {
let _value = null;
renderSelect=(list)=>{
if(list && list.length >0){
return(
list.map((item,key)=>{
return(
<Option key={key+1} value={item.id}>{item.name}</Option>
)
})
try {
_value = JSON.parse(value);
} catch (e) {
_value = value;
}
return _value
}
renderSelect = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<Option key={key + 1} value={item.id}>{item.name}</Option>
)
})
)
}
}
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({
fileList
})
}
handleSubmit = () => {
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId, mergeId } = this.props.match.params;
const { data, textcount } = this.state;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
if (values.issue_tag_ids === '') {
values.issue_tag_ids = []
}
}
// 获取上传后的文件id数组
UploadFunc=(fileList)=>{
this.setState({
fileList
})
}
handleSubmit=()=>{
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { projectsId , mergeId } = this.props.match.params;
const { data , textcount } = this.state;
const url = `/projects/${projectsId}/pull_requests/${mergeId}.json`;
if(values.issue_tag_ids===''){
values.issue_tag_ids = []
}else{
}
if(values.assigned_to_id===0){
values.assigned_to_id = ""
}
axios.put(url,{
project_id:projectsId,
id: data.issue.id,
attachment_ids:fileList,
body:textcount,
...values
}).then(result=>{
if(result){
this.props.history.push(`/projects/${projectsId}/merge`);
this.setState({
textcount:''
})
}
}).catch(error=>{
console.log(error);
if (values.assigned_to_id === 0) {
values.assigned_to_id = ""
}
axios.put(url, {
project_id: projectsId,
id: data.issue.id,
attachment_ids: fileList,
body: textcount,
...values
}).then(result => {
if (result) {
this.props.history.push(`/projects/${projectsId}/merge`);
this.setState({
textcount: ''
})
}
}).catch(error => {
console.log(error);
})
}
})
}
render(){
const { projectsId , mergeId } = this.props.match.params;
render() {
const { projectsId, mergeId } = this.props.match.params;
const { getFieldDecorator } = this.props.form;
const { current_user } = this.props;
const { issue_tag_ids , fixed_version_id , assigned_to_id , issue_chosen , subject, textcount,get_attachments, isSpin } = this.state;
return(
const { issue_tag_ids, fixed_version_id, assigned_to_id, issue_chosen, subject, textcount, get_attachments, isSpin } = this.state;
return (
<div className="main">
<div>
<Form>
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
<div className="list-right df" >
<Link to={`/users/${current_user && current_user.login}/projects`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
</Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('title', {
rules: [{
required: true, message: '请填写任务标题'
}],
initialValue: subject
})(
<Input placeholder="标题" onChange={this.changmodelname}/>
)}
</Form.Item>
<MDEditor placeholder={'请输入合并请求的描述...'} height={350}
mdID={`orderdetail-add-description`} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{
get_attachments ?
<Attachments attachments={get_attachments} showNotification={this.props.showNotification} canDelete={true}/>
:
""
}
<p className="clearfix mt15 text-right">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" style={{marginLeft:5}} onClick={this.handleSubmit}>保存</a>
<Link to={`/projects/${projectsId}/merge/${mergeId}/Messagecount`} className="a_btn cancel_btn fr">取消</Link>
</Spin>
</p>
<div>
<Form>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df" >
<Link to={`/users/${current_user && current_user.login}/projects`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
</Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('title', {
rules: [{
required: true, message: '请填写任务标题'
}],
initialValue: subject
})(
<Input placeholder="标题" onChange={this.changmodelname} />
)}
</Form.Item>
<MDEditor placeholder={'请输入合并请求的描述...'} height={350}
mdID={`orderdetail-add-description`} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{
get_attachments ?
<Attachments attachments={get_attachments} showNotification={this.props.showNotification} canDelete={true} />
:
""
}
<p className="clearfix mt15 text-right">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" style={{ marginLeft: 5 }} onClick={this.handleSubmit}>保存</a>
<Link to={`/projects/${projectsId}/merge/${mergeId}/Messagecount`} className="a_btn cancel_btn fr">取消</Link>
</Spin>
</p>
</div>
</div>
<div className="list-left" style={{ paddingRight: "0px", paddingLeft: "15px", paddingTop: "10px" }}>
<div className="list-l-panel">
<Form.Item
label="标签"
>
{getFieldDecorator('issue_tag_ids', {
initialValue: issue_tag_ids ? [issue_tag_ids] : '',
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_tag)}
</Select>
)}
</Form.Item>
<Form.Item
label="里程碑"
>
{getFieldDecorator('fixed_version_id', {
initialValue: fixed_version_id ? fixed_version_id : "",
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_version)}
</Select>
)}
</Form.Item>
<Form.Item
label="指派成员"
>
{getFieldDecorator('assigned_to_id', {
initialValue: assigned_to_id ? assigned_to_id : "",
})(
<Select>
<Option value={''}>未指派成员</Option>
{this.renderSelect(issue_chosen && issue_chosen.assign_user)}
</Select>
)}
</Form.Item>
</div>
</div>
</div>
</div>
<div className="list-left" style={{paddingRight:"0px",paddingLeft:"15px",paddingTop:"10px"}}>
<div className="list-l-panel">
<Form.Item
label="标签"
>
{getFieldDecorator('issue_tag_ids', {
initialValue: issue_tag_ids ? [issue_tag_ids] : '',
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签':'请在仓库设置里添加标签'}</Option>
{ this.renderSelect(issue_chosen && issue_chosen.issue_tag) }
</Select>
)}
</Form.Item>
<Form.Item
label="里程碑"
>
{getFieldDecorator('fixed_version_id', {
initialValue: fixed_version_id ? fixed_version_id : "",
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑': '请添加里程碑'}</Option>
{ this.renderSelect(issue_chosen && issue_chosen.issue_version) }
</Select>
)}
</Form.Item>
<Form.Item
label="指派成员"
>
{getFieldDecorator('assigned_to_id', {
initialValue: assigned_to_id ? assigned_to_id : "",
})(
<Select>
<Option value={''}>未指派成员</Option>
{ this.renderSelect(issue_chosen && issue_chosen.assign_user) }
</Select>
)}
</Form.Item>
</div>
</div>
</Form>
</div>
</Form>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{ textAlign: 'center' }}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" />
</Modal>
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{textAlign:'center'}}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</Modal>
</div>
)
}
}

View File

@ -1,10 +1,8 @@
import React , { Component } from "react";
import {Link} from 'react-router-dom';
import { Input ,Dropdown , Menu , Icon , Pagination , Spin } from 'antd';
import React, { Component } from "react";
import { Input, Dropdown, Menu, Icon, Pagination, Spin } from 'antd';
import './merge.css';
import NoneData from '../Nodata';
import Nav from '../Order/Nav';
import OrderItem from './MergeItem';
@ -24,114 +22,114 @@ const Search = Input.Search;
* search_count:列表总条数
* issue_type:搜索条件
*/
class merge extends Component{
constructor(props){
class merge extends Component {
constructor(props) {
super(props);
this.state={
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,
status_type:'1',
this.state = {
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,
status_type: '1',
//设置选择高亮
openselect:1,
closeselect:undefined,
issue_tag_ids:'标签',
fixed_version_ids:'里程碑',
assigned_to_ids:'指派人',
paix:'排序'
openselect: 1,
closeselect: undefined,
issue_tag_ids: '标签',
fixed_version_ids: '里程碑',
assigned_to_ids: '指派人',
paix: '排序'
}
}
componentDidMount=()=>{
componentDidMount = () => {
this.getSelectList();
this.getIssueList();
}
getSelectList=()=>{
getSelectList = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen:result.data.issue_chosen
issue_chosen: result.data.issue_chosen
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
// 获取列表数据
getIssueList=(page,limit,search,author_id,assigned_to_id,status_type,id,value,order_type,order_name)=>{
getIssueList = (page, limit, search, author_id, assigned_to_id, status_type, id, value, order_type, order_name) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/pull_requests.json`;
axios.get(url,{
params:{
page,limit,search,author_id,assigned_to_id,status_type,order_type,order_name,
[id]:value
axios.get(url, {
params: {
page, limit, search, author_id, assigned_to_id, status_type, order_type, order_name,
[id]: value
}
}).then((result)=>{
if(result){
}).then((result) => {
if (result) {
this.setState({
data:result.data,
issues:result.data.issues,
search_count:result.data.search_count,
isSpin:false
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
getOption=(e,id,name)=>{
if(id+'s'==="issue_tag_ids"){
getOption = (e, id, name) => {
if (id + 's' === "issue_tag_ids") {
this.setState({
[id]:e.key,
issue_tag_ids:name
[id]: e.key,
issue_tag_ids: name
})
}
if(id+'s'==="fixed_version_ids"){
if (id + 's' === "fixed_version_ids") {
this.setState({
[id]:e.key,
fixed_version_ids:name
[id]: e.key,
fixed_version_ids: name
})
}
if(id+'s'==="assigned_to_ids"){
if (id + 's' === "assigned_to_ids") {
this.setState({
[id]:e.key,
assigned_to_ids:name
[id]: e.key,
assigned_to_ids: name
})
}
this.setState({
[id]:e.key
[id]: e.key
})
const { page,limit,search,author_id,assigned_to_id,status_type } = this.state;
if(e.key==="all"){
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id);
}else{
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id,e.key);
const { page, limit, search, author_id, assigned_to_id, status_type } = this.state;
if (e.key === "all") {
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id);
} else {
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id, e.key);
}
}
renderMenu =(array,name,id)=>{
return(
renderMenu = (array, name, id) => {
return (
<Menu>
<Menu.Item key={"all"} onClick={(e)=>this.getOption(e,id,name)}>{name}</Menu.Item>
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>{name}</Menu.Item>
{
array && array.length > 0 && array.map((item,key)=>{
return(
<Menu.Item key={item.id} onClick={(e)=>this.getOption(e,id,item.name)}>{item.name}</Menu.Item>
array && array.length > 0 && array.map((item, key) => {
return (
<Menu.Item key={item.id} onClick={(e) => this.getOption(e, id, item.name)}>{item.name}</Menu.Item>
)
})
}
@ -140,106 +138,101 @@ class merge extends Component{
}
// 翻页
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page,
isSpin:true
isSpin: true
})
const {limit,search,status_type,author_id, assigned_to_id} = this.state;
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type);
const { limit, search, status_type, author_id, assigned_to_id } = this.state;
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type);
}
// 搜索
searchFunc=(value)=>{
searchFunc = (value) => {
this.setState({
search:value,
isSpin:true
search: value,
isSpin: true
})
const {page,limit,status_type,author_id, assigned_to_id} = this.state;
this.getIssueList(page,limit,value,author_id,assigned_to_id,status_type);
const { page, limit, status_type, author_id, assigned_to_id } = this.state;
this.getIssueList(page, limit, value, author_id, assigned_to_id, status_type);
}
openorder=(type)=>{
if(type){
const { current_user } = this.props;
if(type===1){
openorder = (type) => {
if (type) {
if (type === 1) {
this.setState({
status_type:'1',
closeselect:undefined,
openselect:'123',
issue_tag_ids:'标签',
fixed_version_ids:'里程碑',
assigned_to_ids:'指派人',
paix:'排序'
status_type: '1',
closeselect: undefined,
openselect: '123',
issue_tag_ids: '标签',
fixed_version_ids: '里程碑',
assigned_to_ids: '指派人',
paix: '排序'
})
this.getIssueList("","","","","",1,"");
this.getIssueList("", "", "", "", "", 1, "");
}else{
} else {
this.setState({
status_type:'2',
openselect:undefined,
closeselect:'123',
status_type: '2',
openselect: undefined,
closeselect: '123',
issue_tag_ids:'标签',
fixed_version_ids:'里程碑',
assigned_to_ids:'指派人',
paix:'排序'
issue_tag_ids: '标签',
fixed_version_ids: '里程碑',
assigned_to_ids: '指派人',
paix: '排序'
})
this.getIssueList("","","","","",2,"");
this.getIssueList("", "", "", "", "", 2, "");
}
}
}
arrayList=(e)=>{
const { limit, search,status_type,author_id, assigned_to_id} = this.state;
if(e.key==='created_on'){
if(e.item.props.value==="desc"){
arrayList = (e) => {
const { limit, search, status_type, author_id, assigned_to_id } = this.state;
if (e.key === 'created_on') {
if (e.item.props.value === "desc") {
this.setState({
paix:'最新创建'
paix: '最新创建'
})
}else{
} else {
this.setState({
paix:'最早创建'
paix: '最早创建'
})
}
}else{
if(e.item.props.value==="desc"){
} else {
if (e.item.props.value === "desc") {
this.setState({
paix:'最新更新'
paix: '最新更新'
})
}else{
} else {
this.setState({
paix:'最早更新'
paix: '最早更新'
})
}
}
this.setState({
order_name:e.key,
order_type:e.item.props.value
order_name: e.key,
order_type: e.item.props.value
})
this.getIssueList(1,limit,search,author_id,assigned_to_id,status_type,undefined,undefined, e.item.props.value,e.key);
this.getIssueList(1, limit, search, author_id, assigned_to_id, status_type, undefined, undefined, e.item.props.value, e.key);
}
islogin(){
islogin() {
const { projectsId } = this.props.match.params;
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}else{
this.props.showLoginDialog()
return
} else {
this.props.history.push(`/projects/${projectsId}/merge/new`);
}
}
render(){
const { issue_chosen , issues , limit , page , search_count , data , isSpin,openselect,closeselect } = this.state;
const { projectsId } = this.props.match.params;
render() {
const { issue_chosen, issues, limit, page, search_count, data, isSpin, openselect, closeselect } = this.state;
const menu = (
<Menu onClick={(e)=>this.arrayList(e)}>
<Menu onClick={(e) => this.arrayList(e)}>
<Menu.Item key={'created_on'} value="desc">最新创建</Menu.Item>
<Menu.Item key={'created_on'} value="asc">最早创建</Menu.Item>
<Menu.Item key={'updated_on'} value="desc">最新更新</Menu.Item>
@ -251,26 +244,18 @@ class merge extends Component{
<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>:""
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
return(
return (
<div className="main">
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state}/>*/}
{/*{*/}
{/*<a className="topWrapper_btn" onClick={()=>this.islogin()}>创建合并请求</a> */}
{/*}*/}
{/*</div>*/}
<div className="topWrapper" style={{borderBottom:"none"}}>
<div className="topWrapper" style={{ borderBottom: "none" }}>
<p className="topWrapper_type">
<li className={openselect ? "active":""} onClick={()=>this.openorder(1)}>{data && data.open_count ? data.open_count : 0}个开启中</li>
<li className={closeselect ? "active":""} onClick={()=>this.openorder(2)}>{data && data.close_count ? data.close_count : 0}个已关闭</li>
{/* <span onClick={this.openorder} className={author_id ? "active":""}>{data && data.open_count}</span>
<span onClick={this.closeorder} className={author_id ? "active":""}>{data && data.close_count}个已关闭</span> */}
<li className={openselect ? "active" : ""} onClick={() => this.openorder(1)}>{data && data.open_count ? data.open_count : 0}个开启中</li>
<li className={closeselect ? "active" : ""} onClick={() => this.openorder(2)}>{data && data.close_count ? data.close_count : 0}个已关闭</li>
</p>
<div className="topWrapper_select">
@ -282,7 +267,7 @@ class merge extends Component{
style={{ width: 300 }}
/>
</div>
<a className="topWrapper_btn ml10" onClick={()=>this.islogin()}>创建合并请求</a>
<a className="topWrapper_btn ml10" onClick={() => this.islogin()}>创建合并请求</a>
</div>
</div>
{
@ -295,17 +280,17 @@ class merge extends Component{
</ul>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag,'标签','issue_tag_id')} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag, '标签', 'issue_tag_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.issue_tag_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_version,'里程碑','fixed_version_id')} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_version, '里程碑', 'fixed_version_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.fixed_version_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '指派人', 'assigned_to_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.assigned_to_ids}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
@ -323,14 +308,14 @@ class merge extends Component{
:
<OrderItem issues={issues} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state}></OrderItem>
}
{ Paginations }
{Paginations}
</Spin>
</div>
:
<NoneData _html="暂时还没有相关数据哦!"/>
<NoneData _html="暂时还没有相关数据哦!" />
}
</div>
</div>
)
}
}

View File

@ -1,60 +1,57 @@
import React , { Component } from 'react';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Input , Form , Select , Checkbox , Button , Divider , Spin , AutoComplete } from 'antd';
import { Input, Form, Select, Checkbox, Button, Divider, Spin, AutoComplete } from 'antd';
import '../css/index.css';
import './new.css'
import axios from 'axios' ;
import { callbackify } from 'util';
import axios from 'axios';
const Option = Select.Option
class Index extends Component{
constructor(props){
class Index extends Component {
constructor(props) {
super(props);
this.state={
// authorValue:"0",
preType:"0",
// subType:"0",
languageValue:"0",
gitignoreType:"0",
LicensesType:"0",
this.state = {
preType: "0",
languageValue: "0",
gitignoreType: "0",
LicensesType: "0",
CategoryList:undefined,
LanguageList:undefined,
GitignoreList:undefined,
LicensesList:undefined,
isSpin:false,
CategoryList: undefined,
LanguageList: undefined,
GitignoreList: undefined,
LicensesList: undefined,
isSpin: false,
project_language_id:undefined,
project_category_id:undefined,
license_id:undefined,
ignore_id:undefined,
project_language_id: undefined,
project_category_id: undefined,
license_id: undefined,
ignore_id: undefined,
project_language_list:undefined,
project_category_list:undefined,
license_list:undefined,
ignore_list:undefined,
project_language_list: undefined,
project_category_list: undefined,
license_list: undefined,
ignore_list: undefined,
project_language_name:undefined,
project_category_name:undefined,
license_name:undefined,
ignore_name:undefined
project_language_name: undefined,
project_category_name: undefined,
license_name: undefined,
ignore_name: undefined
}
}
getUserInfo=()=>{
getUserInfo = () => {
const url = `/users/me.json`;
axios.get(url).then(result=>{
if(result && result.data.login){
axios.get(url).then(result => {
if (result && result.data.login) {
this.setState({
current_user:result.data
current_user: result.data
})
this.getDetail();
}
}).catch(error=>{
}).catch(error => {
console.log(error)
})
}
componentDidMount=()=>{
componentDidMount = () => {
// this.getUserInfo();
// 获取项目类别
this.getCategory();
@ -65,60 +62,60 @@ class Index extends Component{
// 获取开源许可证
this.getLicenses();
}
getCategory=()=>{
const url = `/project_categories.json`
axios.get(url).then((result)=>{
if(result){
this.setOptionsList(result.data.project_categories,'project_category');
getCategory = () => {
const url = `/project_categories.json`
axios.get(url).then((result) => {
if (result) {
this.setOptionsList(result.data.project_categories, 'project_category');
this.setState({
CategoryList:result.data.project_categories
CategoryList: result.data.project_categories
})
}
}).catch((error)=>{})
}).catch((error) => { })
}
getLanguage=()=>{
const url = `/project_languages.json`
axios.get(url).then((result)=>{
if(result){
this.setOptionsList(result.data.project_languages,'project_language')
getLanguage = () => {
const url = `/project_languages.json`
axios.get(url).then((result) => {
if (result) {
this.setOptionsList(result.data.project_languages, 'project_language')
this.setState({
LanguageList:result.data.project_languages
LanguageList: result.data.project_languages
})
}
}).catch((error)=>{})
}).catch((error) => { })
}
getGitignore=()=>{
const url = `/ignores.json`
axios.get(url).then((result)=>{
if(result){
this.setOptionsList(result.data.ignores,'ignore');
getGitignore = () => {
const url = `/ignores.json`
axios.get(url).then((result) => {
if (result) {
this.setOptionsList(result.data.ignores, 'ignore');
this.setState({
GitignoreList:result.data.ignores
GitignoreList: result.data.ignores
})
}
}).catch((error)=>{})
}).catch((error) => { })
}
getLicenses=()=>{
const url = `/licenses.json`
axios.get(url).then((result)=>{
if(result){
this.setOptionsList(result.data.licenses,'license');
getLicenses = () => {
const url = `/licenses.json`
axios.get(url).then((result) => {
if (result) {
this.setOptionsList(result.data.licenses, 'license');
this.setState({
LicensesList:result.data.licenses
LicensesList: result.data.licenses
})
}
}).catch((error)=>{})
}).catch((error) => { })
}
// 设置option
setOptionsList = (data,_head,name) =>{
if(data && data.length > 0){
setOptionsList = (data, _head, name) => {
if (data && data.length > 0) {
let _data = data;
if(name){
_data = data.filter(item=>item.name.toLowerCase().indexOf(name.toLowerCase())>-1);
if (name) {
_data = data.filter(item => item.name.toLowerCase().indexOf(name.toLowerCase()) > -1);
}
let list = _data && _data.map((item) => (
<Option key={item.id} value={item.name}>
@ -126,93 +123,90 @@ class Index extends Component{
</Option>
));
this.setState({
[_head+"_list"]:list
[_head + "_list"]: list
})
}
}
subMitFrom = () =>{
subMitFrom = () => {
this.setState({
isSpin:true
isSpin: true
})
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
if (!err) {
const { current_user } = this.props;
const { projectsType } =this.props.match.params;
const { projectsType } = this.props.match.params;
const { project_language_id, project_category_id, license_id, ignore_id } = this.state;
const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json";
axios.post(url,{
const url = projectsType === "deposit" ? "/projects.json" : "/projects/migrate.json";
axios.post(url, {
...values,
project_language_id,
project_category_id,
license_id,
ignore_id,
user_id:current_user.user_id
}).then((result)=>{
if(result){
if(result.data.id){
user_id: current_user.user_id
}).then((result) => {
if (result) {
if (result.data.id) {
this.setState({
isSpin:false
isSpin: false
})
this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`);
this.props.showNotification(`${projectsType === "deposit" ? "托管" : "镜像"}项目创建成功!`);
this.props.history.push(`/projects/${result.data.id}/coders`);
}
}
}).catch((error)=>{
}).catch((error) => {
this.setState({
isSpin:false
isSpin: false
})
console.log(error);
})
}else{
} else {
this.setState({
isSpin:false
isSpin: false
})
}
})
}
ChangePlatform=(value,e,name,list)=>{
this.setOptionsList(list,name,value)
ChangePlatform = (value, e, name, list) => {
this.setOptionsList(list, name, value)
this.setState({
[name+"_id"]:e.key,
[name+"_name"]:value,
[name + "_id"]: e.key,
[name + "_name"]: value,
})
}
blurCategory=(value,list,name)=>{
// console.log(value);
let filter = list && list.filter(item=>item.name === value);
if(!filter || filter.length===0){
blurCategory = (value, list, name) => {
let filter = list && list.filter(item => item.name === value);
if (!filter || filter.length === 0) {
this.props.form.setFieldsValue({
[name]:undefined
[name]: undefined
})
this.setState({
[name+"_name"]:undefined,
[name+"_id"]:undefined
[name + "_name"]: undefined,
[name + "_id"]: undefined
})
this.setOptionsList(list,name);
this.setOptionsList(list, name);
}
}
checkId=(rule, value, callback,list,title)=>{
let filter = list.filter(item=>item.name === value);
if(filter && filter.length>0){
checkId = (rule, value, callback, list, title) => {
let filter = list.filter(item => item.name === value);
if (filter && filter.length > 0) {
callback();
}else{
callback('请在下拉选项中选择正确的'+title+"!");
} else {
callback('请在下拉选项中选择正确的' + title + "!");
}
callback();
}
render(){
render() {
const { getFieldDecorator } = this.props.form;
// 项目类型deposit-托管项目mirror-镜像项目
const { projectsType } =this.props.match.params;
const { projectsType } = this.props.match.params;
const {
// authorValue,
preType,
// subType,
languageValue,
gitignoreType,
LicensesType,
@ -231,168 +225,165 @@ class Index extends Component{
project_category_list,
license_list,
ignore_list,
}=this.state;
console.log("a:",project_category_list);
return(
} = this.state;
return (
<div className="main back-white">
<div className="newPanel">
<div className="newPanel_title">创建{projectsType === "deposit" ? "托管":"镜像"}项目</div>
<div className="newPanel_title">创建{projectsType === "deposit" ? "托管" : "镜像"}项目</div>
<Spin spinning={isSpin}>
<Form>
<div className="newPanel_content">
{
projectsType !== "deposit" &&
<React.Fragment>
<Form.Item
label="镜像版本库地址"
style={{marginBottom:"0px"}}
>
{getFieldDecorator('clone_addr', {
rules: [{
required: true, message: '请填写镜像版本库地址'
}],
})(
<Input placeholder="输入需要同步到本项目的镜像版本库地址"/>
)}
</Form.Item>
<p className="formTip">示例https://github.com/facebook/reack.git</p>
</React.Fragment>
}
<Form.Item
label="项目名称"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请填写项目名称'
}],
})(
<Input placeholder="例如:团队协作方法与研究"/>
)}
</Form.Item>
<Form.Item
label="项目简介"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请填写项目简介'
}],
})(
<Input.TextArea placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }}/>
)}
</Form.Item>
<Form.Item
label="仓库名称"
>
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写仓库名称'
}],
})(
<Input placeholder="仓库名称请使用与项目相关的英文关键字"/>
)}
</Form.Item>
{/*<p className="formTip">好的存储库名称使用简单、深刻和独特的关键字</p>*/}
{/* <div className="newContent_inline"> */}
{
projectsType !== "deposit" &&
<React.Fragment>
<Form.Item
label="镜像版本库地址"
style={{ marginBottom: "0px" }}
>
{getFieldDecorator('clone_addr', {
rules: [{
required: true, message: '请填写镜像版本库地址'
}],
})(
<Input placeholder="输入需要同步到本项目的镜像版本库地址" />
)}
</Form.Item>
<p className="formTip">示例https://github.com/facebook/reack.git</p>
</React.Fragment>
}
<Form.Item
label="项目名称"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请填写项目名称'
}],
})(
<Input placeholder="例如:团队协作方法与研究" />
)}
</Form.Item>
<Form.Item
label="项目简介"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请填写项目简介'
}],
})(
<Input.TextArea placeholder="项目的介绍" autoSize={{ minRows: 2, maxRows: 6 }} />
)}
</Form.Item>
<Form.Item
label="仓库名称"
>
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写仓库名称'
}],
})(
<Input placeholder="仓库名称请使用与项目相关的英文关键字" />
)}
</Form.Item>
<Form.Item
label="项目类别"
>
{getFieldDecorator('project_category', {
>
{getFieldDecorator('project_category', {
rules: [{
required: true, message: '请选择大类别',
},{
validator:(rule, value, callback)=>this.checkId(rule, value, callback,CategoryList,'项目类别')
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, CategoryList, '项目类别')
}],
})(
<AutoComplete
placeholder="请选择项目类别"
onChange={(value,e)=>this.ChangePlatform(value,e,'project_category',CategoryList)}
onChange={(value, e) => this.ChangePlatform(value, e, 'project_category', CategoryList)}
className="plateAutoComplete"
onBlur={(value)=>this.blurCategory(value,CategoryList,"project_category")}
>
onBlur={(value) => this.blurCategory(value, CategoryList, "project_category")}
>
{/* {this.setOptionsList(CategoryList,project_category_name)} */}
{project_category_list}
</AutoComplete>
)}
</Form.Item>
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language', {
rules: [{
required: true, message: '请选择项目语言'
},{
validator:(rule, value, callback)=>this.checkId(rule, value, callback,LanguageList,'项目语言')
}],
})(
<AutoComplete
placeholder="请选择项目语言"
onChange={(value,e)=>this.ChangePlatform(value,e,'project_language',LanguageList)}
className="plateAutoComplete"
onBlur={(value)=>this.blurCategory(value,LanguageList,"project_language")}
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language', {
rules: [{
required: true, message: '请选择项目语言'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LanguageList, '项目语言')
}],
})(
<AutoComplete
placeholder="请选择项目语言"
onChange={(value, e) => this.ChangePlatform(value, e, 'project_language', LanguageList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LanguageList, "project_language")}
>
{/* {this.setOptionsList(LanguageList,project_language_name)} */}
{project_language_list}
</AutoComplete>
)}
</Form.Item>
</AutoComplete>
)}
</Form.Item>
</div>
<Divider />
<div className="newPanel_content">
{
projectsType === "deposit" &&
<React.Fragment>
<Form.Item
label=".gitignore"
>
{getFieldDecorator('ignore',{
rules: [{
required: true, message: '请选择gitignore'
},{
validator:(rule, value, callback)=>this.checkId(rule, value, callback,GitignoreList,'gitignore')
}],
})(
<AutoComplete
placeholder="请选择gitignore用来定义哪些文件不需要添加到版本管理中"
onChange={(value,e)=>this.ChangePlatform(value,e,'ignore',GitignoreList)}
className="plateAutoComplete"
onBlur={(value)=>this.blurCategory(value,GitignoreList,"ignore")}
{
projectsType === "deposit" &&
<React.Fragment>
<Form.Item
label=".gitignore"
>
{getFieldDecorator('ignore', {
rules: [{
required: true, message: '请选择gitignore'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, GitignoreList, 'gitignore')
}],
})(
<AutoComplete
placeholder="请选择gitignore用来定义哪些文件不需要添加到版本管理中"
onChange={(value, e) => this.ChangePlatform(value, e, 'ignore', GitignoreList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, GitignoreList, "ignore")}
>
{/* {this.setOptionsList(GitignoreList,ignore_name)} */}
{ignore_list}
</AutoComplete>
)}
</Form.Item>
<Form.Item
label="开源许可证"
>
{getFieldDecorator('license',{
rules: [{
required: true, message: '请选择开源许可证'
},{
validator:(rule, value, callback)=>this.checkId(rule, value, callback,LicensesList,'开源许可证')
}],
})(
<AutoComplete
placeholder="请选择开源许可证"
onChange={(value,e)=>this.ChangePlatform(value,e,'license',LicensesList)}
className="plateAutoComplete"
onBlur={(value)=>this.blurCategory(value,LicensesList,"license")}
</AutoComplete>
)}
</Form.Item>
<Form.Item
label="开源许可证"
>
{getFieldDecorator('license', {
rules: [{
required: true, message: '请选择开源许可证'
}, {
validator: (rule, value, callback) => this.checkId(rule, value, callback, LicensesList, '开源许可证')
}],
})(
<AutoComplete
placeholder="请选择开源许可证"
onChange={(value, e) => this.ChangePlatform(value, e, 'license', LicensesList)}
className="plateAutoComplete"
onBlur={(value) => this.blurCategory(value, LicensesList, "license")}
>
{/* {this.setOptionsList(LicensesList,license_name)} */}
{license_list}
</AutoComplete>
)}
</Form.Item>
</React.Fragment>
}
</AutoComplete>
)}
</Form.Item>
</React.Fragment>
}
<Form.Item
label="可见性"
style={{marginBottom:"0px"}}
>
{getFieldDecorator('private')(
<Checkbox value="limit">将项目设为私有<span className="ml15 font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox>
)}
style={{ marginBottom: "0px" }}
>
{getFieldDecorator('private')(
<Checkbox value="limit">将项目设为私有<span className="ml15 font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox>
)}
</Form.Item >
<div className="ant-row ant-form-item">
<div className="ant-col ant-form-item-label">
@ -405,8 +396,8 @@ class Index extends Component{
</div>
</div>
<Form.Item className="formTip">
<Button type="primary" onClick={this.subMitFrom} className="mr20">创建项目</Button>
<Link to={'/projects'} className="btn_32">取消</Link>
<Button type="primary" onClick={this.subMitFrom} className="mr20">创建项目</Button>
<Link to={'/projects'} className="btn_32">取消</Link>
</Form.Item>
</div>
</Form>

View File

@ -1,22 +1,22 @@
import React , { useEffect, useState } from 'react';
import React from 'react';
import { Modal } from 'antd';
import './order.css';
function AmplifyImg (props){
function AmplifyImg(props) {
return(
return (
<Modal
title={null}
footer={null}
visible={props.visible}
onCancel={()=>props.setVisible(false)}
onCancel={() => props.setVisible(false)}
closable={true}
centered={true}
width={'96%'}
className={'AmplifyImg'}
>
<div className={"amplifyContent"}>
<img src={props.url} alt=""/>
<img src={props.url} alt="" />
</div>
</Modal>
);

View File

@ -1,104 +1,95 @@
import React , {Component} from 'react';
import {Link} from 'react-router-dom';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import Nav from './Nav';
import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder';
import{ Modal ,Form , Input , Select } from 'antd';
import { Modal, Form, Input, Select } from 'antd';
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
import Attachments from '../Upload/attachment'
const Option = Select.Option;
class CopyDetail extends Component{
constructor(props){
class CopyDetail extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
isShow:false,
imgsrc:'',
journalsdata:undefined,
this.state = {
data: undefined,
isShow: false,
imgsrc: '',
journalsdata: undefined,
//图片区域是否显示 none 隐藏 block 显示
display:'none',
titledisplay:'none',
subject:'',
branch_name:"",
issue_tag_ids:"",
fixed_version_id:"",
tracker_id:0,
issue_type:0,
status_id:0,
assigned_to_id:"",
priority_id:0,
done_ratio:0,
textcount:"",
fileList:undefined,
display: 'none',
titledisplay: 'none',
subject: '',
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: 0,
issue_type: 0,
status_id: 0,
assigned_to_id: "",
priority_id: 0,
done_ratio: 0,
textcount: "",
fileList: undefined,
get_attachments: undefined,
}
}
componentDidMount=()=>{
this.InitData();
componentDidMount = () => {
this.getDetail();
//this.getSelectList();
}
InitData=()=>{
// this.props.form.setFieldsValue({
// ...this.state
// });
}
getDetail=()=>{
const { projectsId , orderId} = this.props.match.params;
getDetail = () => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/edit.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data,
subject:result.data.subject,
issue_chosen:result.data.issue_chosen,
branches:result.data.branches,
tracker_id:result.data.tracker_id,
issue_type:result.data.issue_type,
status_id:result.data.status_id,
priority_id:result.data.priority_id,
done_ratio:result.data.done_ratio,
textcount:result.data.description,
data: result.data,
subject: result.data.subject,
issue_chosen: result.data.issue_chosen,
branches: result.data.branches,
tracker_id: result.data.tracker_id,
issue_type: result.data.issue_type,
status_id: result.data.status_id,
priority_id: result.data.priority_id,
done_ratio: result.data.done_ratio,
textcount: result.data.description,
branch_name: result.data.branch_name,
get_attachments: result.data.attachments,
fileList:undefined,
fileList: undefined,
issue_tag_ids: result.data.issue_tags && result.data.issue_tags[0].id,
fixed_version_id: result.data.fixed_version_id,
assigned_to_id: result.data.assigned_to_id
})
this.getjournalslist();
this.getjournalslist();
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
handleok=() => {
this.setState({
isShow:false
});
};
handleCancel=()=>{
this.setState({
isShow:false
});
}
handleok = () => {
this.setState({
isShow: false
});
};
handleCancel = () => {
this.setState({
isShow: false
});
}
imgshow=()=>{
this.setState({
isShow:true
});
};
stringJson=(value) =>{
imgshow = () => {
this.setState({
isShow: true
});
};
stringJson = (value) => {
let _value = null;
try {
@ -109,106 +100,106 @@ class CopyDetail extends Component{
return _value
}
//删除任务
deleteorder=(id)=>{
const { projectsId , orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
axios.delete(url,{ data: {
project_id: projectsId,
id:id
}
}).then((result)=>{
if(result){
this.props.history.push(`/projects/${projectsId}/orders`);
}
}).catch((error)=>{
console.log(error);
})
//删除任务
deleteorder = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
axios.delete(url, {
data: {
project_id: projectsId,
id: id
}
}).then((result) => {
if (result) {
this.props.history.push(`/projects/${projectsId}/orders`);
}
}).catch((error) => {
console.log(error);
})
}
onContentChange=(value)=>{
this.setState({
textcount:value
})
}
onContentChange = (value) => {
this.setState({
textcount: value
})
}
changmodelname=(e)=>{
this.setState({
subject:e.target.value
})
}
changmodelcount=(e)=>{
this.setState({
textcount:e.target.value
})
}
changmodelname = (e) => {
this.setState({
subject: e.target.value
})
}
changmodelcount = (e) => {
this.setState({
textcount: e.target.value
})
}
renderSelect=(list)=>{
if(list && list.length >0){
return(
list.map((item,key)=>{
return(
<Option key={key+1} value={item.id}>{item.name}</Option>
)
})
renderSelect = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<Option key={key + 1} value={item.id}>{item.name}</Option>
)
})
)
}
}
handleSubmit = () => {
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId, orderId } = this.props.match.params;
const { subject } = this.state;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
if (values.issue_tag_ids === 0) {
values.issue_tag_ids = ""
} else {
values.issue_tag_ids = [values.issue_tag_ids]
}
}
if (values.assigned_to_id === 0) {
values.assigned_to_id = ""
}
const { textcount } = this.state;
handleSubmit=()=>{
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { projectsId , orderId } = this.props.match.params;
const { subject } = this.state;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
if(values.issue_tag_ids===0){
values.issue_tag_ids = ""
}else{
values.issue_tag_ids = [values.issue_tag_ids]
}
if(values.assigned_to_id===0){
values.assigned_to_id = ""
}
const { textcount } = this.state;
axios.put(url,{
project_id:projectsId,
subject:subject,
id: orderId,
description:textcount,
attachment_ids:fileList,
...values
}).then(result=>{
if(result){
this.props.history.push(`/projects/${projectsId}/orders`);
}
}).catch(error=>{
console.log(error);
})
axios.put(url, {
project_id: projectsId,
subject: subject,
id: orderId,
description: textcount,
attachment_ids: fileList,
...values
}).then(result => {
if (result) {
this.props.history.push(`/projects/${projectsId}/orders`);
}
}).catch(error => {
console.log(error);
})
}
})
}
render(){
const { projectsId , orderId } = this.props.match.params;
render() {
const { projectsId, orderId } = this.props.match.params;
const { getFieldDecorator } = this.props.form;
const { current_user } = this.props;
const { issue_tag_ids , fixed_version_id , branch_name , status_id , tracker_id , issue_type ,assigned_to_id , priority_id , done_ratio,
issue_chosen , branches, subject, textcount,get_attachments } = this.state;
return(
const { issue_tag_ids, fixed_version_id, branch_name, status_id, tracker_id, issue_type, assigned_to_id, priority_id, done_ratio,
issue_chosen, branches, subject, textcount, get_attachments } = this.state;
return (
<div className="main">
<div className="topWrapper">
<Nav {...this.props} {...this.state}/>
<Nav {...this.props} {...this.state} />
</div>
<div>
<Form>
<div className="f-wrap-between mt20" style={{alignItems: "flex-start"}}>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df">
<Link to={``}><img className="user_img"
src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" /></Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('subject', {
@ -217,31 +208,31 @@ class CopyDetail extends Component{
}],
initialValue: subject
})(
<Input placeholder="标题" onChange={this.changmodelname}/>
<Input placeholder="标题" onChange={this.changmodelname} />
)}
</Form.Item>
<div className="quillContent" style={{marginBottom:"20px"}}>
<div className="quillContent" style={{ marginBottom: "20px" }}>
</div>
<MDEditor placeholder={'请输入任务的描述...'} height={200}
mdID={'order-copy-description'} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc}
showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
showNotification={this.props.showNotification} isComplete={true} ></UploadComponent>
{
get_attachments ?
<Attachments attachments={get_attachments} showNotification={this.props.showNotification}
canDelete={true}/>
canDelete={true} />
:
""
}
<p className="clearfix mt15 text-right">
<a className="topWrapper_btn fr" type="submit" style={{marginLeft: 5}}
onClick={this.handleSubmit}>保存</a>
<a className="topWrapper_btn fr" type="submit" style={{ marginLeft: 5 }}
onClick={this.handleSubmit}>保存</a>
<Link to={`/projects/${projectsId}/orders/${orderId}/detail`}
className="a_btn cancel_btn fr">取消</Link>
className="a_btn cancel_btn fr">取消</Link>
</p>
</div>
</div>
<div className="list-left" style={{paddingRight: "0px", paddingLeft: "15px", paddingTop: "10px"}}>
<div className="list-left" style={{ paddingRight: "0px", paddingLeft: "15px", paddingTop: "10px" }}>
<div className="list-l-panel">
<Form.Item
label="分支"
@ -270,7 +261,7 @@ class CopyDetail extends Component{
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签':'请在仓库设置里添加标签'}</Option>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_tag)}
</Select>
)}
@ -283,7 +274,7 @@ class CopyDetail extends Component{
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑': '请添加里程碑'}</Option>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_version)}
</Select>
)}
@ -369,11 +360,11 @@ class CopyDetail extends Component{
footer={
[]
}
bodyStyle={{textAlign: 'center'}}
bodyStyle={{ textAlign: 'center' }}
>
<img className="list_img"
src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg"
alt=""/>
src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg"
alt="" />
</Modal>
</div>
)

View File

@ -1,243 +1,245 @@
import React , {Component} from 'react';
import {Link} from 'react-router-dom';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder';
import {Modal , Form , Tooltip, Popconfirm, Pagination , Spin} from 'antd'
import { Modal, Form, Tooltip, Popconfirm, Pagination, Spin } from 'antd'
import Attachments from '../Upload/attachment';
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
import RenderHtml from '../../components/render-html';
import AmplifyImg from './AmplifyImg';
class Detail extends Component{
constructor(props){
class Detail extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
isShow:false,
imgsrc:'',
journalsdata:undefined,
this.state = {
data: undefined,
isShow: false,
imgsrc: '',
journalsdata: undefined,
//图片区域是否显示 none 隐藏 block 显示
display:'none',
titledisplay:'none',
countvalue:'',
display: 'none',
titledisplay: 'none',
countvalue: '',
//是否需要编辑
isedit:undefined,
fileList:undefined,
limit:10,
page:1,
search_count:undefined,
isSpin:false,
isedit: undefined,
fileList: undefined,
limit: 10,
page: 1,
search_count: undefined,
isSpin: false,
showFiles: true,
quillValue:'',
quillFlag:false,
quillValue: '',
quillFlag: false,
// 点击放大的图片路径
imageUrl:undefined,
visible:false,
imageUrl: undefined,
visible: false,
journal_spin: false,
edit_spin: false
}
}
componentDidMount=()=>{
componentDidMount = () => {
this.getDetail();
}
getDetail=()=>{
const { projectsId , orderId} = this.props.match.params;
getDetail = () => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data
data: result.data
})
this.getjournalslist();
this.getjournalslist();
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
handleok=() => {
this.setState({
isShow:false
});
};
handleCancel=()=>{
this.setState({
isShow:false
});
}
handleok = () => {
this.setState({
isShow: false
});
};
handleCancel = () => {
this.setState({
isShow: false
});
}
imgshow=()=>{
this.setState({
isShow:true
});
};
imgshow = () => {
this.setState({
isShow: true
});
};
//添加评论
addjournals=()=>{
const { quillValue } = this.state;
//添加评论
addjournals = () => {
const { quillValue } = this.state;
this.setState({
journal_spin: true
})
if (!quillValue) {
this.setState({
journal_spin: true
quillFlag: true
})
if(!quillValue){
this.setState({
quillFlag:true
return;
}
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { data, page, limit, fileList } = this.state;
const url = `/issues/${data.id}/journals.json`;
axios.post(url, {
...values,
content: quillValue,
issue_id: data.id,
attachment_ids: fileList
}).then(result => {
if (result) {
this.props.showNotification("评论成功!");
this.props.form.setFieldsValue({
content: ""
});
this.setState({
showFiles: false,
quillValue: '',
quillFlag: false,
journal_spin: false
})
this.getjournalslist(page, limit);
}
}).catch(error => {
console.log(error);
})
return;
}
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { data, page, limit, fileList } = this.state;
const url = `/issues/${data.id}/journals.json`;
axios.post(url,{
...values,
content:quillValue,
issue_id:data.id,
attachment_ids:fileList
}).then(result=>{
if(result){
this.props.showNotification("评论成功!");
this.props.form.setFieldsValue({
content: ""
});
this.setState({
showFiles: false,
quillValue:'',
quillFlag:false,
journal_spin: false
})
this.getjournalslist(page, limit);
}
}).catch(error=>{
console.log(error);
})
}
})
}
//获取评论信息
getjournalslist=(page, limit)=>{
const { data} = this.state;
const url = `/issues/${data.id}/journals.json`;
let id=data.id;
axios.get(url,{
params:{
id,page,limit
}
}).then(result=>{
if(result){
this.setState({
journalsdata:result.data,
search_count:result.data.journals_count,
isSpin:false,
fileList:undefined,
})
}
}).catch(error=>{
console.log(error);
})
}
//删除任务信息
deletedetail=(id)=>{
const { projectsId , orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
axios.delete(url,{ data: {
project_id: projectsId,
id:id
})
}
//获取评论信息
getjournalslist = (page, limit) => {
const { data } = this.state;
const url = `/issues/${data.id}/journals.json`;
let id = data.id;
axios.get(url, {
params: {
id, page, limit
}
}).then((result)=>{
if(result){
this.props.history.push(`/projects/${projectsId}/orders`);
}
}).catch((error)=>{
console.log(error);
})
}
//关闭任务
closedetail=(id)=>{
const {projectsId,orderId} = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/close_issue.json`;
axios.post(url,{
project_id:projectsId,
id:orderId,
status_id:id,
}).then(result=>{
if(result){
this.getDetail();
}).then(result => {
if (result) {
this.setState({
journalsdata: result.data,
search_count: result.data.journals_count,
isSpin: false,
fileList: undefined,
})
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
}
//修改评论
updatedetail=(id)=>{
const { page , limit , countvalue } = this.state;
const {orderId} = this.props.match.params;
this.setState({
edit_spin: true
})
const url = `/issues/${orderId}/journals/${id}.json`;
axios.put(url,{
issue_id:orderId,
id:id,
content:countvalue
}).then(result=>{
if(result){
this.setState({
isedit: undefined,
edit_spin: false
})
this.getjournalslist(page, limit);
}
}).catch(error=>{
console.log(error);
})
}
//删除任务信息
deletedetail = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
axios.delete(url, {
data: {
project_id: projectsId,
id: id
}
}).then((result) => {
if (result) {
this.props.history.push(`/projects/${projectsId}/orders`);
}
}).catch((error) => {
console.log(error);
})
}
//关闭任务
closedetail = (id) => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/close_issue.json`;
axios.post(url, {
project_id: projectsId,
id: orderId,
status_id: id,
}).then(result => {
if (result) {
this.getDetail();
}
}).catch(error => {
console.log(error);
})
}
//修改评论
updatedetail = (id) => {
const { page, limit, countvalue } = this.state;
const { orderId } = this.props.match.params;
this.setState({
edit_spin: true
})
const url = `/issues/${orderId}/journals/${id}.json`;
axios.put(url, {
issue_id: orderId,
id: id,
content: countvalue
}).then(result => {
if (result) {
this.setState({
isedit: undefined,
edit_spin: false
})
this.getjournalslist(page, limit);
}
}).catch(error => {
console.log(error);
})
}
// 获取上传后的文件id数组
UploadFunc=(fileList)=>{
UploadFunc = (fileList) => {
this.setState({
fileList
})
}
//删除评论
deleteorder=(id)=>{
const { orderId} = this.props.match.params;
const { page, limit } = this.state;
const url = `/issues/${orderId}/journals/${id}.json`;
axios.delete(url,{ data: {
issue_id: orderId,
id:id
}
}).then((result)=>{
if(result){
this.getjournalslist(page,limit)
}
}).catch((error)=>{
console.log(error);
})
}
editdetail=(count,status)=>{
this.setState({
countvalue:this.stringJson(count),
isedit:status
})
}
//删除评论
deleteorder = (id) => {
const { orderId } = this.props.match.params;
const { page, limit } = this.state;
const url = `/issues/${orderId}/journals/${id}.json`;
axios.delete(url, {
data: {
issue_id: orderId,
id: id
}
}).then((result) => {
if (result) {
this.getjournalslist(page, limit)
}
}).catch((error) => {
console.log(error);
})
}
renderJournalList=(list)=>{
if(list && list.length >0){
return(
list.map((item,key)=>{
return(
<div key={key+1} className="journal-list-item">
editdetail = (count, status) => {
this.setState({
countvalue: this.stringJson(count),
isedit: status
})
}
renderJournalList = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<div key={key + 1} className="journal-list-item">
<span className="font-weight-bold mr3">
{item.detail}
</span>
@ -246,8 +248,8 @@ class Detail extends Component{
</span>
<span>
{item.value && item.value.length > 0 ?
item.detail === "标签" ? <span className="issue-tag-show" style={{background: item.value[0].color}}>{item.value[0].name}</span> : item.value
:
item.detail === "标签" ? <span className="issue-tag-show" style={{ background: item.value[0].color }}>{item.value[0].name}</span> : item.value
:
"无"
}
</span>
@ -255,8 +257,8 @@ class Detail extends Component{
)
})
)
}else{
return(
} else {
return (
<div>
<span>没有评论~</span>
</div>
@ -265,69 +267,69 @@ class Detail extends Component{
}
}
//复制
copydetail=()=>{
const {projectsId , orderId} = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/copy.json`;
axios.post(url,{
project_id:projectsId,
id:orderId,
}).then(result=>{
if(result){
this.props.history.push(`/projects/${projectsId}/orders/${result.data.issue_id}/copyetail`);
}
}).catch(error=>{
console.log(error);
})
}
//复制
copydetail = () => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/copy.json`;
axios.post(url, {
project_id: projectsId,
id: orderId,
}).then(result => {
if (result) {
this.props.history.push(`/projects/${projectsId}/orders/${result.data.issue_id}/copyetail`);
}
}).catch(error => {
console.log(error);
})
}
// 翻页
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page,
isSpin:true
isSpin: true
})
const {limit} = this.state;
this.getjournalslist(page,limit);
const { limit } = this.state;
this.getjournalslist(page, limit);
}
// 判断是否重新上传文件
changeIsComplete=(flag)=>{
changeIsComplete = (flag) => {
this.setState({
showFiles:flag
showFiles: flag
})
}
// 新建评论
onContentChange=(value)=>{
if(value){
onContentChange = (value) => {
if (value) {
this.setState({
quillValue:value,
quillFlag:false
quillValue: value,
quillFlag: false
})
}
}
// 编辑评论
onEditContentChange=(value)=>{
if(value){
onEditContentChange = (value) => {
if (value) {
this.setState({
countvalue:value
countvalue: value
})
}
}
handleShowImage=(value)=>{
handleShowImage = (value) => {
this.setState({
imageUrl:value,
visible:true
imageUrl: value,
visible: true
})
}
setVisible=(flag)=>{
setVisible = (flag) => {
this.setState({
visible:flag
visible: flag
})
}
stringJson=(value) =>{
stringJson = (value) => {
let _value = null;
try {
@ -344,9 +346,9 @@ class Detail extends Component{
)
};
render(){
const { projectsId , orderId } = this.props.match.params;
const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles , quillValue , quillFlag , countvalue , imageUrl , visible, journal_spin, edit_spin } = this.state;
render() {
const { projectsId, orderId } = this.props.match.params;
const { data, journalsdata, page, limit, search_count, isSpin, isedit, showFiles, quillValue, quillFlag, countvalue, imageUrl, visible, journal_spin, edit_spin } = this.state;
const { current_user } = this.props;
const Paginations = (
<React.Fragment>
@ -354,46 +356,46 @@ class Detail extends Component{
search_count > limit ?
<div className="pt30 mb50 edu-txt-center btp1">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
</div> : ""
}
</React.Fragment>
)
const renderList =()=>{
if(journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length>0 ){
return(
<div className="tagList">{
journalsdata.issue_journals.map((item,key)=>{
return(
<li key={key}>
{
key > 0&&
<div className="order_line" style={{marginLeft:80}}></div>
}
const renderList = () => {
if (journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length > 0) {
return (
<div className="tagList">{
journalsdata.issue_journals.map((item, key) => {
return (
<li key={key}>
{
key > 0 &&
<div className="order_line" style={{ marginLeft: 80 }}></div>
}
<div className="df">
<Link to={`/users/${item && item.user_login}/projects`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${item && item.user_picture}`)} alt=""/>
<img className="user_img" src={getImageUrl(`images/${item && item.user_picture}`)} alt="" />
</Link>
<div className="detail_context" >
<div className="topWrapper_detali">
<p className="ml6 detail_p lineH40">
{item.user_name}
<span className="color-grey-9 ml3 mr3">评论于</span>
<Tooltip title={item.format_time} placement="bottom">
<span>{item.created_at}</span>
</Tooltip>
</p>
<div className="detail_right" style={{display: current_user && isedit === undefined && (current_user.admin || current_user.login === item.user_login) ? "block" : "none"}}>
<span onClick={()=>this.editdetail(item.content,item.id)} className="detail_edit_action">编辑</span>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗?'} okText="是" cancelText="否" onConfirm={()=>this.deleteorder(item.id)}>
<span className="detail_edit_action">删除</span>
</Popconfirm>
</div>
<div className="topWrapper_detali">
<p className="ml6 detail_p lineH40">
{item.user_name}
<span className="color-grey-9 ml3 mr3">评论于</span>
<Tooltip title={item.format_time} placement="bottom">
<span>{item.created_at}</span>
</Tooltip>
</p>
<div className="detail_right" style={{ display: current_user && isedit === undefined && (current_user.admin || current_user.login === item.user_login) ? "block" : "none" }}>
<span onClick={() => this.editdetail(item.content, item.id)} className="detail_edit_action">编辑</span>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗?'} okText="是" cancelText="否" onConfirm={() => this.deleteorder(item.id)}>
<span className="detail_edit_action">删除</span>
</Popconfirm>
</div>
</div>
<div className="detail_ptitlecount">
<div style={{display: (isedit && isedit === item.id) ? "none" : "block"}} >
<div style={{ display: (isedit && isedit === item.id) ? "none" : "block" }} >
{
item.content ?
item.content ?
this.commentCtx(item.content)
:
<div>
@ -402,151 +404,141 @@ class Detail extends Component{
}
{
item && item.attachments && item.attachments.length > 0 ?
<Attachments attachments={item.attachments} showNotification={this.props.showNotification} canDelete={current_user && (current_user.admin || current_user.login === item.user_login)}/>
:
""
<Attachments attachments={item.attachments} showNotification={this.props.showNotification} canDelete={current_user && (current_user.admin || current_user.login === item.user_login)} />
:
""
}
</div>
<div style={{display: (isedit && isedit === item.id) ? "block" : "none"}}>
<div style={{ display: (isedit && isedit === item.id) ? "block" : "none" }}>
<div className="quillContent mt20">
<MDEditor placeholder={'添加评论...'} height={200}
mdID={`orderdetail-add-description${item.id}`} startInit={isedit && isedit === item.id} initValue={countvalue} onChange={this.onEditContentChange} ></MDEditor>
<p className="quillFlag">
{ quillFlag && <span className="">请输入评论内容</span>}
{quillFlag && <span className="">请输入评论内容</span>}
</p>
</div>
{/*<TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/>*/}
<p className="clearfix mt15">
<Spin spinning={edit_spin}>
<a className="topWrapper_btn fr" type="submit" onClick={()=>this.updatedetail(item.id)}>保存</a>
<a className="a_btn cancel_btn fr" type="submit" onClick={()=>this.editdetail(item.content,undefined)}>取消</a>
<a className="topWrapper_btn fr" type="submit" onClick={() => this.updatedetail(item.id)}>保存</a>
<a className="a_btn cancel_btn fr" type="submit" onClick={() => this.editdetail(item.content, undefined)}>取消</a>
</Spin>
</p>
</div>
</div>
<div style={{display: this.state.display}}>
<div className="div_line" ></div>
{/* <List
grid={{ gutter: 16, column: 6 }}
dataSource={valuse}
renderItem={obj => (
<List.Item>
<img class="list_img" onClick={this.imgshow} src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</List.Item>
)}
/> */}
<div style={{ display: this.state.display }}>
<div className="div_line" ></div>
</div>
</div>
</div>
</li>
)
})
}
</div>
)
}
}
</div>
</li>
)
})
}
</div>
)
}
}
return(
return (
<div className="main">
{ visible && <AmplifyImg url={imageUrl} visible={visible} setVisible={this.setVisible}/> }
{visible && <AmplifyImg url={imageUrl} visible={visible} setVisible={this.setVisible} />}
<div>
<div className="detailContent">
<p>
{
data ?
<span className="font-20">{data.issue_classify === "issue" ? (data.tracker ? data.tracker : "缺陷" ) : "合并请求"}</span>
<span className="font-20">{data.issue_classify === "issue" ? (data.tracker ? data.tracker : "缺陷") : "合并请求"}</span>
:
""
}
<span className="font-20" > { data && data.subject }</span>
<span className="font-20" > {data && data.subject}</span>
</p>
<p className="mt15 color-grey-c">
<span className={data&&data.issue_status==="关闭"?"closedetail":"opendetail"}>{data&&data.issue_status==="关闭"?"关闭中":"开启中"} </span>
<span className={data && data.issue_status === "关闭" ? "closedetail" : "opendetail"}>{data && data.issue_status === "关闭" ? "关闭中" : "开启中"} </span>
<span className="ml10 lineH32">
{ data && data.author_name} { data && data.created_at }创建{ data && data.journals_count && data.journals_count > 0 ?` · ${data.journals_count} 条评论`:""}
{data && data.author_name} {data && data.created_at}创建{data && data.journals_count && data.journals_count > 0 ? ` · ${data.journals_count} 条评论` : ""}
</span>
{
data && data.user_permission ?
<span className="pull-right lineH32">
<a className="color-blue fr" onClick={this.copydetail}>复制</a>
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={()=>this.deletedetail(orderId)}>
<a className="color-blue fr" style={{marginLeft:20,marginRight:20}}>删除</a>
</Popconfirm>
<a className="color-blue fr" onClick={this.copydetail}>复制</a>
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(orderId)}>
<a className="color-blue fr" style={{ marginLeft: 20, marginRight: 20 }}>删除</a>
</Popconfirm>
<Link to={`/projects/${projectsId}/orders/${orderId}/updatedetail`} className="color-blue fr">编辑</Link>
</span>
<Link to={`/projects/${projectsId}/orders/${orderId}/updatedetail`} className="color-blue fr">编辑</Link>
</span>
:
""
}
</p>
</div>
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="item-list-right" >
<div className="df ">
<Link to={``}><img className="user_img" src={getImageUrl(`images/${data && data.author_picture}`)} alt=""/></Link>
<Link to={``}><img className="user_img" src={getImageUrl(`images/${data && data.author_picture}`)} alt="" /></Link>
<div className="detail_context">
<div className="detail_p">
{data&&data.description&&(data.description.length > 0)?this.commentCtx(data.description): <span className="color-grey-9 ml3 mr3">没有描述</span>}
{data && data.description && (data.description.length > 0) ? this.commentCtx(data.description) : <span className="color-grey-9 ml3 mr3">没有描述</span>}
</div>
{
data && data.attachments && data.attachments.length > 0 ?
<Attachments attachments={data.attachments} showNotification={this.props.showNotification}/>
<Attachments attachments={data.attachments} showNotification={this.props.showNotification} />
:
""
}
</div>
</div>
<div className="order_line" style={{marginLeft:80}}></div>
<div className="order_line" style={{ marginLeft: 80 }}></div>
<Spin spinning={isSpin}>
<ul className="ul_width">
{renderList()}
</ul>
</Spin>
{ Paginations }
{Paginations}
{
current_user && current_user.login ?
<React.Fragment>
<div className="order_line" style={{marginLeft:80}}></div>
<div className="df">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
<div className="new_context">
<div className="quillContent" style={{marginBottom:"20px"}}>
<MDEditor placeholder={'添加评论...'} height={200}
mdID={'orderdetail-add-descriptions'} initValue={quillValue} onChange={this.onContentChange} ></MDEditor>
<p className="quillFlag">
{ quillFlag && <span className="">请输入评论内容</span>}
</p>
</div>
<UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15">
<Spin spinning={journal_spin}>
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
{
data && data.user_permission ?
<a className="Closeor_btn fr" type="submit"
onClick={() => this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"}</a>
:
""
}
</Spin>
<React.Fragment>
<div className="order_line" style={{ marginLeft: 80 }}></div>
<div className="df">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
<div className="new_context">
<div className="quillContent" style={{ marginBottom: "20px" }}>
<MDEditor placeholder={'添加评论...'} height={200}
mdID={'orderdetail-add-descriptions'} initValue={quillValue} onChange={this.onContentChange} ></MDEditor>
<p className="quillFlag">
{quillFlag && <span className="">请输入评论内容</span>}
</p>
</div>
<UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15">
<Spin spinning={journal_spin}>
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
{
data && data.user_permission ?
<a className="Closeor_btn fr" type="submit"
onClick={() => this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"}</a>
:
""
}
</Spin>
</p>
</div>
</div>
</React.Fragment>
:
<div className="loginDiv"><Link to={`/login`}>登录</Link></div>
</p>
</div>
</div>
</React.Fragment>
:
<div className="loginDiv"><Link to={`/login`}>登录</Link></div>
}
</div>
<div className="list-left DetailRight" style={{backgroundColor:"#fff"}}>
<div className="list-left DetailRight" style={{ backgroundColor: "#fff" }}>
<p>
<span className="span_title">分支</span>
<span>{
@ -556,10 +548,10 @@ class Detail extends Component{
<p>
<span className="span_title">标签</span>
<span>{
data && data.issue_tags ? <span className="issue-tag-show" style={{background: data.issue_tags[0].color}}>{data.issue_tags[0].name}</span> : "--"
data && data.issue_tags ? <span className="issue-tag-show" style={{ background: data.issue_tags[0].color }}>{data.issue_tags[0].name}</span> : "--"
}</span>
</p>
<p style={{display: "inline-block",'white-space': "nowrap" }}>
<p style={{ display: "inline-block", 'white-space': "nowrap" }}>
<span className="span_title">里程碑</span>
<span className="title_overflow">{
data && data.version ? data.version : "--"
@ -594,17 +586,17 @@ class Detail extends Component{
</div>
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{textAlign:'center'}}
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{ textAlign: 'center' }}
>
<img className="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</Modal>
</div>
<img className="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" />
</Modal>
</div>
)
}
}

View File

@ -1,119 +1,120 @@
import React , {Component} from 'react';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Dropdown , Icon , Menu , Pagination,Typography,Popconfirm} from 'antd';
import { Dropdown, Icon, Menu, Pagination, Typography, Popconfirm } from 'antd';
import Nav from './Nav';
import NoneData from '../Nodata';
import axios from 'axios';
const { Text } = Typography;
class Milepost extends Component{
constructor(props){
class Milepost extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
limit:15,
page:1,
order_type:undefined,
this.state = {
data: undefined,
limit: 15,
page: 1,
order_type: undefined,
//新建标签区域是否显示 none 隐藏 block 显示
display:'none',
status:'open',
openselect:1,
closeselect:undefined,
order_name:undefined
}
display: 'none',
status: 'open',
openselect: 1,
closeselect: undefined,
order_name: undefined
}
}
componentDidMount=()=>{
this.getList(1,this.state.status,'desc');
componentDidMount = () => {
this.getList(1, this.state.status, 'desc');
}
getList=(page,status,order_type,order_name)=>{
getList = (page, status, order_type, order_name) => {
const { projectsId } = this.props.match.params;
const { limit } = this.state;
const url = `/projects/${projectsId}/versions.json`;
axios.get(url,{
params:{
projectsId,page,limit,status,order_type,order_name
axios.get(url, {
params: {
projectsId, page, limit, status, order_type, order_name
}
}).then((result)=>{
if(result){
}).then((result) => {
if (result) {
this.setState({
data:result.data
data: result.data
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
opneMilelist=(type)=>{
const { order_name} = this.state;
if(type){
opneMilelist = (type) => {
const { order_name } = this.state;
if (type) {
const { current_user } = this.props;
if(type===1){
if (type === 1) {
this.setState({
status:'open',
openselect:current_user.user_id,
closeselect:undefined
status: 'open',
openselect: current_user.user_id,
closeselect: undefined
})
this.getList(1,'open','desc',order_name);
}else{
this.getList(1, 'open', 'desc', order_name);
} else {
this.setState({
status:'closed',
openselect:undefined,
closeselect:current_user.user_id
status: 'closed',
openselect: undefined,
closeselect: current_user.user_id
})
this.getList(1,'closed','desc',order_name);
this.getList(1, 'closed', 'desc', order_name);
}
}
}
updatestatusemile=(status,arr)=>{
updatestatusemile = (status, arr) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${arr.id}/update_status.json`;
const { current_user } = this.props;
axios.post(url,{
project_id:projectsId,
id:arr.id,
status:status
}).then(result=>{
if(result){
axios.post(url, {
project_id: projectsId,
id: arr.id,
status: status
}).then(result => {
if (result) {
this.setState({
status:status,
closeselect:status==="closed"?current_user.user_id:undefined,
openselect:status==="closed"?undefined:current_user.user_id
})
status: status,
closeselect: status === "closed" ? current_user.user_id : undefined,
openselect: status === "closed" ? undefined : current_user.user_id
})
this.getList(1,status,'desc')
this.getList(1, status, 'desc')
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
closemile=(arr)=>{
closemile = (arr) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${arr.id}.json`;
axios.delete(url,{ data: {
project_id: projectsId,
id: arr.id
}
}).then((result)=>{
if(result){
this.getList(1,this.state.status,'desc')
axios.delete(url, {
data: {
project_id: projectsId,
id: arr.id
}
}).catch((error)=>{
}).then((result) => {
if (result) {
this.getList(1, this.state.status, 'desc')
}
}).catch((error) => {
console.log(error);
})
})
}
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page
})
@ -122,31 +123,31 @@ class Milepost extends Component{
}
// 排序
arrayList=(e)=>{
arrayList = (e) => {
this.setState({
order_name:e.key,
order_type:e.item.props.value
order_name: e.key,
order_type: e.item.props.value
})
this.getList(1,this.state.status,e.item.props.value,e.key);
this.getList(1, this.state.status, e.item.props.value, e.key);
}
//控制新建标签页是否显示
newshow=()=>{
newshow = () => {
this.setState({
display:'block'
display: 'block'
});
};
newclose=()=>{
newclose = () => {
this.setState({
display:'none'
});
display: 'none'
});
};
render(){
const { data , limit , page,openselect,closeselect } = this.state;
render() {
const { data, limit, page, openselect, closeselect } = this.state;
const { projectsId } = this.props.match.params;
const menu = (
<Menu onClick={this.arrayList}>
@ -163,23 +164,23 @@ class Milepost extends Component{
<React.Fragment>
{
data && data.issue_tags_count > limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={data && data.issue_tags_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={data && data.issue_tags_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
const renderList =()=>{
if(data && data.versions && data.versions.length>0 ){
return(
const renderList = () => {
if (data && data.versions && data.versions.length > 0) {
return (
<div>
<div className="tagList">
{
data.versions.length===0?<NoneData></NoneData>:data.versions.map((item,key)=>{
return(
<div style={{display:'block'}}>
data.versions.length === 0 ? <NoneData></NoneData> : data.versions.map((item, key) => {
return (
<div style={{ display: 'block' }}>
<div className="milepostdiv">
<div className="milepostwidth">
<div className="grid-item width100">
@ -189,7 +190,7 @@ class Milepost extends Component{
</div>
</div>
<div className="milepostdiv" style={{marginTop:5}}>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="milepostrighe">
<div className="grid-item mr10">
@ -224,11 +225,11 @@ class Milepost extends Component{
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={()=>this.updatestatusemile(this.state.status==="closed"?"open":"closed",item)} className="color-grey-9">{this.state.status==="closed"?"开启":"关闭"}</a>
<a onClick={() => this.updatestatusemile(this.state.status === "closed" ? "open" : "closed", item)} className="color-grey-9">{this.state.status === "closed" ? "开启" : "关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={()=>this.closemile(item)}>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={() => this.closemile(item)}>
<a className="color-grey-9">删除</a>
</Popconfirm>
</div>
@ -238,11 +239,11 @@ class Milepost extends Component{
}
</div>
<div className="milepostdiv"style={{marginTop:5}}>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="textwidth">
<Text
type="secondary"
ellipsis={{rows: 30, expandable: false, onExpand: Function}}
ellipsis={{ rows: 30, expandable: false, onExpand: Function }}
>
{item.description}</Text>
</div>
@ -255,39 +256,27 @@ class Milepost extends Component{
</div>
)
}else{
return(
} else {
return (
<NoneData _html="暂时还没有相关数据哦!" />
)
}
}
return(
return (
<div className="main">
<div>
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state} />*/}
{/*{*/}
{/*data && data.user_admin_or_member ?*/}
{/*<Link to={`/projects/${projectsId}/orders/meilpost`} className="topWrapper_btn">新的里程碑</Link>*/}
{/*: ''*/}
{/*}*/}
{/*</div>*/}
<div style={{display: this.state.display}}>
<div style={{ display: this.state.display }}>
<div className="tagdiv" >
<span>里程碑{ data && data.issue_tags_count }已创建</span>
<span>里程碑{data && data.issue_tags_count}已创建</span>
</div>
</div>
<div className="topWrapper">
<div className="topWrapper_type">
<li className={openselect ? "active":""} onClick={()=>this.opneMilelist(1)}>{data && data.open_count}个开启中</li>
<li className={closeselect ? "active":""} onClick={()=>this.opneMilelist(2)}>{data && data.closed_count}个已关闭</li>
{/* <span onClick={this.opneMilelist}>{ data && data.open_count }</span>
<span onClick={this.closeMilelist}>{ data && data.closed_count }已关闭</span> */}
</div>
<div className="topWrapper_type">
<li className={openselect ? "active" : ""} onClick={() => this.opneMilelist(1)}>{data && data.open_count}个开启中</li>
<li className={closeselect ? "active" : ""} onClick={() => this.opneMilelist(2)}>{data && data.closed_count}个已关闭</li>
</div>
<div className="topWrapper_select">
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={menu} trigger={['click']} placement="bottomCenter">
@ -301,11 +290,9 @@ class Milepost extends Component{
: ''
}
</div>
</div>
{ renderList()}
{ Paginations }
</div>
{renderList()}
{Paginations}
</div>
</div>
)

View File

@ -1,6 +1,6 @@
import React , { Component } from "react";
import {Link} from 'react-router-dom';
import { Dropdown , Menu , Icon , Pagination , Spin } from 'antd';
import React, { Component } from "react";
import { Link } from 'react-router-dom';
import { Dropdown, Menu, Icon, Pagination, Spin } from 'antd';
import './order.css';
import NoneData from '../Nodata';
@ -23,172 +23,169 @@ import axios from 'axios';
* issue_type:搜索条件
* status_type: issue的关闭和开启1表示开启中的2表示关闭的
*/
class MilepostDetail extends Component{
constructor(props){
class MilepostDetail extends Component {
constructor(props) {
super(props);
this.state={
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,
status_type:'1',
this.state = {
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,
status_type: '1',
//设置选择高亮
openselect:1,
closeselect:undefined,
openselect: 1,
closeselect: undefined,
// status_type: undefined
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
}
}
componentDidMount=()=>{
componentDidMount = () => {
this.getSelectList();
this.getIssueList();
}
getSelectList=()=>{
getSelectList = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen:result.data.issue_chosen
issue_chosen: result.data.issue_chosen
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
// 获取列表数据
getIssueList=(page,limit,search,author_id,assigned_to_id,status_type,id,value, order_name, order_type)=>{
const { projectsId,meilid} = this.props.match.params;
getIssueList = (page, limit, search, author_id, assigned_to_id, status_type, id, value, order_name, order_type) => {
const { projectsId, meilid } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${meilid}.json`;
axios.get(url,{
params:{
page,limit,search,author_id,assigned_to_id,status_type,order_name,order_type,
[id]:value
axios.get(url, {
params: {
page, limit, search, author_id, assigned_to_id, status_type, order_name, order_type,
[id]: value
}
}).then((result)=>{
if(result){
}).then((result) => {
if (result) {
this.setState({
data:result.data,
issues:result.data.issues,
search_count:result.data.search_count,
isSpin:false
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
getOption=(e,id,name)=>{
if(id+'s'==="issue_tag_ids"){
getOption = (e, id, name) => {
if (id + 's' === "issue_tag_ids") {
this.setState({
[id]:e.key,
issue_tag_ids:name
[id]: e.key,
issue_tag_ids: name
})
}
if(id+'s'==="tracker_ids"){
if (id + 's' === "tracker_ids") {
this.setState({
[id]:e.key,
tracker_ids:name
[id]: e.key,
tracker_ids: name
})
}
if(id+'s'==="author_ids"){
if (id + 's' === "author_ids") {
this.setState({
[id]:e.key,
author_ids:name
[id]: e.key,
author_ids: name
})
}
if(id+'s'==="assigned_to_ids"){
if (id + 's' === "assigned_to_ids") {
this.setState({
[id]:e.key,
assigned_to_ids:name
[id]: e.key,
assigned_to_ids: name
})
}
if(id+'s'==="priority_ids"){
if (id + 's' === "priority_ids") {
this.setState({
[id]:e.key,
priority_ids:name
[id]: e.key,
priority_ids: name
})
}
if(id+'s'==="done_ratios"){
if (id + 's' === "done_ratios") {
this.setState({
[id]:e.key,
done_ratios:name
[id]: e.key,
done_ratios: name
})
}
if(e.key==="created_on"){
if(e.item.props.value==="desc"){
if (e.key === "created_on") {
if (e.item.props.value === "desc") {
this.setState({
[id]:e.key,
paix:'最新创建'
[id]: e.key,
paix: '最新创建'
})
}else{
} else {
this.setState({
[id]:e.key,
paix:'最早创建'
[id]: e.key,
paix: '最早创建'
})
}
}else if(e.key==="updated_on"){
if(e.item.props.value==="desc"){
} else if (e.key === "updated_on") {
if (e.item.props.value === "desc") {
this.setState({
[id]:e.key,
paix:'最新更新'
[id]: e.key,
paix: '最新更新'
})
}else{
} else {
this.setState({
[id]:e.key,
paix:'最早更新'
[id]: e.key,
paix: '最早更新'
})
}
}
this.setState({
[id]:e.key
[id]: e.key
})
const { page,limit,search,author_id,assigned_to_id,status_type } = this.state;
if(e.key==="all"){
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id);
}else if (e.key==="created_on" || e.key==="updated_on"){
const { page, limit, search, author_id, assigned_to_id, status_type } = this.state;
if (e.key === "all") {
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id);
} else if (e.key === "created_on" || e.key === "updated_on") {
this.setState({
order_name:e.key,
order_type:e.item.props.value
order_name: e.key,
order_type: e.item.props.value
})
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id,undefined,undefined,e.key, e.item.props.value);
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id, undefined, undefined, e.key, e.item.props.value);
}
else{
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id,e.key);
else {
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id, e.key);
}
}
renderMenu =(array,name,id)=>{
return(
renderMenu = (array, name, id) => {
return (
<Menu>
<Menu.Item key={"all"} onClick={(e)=>this.getOption(e,id,name)}>{name}</Menu.Item>
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>{name}</Menu.Item>
{
array && array.length > 0 && array.map((item,key)=>{
return(
<Menu.Item key={item.id} onClick={(e)=>this.getOption(e,id,item.name)}>{item.name}</Menu.Item>
array && array.length > 0 && array.map((item, key) => {
return (
<Menu.Item key={item.id} onClick={(e) => this.getOption(e, id, item.name)}>{item.name}</Menu.Item>
)
})
}
@ -197,72 +194,72 @@ class MilepostDetail extends Component{
}
// 翻页
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page,
isSpin:true
isSpin: true
})
const {limit,search,status_type,author_id,assigned_to_id} = this.state;
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type);
const { limit, search, status_type, author_id, assigned_to_id } = this.state;
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type);
}
// 搜索
searchFunc=(value)=>{
searchFunc = (value) => {
this.setState({
search:value,
isSpin:true
search: value,
isSpin: true
})
const {page,limit,status_type,author_id,assigned_to_id} = this.state;
this.getIssueList(page,limit,value,author_id,assigned_to_id,status_type);
const { page, limit, status_type, author_id, assigned_to_id } = this.state;
this.getIssueList(page, limit, value, author_id, assigned_to_id, status_type);
}
openorder=(type)=>{
if(type){
openorder = (type) => {
if (type) {
const { current_user } = this.props;
if(type===1){
if (type === 1) {
this.setState({
status_type:'1',
openselect:current_user.user_id,
closeselect:undefined,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
status_type: '1',
openselect: current_user.user_id,
closeselect: undefined,
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList("","","","","",1,"");
this.getIssueList("", "", "", "", "", 1, "");
}else{
} else {
this.setState({
status_type:'2',
openselect:undefined,
closeselect:current_user.user_id,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
status_type: '2',
openselect: undefined,
closeselect: current_user.user_id,
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList("","","","","",2,"");
this.getIssueList("", "", "", "", "", 2, "");
}
}
}
render(){
const { issue_chosen , issues , limit , page , search_count , data , isSpin,openselect,closeselect } = this.state;
const { projectsId , meilid } = this.props.match.params;
render() {
const { issue_chosen, issues, limit, page, search_count, data, isSpin, openselect, closeselect } = this.state;
const { projectsId, meilid } = this.props.match.params;
const menu = (
<Menu onClick={(e)=>this.getOption(e)}>
<Menu onClick={(e) => this.getOption(e)}>
<Menu.Item key={'created_on'} value="desc">最新创建</Menu.Item>
<Menu.Item key={'created_on'} value="asc">最早创建</Menu.Item>
<Menu.Item key={'updated_on'} value="desc">最新更新</Menu.Item>
@ -274,82 +271,82 @@ class MilepostDetail extends Component{
<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>:""
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
return(
return (
<div className="main">
<div className="miledetail">
<div className="topmilepost">
<p>{data&&data.name}</p>
<div className="milepostdiv">
<Link to={`/projects/${projectsId}/orders/${meilid}/meilpost`} className="topWrapper_btn" style={{marginRight:15}} >编辑里程碑</Link>
<Link to={`/projects/${projectsId}/orders/${meilid}/new`} className="topWrapper_btn">创建任务</Link>
<div className="topmilepost">
<p>{data && data.name}</p>
<div className="milepostdiv">
<Link to={`/projects/${projectsId}/orders/${meilid}/meilpost`} className="topWrapper_btn" style={{ marginRight: 15 }} >编辑里程碑</Link>
<Link to={`/projects/${projectsId}/orders/${meilid}/new`} className="topWrapper_btn">创建任务</Link>
</div>
</div>
<div className="grid-item mr10">
<span className="mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
data && data.effective_date ?
<span >{data && data.effective_date}</span>
:
<span >暂无截止时间</span>
}
</span>
<span className="font-weight-bold">
{data && data.percent.toFixed(2)}%完成
</span>
</div>
</div>
<div className="grid-item mr10">
<span className="mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
data&&data.effective_date ?
<span >{data&&data.effective_date}</span>
:
<span >暂无截止时间</span>
}
</span>
<span className="font-weight-bold">
{data&&data.percent.toFixed(2)}%完成
</span>
</div>
</div>
<div className="topWrapper" style={{borderBottom:"none"}}>
<div className="topWrapper" style={{ borderBottom: "none" }}>
{/* <p className="topWrapper_type">
</p> */}
</div>
<Spin spinning={isSpin}>
<div className="f-wrap-between mb20">
<ul className="topWrapper_type">
<li className={openselect ? "active":""} onClick={()=>this.openorder(1)}>{data && data.open_issues_count}个开启中</li>
<li className={closeselect ? "active":""} onClick={()=>this.openorder(2)}>{data && data.close_issues_count}个已关闭</li>
<ul className="topWrapper_type">
<li className={openselect ? "active" : ""} onClick={() => this.openorder(1)}>{data && data.open_issues_count}个开启中</li>
<li className={closeselect ? "active" : ""} onClick={() => this.openorder(2)}>{data && data.close_issues_count}个已关闭</li>
{/* <li>@我的</li> */}
</ul>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag,'标签','issue_tag_id')} trigger={['click']} placement="bottomCenter">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag, '标签', 'issue_tag_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.issue_tag_ids}<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>*/}
{/*<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker, '所有分类', 'tracker_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.tracker_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '发布人', 'author_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.author_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '指派人', 'assigned_to_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.assigned_to_ids}<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>{this.state.priority_ids}<Icon type="caret-down" className="ml5"/></span>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.priority, '优先度', 'priority_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.priority_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio, '完成度', 'done_ratio')} trigger={['click']} placement="bottomCenter">
<span>{this.state.done_ratios}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
@ -362,14 +359,14 @@ class MilepostDetail extends Component{
</div>
{
search_count === 0 ?
<NoneData _html="暂时还没有相关数据哦!"/>
:
<OrderItem issues={issues} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state}></OrderItem>
<NoneData _html="暂时还没有相关数据哦!" />
:
<OrderItem issues={issues} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state}></OrderItem>
}
{ Paginations }
{Paginations}
</Spin>
</div>
</div>
)
}
}

View File

@ -1,101 +1,102 @@
import React , { Component } from 'react';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Popconfirm, Text } from 'antd';
class OrderItem extends Component{
set_issue_tags =(issue_tags)=>{
if(issue_tags && issue_tags.length > 0){
return(
issue_tags.map((item,key)=>{
return(
<span className="issue-tag-show" style={{background: item.color}}>{item.name}</span>
class OrderItem extends Component {
set_issue_tags = (issue_tags) => {
if (issue_tags && issue_tags.length > 0) {
return (
issue_tags.map((item, key) => {
return (
<span className="issue-tag-show" style={{ background: item.color }}>{item.name}</span>
)
})
)
}else{
return("--")
} else {
return ("--")
}
}
render(){
const { issues , search_count , page , limit } = this.props;
render() {
const { data } = this.props;
const { projectsId } = this.props.match.params;
const renderList =()=>{
data.versions.map((item,key)=>{
return(
<div style={{display:'block'}}>
<div className="milepostdiv">
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
</div>
</div>
const renderList = () => {
data.versions.map((item, key) => {
return (
<div style={{ display: 'block' }}>
<div className="milepostdiv">
<div className="milepostwidth">
<div className="grid-item width100">
<i className="iconfont icon-lubiaosignpost3 font-12 mr3"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/MilepostDetail`} className="font-16">{item.name}</Link>
</div>
<div className="milepostdiv" style={{marginTop:5}}>
<div className="milepostrighe">
<div className="grid-item mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
item.effective_date ?
<span className="color-red">{item.effective_date}</span>
:
<span className="color-grey-c">暂无截止时间</span>
}
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-issue font-14 mr5"></i>
<span>
{item.open_issues_count}个开启
</span>
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-shanchudiao font-14 mr5"></i>
<span>
{item.close_issues_count}个关闭
</span>
</div>
</div>
</div>
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="milepostrighe">
<div className="grid-item mr10">
<i className="iconfont icon-rili font-14 mr5">
</i>
{
data && data.user_admin_or_member ?
<div className="milepostleft">
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={()=>this.updatestatusemile(this.state.status==="closed"?"open":"closed",item)} className="color-grey-9">{this.state.status==="closed"?"开启":"关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={()=>this.closemile(item)}>
<a className="color-grey-9">删除</a>
</Popconfirm>
</div>
</div>
: ''
item.effective_date ?
<span className="color-red">{item.effective_date}</span>
:
<span className="color-grey-c">暂无截止时间</span>
}
</div>
<div className="milepostdiv"style={{marginTop:5}}>
<div className="textwidth">
<Text
type="secondary"
ellipsis={{rows: 30, expandable: false, onExpand: Function}}
>
{item.description}</Text>
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-issue font-14 mr5"></i>
<span>
{item.open_issues_count}个开启
</span>
</div>
<div className="grid-item mr10 color-grey-9">
<i className="iconfont icon-shanchudiao font-14 mr5"></i>
<span>
{item.close_issues_count}个关闭
</span>
</div>
</div>
)
})
{
data && data.user_admin_or_member ?
<div className="milepostleft">
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-bianji3 font-14 mr5"></i>
<Link to={`/projects/${projectsId}/orders/${item.id}/meilpost`} className="color-grey-9">编辑</Link>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-yiguanbi1 font-14 mr5"></i>
<a onClick={() => this.updatestatusemile(this.state.status === "closed" ? "open" : "closed", item)} className="color-grey-9">{this.state.status === "closed" ? "开启" : "关闭"}</a>
</div>
<div className="grid-item mr15 color-grey-9">
<i className="iconfont icon-lajitong font-14 mr5" ></i>
<Popconfirm placement="bottom" title={'是否删除里程碑?'} okText="是" cancelText="否" onConfirm={() => this.closemile(item)}>
<a className="color-grey-9">删除</a>
</Popconfirm>
</div>
</div>
: ''
}
</div>
<div className="milepostdiv" style={{ marginTop: 5 }}>
<div className="textwidth">
<Text
type="secondary"
ellipsis={{ rows: 30, expandable: false, onExpand: Function }}
>
{item.description}</Text>
</div>
</div>
</div>
)
})
}
return(
return (
<div>
{renderList()}
</div>

View File

@ -15,7 +15,6 @@ class Nav extends Component{
<p className="topWrapper_nav">
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${projectsId}/orders/tags`}>标签</NavLink>
<NavLink activeClassName="active" className="issue-type-button" to={`/projects/${projectsId}/orders/Milepost`}>里程碑</NavLink>
</p>
)
}

View File

@ -1,5 +1,5 @@
import React , { Component } from "react";
import { Form , Input , Select, Spin } from 'antd';
import React, { Component } from "react";
import { Form, Input, Select, Spin } from 'antd';
import { getImageUrl } from 'educoder';
import UploadComponent from '../Upload/Index';
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
@ -7,32 +7,32 @@ import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
import './order.css';
import axios from 'axios';
import {Link} from "react-router-dom";
import { Link } from "react-router-dom";
const Option = Select.Option;
class New extends Component{
constructor(props){
class New extends Component {
constructor(props) {
super(props);
this.state={
branch_name:"",
issue_tag_ids:"",
fixed_version_id:"",
tracker_id:"缺陷",
issue_type:"普通",
status_id:'新增',
assigned_to_id:"",
priority_id:"正常",
done_ratio:"0%",
issue_chosen:undefined,
branches:undefined,
fileList:undefined,
description:undefined,
isSpin:false
this.state = {
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: "缺陷",
issue_type: "普通",
status_id: '新增',
assigned_to_id: "",
priority_id: "正常",
done_ratio: "0%",
issue_chosen: undefined,
branches: undefined,
fileList: undefined,
description: undefined,
isSpin: false
}
}
componentDidMount=()=>{
if(!this.props.checkIfLogin()){
componentDidMount = () => {
if (!this.props.checkIfLogin()) {
this.props.showLoginDialog();
return;
}
@ -40,45 +40,42 @@ class New extends Component{
this.getSelectList();
}
InitData=()=>{
InitData = () => {
this.props.form.setFieldsValue({
...this.state
});
}
getSelectList=()=>{
getSelectList = () => {
let projectsId = ""
if(this.props.match.params.milepostId){
if (this.props.match.params.milepostId) {
projectsId = this.props.match.params.projectsId;
this.props.form.setFieldsValue({
fixed_version_id: this.props.match.params.milepostId
});
// this.setState({
// fixed_version_id: this.props.match.params.milepostId
// })
}else{
} else {
projectsId = this.props.match.params.projectsId;
}
const url = `/projects/${projectsId}/issues/new.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen:result.data.issue_chosen,
branches:result.data.branches
issue_chosen: result.data.issue_chosen,
branches: result.data.branches
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
renderSelect=(list)=>{
if(list && list.length >0){
return(
list.map((item,key)=>{
return(
<Option key={key+1} value={item.id+""}>{item.name}</Option>
renderSelect = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<Option key={key + 1} value={item.id + ""}>{item.name}</Option>
)
})
)
@ -86,50 +83,50 @@ class New extends Component{
}
// 创建
handleSubmit=()=>{
handleSubmit = () => {
this.setState({
isSpin: true
})
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
if (!err) {
const { projectsId } = this.props.match.params;
const { fileList } = this.state;
const url = `/projects/${projectsId}/issues.json`;
if(values.status_id==="新增"){
values.status_id="1"
if (values.status_id === "新增") {
values.status_id = "1"
}
// if(values.issue_type==="普通"){
// values.issue_type="1"
// }
if(values.tracker_id==="缺陷"){
values.tracker_id="1"
if (values.tracker_id === "缺陷") {
values.tracker_id = "1"
}
if(values.priority_id==="正常"){
values.priority_id="2"
if (values.priority_id === "正常") {
values.priority_id = "2"
}
if(values.done_ratio==="0%"){
values.done_ratio="0"
if (values.done_ratio === "0%") {
values.done_ratio = "0"
}
if(values.issue_tag_ids.length > 0){
if (values.issue_tag_ids.length > 0) {
values.issue_tag_ids = [values.issue_tag_ids]
}
const { description } = this.state;
axios.post(url,{
axios.post(url, {
...values,
description:description,
attachment_ids:fileList
}).then(result=>{
if(result){
description: description,
attachment_ids: fileList
}).then(result => {
if (result) {
this.props.showNotification("任务创建成功!");
this.props.history.push(`/projects/${projectsId}/orders`);
this.setState({
description:'',
description: '',
isSpin: false
})
}
}).catch(error=>{
}).catch(error => {
this.setState({
isSpin: false
})
@ -141,30 +138,30 @@ class New extends Component{
}
// 获取上传后的文件id数组
UploadFunc=(fileList)=>{
UploadFunc = (fileList) => {
this.setState({
fileList
})
}
onContentChange=(value)=>{
onContentChange = (value) => {
this.setState({
description:value
description: value
})
}
render(){
render() {
const { getFieldDecorator } = this.props.form;
const { current_user } = this.props;
const { description , issue_chosen , branches, isSpin } = this.state;
return(
const { description, issue_chosen, branches, isSpin } = this.state;
return (
<div className="main">
<Form>
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df">
<Link to={`/users/${current_user && current_user.login}/projects`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
</Link>
<div className="new_context">
@ -174,22 +171,22 @@ class New extends Component{
required: true, message: '请填写任务标题'
}],
})(
<Input placeholder="标题"/>
<Input placeholder="标题" />
)}
</Form.Item>
<div className="quillContent" style={{marginBottom:"20px"}}>
<MDEditor placeholder={'请输入描述信息'} height={350}
mdID={'order-new-description'} initValue={description} onChange={this.onContentChange} ></MDEditor>
<div className="quillContent" style={{ marginBottom: "20px" }}>
<MDEditor placeholder={'请输入描述信息'} height={350}
mdID={'order-new-description'} initValue={description} onChange={this.onContentChange} ></MDEditor>
</div>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true}></UploadComponent>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true}></UploadComponent>
<p className="clearfix mt15">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" onClick={this.handleSubmit}>创建任务</a>
</Spin>
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" onClick={this.handleSubmit}>创建任务</a>
</Spin>
</p>
</div>
</div>
<div className="list-left mt10" style={{paddingRight:"0px",paddingLeft:"0px",width:"25%",backgroundColor:"#fff"}}>
<div className="list-left mt10" style={{ paddingRight: "0px", paddingLeft: "0px", width: "25%", backgroundColor: "#fff" }}>
<div className="list-l-panel">
<Form.Item>
{getFieldDecorator('branch_name', {
@ -198,8 +195,8 @@ class New extends Component{
<Select>
<Option value={''}>分支未指定</Option>
{
branches && branches.length >0 && branches.map((item,key)=>{
return(
branches && branches.length > 0 && branches.map((item, key) => {
return (
<Option value={item}>{item}</Option>
)
})
@ -214,8 +211,8 @@ class New extends Component{
rules: [],
})(
<Select>
<Option value={""}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签':'请在仓库设置里添加标签'}</Option>
{ this.renderSelect(issue_chosen && issue_chosen.issue_tag) }
<Option value={""}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_tag)}
</Select>
)}
</Form.Item>
@ -227,8 +224,8 @@ class New extends Component{
})(
<Select>
<Option value={""}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑': '请添加里程碑'}</Option>
{ this.renderSelect(issue_chosen && issue_chosen.issue_version) }
<Option value={""}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_version)}
</Select>
)}
</Form.Item>
@ -241,7 +238,7 @@ class New extends Component{
}],
})(
<Select>
{ this.renderSelect(issue_chosen && issue_chosen.issue_status) }
{this.renderSelect(issue_chosen && issue_chosen.issue_status)}
</Select>
)}
</Form.Item>
@ -254,7 +251,7 @@ class New extends Component{
}],
})(
<Select>
{ this.renderSelect(issue_chosen && issue_chosen.tracker) }
{this.renderSelect(issue_chosen && issue_chosen.tracker)}
</Select>
)}
</Form.Item>
@ -267,7 +264,7 @@ class New extends Component{
})(
<Select>
<Option value={""}>未指派成员</Option>
{ this.renderSelect(issue_chosen && issue_chosen.assign_user) }
{this.renderSelect(issue_chosen && issue_chosen.assign_user)}
</Select>
)}
</Form.Item>
@ -280,7 +277,7 @@ class New extends Component{
}],
})(
<Select>
{ this.renderSelect(issue_chosen && issue_chosen.priority) }
{this.renderSelect(issue_chosen && issue_chosen.priority)}
</Select>
)}
</Form.Item>
@ -293,7 +290,7 @@ class New extends Component{
}],
})(
<Select>
{ this.renderSelect(issue_chosen && issue_chosen.done_ratio) }
{this.renderSelect(issue_chosen && issue_chosen.done_ratio)}
</Select>
)}
</Form.Item>

View File

@ -1,63 +1,63 @@
import React , { Component } from 'react';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Popconfirm} from 'antd'
import { Popconfirm } from 'antd'
class OrderItem extends Component{
constructor(props){
class OrderItem extends Component {
constructor(props) {
super(props);
this.state={
this.state = {
//显示 隐藏
isdisplay:false,
orderid:'',
isdisplay: false,
orderid: '',
}
}
set_issue_tags =(issue_tags)=>{
if(issue_tags && issue_tags.length > 0){
return(
issue_tags.map((item,key)=>{
return(
<span className="issue-tag-show" style={{background: item.color}}>{item.name}</span>
set_issue_tags = (issue_tags) => {
if (issue_tags && issue_tags.length > 0) {
return (
issue_tags.map((item, key) => {
return (
<span className="issue-tag-show" style={{ background: item.color }}>{item.name}</span>
)
})
)
}else{
return("--")
} else {
return ("--")
}
}
deletedetail=(id)=>{ // 学习挣钱,调用父组件方法
deletedetail = (id) => {
this.props.deletedetail(id);
}
onMouseMove=(type)=>{
this.setState({
isdisplay:true,
orderid:type
})
}
onMouseOut=()=>{
onMouseMove = (type) => {
this.setState({
isdisplay:false
})
isdisplay: true,
orderid: type
})
}
render(){
const { issues , search_count , page , limit } = this.props;
const { projectsId } = this.props.match.params;
const {current_user} = this.props
onMouseOut = () => {
this.setState({
isdisplay: false
})
}
const renderList =()=>{
if(issues && issues.length > 0){
return(
issues.map((item,key)=>{
return(
render() {
const { issues, search_count, page, limit } = this.props;
const { projectsId } = this.props.match.params;
const { current_user } = this.props
const renderList = () => {
if (issues && issues.length > 0) {
return (
issues.map((item, key) => {
return (
<div className="issueItem" key={key}>
<div className="flex-1">
<p className="mb15 df">
<span className={item.issue_status==="关闭"? "issueNo":"issueNo issueOpen"}># {search_count - (key + (page-1) * limit)}</span>
<span className={item.issue_status === "关闭" ? "issueNo" : "issueNo issueOpen"}># {search_count - (key + (page - 1) * limit)}</span>
<Link to={`/projects/${projectsId}/orders/${item.id}/detail`} className="flex-1 hide-1 font-16 color-grey-3 lineh-30">{item.name}</Link>
</p>
<p className="color-grey-6 font-12">
@ -70,55 +70,50 @@ class OrderItem extends Component{
}
</p>
</div>
<ul className="topWrapper_select no-cursor" onMouseMove={()=>this.onMouseMove(item.id)} onMouseOut={()=>this.onMouseOut()} >
<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.issue_type || "--"}</li>*/}
<li>{item.tracker || "--"}</li>
<li>
{
item.author_name ?
<Link to={`/users/${item.author_login}/projects`} className="show-user-link">
{item.author_name}
</Link>
: "--"
<Link to={`/users/${item.author_login}/projects`} className="show-user-link">
{item.author_name}
</Link>
: "--"
}
</li>
<li>
{
{
item.assign_user_name ?
<Link to={`/users/${item.assign_user_login}/projects`} className="show-user-link">
{item.assign_user_name}
</Link>
: "--"
<Link to={`/users/${item.assign_user_login}/projects`} className="show-user-link">
{item.assign_user_name}
</Link>
: "--"
}
{/* {item.assign_user_name || "--"} */}
</li>
<li><p style={{width:60,height:25,margin:'auto', paddingTop:2,background:item.priority==='高'?'#e67e22':item.priority==='正常'?'#28be6c':item.priority==='低'?'#1abc9c':'#e74c3c',color:'#ffffff',borderRadius:4}}>{item.priority|| "--"}</p></li>
</li>
<li><p style={{ width: 60, height: 25, margin: 'auto', paddingTop: 2, background: item.priority === '高' ? '#e67e22' : item.priority === '正常' ? '#28be6c' : item.priority === '低' ? '#1abc9c' : '#e74c3c', color: '#ffffff', borderRadius: 4 }}>{item.priority || "--"}</p></li>
<li>{item.done_ratio || "--"}</li>
<li>
<div className="flex-1">
<p>
{ item.journals_count ? <Link to={`/projects/${projectsId}/orders/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link> : "" }
</p>
<p>
{item.journals_count ? <Link to={`/projects/${projectsId}/orders/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link> : ""}
</p>
{
current_user && current_user.login ?
<div className="milepostleft" style={{display:this.state.orderid===item.id&&this.state.isdisplay?'flex':'none'}}>
<div className="milepostleft" style={{ display: this.state.orderid === item.id && this.state.isdisplay ? 'flex' : 'none' }}>
<div className="grid-item mr15 color-grey-9">
<Link to={`/projects/${projectsId}/orders/${item.id}/updatedetail`} className="color-grey-9"><i className="iconfont icon-bianji3 font-14 mr5"></i></Link>
</div>
<div className="grid-item color-grey-9">
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={()=>this.deletedetail(item.id)}>
<Popconfirm placement="bottom" title={'您确定要删除吗'} okText="是" cancelText="否" onConfirm={() => this.deletedetail(item.id)}>
<i className="iconfont icon-yiguanbi1 font-14"></i>
</Popconfirm>
</div>
</div>
: ""
}
</div>
</div>
</li>
</ul>
</div>
)
@ -126,7 +121,7 @@ class OrderItem extends Component{
)
}
}
return(
return (
<div>
{renderList()}
</div>

View File

@ -1,74 +1,74 @@
import React , {Component} from 'react';
import { Dropdown , Icon , Menu , Pagination, Modal,Input,Popconfirm,Form } from 'antd';
import React, { Component } from 'react';
import { Dropdown, Icon, Menu, Pagination, Modal, Input, Popconfirm, Form } from 'antd';
import Nav from './Nav';
import NoneData from '../Nodata';
import { SketchPicker } from 'react-color'
import reactCSS from 'reactcss'
import axios from 'axios';
class Tags extends Component{
constructor(props){
class Tags extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
limit:15,
page:1,
order_name:undefined,
order_type:undefined,
this.state = {
data: undefined,
limit: 15,
page: 1,
order_name: undefined,
order_type: undefined,
//新建标签区域是否显示 none 隐藏 block 显示
display:'none',
display: 'none',
//调色盘颜色
displayColorPicker: false,
color: {
color: {
r: '241',
g: '112',
b: '19',
a: '1',
},
textcolor:'#F17013',
isShow:false,
newcolor:'',
name:'',
description:'',
id:'',
modelname:''
textcolor: '#F17013',
isShow: false,
newcolor: '',
name: '',
description: '',
id: '',
modelname: ''
}
}
componentDidMount=()=>{
componentDidMount = () => {
this.getList();
}
getList=(page,order_name,order_type)=>{
getList = (page, order_name, order_type) => {
const { projectsId } = this.props.match.params;
const { limit } = this.state;
const url = `/projects/${projectsId}/issue_tags.json`;
axios.get(url,{
params:{
page,limit,order_name,order_type
axios.get(url, {
params: {
page, limit, order_name, order_type
}
}).then((result)=>{
if(result){
}).then((result) => {
if (result) {
this.setState({
data:result.data
data: result.data
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
createtagpost=()=>{
createtagpost = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
if (!err) {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issue_tags.json`;
axios.post(url,{
axios.post(url, {
...values,
project_id:projectsId,
color:this.state.textcolor
}).then(result=>{
if(result){
project_id: projectsId,
color: this.state.textcolor
}).then(result => {
if (result) {
this.props.form.setFieldsValue({
name: "",
description: ""
@ -80,19 +80,19 @@ class Tags extends Component{
b: '19',
a: '1',
},
textcolor:'#F17013',
display:'none'
textcolor: '#F17013',
display: 'none'
});
this.getList()
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
})
}
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page
})
@ -101,13 +101,13 @@ class Tags extends Component{
}
// 排序
arrayList=(e)=>{
arrayList = (e) => {
this.setState({
order_name:e.key,
order_type:e.item.props.value
order_name: e.key,
order_type: e.item.props.value
})
this.getList(1,e.key,e.item.props.value);
this.getList(1, e.key, e.item.props.value);
}
handleClick = () => {
@ -119,104 +119,102 @@ class Tags extends Component{
};
handleChange = (color) => {
this.setState({
this.setState({
color: color.rgb,
textcolor:color.hex,
newcolor:color.hex,
textcolor: color.hex,
newcolor: color.hex,
})
};
//控制新建标签页是否显示
newshow=()=>{
newshow = () => {
this.setState({
display:'block'
display: 'block'
});
};
newclose=()=>{
newclose = () => {
this.setState({
display:'none'
});
display: 'none'
});
};
handleok=()=>{
handleok = () => {
this.updatetag();
}
updatetag=()=>{
updatetag = () => {
const { projectsId } = this.props.match.params;
let id=this.state.id;
let id = this.state.id;
const url = `/projects/${projectsId}/issue_tags/${id}.json`;
let name=this.state.name;
let description=this.state.description;
let modalcolor=this.state.newcolor
axios.put(url,{
project_id:projectsId,
id:id,
name:name,
description:description,
color:modalcolor
}).then((result)=>{
if(result){
let name = this.state.name;
let description = this.state.description;
let modalcolor = this.state.newcolor
axios.put(url, {
project_id: projectsId,
id: id,
name: name,
description: description,
color: modalcolor
}).then((result) => {
if (result) {
this.setState({
isShow:false
});
isShow: false
});
this.getList()
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
}
deletetag=(id)=>{
deletetag = (id) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issue_tags/${id}.json`;
axios.delete(url,{ data: {
project_id: projectsId,
id: id
}
}).then((result)=>{
if(result){
axios.delete(url, {
data: {
project_id: projectsId,
id: id
}
}).then((result) => {
if (result) {
this.getList()
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
})
}
handleCancel=()=>{
handleCancel = () => {
this.setState({
isShow:false
isShow: false
});
}
changmodelname=(e)=>{
changmodelname = (e) => {
this.setState({
name:e.target.value
name: e.target.value
})
}
changdescription=(e)=>{
changdescription = (e) => {
this.setState({
description:e.target.value
description: e.target.value
})
}
editshow=(arr)=>{
editshow = (arr) => {
this.setState({
isShow:true,
newcolor:arr.color,
name:arr.name,
description:arr.description,
id:arr.id
});
isShow: true,
newcolor: arr.color,
name: arr.name,
description: arr.description,
id: arr.id
});
};
render(){
const { data , limit , page } = this.state;
const { projectsId } = this.props.match.params;
render() {
const { data, limit, page } = this.state;
const { getFieldDecorator } = this.props.form;
const menu = (
<Menu onClick={this.arrayList}>
<Menu.Item key={'created_at'} value="desc">按创建时间降序排序</Menu.Item>
@ -231,15 +229,15 @@ class Tags extends Component{
width: '20px',
height: '20px',
borderRadius: '2px',
background: `rgba(${ this.state.color.r }, ${ this.state.color.g }, ${ this.state.color.b }, ${ this.state.color.a })`,
background: `rgba(${this.state.color.r}, ${this.state.color.g}, ${this.state.color.b}, ${this.state.color.a})`,
},
swatch: {
padding: '5px',
background: '#fff',
borderRadius: '1px',
width:'100px',
marginTop:'5px',
height:'28px',
width: '100px',
marginTop: '5px',
height: '28px',
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
display: 'flex',
cursor: 'pointer',
@ -255,7 +253,7 @@ class Tags extends Component{
bottom: '0px',
left: '0px',
},
modalcolor:{
modalcolor: {
width: '20px',
height: '20px',
borderRadius: '2px',
@ -269,19 +267,19 @@ class Tags extends Component{
<React.Fragment>
{
data && data.issue_tags_count > limit ?
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={data && data.issue_tags_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div>:""
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={data && data.issue_tags_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
const renderList =()=>{
if(data && data.issue_tags && data.issue_tags.length>0 ){
return(
const renderList = () => {
if (data && data.issue_tags && data.issue_tags.length > 0) {
return (
<div>
<div className="topWrapper">
<span>{ data && data.issue_tags_count }个标签</span>
<span>{data && data.issue_tags_count}个标签</span>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={menu} trigger={['click']} placement="bottomCenter">
@ -292,20 +290,20 @@ class Tags extends Component{
</div>
<div className="tagList">
{
data.issue_tags.map((item,key)=>{
return(
<div>
<span className="width20 mr10">
<span style={{backgroundColor:`${item.color}`}} className="tagColor"></span>
{item.name}
</span>
data.issue_tags.map((item, key) => {
return (
<div key={key}>
<span className="width20 mr10">
<span style={{ backgroundColor: `${item.color}` }} className="tagColor"></span>
{item.name}
</span>
<span className="hide-1 width50 mr10">{item.description}</span>
<span className="width15 mr10">{item.issues_count}个开启的任务</span>
{
data && data.user_admin_or_member ?
<div className="width15 text-right">
<a onClick={()=>this.editshow(item)} className="topWrapper_btn fr" >编辑</a>
<Popconfirm placement="bottom" title={'删除标签会将其从所有引用中删除。继续?'} okText="是" cancelText="否" onConfirm={()=>this.deletetag(item.id)}>
<a onClick={() => this.editshow(item)} className="topWrapper_btn fr" >编辑</a>
<Popconfirm placement="bottom" title={'删除标签会将其从所有引用中删除。继续?'} okText="是" cancelText="否" onConfirm={() => this.deletetag(item.id)}>
<a className="a_btn delete_btn fr" >删除</a>
</Popconfirm>
@ -318,16 +316,15 @@ class Tags extends Component{
}
</div>
</div>
)
}else{
return(
} else {
return (
<NoneData _html="暂时还没有相关数据哦!" />
)
}
}
return(
return (
<div className="main">
<div>
<div className="topWrapper">
@ -337,62 +334,57 @@ class Tags extends Component{
<a onClick={this.newshow} className="topWrapper_btn" >创建标签</a>
: ''
}
{/* <Link to={`/projects/${projectsId}/orders/new`} className="topWrapper_btn" >新建标签</Link> */}
</div>
<div style={{display: this.state.display}}>
<div style={{ display: this.state.display }}>
<Form>
<div className="tagdiv" >
<Form.Item
className="inptwidth"
>
<div className="tagdiv" >
<Form.Item
className="inptwidth"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请填写标签名字'
}],
})(
<Input placeholder="标签名字" maxLength="10"/>
<Input placeholder="标签名字" maxLength="10" />
)}
</Form.Item>
<Form.Item
className="inputcount"
className="inputcount"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '描述不能为空'
}],
})(
<Input placeholder="描述, 30字以内" maxLength="30"/>
<Input placeholder="描述, 30字以内" maxLength="30" />
)}
</Form.Item>
<div>
<div style={ styles.swatch } onClick={ this.handleClick }>
<div style={ styles.color }>
<p style={{paddingLeft:25}}>{this.state.textcolor}</p>
<div>
<div style={styles.swatch} onClick={this.handleClick}>
<div style={styles.color}>
<p style={{ paddingLeft: 25 }}>{this.state.textcolor}</p>
</div>
</div>
{this.state.displayColorPicker ? <div style={styles.popover}>
<div style={styles.cover} onClick={this.handleClose} />
<SketchPicker color={this.state.color} onChange={this.handleChange} />
</div> :
null}
</div>
<div className="fr" style={{ marginTop: 5 }}>
<a onClick={this.createtagpost} className="topWrapper_btn fr" >创建标签</a>
<a onClick={this.newclose} className="a_btn cancel_btn fr" >取消</a>
</div>
</div>
</div>
{ this.state.displayColorPicker ? <div style={ styles.popover }>
<div style={ styles.cover } onClick={ this.handleClose }/>
<SketchPicker color={ this.state.color } onChange={ this.handleChange } />
</div> :
null }
</div>
<div className="fr" style={{marginTop:5}}>
<a onClick={this.createtagpost} className="topWrapper_btn fr" >创建标签</a>
<a onClick={this.newclose} className="a_btn cancel_btn fr" >取消</a>
</div>
</div>
</Form>
</div>
{ renderList() }
{ Paginations }
{renderList()}
{Paginations}
</div>
<Modal
title="编辑标签"
@ -403,24 +395,22 @@ class Tags extends Component{
width="60%"
>
<div className="dialogdiv">
<Input placeholder="标签名字" maxLength="10" className="inptwidth" value={this.state.name} onChange={this.changmodelname}/>
<Input placeholder="描述, 30字以内" maxLength="30" className="inputcount" value={this.state.description} onChange={this.changdescription}/>
<Input placeholder="标签名字" maxLength="10" className="inptwidth" value={this.state.name} onChange={this.changmodelname} />
<Input placeholder="描述, 30字以内" maxLength="30" className="inputcount" value={this.state.description} onChange={this.changdescription} />
<div>
<div style={ styles.swatch } onClick={ this.handleClick }>
<div style={ styles.modalcolor }>
<p style={{paddingLeft:25,width:100}}>{this.state.newcolor}</p>
<div style={styles.swatch} onClick={this.handleClick}>
<div style={styles.modalcolor}>
<p style={{ paddingLeft: 25, width: 100 }}>{this.state.newcolor}</p>
</div>
</div>
{this.state.displayColorPicker ? <div style={styles.popover}>
<div style={styles.cover} onClick={this.handleClose} />
<SketchPicker color={this.state.color} onChange={this.handleChange} />
</div> :
null}
</div>
{ this.state.displayColorPicker ? <div style={ styles.popover }>
<div style={ styles.cover } onClick={ this.handleClose }/>
<SketchPicker color={ this.state.color } onChange={ this.handleChange } />
</div> :
null }
</div>
</div>
</Modal>
</div>
)
}

View File

@ -1,11 +1,10 @@
import React , {Component} from 'react';
import {Link} from 'react-router-dom';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import Nav from './Nav';
import UploadComponent from '../Upload/Index';
import { getImageUrl } from 'educoder';
import{ Modal , Form , Input , Select, Spin } from 'antd'
import { Modal, Form, Input, Select, Spin } from 'antd'
import Attachments from '../Upload/attachment';
import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
@ -13,404 +12,385 @@ import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor';
const Option = Select.Option;
const options = [
['bold', 'italic', 'underline'],
[{header: [1,2,3,false]}],
['blockquote', 'code-block'],
['link', 'image'],
['formula']
];
class UpdateDetail extends Component{
constructor(props){
class UpdateDetail extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
isShow:false,
imgsrc:'',
journalsdata:undefined,
this.state = {
data: undefined,
isShow: false,
imgsrc: '',
journalsdata: undefined,
//图片区域是否显示 none 隐藏 block 显示
display:'none',
titledisplay:'none',
subject:'',
branch_name:"",
issue_tag_ids:"",
fixed_version_id:"",
tracker_id:0,
issue_type:0,
status_id:0,
assigned_to_id:"",
priority_id:0,
done_ratio:0,
textcount:"",
fileList:undefined,
display: 'none',
titledisplay: 'none',
subject: '',
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: 0,
issue_type: 0,
status_id: 0,
assigned_to_id: "",
priority_id: 0,
done_ratio: 0,
textcount: "",
fileList: undefined,
get_attachments: undefined,
isSpin: false
}
}
componentDidMount=()=>{
this.InitData();
componentDidMount = () => {
this.getDetail();
//this.getSelectList();
}
InitData=()=>{
// this.props.form.setFieldsValue({
// ...this.state
// });
}
getDetail=()=>{
const { projectsId , orderId} = this.props.match.params;
getDetail = () => {
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/edit.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data,
subject:result.data.subject,
issue_chosen:result.data.issue_chosen,
branches:result.data.branches,
tracker_id:result.data.tracker_id,
issue_type:result.data.issue_type,
status_id:result.data.status_id,
priority_id:result.data.priority_id,
done_ratio:result.data.done_ratio,
textcount:result.data.description,
data: result.data,
subject: result.data.subject,
issue_chosen: result.data.issue_chosen,
branches: result.data.branches,
tracker_id: result.data.tracker_id,
issue_type: result.data.issue_type,
status_id: result.data.status_id,
priority_id: result.data.priority_id,
done_ratio: result.data.done_ratio,
textcount: result.data.description,
branch_name: result.data.branch_name,
get_attachments: result.data.attachments,
fileList:undefined,
fileList: undefined,
issue_tag_ids: result.data.issue_tags && result.data.issue_tags[0].id,
fixed_version_id: result.data.fixed_version_id,
assigned_to_id: result.data.assigned_to_id
})
// this.getjournalslist();
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
handleok=() => {
this.setState({
isShow:false
});
};
handleCancel=()=>{
this.setState({
isShow:false
});
handleok = () => {
this.setState({
isShow: false
});
};
handleCancel = () => {
this.setState({
isShow: false
});
}
imgshow = () => {
this.setState({
isShow: true
});
};
onContentChange = (value) => {
this.setState({
textcount: value
})
}
changmodelname = (e) => {
this.setState({
subject: e.target.value
})
}
changmodelcount = (e) => {
this.setState({
textcount: e.target.value
})
}
renderSelect = (list) => {
if (list && list.length > 0) {
return (
list.map((item, key) => {
return (
<Option key={key + 1} value={item.id}>{item.name}</Option>
)
})
)
}
}
imgshow=()=>{
// 切换完成度
changeRatio = (e) => {
if (e === 0) {
this.props.form.setFieldsValue({
status_id: 1
})
this.setState({
isShow:true
});
};
onContentChange=(value)=>{
status_id: 1
})
} else if (e === 100) {
this.props.form.setFieldsValue({
status_id: 3
})
this.setState({
textcount:value
status_id: 3
})
} else {
this.props.form.setFieldsValue({
status_id: 2
})
this.setState({
status_id: 2
})
}
}
// 切换状态
changeStatus = (e) => {
// console.log(e);
if (e === 1) {
this.props.form.setFieldsValue({
done_ratio: 0
})
this.setState({
done_ratio: 0
})
} else if (e === 3) {
this.props.form.setFieldsValue({
done_ratio: 100
})
this.setState({
done_ratio: 100
})
}
}
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({
fileList
})
}
handleSubmit = () => {
this.setState({
isSpin: true
})
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId, orderId } = this.props.match.params;
const { subject } = this.state;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
changmodelname=(e)=>{
this.setState({
subject:e.target.value
})
}
changmodelcount=(e)=>{
this.setState({
textcount:e.target.value
})
}
renderSelect=(list)=>{
if(list && list.length >0){
return(
list.map((item,key)=>{
return(
<Option key={key+1} value={item.id}>{item.name}</Option>
)
})
)
if (values.issue_tag_ids === 0) {
values.issue_tag_ids = ""
} else {
values.issue_tag_ids = [values.issue_tag_ids]
}
}
// 切换完成度
changeRatio=(e)=>{
if(e === 0){
this.props.form.setFieldsValue({
status_id:1
})
this.setState({
status_id:1
})
}else if(e === 100){
this.props.form.setFieldsValue({
status_id:3
})
this.setState({
status_id:3
})
}else{
this.props.form.setFieldsValue({
status_id:2
})
this.setState({
status_id:2
})
if (values.assigned_to_id === 0) {
values.assigned_to_id = ""
}
}
// 切换状态
changeStatus=(e)=>{
// console.log(e);
if(e === 1){
this.props.form.setFieldsValue({
done_ratio:0
})
this.setState({
done_ratio:0
})
}else if(e === 3){
this.props.form.setFieldsValue({
done_ratio:100
})
this.setState({
done_ratio:100
})
}
}
// 获取上传后的文件id数组
UploadFunc=(fileList)=>{
this.setState({
fileList
})
}
handleSubmit=()=>{
this.setState({
isSpin: true
})
const { fileList } = this.state;
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
const { projectsId , orderId } = this.props.match.params;
const { subject } = this.state;
const url = `/projects/${projectsId}/issues/${orderId}.json`;
const { textcount } = this.state;
if(values.issue_tag_ids===0){
values.issue_tag_ids = ""
}else{
values.issue_tag_ids = [values.issue_tag_ids]
}
if(values.assigned_to_id===0){
values.assigned_to_id = ""
}
const { textcount } = this.state;
axios.put(url,{
project_id:projectsId,
subject:subject,
id: orderId,
description:textcount,
attachment_ids:fileList,
...values
}).then(result=>{
if(result){
this.props.history.push(`/projects/${projectsId}/orders/${orderId}/detail`);
}
}).catch(error=>{
this.setState({
isSpin: false
})
console.log(error);
})
axios.put(url, {
project_id: projectsId,
subject: subject,
id: orderId,
description: textcount,
attachment_ids: fileList,
...values
}).then(result => {
if (result) {
this.props.history.push(`/projects/${projectsId}/orders/${orderId}/detail`);
}
}).catch(error => {
this.setState({
isSpin: false
})
console.log(error);
})
}
})
}
render(){
const { projectsId , orderId } = this.props.match.params;
render() {
const { projectsId, orderId } = this.props.match.params;
const { getFieldDecorator } = this.props.form;
const { current_user } = this.props;
const { issue_tag_ids , fixed_version_id , branch_name , status_id , tracker_id , issue_type ,assigned_to_id , priority_id , done_ratio,
issue_chosen , branches, subject, textcount,get_attachments,isSpin } = this.state;
return(
const { issue_tag_ids, fixed_version_id, branch_name, status_id, tracker_id, issue_type, assigned_to_id, priority_id, done_ratio,
issue_chosen, branches, subject, textcount, get_attachments, isSpin } = this.state;
return (
<div className="main">
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state}/>*/}
{/*</div>*/}
<div>
<Form>
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
<div className="list-right df" >
<Link to={`/users/${current_user && current_user.login}/projects`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
</Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('subject', {
rules: [{
required: true, message: '请填写任务标题'
}],
initialValue: subject
})(
<Input placeholder="标题" onChange={this.changmodelname}/>
)}
</Form.Item>
<MDEditor placeholder={'请输入任务的描述...'} height={350}
mdID={'order-update-description'} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true}></UploadComponent>
{
get_attachments ?
<Attachments attachments={get_attachments} showNotification={this.props.showNotification} canDelete={true}/>
:
""
}
<p className="clearfix mt15 text-right">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" style={{marginLeft:5}} onClick={this.handleSubmit}>保存</a>
<Link to={`/projects/${projectsId}/orders/${orderId}/detail`} className="a_btn cancel_btn fr">取消</Link>
</Spin>
</p>
</div>
</div>
<div className="list-left mt10" style={{paddingRight:"0px",paddingLeft:"0px",width:"25%",backgroundColor:"#fff"}}>
<div className="list-l-panel">
<Form.Item
label="分支"
>
{getFieldDecorator('branch_name', {
initialValue: branch_name,
rules: [],
})(
<Select>
<Option value={''}>分支未指定</Option>
{
branches && branches.length >0 && branches.map((item,key)=>{
return(
<Option value={item}>{item}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item
label="标签"
>
{getFieldDecorator('issue_tag_ids', {
initialValue: issue_tag_ids ? [issue_tag_ids] : '',
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签':'请在仓库设置里添加标签'}</Option>
{ this.renderSelect(issue_chosen && issue_chosen.issue_tag) }
</Select>
)}
</Form.Item>
<Form.Item
label="里程碑"
>
{getFieldDecorator('fixed_version_id', {
initialValue: fixed_version_id ? fixed_version_id : "",
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑': '请添加里程碑'}</Option>
{ this.renderSelect(issue_chosen && issue_chosen.issue_version) }
</Select>
)}
</Form.Item>
<Form.Item
label="状态"
>
{getFieldDecorator('status_id', {
initialValue:status_id,
rules: [{
required: true, message: '请选择完成状态'
}],
})(
<Select onChange={this.changeStatus}>
{ this.renderSelect(issue_chosen && issue_chosen.issue_status) }
</Select>
)}
</Form.Item>
<Form.Item
label="分类"
>
{getFieldDecorator('tracker_id', {
initialValue:tracker_id,
rules: [{
required: true, message: '请选择分类'
}],
})(
<Select>
{ this.renderSelect(issue_chosen && issue_chosen.tracker) }
</Select>
)}
</Form.Item>
<Form.Item
label="指派成员"
>
{getFieldDecorator('assigned_to_id', {
initialValue: assigned_to_id ? assigned_to_id : "",
})(
<Select>
<Option value={''}>未指派成员</Option>
{ this.renderSelect(issue_chosen && issue_chosen.assign_user) }
</Select>
)}
</Form.Item>
<Form.Item
label="优先度"
>
{getFieldDecorator('priority_id', {
<div>
<Form>
<div className="f-wrap-between mt20" style={{ alignItems: "flex-start" }}>
<div className="list-right df" >
<Link to={`/users/${current_user && current_user.login}/projects`} className="show-user-link">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt="" />
</Link>
<div className="new_context">
<Form.Item>
{getFieldDecorator('subject', {
rules: [{
required: true, message: '请填写任务标题'
}],
initialValue: subject
})(
<Input placeholder="标题" onChange={this.changmodelname} />
)}
</Form.Item>
initialValue:priority_id,
rules: [{
required: true, message: '请选择优先度'
}],
})(
<Select>
{ this.renderSelect(issue_chosen && issue_chosen.priority) }
</Select>
)}
</Form.Item>
<Form.Item
label="完成度"
>
{getFieldDecorator('done_ratio', {
initialValue:done_ratio,
rules: [{
required: true, message: '请选择完成度'
}],
})(
<Select value={done_ratio} onChange={this.changeRatio}>
{ this.renderSelect(issue_chosen && issue_chosen.done_ratio) }
</Select>
)}
</Form.Item>
</div>
</div>
<MDEditor placeholder={'请输入任务的描述...'} height={350}
mdID={'order-update-description'} initValue={textcount} onChange={this.onContentChange} ></MDEditor>
<UploadComponent load={this.UploadFunc} showNotification={this.props.showNotification} isComplete={true}></UploadComponent>
{
get_attachments ?
<Attachments attachments={get_attachments} showNotification={this.props.showNotification} canDelete={true} />
:
""
}
<p className="clearfix mt15 text-right">
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" type="submit" style={{ marginLeft: 5 }} onClick={this.handleSubmit}>保存</a>
<Link to={`/projects/${projectsId}/orders/${orderId}/detail`} className="a_btn cancel_btn fr">取消</Link>
</Spin>
</p>
</div>
</div>
<div className="list-left mt10" style={{ paddingRight: "0px", paddingLeft: "0px", width: "25%", backgroundColor: "#fff" }}>
<div className="list-l-panel">
<Form.Item
label="分支"
>
{getFieldDecorator('branch_name', {
initialValue: branch_name,
rules: [],
})(
<Select>
<Option value={''}>分支未指定</Option>
{
branches && branches.length > 0 && branches.map((item, key) => {
return (
<Option value={item}>{item}</Option>
)
})
}
</Select>
)}
</Form.Item>
<Form.Item
label="标签"
>
{getFieldDecorator('issue_tag_ids', {
initialValue: issue_tag_ids ? [issue_tag_ids] : '',
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_tag.length > 0 ? '未选择标签' : '请在仓库设置里添加标签'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_tag)}
</Select>
)}
</Form.Item>
<Form.Item
label="里程碑"
>
{getFieldDecorator('fixed_version_id', {
initialValue: fixed_version_id ? fixed_version_id : "",
rules: [],
})(
<Select>
<Option value={''}>{issue_chosen && issue_chosen.issue_version.length > 0 ? '未选择里程碑' : '请添加里程碑'}</Option>
{this.renderSelect(issue_chosen && issue_chosen.issue_version)}
</Select>
)}
</Form.Item>
<Form.Item
label="状态"
>
{getFieldDecorator('status_id', {
initialValue: status_id,
rules: [{
required: true, message: '请选择完成状态'
}],
})(
<Select onChange={this.changeStatus}>
{this.renderSelect(issue_chosen && issue_chosen.issue_status)}
</Select>
)}
</Form.Item>
<Form.Item
label="分类"
>
{getFieldDecorator('tracker_id', {
initialValue: tracker_id,
rules: [{
required: true, message: '请选择分类'
}],
})(
<Select>
{this.renderSelect(issue_chosen && issue_chosen.tracker)}
</Select>
)}
</Form.Item>
<Form.Item
label="指派成员"
>
{getFieldDecorator('assigned_to_id', {
initialValue: assigned_to_id ? assigned_to_id : "",
})(
<Select>
<Option value={''}>未指派成员</Option>
{this.renderSelect(issue_chosen && issue_chosen.assign_user)}
</Select>
)}
</Form.Item>
<Form.Item
label="优先度"
>
{getFieldDecorator('priority_id', {
initialValue: priority_id,
rules: [{
required: true, message: '请选择优先度'
}],
})(
<Select>
{this.renderSelect(issue_chosen && issue_chosen.priority)}
</Select>
)}
</Form.Item>
<Form.Item
label="完成度"
>
{getFieldDecorator('done_ratio', {
initialValue: done_ratio,
rules: [{
required: true, message: '请选择完成度'
}],
})(
<Select value={done_ratio} onChange={this.changeRatio}>
{this.renderSelect(issue_chosen && issue_chosen.done_ratio)}
</Select>
)}
</Form.Item>
</div>
</div>
</div>
</Form>
</div>
</Form>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{ textAlign: 'center' }}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt="" />
</Modal>
</div>
<Modal
onCancel={this.handleCancel}
visible={this.state.isShow}
width="400px"
footer={
[]
}
bodyStyle={{textAlign:'center'}}
>
<img class="list_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</Modal>
</div>
)
}
}

View File

@ -1,64 +1,60 @@
import React , {Component} from 'react';
import { Link } from 'react-router-dom';
import { Calendar, Select, Radio, Col, Row,Divider,Input,Form, Spin} from 'antd';
import Nav from './Nav';
import NoneData from '../../modules/courses/coursesPublic/NoneData';
import reactCSS from 'reactcss'
import React, { Component } from 'react';
import { Calendar, Select, Radio, Col, Row, Divider, Input, Form, Spin } from 'antd';
import axios from 'axios';
import moment from 'moment'
const TextArea = Input.TextArea;
const { Group, Button } = Radio;
class UpdateMilepost extends Component{
constructor(props){
class UpdateMilepost extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
this.state = {
data: undefined,
value: moment('2017-01-25'),
selectedValue: moment('2020-2-12'),
isSpin: false
}
}
componentDidMount=()=>{
this.getmeil();
componentDidMount = () => {
this.getmeil();
}
onPanelChange=(time, mode)=>{
onPanelChange = (time, mode) => {
this.setState({
value:time
});
value: time
});
}
onSelect=(time)=>{
onSelect = (time) => {
this.setState({
value:time,
value: time,
selectedValue: time,
});
}
getmeil=()=>{
getmeil = () => {
const { projectsId } = this.props.match.params;
const { meilid } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${meilid}/edit.json`;
axios.get(url,{
params:{
projectsId,meilid
axios.get(url, {
params: {
projectsId, meilid
}
}).then((result)=>{
if(result){
}).then((result) => {
if (result) {
this.setState({
data:result.data,
selectedValue:moment(result.data.effective_date)
data: result.data,
selectedValue: moment(result.data.effective_date)
})
this.props.form.setFieldsValue({
name:result.data.name,
description:result.data.description
});
name: result.data.name,
description: result.data.description
});
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
@ -66,67 +62,61 @@ class UpdateMilepost extends Component{
}
submit=()=>{
this.setState({isSpin: true})
submit = () => {
this.setState({ isSpin: true })
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
if (!err) {
const { projectsId } = this.props.match.params;
const { meilid } = this.props.match.params;
const url = `/projects/${projectsId}/versions/${meilid}.json`;
let time=undefined;
if(this.state.selectedValue===undefined){
}else{
time=this.state.selectedValue.format("YYYY-MM-DD")
let time = undefined;
if (this.state.selectedValue === undefined) {
} else {
time = this.state.selectedValue.format("YYYY-MM-DD")
}
axios.put(url,{
axios.put(url, {
...values,
project_id:projectsId,
id:meilid,
effective_date:time,
status:'open'
}).then(result=>{
if(result){
this.setState({isSpin: false})
this.props.history.push(`/projects/${projectsId}/orders/Milepost`);
project_id: projectsId,
id: meilid,
effective_date: time,
status: 'open'
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${projectsId}/orders/Milepost`);
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
})
}
claertime=()=>{
claertime = () => {
this.setState({
selectedValue: undefined,
})
}
render(){
render() {
const { getFieldDecorator } = this.props.form;
const { data, isSpin } = this.state;
const { isSpin } = this.state;
const { projectsId } = this.props.match.params;
return(
<div className="main">
<Form>
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state} />*/}
{/*/!* <a onClick={this.newshow} className="topWrapper_btn" >新建里程碑</a> *!/*/}
{/*</div>*/}
<div style={{marginLeft:15, marginTop: 24}}>
<h1 >编辑里程碑</h1>
<h5 className="mt-5 color-grey-9">里程碑可以组织任务和合并请求并跟踪进度.</h5>
</div>
<Divider/>
<div style={{display:'flex'}}>
<div className="newmilepostleft">
标题
return (
<div className="main">
<Form>
<div style={{ marginLeft: 15, marginTop: 24 }}>
<h1 >编辑里程碑</h1>
<h5 className="mt-5 color-grey-9">里程碑可以组织任务和合并请求并跟踪进度.</h5>
</div>
<Divider />
<div style={{ display: 'flex' }}>
<div className="newmilepostleft">
标题
<div>
<Form.Item>
<Form.Item>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请输入标题'
@ -136,114 +126,114 @@ class UpdateMilepost extends Component{
)}
</Form.Item>
</div>
描述
描述
<Form.Item>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入描述内容'
}],
})(
<TextArea placeholder="请输入描述内容..." style={{height:"150px"}} />
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入描述内容'
}],
})(
<TextArea placeholder="请输入描述内容..." style={{ height: "150px" }} />
)}
</Form.Item>
</div>
<div className="newmilepostrighe" >
截止日期(可选) <a style={{color:'red'}} onClick={this.claertime}>清除</a>
<div>
<Input style={{width:"120px"}} value={this.state.selectedValue && this.state.selectedValue.format('YYYY-MM-DD')}/>
)}
</Form.Item>
</div>
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4 ,marginTop:5}}>
<Calendar
fullscreen={false}
headerRender={({ value, type, onChange, onTypeChange }) => {
const start = 0;
const end = 12;
const monthOptions = [];
const current = value.clone();
const localeData = value.localeData();
const months = [];
for (let i = 0; i < 12; i++) {
current.month(i);
months.push(localeData.monthsShort(current));
}
<div className="newmilepostrighe" >
截止日期(可选) <a style={{ color: 'red' }} onClick={this.claertime}>清除</a>
<div>
<Input style={{ width: "120px" }} value={this.state.selectedValue && this.state.selectedValue.format('YYYY-MM-DD')} />
</div>
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4, marginTop: 5 }}>
<Calendar
fullscreen={false}
headerRender={({ value, type, onChange, onTypeChange }) => {
const start = 0;
const end = 12;
const monthOptions = [];
const current = value.clone();
const localeData = value.localeData();
const months = [];
for (let i = 0; i < 12; i++) {
current.month(i);
months.push(localeData.monthsShort(current));
}
for (let index = start; index < end; index++) {
monthOptions.push(
<Select.Option className="month-item" key={`${index}`}>
{months[index]}
</Select.Option>,
);
}
const month = value.month();
for (let index = start; index < end; index++) {
monthOptions.push(
<Select.Option className="month-item" key={`${index}`}>
{months[index]}
</Select.Option>,
);
}
const month = value.month();
const year = value.year();
const options = [];
for (let i = year - 10; i < year + 10; i += 1) {
options.push(
<Select.Option key={i} value={i} className="year-item">
{i}
</Select.Option>,
);
}
return (
<div style={{ padding: 10 }}>
const year = value.year();
const options = [];
for (let i = year - 10; i < year + 10; i += 1) {
options.push(
<Select.Option key={i} value={i} className="year-item">
{i}
</Select.Option>,
);
}
return (
<div style={{ padding: 10 }}>
<Row type="flex" justify="space-between">
<Col>
<Group size="small" onChange={e => onTypeChange(e.target.value)} value={type}>
<Button value="month">月份</Button>
<Button value="year">年份</Button>
</Group>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
className="my-year-select"
style={{ width: 80 }}
onChange={newYear => {
const now = value.clone().year(newYear);
onChange(now);
}}
value={String(year)}
>
{options}
</Select>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
value={String(month)}
onChange={selectedMonth => {
const newValue = value.clone();
newValue.month(parseInt(selectedMonth, 10));
onChange(newValue);
}}
>
{monthOptions}
</Select>
</Col>
</Row>
</div>
);
}}
onPanelChange={this.onPanelChange}
onSelect={this.onSelect}
/>
</div>
</div>
</div>
<Divider />
<div className="clearfix mt15" onClick={this.submit}>
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" >更新里程碑</a>
</Spin>
<Row type="flex" justify="space-between">
<Col>
<Group size="small" onChange={e => onTypeChange(e.target.value)} value={type}>
<Button value="month">月份</Button>
<Button value="year">年份</Button>
</Group>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
className="my-year-select"
style={{width:80}}
onChange={newYear => {
const now = value.clone().year(newYear);
onChange(now);
}}
value={String(year)}
>
{options}
</Select>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
value={String(month)}
onChange={selectedMonth => {
const newValue = value.clone();
newValue.month(parseInt(selectedMonth, 10));
onChange(newValue);
}}
>
{monthOptions}
</Select>
</Col>
</Row>
</div>
);
}}
onPanelChange={this.onPanelChange}
onSelect={this.onSelect}
/>
</div>
</div>
</div>
<Divider/>
<div className="clearfix mt15" onClick={this.submit}>
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" >更新里程碑</a>
</Spin>
</div>
</Form>
</div>
</div>
)
}
}

View File

@ -1,217 +1,213 @@
import React , {Component} from 'react';
import { Link } from 'react-router-dom';
import { Calendar, Select, Radio, Col, Row,Divider,Input,Form, Spin} from 'antd';
import Nav from './Nav';
import NoneData from '../../modules/courses/coursesPublic/NoneData';
import reactCSS from 'reactcss'
import React, { Component } from 'react';
import { Calendar, Select, Radio, Col, Row, Divider, Input, Form, Spin } from 'antd';
import axios from 'axios';
import moment from 'moment'
const TextArea = Input.TextArea;
const { Group, Button } = Radio;
class NewMilepost extends Component{
constructor(props){
class NewMilepost extends Component {
constructor(props) {
super(props);
this.state={
data:undefined,
this.state = {
data: undefined,
value: moment('2017-01-25'),
selectedValue: undefined,
isSpin: false
}
}
componentDidMount=()=>{
componentDidMount = () => {
}
onPanelChange=(time, mode)=>{
onPanelChange = (time, mode) => {
this.setState({
value:time
});
value: time
});
}
onSelect=(time)=>{
onSelect = (time) => {
this.setState({
value:time,
value: time,
selectedValue: time,
});
}
submit=()=>{
this.setState({isSpin: true})
submit = () => {
this.setState({ isSpin: true })
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
if (!err) {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/versions.json`;
let time=undefined;
if(this.state.selectedValue===undefined){
}else{
time=this.state.selectedValue.format("YYYY-MM-DD")
let time = undefined;
if (this.state.selectedValue === undefined) {
} else {
time = this.state.selectedValue.format("YYYY-MM-DD")
}
axios.post(url,{
axios.post(url, {
...values,
project_id:projectsId,
effective_date:time,
status:'open'
}).then(result=>{
if(result){
this.setState({isSpin: false})
this.props.history.push(`/projects/${projectsId}/orders/Milepost`);
project_id: projectsId,
effective_date: time,
status: 'open'
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.history.push(`/projects/${projectsId}/orders/Milepost`);
}
}).catch(error=>{
}).catch(error => {
console.log(error);
})
}
})
}
cleartime=()=>{
cleartime = () => {
this.setState({
selectedValue:undefined
selectedValue: undefined
})
}
render(){
render() {
const { getFieldDecorator } = this.props.form;
const { projectsId } = this.props.match.params;
const { isSpin } = this.state
return(
<div className="main">
<Form>
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state} />*/}
{/*/!* <a onClick={this.newshow} className="topWrapper_btn" >新建里程碑</a> *!/*/}
return (
<div className="main">
<Form>
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state} />*/}
{/*/!* <a onClick={this.newshow} className="topWrapper_btn" >新建里程碑</a> *!/*/}
{/*</div>*/}
<div style={{marginLeft:15, marginTop: 24}}>
<h1 >新的里程碑</h1>
<h5 className="mt-5 color-grey-9">里程碑可以组织任务和合并请求并跟踪进度.</h5>
</div>
<Divider/>
<div style={{display:'flex'}}>
<div className="newmilepostleft">
标题
<div style={{ marginLeft: 15, marginTop: 24 }}>
<h1 >新的里程碑</h1>
<h5 className="mt-5 color-grey-9">里程碑可以组织任务和合并请求并跟踪进度.</h5>
</div>
<Divider />
<div style={{ display: 'flex' }}>
<div className="newmilepostleft">
标题
<div>
<Form.Item>
<Form.Item>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请输入标题'
}],
})(
<Input placeholder="标题"/>
<Input placeholder="标题" />
)}
</Form.Item>
</div>
描述
描述
<Form.Item>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入描述内容'
}],
})(
<TextArea placeholder="请输入描述内容..." style={{height:"150px"}}/>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入描述内容'
}],
})(
<TextArea placeholder="请输入描述内容..." style={{ height: "150px" }} />
)}
</Form.Item>
</div>
<div className="newmilepostrighe" >
<a style={{color:'black'}}>截止日期(可选)</a> <a style={{color:'red'}} onClick={this.cleartime}></a>
<div>
<Input style={{width:"120px"}} value={this.state.selectedValue && this.state.selectedValue.format('YYYY-MM-DD')}/>
)}
</Form.Item>
</div>
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4 ,marginTop:25}}>
<Calendar
fullscreen={false}
headerRender={({ value, type, onChange, onTypeChange }) => {
const start = 0;
const end = 12;
const monthOptions = [];
const current = value.clone();
const localeData = value.localeData();
const months = [];
for (let i = 0; i < 12; i++) {
current.month(i);
months.push(localeData.monthsShort(current));
}
<div className="newmilepostrighe" >
<a style={{ color: 'black' }}>截止日期(可选)</a> <a style={{ color: 'red' }} onClick={this.cleartime}></a>
<div>
<Input style={{ width: "120px" }} value={this.state.selectedValue && this.state.selectedValue.format('YYYY-MM-DD')} />
</div>
<div style={{ width: 300, border: '1px solid #d9d9d9', borderRadius: 4, marginTop: 25 }}>
<Calendar
fullscreen={false}
headerRender={({ value, type, onChange, onTypeChange }) => {
const start = 0;
const end = 12;
const monthOptions = [];
const current = value.clone();
const localeData = value.localeData();
const months = [];
for (let i = 0; i < 12; i++) {
current.month(i);
months.push(localeData.monthsShort(current));
}
for (let index = start; index < end; index++) {
monthOptions.push(
<Select.Option className="month-item" key={`${index}`}>
{months[index]}
</Select.Option>,
);
}
const month = value.month();
for (let index = start; index < end; index++) {
monthOptions.push(
<Select.Option className="month-item" key={`${index}`}>
{months[index]}
</Select.Option>,
);
}
const month = value.month();
const year = value.year();
const options = [];
for (let i = year - 10; i < year + 10; i += 1) {
options.push(
<Select.Option key={i} value={i} className="year-item">
{i}
</Select.Option>,
);
}
return (
<div style={{ padding: 10 }}>
<Row type="flex" justify="space-between">
<Col>
<Group size="small" onChange={e => onTypeChange(e.target.value)} value={type}>
<Button value="month">日期</Button>
<Button value="year">月份</Button>
</Group>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
className="my-year-select"
style={{ width: 80 }}
onChange={newYear => {
const now = value.clone().year(newYear);
onChange(now);
}}
value={String(year)}
>
{options}
</Select>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
value={String(month)}
onChange={selectedMonth => {
const newValue = value.clone();
newValue.month(parseInt(selectedMonth, 10));
onChange(newValue);
}}
>
{monthOptions}
</Select>
</Col>
</Row>
</div>
);
}}
onPanelChange={this.onPanelChange}
onSelect={this.onSelect}
/>
</div>
</div>
</div>
<Divider />
<div className="clearfix mt15" onClick={this.submit}>
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" >创建里程碑</a>
</Spin>
const year = value.year();
const options = [];
for (let i = year - 10; i < year + 10; i += 1) {
options.push(
<Select.Option key={i} value={i} className="year-item">
{i}
</Select.Option>,
);
}
return (
<div style={{ padding: 10 }}>
<Row type="flex" justify="space-between">
<Col>
<Group size="small" onChange={e => onTypeChange(e.target.value)} value={type}>
<Button value="month">日期</Button>
<Button value="year">月份</Button>
</Group>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
className="my-year-select"
style={{width:80}}
onChange={newYear => {
const now = value.clone().year(newYear);
onChange(now);
}}
value={String(year)}
>
{options}
</Select>
</Col>
<Col>
<Select
size="small"
dropdownMatchSelectWidth={false}
value={String(month)}
onChange={selectedMonth => {
const newValue = value.clone();
newValue.month(parseInt(selectedMonth, 10));
onChange(newValue);
}}
>
{monthOptions}
</Select>
</Col>
</Row>
</div>
);
}}
onPanelChange={this.onPanelChange}
onSelect={this.onSelect}
/>
</div>
</div>
</div>
<Divider/>
<div className="clearfix mt15" onClick={this.submit}>
<Spin spinning={isSpin}>
<a className="topWrapper_btn fr" >创建里程碑</a>
</Spin>
</div>
</Form>
</div>
</div>
)
}
}

View File

@ -1,5 +1,5 @@
import React , { Component } from "react";
import { Input ,Dropdown , Menu , Icon , Pagination , Spin } from 'antd';
import React, { Component } from "react";
import { Input, Dropdown, Menu, Icon, Pagination, Spin } from 'antd';
import './order.css';
import NoneData from '../Nodata';
@ -22,169 +22,169 @@ const Search = Input.Search;
* issue_type:搜索条件
* status_type: issue的关闭和开启1表示开启中的2表示关闭的
*/
class order extends Component{
constructor(props){
class order extends Component {
constructor(props) {
super(props);
this.state={
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,
status_type:'1',
this.state = {
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,
status_type: '1',
//设置选择高亮
openselect:1,
closeselect:undefined,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
openselect: 1,
closeselect: undefined,
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
}
}
componentDidMount=()=>{
componentDidMount = () => {
this.getSelectList();
this.getIssueList("","","","","","1","","","","");
this.getIssueList("", "", "", "", "", "1", "", "", "", "");
}
getSelectList=()=>{
getSelectList = () => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/index_chosen.json`;
axios.get(url).then((result)=>{
if(result){
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen:result.data.issue_chosen
issue_chosen: result.data.issue_chosen
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
// 获取列表数据
getIssueList=(page,limit,search,author_id,assigned_to_id,status_type,id,value, order_name, order_type)=>{
getIssueList = (page, limit, search, author_id, assigned_to_id, status_type, id, value, order_name, order_type) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues.json`;
axios.get(url,{
params:{
page,limit,search,author_id,assigned_to_id,status_type,order_name,order_type,
[id]:value
axios.get(url, {
params: {
page, limit, search, author_id, assigned_to_id, status_type, order_name, order_type,
[id]: value
}
}).then((result)=>{
if(result){
}).then((result) => {
if (result) {
this.setState({
data:result.data,
issues:result.data.issues,
search_count:result.data.search_count,
isSpin:false
data: result.data,
issues: result.data.issues,
search_count: result.data.search_count,
isSpin: false
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
getOption=(e,id,name)=>{
if(id+'s'==="issue_tag_ids"){
getOption = (e, id, name) => {
if (id + 's' === "issue_tag_ids") {
this.setState({
[id]:e.key,
issue_tag_ids:name
[id]: e.key,
issue_tag_ids: name
})
}
if(id+'s'==="tracker_ids"){
if (id + 's' === "tracker_ids") {
this.setState({
[id]:e.key,
tracker_ids:name
[id]: e.key,
tracker_ids: name
})
}
if(id+'s'==="author_ids"){
if (id + 's' === "author_ids") {
this.setState({
[id]:e.key,
author_ids:name
[id]: e.key,
author_ids: name
})
}
if(id+'s'==="assigned_to_ids"){
if (id + 's' === "assigned_to_ids") {
this.setState({
[id]:e.key,
assigned_to_ids:name
[id]: e.key,
assigned_to_ids: name
})
}
if(id+'s'==="priority_ids"){
if (id + 's' === "priority_ids") {
this.setState({
[id]:e.key,
priority_ids:name
[id]: e.key,
priority_ids: name
})
}
if(id+'s'==="done_ratios"){
if (id + 's' === "done_ratios") {
this.setState({
[id]:e.key,
done_ratios:name
[id]: e.key,
done_ratios: name
})
}
if(e.key==="created_on"){
if(e.item.props.value==="desc"){
if (e.key === "created_on") {
if (e.item.props.value === "desc") {
this.setState({
[id]:e.key,
paix:'最新创建'
[id]: e.key,
paix: '最新创建'
})
}else{
} else {
this.setState({
[id]:e.key,
paix:'最早创建'
[id]: e.key,
paix: '最早创建'
})
}
}else if(e.key==="updated_on"){
if(e.item.props.value==="desc"){
} else if (e.key === "updated_on") {
if (e.item.props.value === "desc") {
this.setState({
[id]:e.key,
paix:'最新更新'
[id]: e.key,
paix: '最新更新'
})
}else{
} else {
this.setState({
[id]:e.key,
paix:'最早更新'
[id]: e.key,
paix: '最早更新'
})
}
}
this.setState({
[id]:e.key,
[id]: e.key,
})
const { page,limit,search,author_id,assigned_to_id,status_type } = this.state;
if(e.key==="all"){
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id,);
}else if (e.key==="created_on" || e.key==="updated_on"){
const { page, limit, search, author_id, assigned_to_id, status_type } = this.state;
if (e.key === "all") {
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id);
} else if (e.key === "created_on" || e.key === "updated_on") {
this.setState({
order_name:e.key,
order_type:e.item.props.value
order_name: e.key,
order_type: e.item.props.value
})
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id,undefined,e.key, e.item.props.value);
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id, undefined, e.key, e.item.props.value);
}
else{
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type,id,e.key);
else {
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type, id, e.key);
}
}
renderMenu =(array,name,id)=>{
return(
renderMenu = (array, name, id) => {
return (
<Menu>
<Menu.Item key={"all"} onClick={(e)=>this.getOption(e,id,name)}>{name}</Menu.Item>
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name)}>{name}</Menu.Item>
{
array && array.length > 0 && array.map((item,key)=>{
return(
<Menu.Item key={item.id} onClick={(e)=>this.getOption(e,id,item.name)}>{item.name}</Menu.Item>
array && array.length > 0 && array.map((item, key) => {
return (
<Menu.Item key={item.id} onClick={(e) => this.getOption(e, id, item.name)}>{item.name}</Menu.Item>
)
})
}
@ -193,164 +193,164 @@ class order extends Component{
}
// 翻页
ChangePage=(page)=>{
ChangePage = (page) => {
this.setState({
page,
isSpin:true
isSpin: true
})
const {limit,search,status_type,author_id, assigned_to_id} = this.state;
this.getIssueList(page,limit,search,author_id,assigned_to_id,status_type);
const { limit, search, status_type, author_id, assigned_to_id } = this.state;
this.getIssueList(page, limit, search, author_id, assigned_to_id, status_type);
}
// 搜索
searchFunc=(value)=>{
searchFunc = (value) => {
this.setState({
search:value,
isSpin:true
search: value,
isSpin: true
})
const {page,limit,status_type,author_id, assigned_to_id} = this.state;
this.getIssueList(page,limit,value,author_id,assigned_to_id,status_type);
const { page, limit, status_type, author_id, assigned_to_id } = this.state;
this.getIssueList(page, limit, value, author_id, assigned_to_id, status_type);
}
openorder=(type)=>{
if(type){
console.log(this.state.closeselect+"|"+this.state.openselect)
openorder = (type) => {
if (type) {
console.log(this.state.closeselect + "|" + this.state.openselect)
const { current_user } = this.props;
if(type===1){
if (type === 1) {
this.setState({
status_type:'1',
closeselect:undefined,
openselect:1,
status_type: '1',
closeselect: undefined,
openselect: 1,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList("","","","","",1,"");
this.getIssueList("", "", "", "", "", 1, "");
}else{
} else {
this.setState({
status_type:'2',
openselect:undefined,
closeselect:1,
status_type: '2',
openselect: undefined,
closeselect: 1,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList("","","","","",2,"");
this.getIssueList("", "", "", "", "", 2, "");
}
}
}
// 筛选:全部、指派给我、由我创建
ChangeAssign=(type)=>{
const { limit, search,status_type} = this.state;
ChangeAssign = (type) => {
const { limit, search, status_type } = this.state;
const { current_user } = this.props;
this.setState({
isSpin:true
isSpin: true
})
console.log(current_user)
if(type){
if(current_user===undefined){
if (type) {
if (current_user === undefined) {
this.setState({
isSpin:false
isSpin: false
})
return;
}
if(type===1){
if (type === 1) {
this.setState({
page:1,
author_id:undefined,
assigned_to_id:current_user.user_id,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
page: 1,
author_id: undefined,
assigned_to_id: current_user.user_id,
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList(1,limit,search,undefined,current_user.user_id,status_type);
this.getIssueList(1, limit, search, undefined, current_user.user_id, status_type);
}else{
} else {
this.setState({
page:1,
author_id:current_user.user_id,
assigned_to_id:undefined,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
page: 1,
author_id: current_user.user_id,
assigned_to_id: undefined,
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList(1,limit,search,current_user.user_id,undefined,status_type);
this.getIssueList(1, limit, search, current_user.user_id, undefined, status_type);
}
}else{
} else {
this.setState({
page:1,
author_id:undefined,
assigned_to_id:undefined,
issue_tag_ids:'标签',
tracker_ids:'所有分类',
author_ids:'发布人',
assigned_to_ids:'指派人',
priority_ids:'优先度',
done_ratios:'完成度',
paix:'排序'
page: 1,
author_id: undefined,
assigned_to_id: undefined,
issue_tag_ids: '标签',
tracker_ids: '所有分类',
author_ids: '发布人',
assigned_to_ids: '指派人',
priority_ids: '优先度',
done_ratios: '完成度',
paix: '排序'
})
this.getIssueList(1,limit,search,undefined,undefined,status_type);
this.getIssueList(1, limit, search, undefined, undefined, status_type);
}
}
deletedetail=(id)=>{
const { projectsId} = this.props.match.params;
deletedetail = (id) => {
const { projectsId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${id}.json`;
axios.delete(url,{ data: {
axios.delete(url, {
data: {
project_id: projectsId,
id:id
id: id
}
}).then((result)=>{
if(result){
this.getIssueList()
}
}).catch((error)=>{
console.log(error);
})
}).then((result) => {
if (result) {
this.getIssueList()
}
}).catch((error) => {
console.log(error);
})
console.log(id)
}
islogin(){
islogin() {
const { projectsId } = this.props.match.params;
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}else{
this.props.showLoginDialog()
return
} else {
this.props.history.push(`/projects/${projectsId}/orders/new`);
}
}
render(){
const { current_user } = this.props;
render() {
const { current_user } = this.props;
const { issue_chosen , issues , limit , page , search_count , data , assigned_to_id , author_id , isSpin,openselect,closeselect } = this.state;
const { projectsId } = this.props.match.params;
const { issue_chosen, issues, limit, page, search_count, data, assigned_to_id, author_id, isSpin, openselect, closeselect } = this.state;
const menu = (
<Menu onClick={(e)=>this.getOption(e)}>
<Menu onClick={(e) => this.getOption(e)}>
<Menu.Item key={'created_on'} value="desc">最新创建</Menu.Item>
<Menu.Item key={'created_on'} value="asc">最早创建</Menu.Item>
<Menu.Item key={'updated_on'} value="desc">最新更新</Menu.Item>
@ -362,28 +362,18 @@ class order extends Component{
<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>:""
<div className="mt30 mb50 edu-txt-center">
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
</div> : ""
}
</React.Fragment>
)
return(
return (
<div className="main">
{/*<div className="topWrapper">*/}
{/*<Nav {...this.props} {...this.state}/>*/}
{/*{*/}
{/*<a className="topWrapper_btn" onClick={()=>this.islogin()} >创建任务</a>*/}
{/*}*/}
{/*</div>*/}
<div className="topWrapper" style={{borderBottom:"none"}}>
<div className="topWrapper" style={{ borderBottom: "none" }}>
<p className="topWrapper_type">
<li className={openselect ? "active":""} onClick={()=>this.openorder(1)}>{data && data.open_count}个开启中</li>
<li className={closeselect ? "active":""} onClick={()=>this.openorder(2)}>{data && data.close_count}个已关闭</li>
{/* <span onClick={this.openorder} className={author_id ? "active":""}>{data && data.open_count}</span>
<span onClick={this.closeorder} className={author_id ? "active":""}>{data && data.close_count}个已关闭</span> */}
<li className={openselect ? "active" : ""} onClick={() => this.openorder(1)}>{data && data.open_count}个开启中</li>
<li className={closeselect ? "active" : ""} onClick={() => this.openorder(2)}>{data && data.close_count}个已关闭</li>
</p>
<div className="topWrapper_select">
@ -394,53 +384,46 @@ class order extends Component{
onSearch={this.searchFunc}
style={{ width: 300 }}
/>
</div>
<a className="topWrapper_btn ml10" onClick={()=>this.islogin()} >创建任务</a>
<a className="topWrapper_btn ml10" onClick={() => this.islogin()} >创建任务</a>
</div>
</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 && !assigned_to_id ? "active" : ""} onClick={() => this.ChangeAssign()}>全部</li>
{}
<li style={{display:current_user&&current_user.login===""?'none':'flex'}} className={assigned_to_id ? "active":""} onClick={ ()=>this.ChangeAssign(1)}>指派给我</li>
<li style={{display:current_user&&current_user.login===""?'none':'flex'}} className={author_id ? "active":""} onClick={()=>this.ChangeAssign(2)}>由我创建</li>
{/* <li>@我的</li> */}
<li style={{ display: current_user && current_user.login === "" ? 'none' : 'flex' }} className={assigned_to_id ? "active" : ""} onClick={() => this.ChangeAssign(1)}>指派给我</li>
<li style={{ display: current_user && current_user.login === "" ? 'none' : 'flex' }} className={author_id ? "active" : ""} onClick={() => this.ChangeAssign(2)}>由我创建</li>
</ul>
<ul className="topWrapper_select">
<li>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag,'标签','issue_tag_id')} trigger={['click']} placement="bottomCenter">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.issue_tag, '标签', 'issue_tag_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.issue_tag_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.tracker, '所有分类', 'tracker_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.tracker_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '发布人', 'author_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.author_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.assign_user, '指派人', 'assigned_to_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.assigned_to_ids}<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>{this.state.priority_ids}<Icon type="caret-down" className="ml5"/></span>
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.priority, '优先度', 'priority_id')} trigger={['click']} placement="bottomCenter">
<span>{this.state.priority_ids}<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">
<Dropdown className="topWrapperSelect" overlay={this.renderMenu(issue_chosen && issue_chosen.done_ratio, '完成度', 'done_ratio')} trigger={['click']} placement="bottomCenter">
<span>{this.state.done_ratios}<Icon type="caret-down" className="ml5" /></span>
</Dropdown>
</li>
@ -453,15 +436,15 @@ class order extends Component{
</div>
{
search_count === 0 ?
<NoneData _html="暂时还没有相关数据哦!" />
:
<OrderItem issues={issues} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state} deletedetail={this.deletedetail}></OrderItem>
<NoneData _html="暂时还没有相关数据哦!" />
:
<OrderItem issues={issues} search_count={search_count} page={page} limit={limit} {...this.props} {...this.state} deletedetail={this.deletedetail}></OrderItem>
}
{ Paginations }
{Paginations}
</Spin>
</div>
</div>
)
}
}