Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge
commit
30fdbec06a
@ -1,16 +1,209 @@
|
|||||||
import React , { Component } from "react";
|
import React , { Component } from "react";
|
||||||
|
import { Form , Input , Select } from 'antd';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
|
||||||
|
import {getImageUrl} from 'educoder';
|
||||||
|
|
||||||
import Nav from './Nav';
|
import Nav from './Nav';
|
||||||
|
import './order.css';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const Option = Select.Option;
|
||||||
|
const TextArea = Input.TextArea;
|
||||||
class New extends Component{
|
class New extends Component{
|
||||||
|
constructor(props){
|
||||||
|
super(props);
|
||||||
|
this.state={
|
||||||
|
branch_name:"0",
|
||||||
|
issue_tag_ids:"0",
|
||||||
|
fixed_version_id:"0",
|
||||||
|
tracker_id:"0",
|
||||||
|
issue_type:"0",
|
||||||
|
assigned_to_id:"0",
|
||||||
|
priority_id:"0",
|
||||||
|
done_ratio:"0",
|
||||||
|
issue_chosen:undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount=()=>{
|
||||||
|
this.InitData();
|
||||||
|
this.getSelectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
InitData=()=>{
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
...this.state
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getSelectList=()=>{
|
||||||
|
const { projectsId } = this.props.match.params;
|
||||||
|
|
||||||
|
const url = `/projects/${projectsId}/issues/new.json`;
|
||||||
|
axios.get(url).then((result)=>{
|
||||||
|
if(result){
|
||||||
|
this.setState({
|
||||||
|
issue_chosen:result.data.issue_chosen
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建
|
||||||
|
handleSubmit=()=>{
|
||||||
|
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||||
|
console.log(values);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
|
const { getFieldDecorator } = this.props.form;
|
||||||
|
const { current_user } = this.props;
|
||||||
|
const { issue_tag_ids , fixed_version_id , branch_name , tracker_id , issue_type ,assigned_to_id , priority_id , done_ratio,
|
||||||
|
issue_chosen } = this.state;
|
||||||
|
|
||||||
|
const renderSelect =(array)=>{
|
||||||
|
if(array && array.length > 0){
|
||||||
|
return(
|
||||||
|
array.map((item,key)=>{
|
||||||
|
return(
|
||||||
|
<Option key={key} value={item.id}>{item.name}</Option>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
return(
|
return(
|
||||||
<div className="main">
|
<div className="main">
|
||||||
<div className="topWrapper">
|
<div className="topWrapper">
|
||||||
<Nav />
|
<Nav />
|
||||||
</div>
|
</div>
|
||||||
|
<Form>
|
||||||
|
<div className="f-wrap-between mt20" style={{alignItems:"flex-start"}}>
|
||||||
|
<div className="list-right df">
|
||||||
|
<Link to={``}><img class="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: '请填写工单标题'
|
||||||
|
}],
|
||||||
|
})(
|
||||||
|
<Input placeholder="标题"/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('description', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<TextArea placeholder="添加一个可选的扩展描述。。。" style={{height:"150px"}}/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<p className="clearfix mt15">
|
||||||
|
<a className="topWrapper_btn fr" type="submit" onClick={this.handleSubmit}>创建Issue</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="list-left" style={{paddingRight:"0px",paddingLeft:"15px",paddingTop:"10px"}}>
|
||||||
|
<div className="list-l-panel">
|
||||||
|
<Form.Item>
|
||||||
|
{getFieldDecorator('branch_name', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={branch_name}>
|
||||||
|
{/* {renderSelect(issue_chosen && issue_chosen.)} */}
|
||||||
|
<Option value="0">分支未指定</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="标签"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('issue_tag_ids', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={issue_tag_ids}>
|
||||||
|
<Option value="0">未选择标签</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="里程碑"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('fixed_version_id', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={fixed_version_id}>
|
||||||
|
<Option value="0">未选择里程碑</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="类型"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('issue_type', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={issue_type}>
|
||||||
|
<Option value="0">未选择类型</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="分类"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('tracker_id', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={tracker_id}>
|
||||||
|
<Option value="0">未选择分类</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="指派成员"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('assigned_to_id', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={assigned_to_id}>
|
||||||
|
<Option value="0">未指派成员</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="优先度"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('priority_id', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={priority_id}>
|
||||||
|
<Option value="0">未选择优先度</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="完成度"
|
||||||
|
>
|
||||||
|
{getFieldDecorator('done_ratio', {
|
||||||
|
rules: [],
|
||||||
|
})(
|
||||||
|
<Select value={done_ratio}>
|
||||||
|
<Option value="0">未选择完成度</Option>
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default New;
|
const WrappedNewForm = Form.create({ name: 'NewOrderForm' })(New);
|
||||||
|
export default WrappedNewForm;
|
Loading…
Reference in new issue