|
|
|
@ -5,7 +5,7 @@ import axios from 'axios';
|
|
|
|
|
import Nav from './Nav';
|
|
|
|
|
import UploadComponent from '../Upload/Index';
|
|
|
|
|
import { getImageUrl } from 'educoder';
|
|
|
|
|
import{ Modal,Col,Form,Input,Tooltip,Popconfirm } from 'antd'
|
|
|
|
|
import {Modal, Col, Form, Input, Tooltip, Popconfirm, Pagination , Spin} from 'antd'
|
|
|
|
|
import NoneData from '../../modules/courses/coursesPublic/NoneData';
|
|
|
|
|
import Attachments from '../Upload/attachment'
|
|
|
|
|
|
|
|
|
@ -26,7 +26,12 @@ class Detail extends Component{
|
|
|
|
|
titledisplay:'none',
|
|
|
|
|
countvalue:'',
|
|
|
|
|
//是否需要编辑
|
|
|
|
|
isedit:'block'
|
|
|
|
|
isedit:undefined,
|
|
|
|
|
fileList:undefined,
|
|
|
|
|
limit:10,
|
|
|
|
|
page:1,
|
|
|
|
|
search_count:undefined,
|
|
|
|
|
isSpin:false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -72,12 +77,15 @@ class Detail extends Component{
|
|
|
|
|
if(!err){
|
|
|
|
|
const { data } = this.state;
|
|
|
|
|
const url = `/issues/${data.id}/journals.json`;
|
|
|
|
|
const { fileList } = this.state;
|
|
|
|
|
axios.post(url,{
|
|
|
|
|
...values,
|
|
|
|
|
issue_id:data.id,
|
|
|
|
|
attachment_ids:fileList
|
|
|
|
|
}).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.getjournalslist();
|
|
|
|
|
this.props.showNotification("评论成功!");
|
|
|
|
|
}
|
|
|
|
|
}).catch(error=>{
|
|
|
|
|
console.log(error);
|
|
|
|
@ -86,18 +94,20 @@ class Detail extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//获取评论信息
|
|
|
|
|
getjournalslist=()=>{
|
|
|
|
|
getjournalslist=(page, limit)=>{
|
|
|
|
|
const { data} = this.state;
|
|
|
|
|
const url = `/issues/${data.id}/journals.json`;
|
|
|
|
|
let id=data.id;
|
|
|
|
|
axios.get(url,{
|
|
|
|
|
params:{
|
|
|
|
|
id
|
|
|
|
|
id,page,limit
|
|
|
|
|
}
|
|
|
|
|
}).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.setState({
|
|
|
|
|
journalsdata:result.data
|
|
|
|
|
journalsdata:result.data,
|
|
|
|
|
search_count:result.data.journals_count,
|
|
|
|
|
isSpin:false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch(error=>{
|
|
|
|
@ -105,7 +115,7 @@ class Detail extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除评论信息
|
|
|
|
|
//删除工单信息
|
|
|
|
|
deletedetail=(id)=>{
|
|
|
|
|
const { projectsId , orderId} = this.props.match.params;
|
|
|
|
|
const url = `/projects/${projectsId}/issues/${orderId}.json`;
|
|
|
|
@ -141,6 +151,7 @@ class Detail extends Component{
|
|
|
|
|
|
|
|
|
|
//修改评论
|
|
|
|
|
updatedetail=(id)=>{
|
|
|
|
|
const {page, limit } = this.state;
|
|
|
|
|
const {orderId} = this.props.match.params;
|
|
|
|
|
const url = `/issues/${orderId}/journals/${id}.json`;
|
|
|
|
|
axios.put(url,{
|
|
|
|
@ -149,19 +160,26 @@ class Detail extends Component{
|
|
|
|
|
content:this.state.countvalue
|
|
|
|
|
}).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.setState({
|
|
|
|
|
isedit:'block'
|
|
|
|
|
})
|
|
|
|
|
this.getjournalslist();
|
|
|
|
|
// this.setState({
|
|
|
|
|
// journalsdata: 'block'
|
|
|
|
|
// })
|
|
|
|
|
this.getjournalslist(page, limit);
|
|
|
|
|
}
|
|
|
|
|
}).catch(error=>{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 获取上传后的文件id数组
|
|
|
|
|
UploadFunc=(fileList)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
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,
|
|
|
|
@ -169,7 +187,7 @@ class Detail extends Component{
|
|
|
|
|
}
|
|
|
|
|
}).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.getjournalslist()
|
|
|
|
|
this.getjournalslist(page,limit)
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error);
|
|
|
|
@ -188,6 +206,39 @@ class Detail extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
renderJournalList=(list)=>{
|
|
|
|
|
if(list && list.length >0){
|
|
|
|
|
return(
|
|
|
|
|
list.map((item,key)=>{
|
|
|
|
|
return(
|
|
|
|
|
<div key={key+1} className="journal-list-item">
|
|
|
|
|
<span className="font-weight-bold mr3">
|
|
|
|
|
{item.detail}:
|
|
|
|
|
</span>
|
|
|
|
|
<span className="mr5 color-grey-9">
|
|
|
|
|
{item.old_value.length > 0 ? "更新为" : "新增"}
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
{item.value && item.value.length > 0 ?
|
|
|
|
|
item.detail === "标签" ? <span className="issue-tag-show" style={{background: item.value[0].color}}>{item.value[0].name}</span> : item.value
|
|
|
|
|
:
|
|
|
|
|
"无"
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
}else{
|
|
|
|
|
return(
|
|
|
|
|
<div>
|
|
|
|
|
<span>没有评论~</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//复制
|
|
|
|
|
copydetail=()=>{
|
|
|
|
|
const {projectsId,orderId} = this.props.match.params;
|
|
|
|
@ -204,11 +255,31 @@ class Detail extends Component{
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 翻页
|
|
|
|
|
ChangePage=(page)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
page,
|
|
|
|
|
isSpin:true
|
|
|
|
|
})
|
|
|
|
|
const {limit} = this.state;
|
|
|
|
|
this.getjournalslist(page,limit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
const { projectsId,orderId} = this.props.match.params;
|
|
|
|
|
const { data,journalsdata } = this.state;
|
|
|
|
|
const { data,journalsdata, page, limit, search_count, isSpin, isedit } = this.state;
|
|
|
|
|
const { getFieldDecorator } = this.props.form;
|
|
|
|
|
const { current_user } = this.props;
|
|
|
|
|
const Paginations = (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{
|
|
|
|
|
search_count > limit ?
|
|
|
|
|
<div className="pt30 mb50 edu-txt-center btp1">
|
|
|
|
|
<Pagination simple defaultCurrent={page} total={search_count} pageSize={limit} onChange={this.ChangePage}></Pagination>
|
|
|
|
|
</div>:""
|
|
|
|
|
}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
)
|
|
|
|
|
const renderList =()=>{
|
|
|
|
|
if(journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length>0 ){
|
|
|
|
|
return(
|
|
|
|
@ -217,36 +288,45 @@ class Detail extends Component{
|
|
|
|
|
return(
|
|
|
|
|
<li>
|
|
|
|
|
<div className="df">
|
|
|
|
|
<Link to={``}><img class="user_img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/></Link>
|
|
|
|
|
<Link to={``}><img class="user_img" src={getImageUrl(`images/${item.user_picture && item.user_picture}`)} alt=""/></Link>
|
|
|
|
|
<div className="detail_context" >
|
|
|
|
|
<div className="topWrapper_detali">
|
|
|
|
|
<p className="detail_p">
|
|
|
|
|
<p className="ml6 detail_p lineH40">
|
|
|
|
|
{item.user_name}
|
|
|
|
|
<span className="color-grey-9">评论于</span>
|
|
|
|
|
<span className="color-grey-9 ml3 mr3">评论于</span>
|
|
|
|
|
<Tooltip title={item.format_time} placement="bottom">
|
|
|
|
|
<span>{item.created_at}</span>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</p>
|
|
|
|
|
<div className="detail_right">
|
|
|
|
|
<span onClick={()=>this.editdetail(item.content,'none')} className="detail_edit_action">编辑</span>
|
|
|
|
|
<Popconfirm placement="bottom" title={'确定要删除当前评论吗'} okText="是" cancelText="否" onConfirm={()=>this.deletedetail(item.id)}>
|
|
|
|
|
<div className="detail_right" style={{display: current_user && (current_user.admin || current_user.login === item.user_login) ? "block" : "none"}}>
|
|
|
|
|
<span onClick={()=>this.editdetail(item.content,item.id)} className="detail_edit_action">编辑</span>
|
|
|
|
|
<Popconfirm placement="bottom" title={'确定要删除当前评论吗'} okText="是" cancelText="否" onConfirm={()=>this.deleteorder(item.id)}>
|
|
|
|
|
<span className="detail_edit_action">删除</span>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
{/*<i className="iconfont icon-weibiaoti1 font-18 mr3" onClick={()=>this.editdetail(item.content,'none')}></i> */}
|
|
|
|
|
{/*<div style={{width:20}}></div>*/}
|
|
|
|
|
{/*<Popconfirm placement="bottom" title={'确定要删除当前评论吗'} okText="是" cancelText="否" onConfirm={()=>this.deletedetail(item.id)}>*/}
|
|
|
|
|
{/*<i className="iconfont icon-yiguanbi1 font-18 mr3"></i> */}
|
|
|
|
|
{/*</Popconfirm>*/}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div className="detail_ptitlecount">
|
|
|
|
|
<p style={{display:this.state.isedit}} >{item.content}</p>
|
|
|
|
|
<div style={{display:this.state.isedit==='none'?'block':'none'}}>
|
|
|
|
|
<div style={{display: (isedit && isedit === item.id) ? "none" : "block"}} >
|
|
|
|
|
{
|
|
|
|
|
item.content ?
|
|
|
|
|
<div>{item.content}</div>
|
|
|
|
|
:
|
|
|
|
|
<div>
|
|
|
|
|
{this.renderJournalList(item.journal_details)}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
item && item.attachments.length > 0 ?
|
|
|
|
|
<Attachments attachments={item.attachments} showNotification={this.props.showNotification} canDelete={current_user && (current_user.admin || current_user.login === item.user_login)}/>
|
|
|
|
|
:
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{display: (isedit && isedit === item.id) ? "block" : "none"}}>
|
|
|
|
|
<TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/>
|
|
|
|
|
<p className="clearfix mt15">
|
|
|
|
|
<a className="topWrapper_btn fr" type="submit" onClick={()=>this.updatedetail(item.id)}>保存</a>
|
|
|
|
|
<a className="Closeor_btn fr" type="submit" onClick={()=>this.editdetail(item.content,'block')}>取消</a>
|
|
|
|
|
<a className="a_btn cancel_btn fr" type="submit" onClick={()=>this.editdetail(item.content,undefined)}>取消</a>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -318,17 +398,22 @@ class Detail extends Component{
|
|
|
|
|
:
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
{/*{renderAttachments()}*/}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="f-wrap-between mt5" style={{alignItems:"flex-start"}}>
|
|
|
|
|
<div className="df item-list-right" >
|
|
|
|
|
<div className="item-list-right" >
|
|
|
|
|
<Spin spinning={isSpin}>
|
|
|
|
|
<ul className="ul_width">
|
|
|
|
|
{renderList()}
|
|
|
|
|
<li>
|
|
|
|
|
</ul>
|
|
|
|
|
</Spin>
|
|
|
|
|
|
|
|
|
|
{ Paginations }
|
|
|
|
|
|
|
|
|
|
<div className="df">
|
|
|
|
|
<Link to={``}><img class="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
|
|
|
|
|
<Link to={``}><img className="user_img"
|
|
|
|
|
src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
|
|
|
|
|
<div className="new_context">
|
|
|
|
|
<Form.Item>
|
|
|
|
|
{getFieldDecorator('content', {
|
|
|
|
@ -342,12 +427,11 @@ class Detail extends Component{
|
|
|
|
|
<UploadComponent load={this.UploadFunc}></UploadComponent>
|
|
|
|
|
<p className="clearfix mt15">
|
|
|
|
|
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
|
|
|
|
|
<a className="Closeor_btn fr" type="submit" onClick={()=>this.closedetail(data&&data.issue_status==="关闭"?2:5)}>{data&&data.issue_status==="关闭"?"开启工单":"关闭工单"}</a>
|
|
|
|
|
<a className="Closeor_btn fr" type="submit"
|
|
|
|
|
onClick={() => this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "开启工单" : "关闭工单"}</a>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="list-left DetailRight mt10">
|
|
|
|
|
<p>
|
|
|
|
|