问题反馈

This commit is contained in:
caishi 2020-07-21 15:29:11 +08:00
parent 37e3fbae91
commit c71feff3fc
4 changed files with 304 additions and 376 deletions

View File

@ -3926,6 +3926,7 @@ html>body #ajax-indicator {
.markdown-body {
text-align: justify;
word-break: break-all;
width:100%;
}
.RightPaneDrawer .ant-drawer-content {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,6 +1,5 @@
import React, { Component } from "react";
import { Form, Input, Select, Button, DatePicker } from "antd";
import { Cancel } from '../Component/layout';
import { Form, Input, Select, Button, DatePicker ,Spin } from "antd";
import Upload from "../Upload/Index";
import UploadImg from "../Images/upload.png";
import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor";
@ -18,17 +17,17 @@ class order_form extends Component {
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: "缺陷",
tracker_id: "",
issue_type: "1",
status_id: "新增",
status_id: "",
assigned_to_id: "",
priority_id: "正常",
priority_id: "",
done_ratio: "0%",
issue_chosen: undefined,
branches: undefined,
fileList: undefined,
description: undefined,
isSpin: false,
isSpin: true,
token: undefined,
start_date: "",
due_date: "",
@ -38,78 +37,54 @@ class order_form extends Component {
};
}
componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && !this.props.checkIfLogin()){
if(prevPros && this.props && this.props.checkIfLogin()===false){
this.props.history.push("/403")
return
}
}
componentDidMount = () => {
// this.check_is_login()
this.getSelectList();
this.get_detail();
setTimeout(this.get_detail(),800);
};
// check_is_login =() =>{
// if(!this.props.checkIfLogin()){
// this.props.history.push("/403")
// return
// }
// }
get_detail = () => {
const { form_type } = this.props;
if (form_type === "new") {
this.getSelectList();
} else {
this.state.isSpin = true;
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/edit.json`;
axios
.get(url)
.then((result) => {
if (result) {
this.setState(
{
branch_name: result.data.branch_name,
issue_tag_ids: [
result.data.issue_tags && result.data.issue_tags[0].id
? String(
result.data.issue_tags && result.data.issue_tags[0].id
)
: "",
],
fixed_version_id: result.data.fixed_version_id
? String(result.data.fixed_version_id)
: "",
tracker_id: result.data.tracker_id
? String(result.data.tracker_id)
: "",
issue_type: result.data.issue_type,
status_id: result.data.status_id
? String(result.data.status_id)
: "",
assigned_to_id: result.data.assigned_to_id
? String(result.data.assigned_to_id)
: "",
priority_id: result.data.priority_id
? String(result.data.priority_id)
: "",
done_ratio: result.data.done_ratio,
fileList: undefined,
description: result.data.description,
isSpin: false,
token: result.data.token,
get_attachments: result.data.attachments,
start_date: result.data.start_date,
due_date: result.data.due_date,
subject: result.data.subject,
}
);
}
})
.catch((error) => {
this.state.isSpin = false;
console.log(error);
});
}
this.setState({
isSpin:true
})
const { projectsId, orderId } = this.props.match.params;
const url = `/projects/${projectsId}/issues/${orderId}/edit.json`;
axios.get(url).then((result) => {
if (result) {
let data ={
branch_name: result.data.branch_name,
issue_tag_ids: [
result.data.issue_tags && result.data.issue_tags[0].id ?
String(result.data.issue_tags[0].id) : "",
],
fixed_version_id: result.data.fixed_version_id ? String(result.data.fixed_version_id) : "",
tracker_id: result.data.tracker_id ? String(result.data.tracker_id) : "",
issue_type: result.data.issue_type,
status_id: result.data.status_id ? String(result.data.status_id) : "",
assigned_to_id: result.data.assigned_to_id ? String(result.data.assigned_to_id) : "",
priority_id: result.data.priority_id ? String(result.data.priority_id) : "",
done_ratio: result.data.done_ratio,
fileList: undefined,
description: result.data.description,
isSpin: false,
token: result.data.token,
get_attachments: result.data.attachments,
start_date: result.data.start_date,
due_date: result.data.due_date,
subject: result.data.subject,
}
this.props.form.setFieldsValue({ ...data });
this.setState({ ...data });
}
}).catch((error) => {
this.setState({
isSpin:false
})
console.log(error);
});
};
getSelectList = () => {
let projectsId = "";
@ -121,28 +96,24 @@ class order_form extends Component {
} else {
projectsId = this.props.match.params.projectsId;
}
const url = `/projects/${projectsId}/issues/new.json`;
axios
.get(url)
.then((result) => {
if (result) {
this.setState({
issue_chosen: result.data.issue_chosen,
branches: result.data.branches,
});
}
})
.catch((error) => {
console.log(error);
});
axios.get(url).then((result) => {
if (result) {
this.setState({
issue_chosen: result.data.issue_chosen,
branches: result.data.branches,
});
}
}).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 + ""}>
<Option key={key + 1} value={String(item.id)}>
{item.name}
</Option>
);
@ -180,58 +151,56 @@ class order_form extends Component {
const { description, start_date, due_date, issue_type } = this.state;
if (form_type === "new") {
const url = `/projects/${projectsId}/issues.json`;
axios
.post(url, {
...values,
description: description,
attachment_ids: fileList,
start_date: start_date,
due_date: due_date,
issue_type: issue_type,
})
.then((result) => {
if (result && result.data.id) {
this.props.showNotification("任务创建成功!");
this.props.history.push(`/projects/${projectsId}/orders/${result.data.id}/detail`);
this.setState({
description: "",
isSpin: false,
});
const { getDetail } = this.props;
getDetail && getDetail();
}
})
.catch((error) => {
axios.post(url, {
...values,
description: description,
attachment_ids: fileList,
start_date: start_date,
due_date: due_date,
issue_type: issue_type,
})
.then((result) => {
if (result && result.data.id) {
this.props.showNotification("任务创建成功!");
this.props.history.push(`/projects/${projectsId}/orders/${result.data.id}/detail`);
this.setState({
description: "",
isSpin: false,
});
console.log(error);
const { getDetail } = this.props;
getDetail && getDetail();
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
} else {
const url = `/projects/${projectsId}/issues/${orderId}.json`;
axios
.put(url, {
description: description,
attachment_ids: fileList,
start_date: start_date,
due_date: due_date,
issue_type: issue_type,
...values,
})
.then((result) => {
if (result) {
this.props.history.push(
`/projects/${projectsId}/orders/${orderId}/detail`
);
this.props.showNotification("任务更新成功!");
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
axios.put(url, {
description: description,
attachment_ids: fileList,
start_date: start_date,
due_date: due_date,
issue_type: issue_type,
...values,
})
.then((result) => {
if (result) {
this.props.history.push(
`/projects/${projectsId}/orders/${orderId}/detail`
);
this.props.showNotification("任务更新成功!");
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
}
}
this.setState({
@ -327,270 +296,224 @@ class order_form extends Component {
const projectsId = this.props.match.params.projectsId;
const { orderId } = this.props.match.params;
const { form_type } = 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,
description,
get_attachments,
isSpin,
start_date,
due_date,
token,
show_token,
} = this.state;
const {issue_chosen,branches,description,get_attachments,isSpin,start_date,due_date} = this.state;
return (
<div className="ProjectListIndex issue-form-index">
<Form className="width100 display-in" size="small">
<div className="list-right">
<div className="pd20">
<h3 className="mb15">
{form_type === "new" ? "新建" :( form_type === "copy" ? "复制" : "编辑")}任务
</h3>
<Form.Item>
{getFieldDecorator("subject", {
rules: [
{
required: true,
message: "请填写任务标题",
},
],
initialValue: subject,
})(<Input placeholder="标题" size="large" />)}
</Form.Item>
<div className="quillContent">
<MDEditor
placeholder={"请输入描述信息"}
height={500}
mdID={"order-new-description"}
initValue={description}
onChange={this.onContentChange}
></MDEditor>
</div>
{get_attachments && get_attachments.length > 0 ? (
<div className="mt20">
<Attachments
attachments={get_attachments}
showNotification={this.props.showNotification}
canDelete={true}
/>
<Spin spinning={isSpin}>
<div className="ProjectListIndex issue-form-index">
<Form className="width100 display-in" size="small">
<div className="list-right">
<div className="pd20">
<h3 className="mb15">
{form_type === "new" ? "新建" :( form_type === "copy" ? "复制" : "编辑")}任务
</h3>
<Form.Item>
{getFieldDecorator("subject", {
rules: [
{
required: true,
message: "请填写任务标题",
},
]
})(<Input placeholder="标题" size="large" />)}
</Form.Item>
<div className="quillContent">
<MDEditor
placeholder={"请输入描述信息"}
height={500}
mdID={"order-new-description"}
initValue={description}
onChange={this.onContentChange}
></MDEditor>
</div>
) : (
""
)}
<Upload
className="commentStyle mt30"
isComplete={true}
load={this.UploadFunc}
icon={
<img
src={UploadImg}
width="58"
alt=""
style={{ marginBottom: 15 }}
/>
}
size={100}
showNotification={this.props.showNotification}
/>
<p className="clearfix mt20">
<Button
type="primary"
loading={isSpin}
onClick={this.handleSubmit}
>
<span className="plr10">
{form_type === "new" ? "创建" : "提交"}
</span>
</Button>
<Button
type="default"
className="ml30"
onClick={()=>
this.props.history.push(form_type === "new" ? `/projects/${projectsId || orderId}/orders` : `/projects/${projectsId}/orders/${orderId}/detail`)}
>
<span className="plr10">取消</span>
</Button>
</p>
{get_attachments && get_attachments.length > 0 ? (
<div className="mt20">
<Attachments
attachments={get_attachments}
showNotification={this.props.showNotification}
canDelete={true}
/>
</div>
) : (
""
)}
<Upload
className="commentStyle mt30"
isComplete={true}
load={this.UploadFunc}
icon={
<img
src={UploadImg}
width="58"
alt=""
style={{ marginBottom: 15 }}
/>
}
size={100}
showNotification={this.props.showNotification}
/>
<p className="clearfix mt20">
<Button
type="primary"
onClick={this.handleSubmit}
>
<span className="plr10">
{form_type === "new" ? "创建" : "提交"}
</span>
</Button>
<Button
type="default"
className="ml30"
onClick={()=>
this.props.history.push(form_type === "new" ? `/projects/${projectsId || orderId}/orders` : `/projects/${projectsId}/orders/${orderId}/detail`)}
>
<span className="plr10">取消</span>
</Button>
</p>
</div>
</div>
</div>
<div className="list-left list-left-padding issue-edit-form-right">
<div className="pd20 background-f issue-form-right">
<Form.Item>
{getFieldDecorator("branch_name", {
rules: [],
initialValue: branch_name,
})(
<Select>
<Option value={""}>分支未指定</Option>
{branches &&
branches.length > 0 &&
branches.map((item, key) => {
<div className="list-left list-left-padding issue-edit-form-right">
<div className="pd20 background-f issue-form-right">
<Form.Item>
{getFieldDecorator("branch_name", {
rules: []
})(
<Select>
<Option value={""}>分支未指定</Option>
{branches && branches.length > 0 && branches.map((item, key) => {
return (
<Option value={item} key={key}>
{item}
</Option>
);
})}
</Select>
)}
</Form.Item>
<Form.Item label="状态">
{getFieldDecorator("status_id", {
rules: [
{
</Select>
)}
</Form.Item>
<Form.Item label="状态">
{getFieldDecorator("status_id", {
rules: [{
required: true,
message: "请选择完成状态",
},
],
initialValue: status_id,
})(
<Select onChange={this.changeStatus}>
{this.renderSelect(
issue_chosen && issue_chosen.issue_status
)}
</Select>
)}
</Form.Item>
<Form.Item label="类型">
{getFieldDecorator("tracker_id", {
rules: [
{
}]
})(
<Select onChange={this.changeStatus}>
{this.renderSelect( issue_chosen && issue_chosen.issue_status )}
</Select>
)}
</Form.Item>
<Form.Item label="类型">
{getFieldDecorator("tracker_id", {
rules: [{
required: true,
message: "请选择类型",
},
],
initialValue: tracker_id,
})(
<Select>
{this.renderSelect(issue_chosen && issue_chosen.tracker)}
</Select>
)}
</Form.Item>
}]
})(
<Select>
{this.renderSelect(issue_chosen && issue_chosen.tracker)}
</Select>
)}
</Form.Item>
<Form.Item label="优先度">
{getFieldDecorator("priority_id", {
rules: [
{
<Form.Item label="优先度">
{getFieldDecorator("priority_id", {
rules: [{
required: true,
message: "请选择优先度",
},
],
initialValue: priority_id,
})(
<Select>
{this.renderSelect(issue_chosen && issue_chosen.priority)}
</Select>
)}
</Form.Item>
<Form.Item label="里程碑">
{getFieldDecorator("fixed_version_id", {
rules: [],
initialValue: fixed_version_id,
})(
<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("issue_tag_ids", {
rules: [],
initialValue: issue_tag_ids,
})(
<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("assigned_to_id", {
rules: [{}],
initialValue: assigned_to_id,
})(
<Select>
<Option value={""}>未指派成员</Option>
{this.renderSelect(
issue_chosen && issue_chosen.assign_user
)}
</Select>
)}
</Form.Item>
<Form.Item label="开始日期">
<DatePicker
value={start_date ? moment(start_date, "YYYY-MM-DD") : null}
style={{ width: "100%" }}
placeholder="请选择开始日期"
onChange={this.changeBeginTime}
/>
</Form.Item>
<Form.Item label="结束日期">
<DatePicker
value={due_date ? moment(due_date, "YYYY-MM-DD") : null}
style={{ width: "100%" }}
placeholder="请选择结束日期"
onChange={this.changeEndTime}
/>
</Form.Item>
<Form.Item label="完成度">
{getFieldDecorator("done_ratio", {
rules: [],
initialValue: done_ratio,
})(
<Select onChange={this.changeRatio}>
{this.renderSelect(issue_chosen && issue_chosen.done_ratio)}
</Select>
)}
</Form.Item>
{/* <Form.Item label="">
<Switch
checkedChildren="是"
unCheckedChildren="否"
defaultChecked={false}
checked={issue_type && issue_type === "2"}
onChange={this.change_issue_type}
/>
</Form.Item>
{(show_token || (issue_type && issue_type === "2")) && (
<Form.Item label="token">
{getFieldDecorator("token", {
rules: [
{
required: true,
message: "请填写token值",
},
],
initialValue: token,
})(<Input placeholder="请填写token值" />)}
}]
})(
<Select>
{this.renderSelect(issue_chosen && issue_chosen.priority)}
</Select>
)}
</Form.Item>
)} */}
<Form.Item label="里程碑">
{getFieldDecorator("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("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("assigned_to_id", {rules: []})(
<Select>
<Option value={""}>未指派成员</Option>
{this.renderSelect(
issue_chosen && issue_chosen.assign_user
)}
</Select>
)}
</Form.Item>
<Form.Item label="开始日期">
<DatePicker
value={start_date ? moment(start_date, "YYYY-MM-DD") : null}
style={{ width: "100%" }}
placeholder="请选择开始日期"
onChange={this.changeBeginTime}
/>
</Form.Item>
<Form.Item label="结束日期">
<DatePicker
value={due_date ? moment(due_date, "YYYY-MM-DD") : null}
style={{ width: "100%" }}
placeholder="请选择结束日期"
onChange={this.changeEndTime}
/>
</Form.Item>
<Form.Item label="完成度">
{getFieldDecorator("done_ratio", {rules: []})(
<Select onChange={this.changeRatio}>
{this.renderSelect(issue_chosen && issue_chosen.done_ratio)}
</Select>
)}
</Form.Item>
{/* <Form.Item label="">
<Switch
checkedChildren="是"
unCheckedChildren="否"
defaultChecked={false}
checked={issue_type && issue_type === "2"}
onChange={this.change_issue_type}
/>
</Form.Item>
{(show_token || (issue_type && issue_type === "2")) && (
<Form.Item label="token">
{getFieldDecorator("token", {
rules: [
{
required: true,
message: "请填写token值",
},
],
initialValue: token,
})(<Input placeholder="请填写token值" />)}
</Form.Item>
)} */}
</div>
</div>
</div>
</Form>
</div>
</Form>
</div>
</Spin>
);
}
}

View File

@ -52,6 +52,7 @@ class NewHeader extends Component {
componentDidMount() {
this.getAppdata();
window._header_componentHandler = this;
//下拉框的显示隐藏
var hoverTimeout;
var hoveredPanel;
@ -761,6 +762,9 @@ class NewHeader extends Component {
)
})
}
<li>
<a href="https://www.trustie.net/forums/82/memos/3075" target="_blank" style={{color:"#FF6E21"}}>问题反馈</a>
</li>
</ul>
</div>
: ""