添加或修改里程碑信息时,可以添加或修改附件

This commit is contained in:
向明星 2024-08-07 17:26:19 +08:00
parent f58193307f
commit 70348f8355
5 changed files with 91 additions and 8 deletions

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
var proxy = "https://testforgeplus.trustie.net";
var proxy = "https://testforgeplus.educoder.net";
//响应前的设置
axios.interceptors.request.use(
config => {

View File

@ -45,7 +45,7 @@ class Milepost extends Component {
getList = (page, status, order_type, order_name) => {
const { projectsId ,owner } = this.props.match.params;
const { limit } = this.state;
const { limit,keyword } = this.state;
const url = `/${owner}/${projectsId}/milestones.json`;
axios.get(url, {
params: {

View File

@ -1,5 +1,8 @@
import React, { Component } from 'react';
import { Calendar, Select, Radio, Col, Row, Divider, Input, Form, Spin } from 'antd';
import Upload from "../Upload/Index";
import UploadImg from "../Images/upload.png";
import Attachments from "../Upload/attachment";
import axios from 'axios';
import moment from 'moment';
import '../Order/order.css';
@ -14,7 +17,8 @@ class UpdateMilepost extends Component {
data: undefined,
value: moment('2017-01-25'),
selectedValue: moment('2020-2-12'),
isSpin: false
isSpin: false,
get_attachments: undefined,
}
}
@ -34,6 +38,12 @@ class UpdateMilepost extends Component {
selectedValue: time,
});
}
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({
fileList,
});
};
getmeil = () => {
const { projectsId , owner } = this.props.match.params;
@ -47,11 +57,13 @@ class UpdateMilepost extends Component {
if (result) {
this.setState({
data: result.data,
selectedValue: result.data.effective_date && moment(result.data.effective_date)
selectedValue: result.data.effective_date && moment(result.data.effective_date),
get_attachments: result.data.attachments,
})
this.props.form.setFieldsValue({
name: result.data.name,
description: result.data.description
description: result.data.description,
get_attachments: result.data.attachments,
});
}
@ -101,7 +113,7 @@ class UpdateMilepost extends Component {
render() {
const { getFieldDecorator } = this.props.form;
const { isSpin , selectedValue } = this.state;
const { isSpin , selectedValue, get_attachments } = this.state;
return (
<div className="main">
<Form>
@ -135,6 +147,32 @@ class UpdateMilepost extends Component {
)}
</Form.Item>
{get_attachments && get_attachments.length > 0 ? (
<div className="mt20">
<Attachments
attachments={get_attachments}
showNotification={this.props.showNotification}
canDelete={true}
/>
</div>
) : (
""
)}
<Upload
className="commentStyle mt30 uploadHeight"
isComplete={true}
load={this.UploadFunc}
icon={
<img
src={UploadImg}
width="58"
alt=""
style={{ marginBottom: 15 }}
/>
}
size={100}
showNotification={this.props.showNotification}
/>
</div>
<div className="newmilepostrighe" >
截止日期(可选) <a style={{ color: 'red' }} onClick={this.claertime}>清除</a>

View File

@ -1,5 +1,8 @@
import React, { Component } from 'react';
import { Calendar, Select, Radio, Col, Row, Divider, Input, Form, Spin } from 'antd';
import Upload from "../Upload/Index";
import UploadImg from "../Images/upload.png";
import Attachments from "../Upload/attachment";
import axios from 'axios';
import moment from 'moment';
import '../Order/order.css';
@ -13,7 +16,9 @@ class NewMilepost extends Component {
data: undefined,
value: moment('2017-01-25'),
selectedValue: undefined,
isSpin: false
isSpin: false,
get_attachments: undefined,
fileList: undefined,
}
}
componentDidUpdate=(prevPros)=>{
@ -35,6 +40,13 @@ class NewMilepost extends Component {
// return
// }
// };
// 获取上传后的文件id数组
UploadFunc = (fileList) => {
this.setState({
fileList,
});
};
onPanelChange = (time, mode) => {
this.setState({
@ -54,6 +66,7 @@ class NewMilepost extends Component {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { projectsId , owner } = this.props.match.params;
const { fileList } = this.state;
const url = `/${owner}/${projectsId}/milestones.json`;
let time = undefined;
if (this.state.selectedValue) {
@ -62,11 +75,13 @@ class NewMilepost extends Component {
axios.post(url, {
...values,
project_id: projectsId,
attachment_ids: fileList,
effective_date: time,
status: 'open'
}).then(result => {
if (result) {
this.setState({ isSpin: false })
this.props.showNotification("里程碑创建成功!");
this.props.history.push(`/${owner}/${projectsId}/milestones`);
const { getDetail } = this.props;
getDetail && getDetail();
@ -87,7 +102,7 @@ class NewMilepost extends Component {
render() {
const { getFieldDecorator } = this.props.form;
const { isSpin } = this.state
const { isSpin,get_attachments } = this.state
return (
<div className="main">
<Form>
@ -121,6 +136,33 @@ class NewMilepost extends Component {
)}
</Form.Item>
{get_attachments && get_attachments.length > 0 ? (
<div className="mt20">
<Attachments
attachments={get_attachments}
showNotification={this.props.showNotification}
canDelete={true}
/>
</div>
) : (
""
)}
<Upload
className="commentStyle mt30 uploadHeight"
style={{height:100}}
isComplete={true}
load={this.UploadFunc}
icon={
<img
src={UploadImg}
width="58"
alt=""
style={{ marginBottom: 15 }}
/>
}
size={100}
showNotification={this.props.showNotification}
/>
</div>
<div className="newmilepostrighe" >
<a style={{ color: 'black' }}>截止日期(可选)</a> <a style={{ color: 'red' }} onClick={this.cleartime}></a>

View File

@ -672,6 +672,9 @@ a.issue-type-button.active:hover {
.commentStyle {
background-color: #fff !important;
}
.uploadHeight{
height: 110px !important;
}
.reply-comment-input .add_reply_button {
background-color: #fff !important;
color: #bbb;