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

855 lines
26 KiB
JavaScript
Raw Normal View History

2020-05-07 10:10:13 +08:00
import React, { Component } from "react";
2020-05-28 11:35:57 +08:00
import { Input, Dropdown, Menu, Icon, Pagination, Spin, DatePicker, Checkbox } from "antd";
2020-07-17 17:36:36 +08:00
import { Link } from 'react-router-dom';
2020-05-19 18:14:21 +08:00
import "./order.css";
2020-05-28 11:35:57 +08:00
import './index.scss';
import moment from 'moment';
2020-03-16 14:12:11 +08:00
2020-05-19 18:14:21 +08:00
import NoneData from "../Nodata";
import OrderItem from "./OrderItem";
2020-03-16 14:12:11 +08:00
2020-05-19 18:14:21 +08:00
import axios from "axios";
2020-03-16 14:12:11 +08:00
const Search = Input.Search;
/**
* issue_chosen:下拉的筛选列表,
* data:列表接口返回的所有数据,
* issues:列表数组,
* isSpin:加载中,
* search:搜索关键字,
* author_id:发布者id,
* assigned_to_id:指派给的id
* limit:每页条数,
* page:当前页,
* search_count:列表总条数
* issue_type:搜索条件
* status_type: issue的关闭和开启1表示开启中的2表示关闭的
*/
2020-05-07 10:10:13 +08:00
class order extends Component {
constructor(props) {
2020-03-16 14:12:11 +08:00
super(props);
2020-05-07 10:10:13 +08:00
this.state = {
issue_chosen: undefined,
data: undefined,
issues: undefined,
isSpin: false,
search: undefined,
author_id: undefined,
assigned_to_id: undefined,
search_count: undefined,
issue_type: undefined,
2020-06-01 18:28:42 +08:00
status_type: "1", // 默认显示开启中的
2020-05-19 18:14:21 +08:00
issue_tag_ids: "标签",
2020-05-28 11:35:57 +08:00
tracker_ids: "类型",
2020-05-19 18:14:21 +08:00
author_ids: "发布人",
2020-05-28 11:35:57 +08:00
assigned_to_ids: "负责人",
fixed_version_ids: "里程碑",
status_ids: "状态",
2020-05-19 18:14:21 +08:00
done_ratios: "完成度",
paix: "排序",
2020-07-06 14:21:48 +08:00
update_author_ids: "更换负责人",
update_fixed_version_ids: '更换里程碑',
update_status_ids: "修改状态",
2020-05-28 11:35:57 +08:00
begin: '',
end: '',
checkedValue: [],
allValue: [],
all: false,
2020-05-19 18:14:21 +08:00
select_params: {
2020-05-28 11:35:57 +08:00
assigned_to_id: undefined, // 负责人
2020-05-19 18:14:21 +08:00
author_id: undefined, // 发布人
issue_tag_id: undefined, // 标签
2020-05-28 11:35:57 +08:00
tracker_id: undefined, //类型
2020-05-19 18:14:21 +08:00
done_ratio: undefined, // 完成度
2020-05-28 11:35:57 +08:00
status_id: undefined, // 优先级
fixed_version_id: undefined,//里程碑
2020-05-19 18:14:21 +08:00
order_name: undefined,
order_type: undefined,
search: undefined,
2020-07-06 14:21:48 +08:00
update_author_id: undefined,
update_fixed_version_id: undefined,
update_status_id: undefined,
2020-05-19 18:14:21 +08:00
page: 1,
limit: 15,
},
};
2020-03-16 14:12:11 +08:00
}
2020-05-07 10:10:13 +08:00
componentDidMount = () => {
2020-03-16 14:12:11 +08:00
this.getSelectList();
2020-06-29 16:32:39 +08:00
this.getIssueList('1');
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
2020-05-07 10:10:13 +08:00
getSelectList = () => {
2020-05-28 11:35:57 +08:00
this.setState({
isSpin: true
})
2020-08-12 18:13:18 +08:00
const { projectsId , owner } = this.props.match.params;
2020-03-16 14:12:11 +08:00
2020-08-12 18:13:18 +08:00
const url = `/${owner}/${projectsId}/issues/index_chosen.json`;
2020-05-28 11:35:57 +08:00
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen: result.data.issue_chosen,
isSpin: false
});
}
})
2020-05-19 18:14:21 +08:00
.catch((error) => {
console.log(error);
});
};
2020-03-16 14:12:11 +08:00
// 获取列表数据
2020-07-06 14:21:48 +08:00
getIssueList = (status_type, begin, end) => {
2020-05-28 11:35:57 +08:00
this.setState({
isSpin: true
})
2020-05-19 18:14:21 +08:00
const { select_params } = this.state;
2020-08-12 18:13:18 +08:00
const { projectsId, owner } = this.props.match.params;
const url = `/${owner }/${projectsId}/issues.json`;
2020-05-19 18:14:21 +08:00
axios
.get(url, {
2020-05-28 11:35:57 +08:00
params: {
...select_params,
start_date: begin,
2020-06-29 16:32:39 +08:00
due_date: end,
status_type
2020-05-28 11:35:57 +08:00
}
2020-03-16 14:12:11 +08:00
})
2020-05-19 18:14:21 +08:00
.then((result) => {
if (result) {
2020-05-28 11:35:57 +08:00
const issues = result.data.issues
2020-05-19 18:14:21 +08:00
this.setState({
data: result.data,
2020-05-28 11:35:57 +08:00
issues: issues,
2020-05-19 18:14:21 +08:00
search_count: result.data.search_count,
isSpin: false,
2020-05-28 11:35:57 +08:00
allValue: issues && issues.length > 0 && issues.map((item) => {
return (item.id)
})
2020-05-19 18:14:21 +08:00
});
}
2020-03-16 14:12:11 +08:00
})
2020-05-19 18:14:21 +08:00
.catch((error) => {
console.log(error);
});
};
getMenu = (e, id, name) => {
this.setState({
isSpin: true,
});
let key_name = e.key.split("-");
if (key_name[0] === "created_on") {
2020-05-07 10:10:13 +08:00
if (e.item.props.value === "desc") {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
paix: "最新创建",
});
2020-05-07 10:10:13 +08:00
} else {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
paix: "最早创建",
});
2020-03-16 14:12:11 +08:00
}
2020-05-19 18:14:21 +08:00
this.state.select_params.order_name = e.key;
} else if (key_name[0] === "updated_on") {
2020-05-07 10:10:13 +08:00
if (e.item.props.value === "desc") {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
paix: "最新更新",
});
2020-05-07 10:10:13 +08:00
} else {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
paix: "最早更新",
});
2020-03-16 14:12:11 +08:00
}
}
2020-05-19 18:14:21 +08:00
this.state.select_params.order_name = key_name[0];
this.state.select_params.order_type = e.item.props.value;
this.state.select_params.page = 1;
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
this.getIssueList(status_type);
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
2020-07-06 14:21:48 +08:00
getOption = (e, id, name, toGet) => {
const { current_user } = this.props;
2020-05-19 18:14:21 +08:00
let option_id = e.key === "all" ? undefined : e.key;
2020-05-28 11:35:57 +08:00
2020-05-29 17:00:42 +08:00
let author_id = this.state.author_id;
let assigned_to_id = this.state.assigned_to_id;
2020-05-28 11:35:57 +08:00
let select_params = this.state.select_params;
select_params[`${id}`] = option_id;
select_params.page = 1;
2020-05-29 17:00:42 +08:00
2020-05-20 09:33:58 +08:00
if (current_user) {
2020-05-29 17:07:48 +08:00
author_id = (select_params.author_id && select_params.author_id === current_user.user_id) ? current_user.user_id : undefined;
2020-07-06 14:21:48 +08:00
2020-05-29 17:07:48 +08:00
assigned_to_id = (select_params.assigned_to_id && select_params.assigned_to_id === current_user.user_id) ? current_user.user_id : undefined;
}
2020-05-29 17:00:42 +08:00
2020-05-28 11:35:57 +08:00
this.setState({
2020-07-06 14:21:48 +08:00
[`${id}s`]: name,
2020-05-29 17:00:42 +08:00
select_params,
author_id,
assigned_to_id
2020-05-28 11:35:57 +08:00
});
2020-07-06 14:21:48 +08:00
if (!toGet) {
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
this.getIssueList(status_type);
2020-05-28 11:35:57 +08:00
}
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
2020-07-06 14:21:48 +08:00
renderMenu = (array, name, id, toGet) => {
2020-05-07 10:10:13 +08:00
return (
2020-03-16 14:12:11 +08:00
<Menu>
2020-07-06 14:21:48 +08:00
<Menu.Item key={"all"} onClick={(e) => this.getOption(e, id, name, toGet)}>
2020-05-19 18:14:21 +08:00
{name}
</Menu.Item>
{array &&
array.length > 0 &&
array.map((item, key) => {
2020-05-07 10:10:13 +08:00
return (
2020-05-19 18:14:21 +08:00
<Menu.Item
key={item.id}
2020-07-06 14:21:48 +08:00
onClick={(e) => this.getOption(e, id, item.name, toGet)}
2020-12-14 14:12:41 +08:00
style={{textAlign:item.color ? "left" :"center",padding:"6px 15px"}}
2020-05-19 18:14:21 +08:00
>
2020-12-11 18:14:25 +08:00
{/* 标签前面的颜色tag */}
{item.color && <span className="tagColor" style={{backgroundColor:`${item.color}`}}></span>}
2020-05-19 18:14:21 +08:00
{item.name}
</Menu.Item>
);
})}
2020-03-16 14:12:11 +08:00
</Menu>
2020-05-19 18:14:21 +08:00
);
};
2020-03-16 14:12:11 +08:00
// 翻页
2020-05-07 10:10:13 +08:00
ChangePage = (page) => {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
isSpin: true,
2020-05-28 11:35:57 +08:00
checkedValue: [],
all: false
2020-05-19 18:14:21 +08:00
});
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
2020-05-19 18:14:21 +08:00
this.state.select_params.page = page;
2020-06-29 16:32:39 +08:00
this.getIssueList(status_type);
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
// 搜索
2020-05-07 10:10:13 +08:00
searchFunc = (value) => {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-07 10:10:13 +08:00
search: value,
2020-05-19 18:14:21 +08:00
isSpin: true,
2020-10-27 16:47:14 +08:00
checkedValue:[],
all:undefined
2020-05-19 18:14:21 +08:00
});
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
2020-05-19 18:14:21 +08:00
this.state.select_params.search = value;
this.state.select_params.page = 1;
2020-06-29 16:32:39 +08:00
this.getIssueList(status_type);
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
2020-05-07 10:10:13 +08:00
openorder = (type) => {
2020-05-19 18:14:21 +08:00
this.setState({
2020-05-28 11:35:57 +08:00
author_id: undefined,
assigned_to_id: undefined,
status_type: type,
issue_tag_ids: "标签",
tracker_ids: "类型",
author_ids: "发布人",
assigned_to_ids: "负责人",
status_ids: "状态",
done_ratios: "完成度",
2020-11-02 09:58:19 +08:00
fixed_version_ids:"里程碑",
2020-05-28 11:35:57 +08:00
paix: "排序",
2020-10-27 16:47:14 +08:00
checkedValue:[],
all:undefined
2020-05-19 18:14:21 +08:00
});
2020-05-28 11:35:57 +08:00
this.state.select_params = {
search: undefined,
page: 1,
limit: 15,
};
2020-06-29 16:32:39 +08:00
this.getIssueList(type);
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
// 筛选:全部、指派给我、由我创建
2020-05-07 10:10:13 +08:00
ChangeAssign = (type) => {
2020-03-24 18:05:54 +08:00
const { current_user } = this.props;
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
isSpin: true,
});
2020-05-07 10:10:13 +08:00
if (type) {
2020-06-29 16:32:39 +08:00
if (!current_user) {
2020-03-24 18:05:54 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
isSpin: false,
});
2020-03-24 18:05:54 +08:00
return;
}
2020-05-07 10:10:13 +08:00
if (type === 1) {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
assigned_to_ids: current_user.username,
2020-05-07 10:10:13 +08:00
assigned_to_id: current_user.user_id,
2020-05-19 18:14:21 +08:00
author_id: undefined,
author_ids: "发布人",
});
this.state.select_params.author_id = undefined;
this.state.select_params.assigned_to_id = current_user.user_id;
2020-05-07 10:10:13 +08:00
} else {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
author_ids: current_user.username,
2020-05-07 10:10:13 +08:00
author_id: current_user.user_id,
assigned_to_id: undefined,
2020-05-28 11:35:57 +08:00
assigned_to_ids: "负责人",
2020-05-19 18:14:21 +08:00
});
this.state.select_params.assigned_to_id = undefined;
this.state.select_params.author_id = current_user.user_id;
2020-03-16 14:12:11 +08:00
}
2020-05-07 10:10:13 +08:00
} else {
2020-03-16 14:12:11 +08:00
this.setState({
2020-05-19 18:14:21 +08:00
author_ids: "发布人",
2020-05-07 10:10:13 +08:00
author_id: undefined,
2020-05-28 11:35:57 +08:00
assigned_to_ids: "负责人",
2020-05-07 10:10:13 +08:00
assigned_to_id: undefined,
2020-05-19 18:14:21 +08:00
});
this.state.select_params.assigned_to_id = undefined;
this.state.select_params.author_id = undefined;
2020-03-16 14:12:11 +08:00
}
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
2020-05-19 18:14:21 +08:00
2020-06-29 16:32:39 +08:00
this.getIssueList(status_type);
2020-05-19 18:14:21 +08:00
};
2020-05-07 10:10:13 +08:00
deletedetail = (id) => {
2020-08-18 17:21:11 +08:00
const { projectsId , owner } = this.props.match.params;
2021-02-22 10:17:52 +08:00
const url = `/${owner}/${projectsId}/issues/${id}.json`;
2020-05-28 11:35:57 +08:00
axios.delete(url, {
data: {
project_id: projectsId,
id: id,
},
})
2020-11-23 10:14:29 +08:00
.then((result) => {
if (result) {
const { status_type } = this.state;
2020-06-29 16:32:39 +08:00
2020-11-23 10:14:29 +08:00
this.getIssueList(status_type);
}
})
.catch((error) => {
console.log(error);
});
2020-05-19 18:14:21 +08:00
};
2020-03-16 14:12:11 +08:00
2020-11-18 11:31:52 +08:00
islogin=()=>{
2020-07-17 17:36:36 +08:00
this.props.showLoginDialog();
}
renderNew =()=>{
2020-08-12 18:13:18 +08:00
const { projectsId , owner } = this.props.match.params;
2020-07-17 17:36:36 +08:00
if (this.props.checkIfLogin()) {
return(
2020-08-13 15:44:02 +08:00
<Link className="topWrapper_btn ml10" target="_blank" to={`/projects/${owner}/${projectsId}/issues/new`}>
+&nbsp;创建易修
2020-07-17 17:36:36 +08:00
</Link>
)
}else{
return(
<a className="topWrapper_btn ml10" onClick={this.islogin}>+&nbsp;创建易修</a>
2020-07-17 17:36:36 +08:00
)
2020-04-03 16:45:59 +08:00
}
}
2020-05-28 11:35:57 +08:00
// 修改开始时间
changeBeginTime = (data, value) => {
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
2020-05-28 11:35:57 +08:00
this.setState({
begin: value
})
2020-07-06 14:21:48 +08:00
this.getIssueList(status_type, value, this.state.end);
2020-05-28 11:35:57 +08:00
}
changeEndTime = (data, value) => {
2020-06-29 16:32:39 +08:00
const { status_type } = this.state;
2020-05-28 11:35:57 +08:00
this.setState({
end: value
})
2020-07-06 14:21:48 +08:00
this.getIssueList(status_type, this.state.begin, value);
2020-05-28 11:35:57 +08:00
}
// 选择列表里面的checkbox
checkIssues = (value) => {
this.setState({
checkedValue: value
})
const { allValue } = this.state;
this.setState({
all: allValue && value && value.length === allValue.length,
})
// 不勾选数据时清除右上角选择的项
2020-07-06 14:21:48 +08:00
if (value.length === 0) {
2020-05-28 11:35:57 +08:00
this.setState({
2020-07-06 14:21:48 +08:00
update_author_ids: "更换负责人",
update_fixed_version_ids: "更换里程碑",
update_status_ids: "修改状态",
select_params: {
update_author_id: undefined,
update_fixed_version_id: undefined,
update_status_id: undefined
2020-05-28 11:35:57 +08:00
}
})
}
}
// 全选和反选
changeAll = (e) => {
if (e.target.checked) {
const { allValue } = this.state;
this.setState({
checkedValue: allValue
})
} else {
this.setState({
checkedValue: []
})
}
this.setState({
all: e.target.checked
})
}
// 批量修改
2020-07-06 14:21:48 +08:00
updateIssues = () => {
const { checkedValue, select_params } = this.state;
2020-08-13 15:44:02 +08:00
const { projectsId , owner } = this.props.match.params;
2020-07-06 14:21:48 +08:00
if (!select_params.update_author_id && !select_params.update_fixed_version_id && !select_params.update_status_id) {
2020-06-29 16:32:39 +08:00
this.resetSelectParams();
return;
}
2020-05-28 11:35:57 +08:00
this.setState({
2020-07-06 14:21:48 +08:00
isSpin: true
2020-05-28 11:35:57 +08:00
})
2020-08-13 15:44:02 +08:00
const url = `/${owner}/${projectsId}/issues/series_update.json`;
2020-07-06 14:21:48 +08:00
axios.post(url, {
ids: checkedValue,
assigned_to_id: select_params.update_author_id,
fixed_version_id: select_params.update_fixed_version_id,
status_id: select_params.update_status_id
}).then(result => {
if (result) {
2020-05-28 11:35:57 +08:00
this.props.showNotification("修改成功!");
this.successFunc();
}
2020-07-06 14:21:48 +08:00
}).catch(error => {
2020-05-28 11:35:57 +08:00
console.log(error);
})
}
2020-07-06 14:21:48 +08:00
successFunc = () => {
2020-06-29 16:32:39 +08:00
this.resetSelectParams();
const { status_type } = this.state;
this.getIssueList(status_type);
}
2020-07-06 14:21:48 +08:00
resetSelectParams = () => {
2020-05-28 11:35:57 +08:00
let select_params = this.state.select_params;
select_params.update_author_id = undefined;
select_params.update_fixed_version_id = undefined;
select_params.update_status_id = undefined;
this.setState({
2020-07-06 14:21:48 +08:00
all: false,
checkedValue: [],
update_author_ids: "更换负责人",
update_fixed_version_ids: "更换里程碑",
update_status_ids: "修改状态",
2020-05-28 11:35:57 +08:00
select_params
})
}
// 批量删除
2020-07-06 14:21:48 +08:00
deleteIssues = () => {
2020-05-28 11:35:57 +08:00
this.props.confirm({
content: "是否确认删除所有选中的任务?",
2020-07-06 14:21:48 +08:00
onOk: () => {
2020-05-28 11:35:57 +08:00
this.setState({
2020-07-06 14:21:48 +08:00
isSpin: true
2020-05-28 11:35:57 +08:00
})
const { checkedValue } = this.state;
2020-08-18 17:21:11 +08:00
const { projectsId , owner } = this.props.match.params;
2020-09-18 17:25:36 +08:00
const url = `/${owner}/${projectsId}/issues/clean.json`;
2020-07-06 14:21:48 +08:00
axios.post(url, {
ids: checkedValue
}).then(result => {
if (result) {
2020-05-28 11:35:57 +08:00
this.props.showNotification("删除成功!");
this.successFunc();
}
2020-07-06 14:21:48 +08:00
}).catch(error => {
2020-05-28 11:35:57 +08:00
console.log(error);
})
}
})
}
2020-07-06 14:21:48 +08:00
menu =()=> (
<Menu onClick={(e) => this.getMenu(e)}>
<Menu.Item key={"created_on-desc"} value="desc">
最新创建
</Menu.Item>
<Menu.Item key={"created_on-asc"} value="asc">
最早创建
</Menu.Item>
<Menu.Item key={"updated_on-desc"} value="desc">
最新更新
</Menu.Item>
<Menu.Item key={"updated_on-asc"} value="asc">
最早更新
</Menu.Item>
</Menu>
);
2020-05-28 11:35:57 +08:00
2020-05-07 10:10:13 +08:00
render() {
const { current_user } = this.props;
2020-05-19 18:14:21 +08:00
const {
issue_chosen,
issues,
search_count,
data,
author_id,
assigned_to_id,
isSpin,
status_type,
select_params,
2020-05-28 11:35:57 +08:00
begin, end, checkedValue, all
2020-05-19 18:14:21 +08:00
} = this.state;
2020-07-06 14:21:48 +08:00
2020-05-07 10:10:13 +08:00
return (
2021-03-19 15:46:37 +08:00
<div className="main" style={{padding:"0px"}}>
<div style={{padding:"10px 20px 0px 20px"}}>
2020-05-28 11:35:57 +08:00
<div className="topWrapper" style={{ paddingTop: "10px" }}>
<ul className="topWrapper_type">
<li>
<label>所有</label>
<span
className={status_type ? "" : "active"}
onClick={() => this.openorder()}
>{data && data.all_count}</span>
2020-05-19 18:14:21 +08:00
</li>
2020-05-28 11:35:57 +08:00
<li>
<label>开启中</label>
<span
className={status_type === "1" ? "active" : ""}
onClick={() => this.openorder("1")}
>{data && data.open_count}</span>
2020-05-19 18:14:21 +08:00
</li>
2020-05-28 11:35:57 +08:00
<li>
<label>已关闭</label>
<span className={status_type === "2" ? "active" : ""}
onClick={() => this.openorder("2")}>{data && data.close_count}</span>
</li>
</ul>
2020-07-17 17:36:36 +08:00
{this.renderNew()}
2020-05-28 11:35:57 +08:00
</div>
2021-02-22 17:50:47 +08:00
<div className="topWrapper" style={{borderBottom:"none"}}>
2020-05-28 11:35:57 +08:00
<div className="target-detail-search">
<Search
2021-05-21 18:58:17 +08:00
placeholder="输入关键字搜索易修"
2020-05-28 11:35:57 +08:00
enterButton
onSearch={this.searchFunc}
style={{ width: 300 }}
/>
</div>
<div>
<DatePicker
value={begin ? moment(begin, 'YYYY-MM-DD') : ""}
style={{ marginRight: "20px" }}
placeholder="请选择开始时间"
onChange={this.changeBeginTime}
/>
<DatePicker value={end ? moment(end, 'YYYY-MM-DD') : ""} placeholder="请选择结束时间" onChange={this.changeEndTime} />
2020-03-16 14:12:11 +08:00
</div>
</div>
2021-03-19 15:46:37 +08:00
</div>
2020-03-16 14:12:11 +08:00
<Spin spinning={isSpin}>
2020-05-28 11:35:57 +08:00
<div className="f-wrap-between screenWrap">
<div className="df">
2020-05-29 17:07:48 +08:00
{
2020-06-05 17:21:23 +08:00
current_user && current_user.login ?
2020-05-29 17:07:48 +08:00
<Checkbox value="0" style={{ lineHeight: "50px", marginRight: "15px" }} checked={all} onChange={this.changeAll}></Checkbox>
2020-07-06 14:21:48 +08:00
: ""
2020-05-29 17:07:48 +08:00
}
2020-05-28 11:35:57 +08:00
{checkedValue && checkedValue.length > 0 ?
<span style={{ lineHeight: "50px" }}>选中{checkedValue.length}个issue</span>
:
<ul className="searchBanner">
<li
className={!author_id && !assigned_to_id ? "active" : ""}
onClick={() => this.ChangeAssign()}
>
<label>搜索结果</label>
<span>{data && data.search_count}</span>
</li>
<li
style={{
display:
current_user && current_user.login === "" ? "none" : "flex",
}}
className={assigned_to_id ? "active" : ""}
onClick={() => this.ChangeAssign(1)}
>
<label>指派给我</label>
<span>{data && data.assign_me_count}</span>
</li>
<li
style={{
display:
current_user && current_user.login === "" ? "none" : "flex",
}}
className={author_id ? "active" : ""}
onClick={() => this.ChangeAssign(2)}
>
<label>我的发布</label>
<span>{data && data.my_published_count}</span>
</li>
</ul>
}
</div>
{
2020-07-06 14:21:48 +08:00
checkedValue && checkedValue.length > 0 ?
2020-10-12 14:00:18 +08:00
<ul className="topWrapper_select wrapperStyle">
2020-07-06 14:21:48 +08:00
<li className="mr20">
<Dropdown
className="topWrapperSelect"
overlay={this.renderMenu(
issue_chosen && issue_chosen.assign_user,
"更换负责人",
"update_author_id", true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_author_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li className="mr20">
<Dropdown
2020-10-12 14:00:18 +08:00
className="topWrapperSelect wrapperStyle"
2020-07-06 14:21:48 +08:00
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_version,
"更换里程碑",
"update_fixed_version_id", true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_fixed_version_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li className="mr20">
<Dropdown
2020-10-12 14:00:18 +08:00
className="topWrapperSelect wrapperStyle"
2020-07-06 14:21:48 +08:00
overlay={this.renderMenu(
issue_chosen && issue_chosen.issue_status,
"修改状态",
"update_status_id", true
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.update_status_ids}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<a onClick={this.updateIssues} className="updateBtn blue mr20">确定</a>
<a onClick={this.deleteIssues} className="updateBtn red mr20">删除</a>
</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"
>
<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.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"
>
<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.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.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.issue_status,
"状态",
"status_id"
)}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.status_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"
>
<span>
{this.state.done_ratios}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
<li>
<Dropdown
className="topWrapperSelect"
overlay={this.menu()}
trigger={["click"]}
placement="bottomCenter"
>
<span>
{this.state.paix}
<Icon type="caret-down" className="ml5" />
</span>
</Dropdown>
</li>
</ul>
2020-05-28 11:35:57 +08:00
}
2020-07-06 14:21:48 +08:00
2020-03-16 14:12:11 +08:00
</div>
2020-05-19 18:14:21 +08:00
{search_count === 0 ? (
2020-10-30 10:42:02 +08:00
<NoneData _html="暂时还没有相关数据!" />
2020-05-19 18:14:21 +08:00
) : (
2020-05-28 11:35:57 +08:00
<div style={{ minHeight: "500px" }}>
<Checkbox.Group name="issues" onChange={this.checkIssues} value={checkedValue} style={{ width: "100%" }}>
{issues && issues.length > 0 && issues.map((item, key) => {
return (
<OrderItem
key={key}
item={item}
2020-07-06 14:21:48 +08:00
checkbox={current_user ? <Checkbox value={item.id} key={item.id} style={{ margin: '4px 15px 0px 0px' }}></Checkbox> : ""}
2020-05-28 11:35:57 +08:00
search_count={search_count}
page={select_params.page}
limit={select_params.limit}
{...this.props}
{...this.state}
deletedetail={this.deletedetail}
></OrderItem>
)
})}
</Checkbox.Group>
</div>
)}
2020-07-06 14:21:48 +08:00
{
search_count > select_params.limit ?
2021-05-08 16:53:16 +08:00
<div className="mt30 mb30 edu-txt-center">
2020-07-06 14:21:48 +08:00
<Pagination
simple
defaultCurrent={select_params.page}
total={search_count}
pageSize={select_params.limit}
onChange={this.ChangePage}
></Pagination>
</div>
:
""
}
2020-03-16 14:12:11 +08:00
</Spin>
2020-05-07 10:10:13 +08:00
</div>
2020-05-19 18:14:21 +08:00
);
2020-03-16 14:12:11 +08:00
}
}
2020-05-19 18:14:21 +08:00
export default order;