diff --git a/src/forge/Order/CopyDetail.js b/src/forge/Order/CopyDetail.js index 2fac366c2..0a7703c4b 100644 --- a/src/forge/Order/CopyDetail.js +++ b/src/forge/Order/CopyDetail.js @@ -198,8 +198,9 @@ class CopyDetail extends Component {
- + + +
{getFieldDecorator('subject', { diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index 7a662eeb3..e4e719e16 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -1,15 +1,15 @@ -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 Attachments from '../Upload/attachment'; -import MDEditor from '../../modules/tpm/challengesnew/tpm-md-editor'; -import RenderHtml from '../../components/render-html'; -import AmplifyImg from './AmplifyImg'; +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, Tag } from "antd"; +import Attachments from "../Upload/attachment"; +import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; +import RenderHtml from "../../components/render-html"; +import "./order.css"; +// import AmplifyImg from "./AmplifyImg"; class Detail extends Component { constructor(props) { @@ -17,12 +17,12 @@ class Detail extends Component { this.state = { data: undefined, isShow: false, - imgsrc: '', + imgsrc: "", journalsdata: undefined, //图片区域是否显示 none 隐藏 block 显示 - display: 'none', - titledisplay: 'none', - countvalue: '', + display: "none", + titledisplay: "none", + countvalue: "", //是否需要编辑 isedit: undefined, fileList: undefined, @@ -31,314 +31,345 @@ class Detail extends Component { search_count: undefined, isSpin: false, showFiles: true, - quillValue: '', + quillValue: "", quillFlag: false, // 点击放大的图片路径 imageUrl: undefined, visible: false, journal_spin: false, - edit_spin: false - } + edit_spin: false, + }; } componentDidMount = () => { this.getDetail(); - } + }; getDetail = () => { const { projectsId, orderId } = this.props.match.params; const url = `/projects/${projectsId}/issues/${orderId}.json`; - axios.get(url).then((result) => { - if (result) { - this.setState({ - data: result.data - }) - this.getjournalslist(); - } - }).catch((error) => { - console.log(error); - }) - } + axios + .get(url) + .then((result) => { + if (result) { + this.setState({ + data: result.data, + }); + this.getjournalslist(); + } + }) + .catch((error) => { + console.log(error); + }); + }; handleok = () => { this.setState({ - isShow: false + isShow: false, }); }; handleCancel = () => { this.setState({ - isShow: false - }); - } - - imgshow = () => { - this.setState({ - isShow: true + isShow: false, }); }; - //添加评论 + imgshow = () => { + this.setState({ + isShow: true, + }); + }; + + //添加评论 addjournals = () => { const { quillValue } = this.state; this.setState({ - journal_spin: true - }) + journal_spin: true, + }); if (!quillValue) { this.setState({ quillFlag: true, - journal_spin: false - }) + journal_spin: false, + }); 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 => { - this.setState({ - journal_spin: false + axios + .post(url, { + ...values, + content: quillValue, + issue_id: data.id, + attachment_ids: fileList, }) - console.log(error); - }) - }else{ + .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) => { + this.setState({ + journal_spin: false, + }); + console.log(error); + }); + } else { this.setState({ - journal_spin: false - }) + journal_spin: false, + }); } - }) - } + }); + }; //获取评论信息 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); - }) - } + 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 - } - }).then((result) => { - if (result) { - this.props.history.push(`/projects/${projectsId}/orders`); - } - }).catch((error) => { - console.log(error); - }) - } + 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); - }) - } + 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 - }) + 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 => { - this.setState({ - edit_spin: false + axios + .put(url, { + issue_id: orderId, + id: id, + content: countvalue, }) - console.log(error); - }) - } + .then((result) => { + if (result) { + this.setState({ + isedit: undefined, + edit_spin: false, + }); + this.getjournalslist(page, limit); + } + }) + .catch((error) => { + this.setState({ + edit_spin: false, + }); + console.log(error); + }); + }; // 获取上传后的文件id数组 UploadFunc = (fileList) => { this.setState({ - fileList - }) - } + 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); - }) - } - + 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 - }) - } + isedit: status, + }); + }; renderJournalList = (list) => { if (list && list.length > 0) { - return ( - list.map((item, key) => { - return ( -
- - {item.detail}: - - - {item.old_value && item.old_value.length > 0 ? "更新为" : "新增"} - - - {item.value && item.value.length > 0 ? - item.detail === "标签" ? {item.value[0].name} : item.value - : - "无" - } - -
- ) - }) - ) + return list.map((item, key) => { + return ( +
+ {item.detail}: + + {item.old_value && item.old_value.length > 0 ? "更新为" : "新增"} + + + {item.value && item.value.length > 0 ? ( + item.detail === "标签" ? ( + + {item.value[0].name} + + ) : ( + item.value + ) + ) : ( + "无" + )} + +
+ ); + }); } else { return (
没有评论~
- - ) + ); } - } + }; //复制 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); - }) - } + 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) => { this.setState({ page, - isSpin: true - }) + isSpin: true, + }); const { limit } = this.state; this.getjournalslist(page, limit); - } + }; // 判断是否重新上传文件 changeIsComplete = (flag) => { this.setState({ - showFiles: flag - }) - } + showFiles: flag, + }); + }; // 新建评论 onContentChange = (value) => { if (value) { this.setState({ quillValue: value, - quillFlag: false - }) + quillFlag: false, + }); } - } + }; // 编辑评论 onEditContentChange = (value) => { if (value) { this.setState({ - countvalue: value - }) + countvalue: value, + }); } - } + }; handleShowImage = (value) => { this.setState({ imageUrl: value, - visible: true - }) - } + visible: true, + }); + }; setVisible = (flag) => { this.setState({ - visible: flag - }) - } + visible: flag, + }); + }; stringJson = (value) => { let _value = null; @@ -348,46 +379,80 @@ class Detail extends Component { } catch (e) { _value = value; } - return _value - } + return _value; + }; commentCtx = (v) => { - return ( - - ) + return ; }; 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 { + 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 = ( - { - search_count > limit ? -
- -
: "" - } + {search_count > limit ? ( +
+ +
+ ) : ( + "" + )}
- ) + ); const renderList = () => { - if (journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length > 0) { + if ( + journalsdata && + journalsdata.issue_journals && + journalsdata.issue_journals.length > 0 + ) { return ( -
{ - journalsdata.issue_journals.map((item, key) => { +
+ {journalsdata.issue_journals.map((item, key) => { return (
  • - { - key > 0 && -
    - } + {key > 0 && ( +
    + )}
    - - + + -
    +

    {item.user_name} @@ -396,221 +461,450 @@ class Detail extends Component { {item.created_at}

    -
    - this.editdetail(item.content, item.id)} className="detail_edit_action">编辑 - this.deleteorder(item.id)}> +
    + + this.editdetail(item.content, item.id) + } + className="detail_edit_action" + > + 编辑 + + this.deleteorder(item.id)} + > 删除
    -
    - { - item.content ? - this.commentCtx(item.content) - : -
    - {this.renderJournalList(item.journal_details)} -
    - } - { - item && item.attachments && item.attachments.length > 0 ? - - : - "" - } +
    + {item.content ? ( + this.commentCtx(item.content) + ) : ( +
    + {this.renderJournalList(item.journal_details)} +
    + )} + {item && + item.attachments && + item.attachments.length > 0 ? ( + + ) : ( + "" + )}
    -
    -
    +
  • - ) - }) - } + ); + })}
    - ) + ); } - } - - + }; + const get_color = (type) => { + if (type === "高") { + return "#e67e22"; + } else if (type === "正常") { + return "#28be6c"; + } else if (type === "低") { + return "#1abc9c"; + } else { + return "#e74c3c"; + } + }; return ( -
    - {visible && } -
    -
    -

    - { - data ? - 【{data.issue_classify === "issue" ? (data.tracker ? data.tracker : "缺陷") : "合并请求"}】 - : - "" - } - {data && data.subject} +

    +
    +
    + + + +
    +
    + + + 【 + {data && data.issue_classify === "issue" + ? data.tracker + ? data.tracker + : "缺陷" + : "合并请求"} + 】 + + {data && data.subject} + -

    -

    - {data && data.issue_status === "关闭" ? "关闭中" : "开启中"} - - 由 {data && data.author_name} 于 {data && data.created_at}创建{data && data.journals_count && data.journals_count > 0 ? ` · ${data.journals_count} 条评论` : ""} - - { - data && data.user_permission ? - - 复制 - this.deletedetail(orderId)}> - 删除 + {data && data.priority && ( + {data.priority} + )} +

    +
    + + + {data && data.author_name} + + + 添加于 {data && data.created_at} + + {data && data.user_permission ? ( + + + 复制 + + this.deletedetail(orderId)} + > + + 删除 + - 编辑 + + 编辑 + - : + ) : ( "" - } -

    - -
    -
    -
    -
    - -
    -
    - {data && data.description && (data.description.length > 0) ? this.commentCtx(data.description) : 没有描述} -
    - { - data && data.attachments && data.attachments.length > 0 ? - - : - "" - } -
    + )}
    -
    - -
      - {renderList()} -
    -
    - - {Paginations} - { - current_user && current_user.login ? - -
    -
    - -
    -
    - -

    - {quillFlag && 请输入评论内容} -

    -
    - -

    - - 评论 - { - data && data.user_permission ? - this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"} - : - "" - } - - - -

    -
    -
    -
    - : -
    登录并参与到对话中
    - } -
    -
    -

    - 分支 - { - data && data.branch_name ? data.branch_name : "--" - } -

    -

    - 标签 - { - data && data.issue_tags ? {data.issue_tags[0].name} : "--" - } -

    -

    - 里程碑 - { - data && data.version ? data.version : "--" - } -

    -

    - 当前状态 - { - data && data.issue_status ? data.issue_status : "--" - } -

    -

    - 分类 - { - data && data.tracker ? data.tracker : "--" - } -

    -

    - 指派给 - {data && data.assign_user_name ? data.assign_user_name : "--"} -

    -

    - 优先级 - {data && data.priority ? data.priority : "--"} -

    -

    - 完成度 - {data && data.done_ratio ? data.done_ratio : "--"} -

    - +
    +
    +
    + {data && data.description && data.description.length > 0 ? ( + this.commentCtx(data.description) + ) : ( + 没有描述 + )}
    + {data && data.attachments && data.attachments.length > 0 ? ( + + ) : ( + "" + )} +
    +
    +
    +
    +

    + 分支: + {data && data.branch_name ? data.branch_name : "--"} +

    +

    + 标签: + + {data && data.issue_tags ? ( + + {data.issue_tags[0].name} + + ) : ( + "--" + )} + +

    +

    + 里程碑: + + {data && data.version ? data.version : "--"} + +

    +

    + 状态: + + {data && data.issue_status ? data.issue_status : "--"} + +

    +

    + 分类: + {data && data.tracker ? data.tracker : "--"} +

    +

    + 负责人: + + {data && data.assign_user_name ? data.assign_user_name : "--"} + +

    +

    + 开始日期: + {data && data.start_date ? data.start_date : "--"} +

    +

    + 结束日期: + {data && data.due_date ? data.due_date : "--"} +

    +

    + token值: + {data && data.token ? data.token : "--"} +

    +

    + 完成度: + {data && data.done_ratio ? data.done_ratio : "--"} +

    - - -
    - ) + //
    + // {visible && } + //
    + //
    + //

    + // { + // data ? + // 【{data.issue_classify === "issue" ? (data.tracker ? data.tracker : "缺陷") : "合并请求"}】 + // : + // "" + // } + // {data && data.subject} + + //

    + //

    + // {data && data.issue_status === "关闭" ? "关闭中" : "开启中"} + // + // 由 {data && data.author_name} 于 {data && data.created_at}创建{data && data.journals_count && data.journals_count > 0 ? ` · ${data.journals_count} 条评论` : ""} + // + // { + // data && data.user_permission ? + // + // 复制 + // this.deletedetail(orderId)}> + // 删除 + // + + // 编辑 + // + // : + // "" + // } + //

    + + //
    + //
    + //
    + //
    + // + //
    + //
    + // {data && data.description && (data.description.length > 0) ? this.commentCtx(data.description) : 没有描述} + //
    + // { + // data && data.attachments && data.attachments.length > 0 ? + // + // : + // "" + // } + //
    + //
    + //
    + // + //
      + // {renderList()} + //
    + //
    + + // {Paginations} + // { + // current_user && current_user.login ? + // + //
    + //
    + // + //
    + //
    + // + //

    + // {quillFlag && 请输入评论内容} + //

    + //
    + // + //

    + // + // 评论 + // { + // data && data.user_permission ? + // this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"} + // : + // "" + // } + // + + //

    + //
    + //
    + //
    + // : + //
    登录并参与到对话中
    + // } + + //
    + //
    + //

    + // 分支 + // { + // data && data.branch_name ? data.branch_name : "--" + // } + //

    + //

    + // 标签 + // { + // data && data.issue_tags ? {data.issue_tags[0].name} : "--" + // } + //

    + //

    + // 里程碑 + // { + // data && data.version ? data.version : "--" + // } + //

    + //

    + // 当前状态 + // { + // data && data.issue_status ? data.issue_status : "--" + // } + //

    + //

    + // 分类 + // { + // data && data.tracker ? data.tracker : "--" + // } + //

    + //

    + // 指派给 + // {data && data.assign_user_name ? data.assign_user_name : "--"} + //

    + //

    + // 优先级 + // {data && data.priority ? data.priority : "--"} + //

    + //

    + // 完成度 + // {data && data.done_ratio ? data.done_ratio : "--"} + //

    + + //
    + //
    + //
    + // + // + // + //
    + ); } } -const WrappedDetailForm = Form.create({ name: 'DetailOrderForm' })(Detail); -export default WrappedDetailForm; \ No newline at end of file +const WrappedDetailForm = Form.create({ name: "DetailOrderForm" })(Detail); +export default WrappedDetailForm; diff --git a/src/forge/Order/order.css b/src/forge/Order/order.css index 4d91b3723..c083942b4 100644 --- a/src/forge/Order/order.css +++ b/src/forge/Order/order.css @@ -503,7 +503,7 @@ /*text-align: right;*/ /*}*/ .span_title{ - min-width: 90px; + min-width: 40px; margin-right: 15px; text-align: right; color: rgba(0, 0, 0, 0.65); @@ -532,6 +532,8 @@ a.issue-type-button.active:hover{background: #f4f4f4; color: #4CACFF;} .attachment-list-a{color: rgba(0, 0, 0, 0.65) !important;} .btp1{border-top: 1px solid #f4f4f4;} .grid-item{display: grid; align-items: center; grid-template-columns: max-content 1fr;} +.grid-item-left{display: grid; align-items: center; grid-template-columns: 1fr max-content ;} + .fwb{font-weight: bold;} /* 发布人、指派人数量过多时要出现滚动条 */ @@ -555,4 +557,13 @@ a.issue-type-button.active:hover{background: #f4f4f4; color: #4CACFF;} .amplifyContent{ text-align: center; } -.mb-0{margin-bottom: 0 !important;} \ No newline at end of file +.mb-0{margin-bottom: 0 !important;} +.text-yellow{color: #FF6E21;} +.border-1f{border-bottom: 1px solid #f4f4f4;} +.background-f{background: #fff;} +.issue_detail_info{ + width: 65px; + margin-right: 15px; + text-align: right; + color:#888888; +} \ No newline at end of file diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js index 3051f17df..80ff73964 100644 --- a/src/forge/Order/order.js +++ b/src/forge/Order/order.js @@ -1,8 +1,7 @@ import React, { Component } from "react"; -import { Input, Dropdown, Menu, Icon, Pagination, Spin, Button, DatePicker } from "antd"; +import { Input, Dropdown, Menu, Icon, Pagination, Spin } from "antd"; import "./order.css"; -const { RangePicker } = DatePicker; import NoneData from "../Nodata"; import OrderItem from "./OrderItem"; @@ -60,8 +59,6 @@ class order extends Component { order_name: undefined, order_type: undefined, search: undefined, - start_date:undefined, - due_date: undefined, page: 1, limit: 15, }, @@ -158,20 +155,13 @@ class order extends Component { this.state.select_params.page = 1; this.state[`${id}s`] = name; if (current_user) { - if ( - this.state.select_params.author_id && - parseInt(this.state.select_params.author_id) === current_user.user_id - ) { + if ( this.state.select_params.author_id && parseInt(this.state.select_params.author_id) === current_user.user_id) { this.state.author_id = current_user.user_id; } else { this.state.author_id = undefined; } - if ( - this.state.select_params.assigned_to_id && - parseInt(this.state.select_params.assigned_to_id) === - current_user.user_id - ) { + if (this.state.select_params.assigned_to_id && parseInt(this.state.select_params.assigned_to_id) === current_user.user_id ) { this.state.assigned_to_id = current_user.user_id; } else { this.state.assigned_to_id = undefined; @@ -228,8 +218,6 @@ class order extends Component { }); if (type) { this.setState({ - author_id: undefined, - assigned_to_id: undefined, status_type: type, issue_tag_ids: "标签", tracker_ids: "所有分类", @@ -377,42 +365,8 @@ class order extends Component { ); return (
    -
    -
    - - 所有: - - - - 开启中: - - - - 已关闭: - - -
    - - -
    -
    - -
    - -
    - - {/*

    +

  • this.openorder("1")} @@ -425,9 +379,9 @@ class order extends Component { > {data && data.close_count}个已关闭
  • -

    */} +

    - {/*
    +
    this.islogin()}> 创建任务 -
    */} +