import React, { Component } from 'react'; import { Redirect } from 'react-router'; import { List,Typography,Tag,Modal,Radio} from 'antd'; import TPMRightSection from './component/TPMRightSection'; import TPMNav from './component/TPMNav'; import axios from 'axios'; class Audit_situationComponent extends Component { constructor(props) { super(props) this.state = { datas:undefined, value:undefined, } } componentDidMount() { this.getdatas() } getdatas=()=>{ let url=`/shixuns/${this.props.match.params.shixunId}/review_newest_record.json`; axios.get(url).then((response) => { if(response.data===undefined||JSON.stringify(response.data) == "{}"||response.data===null){ this.setState({ datas:[ { name: '内容审核情况', id:"Content", }, { name: '性能审核情况', id:"Performance", }, ] }) }else{ let newlist=[] if(response.data.content_info!=undefined&&response.data.perference_info===undefined){ let arr=[ { name: '内容审核情况', id:"Content", status:response.data.content_info.status, username:response.data.content_info.username, time:response.data.content_info.time, }, { name: '性能审核情况', id:"Performance", }, ] newlist=arr } if(response.data.content_info===undefined&&response.data.perference_info!=undefined){ let arr=[ { name: '内容审核情况', id:"Content", }, { name: '性能审核情况', id:"Performance", status:response.data.perference_info.status, username:response.data.perference_info.username, time:response.data.perference_info.time, }, ] newlist=arr } if(response.data.content_info!=undefined&&response.data.perference_info!=undefined){ let arr=[ { name: '内容审核情况', id:"Content", status:response.data.content_info.status, username:response.data.content_info.username, time:response.data.content_info.time, }, { name: '性能审核情况', id:"Performance", status:response.data.perference_info.status, username:response.data.perference_info.username, time:response.data.perference_info.time, }, ] newlist=arr } this.setState({ datas:newlist }) } }).catch((error) => { console.log(error) }); } showModal = (id,status) => { debugger this.setState({ visible: true, editid:id, value:status }); }; handleOk=(id,editid)=>{ let url = `/shixuns/${this.props.match.params.shixunId}/review_shixun.json`; axios.post(url, { status: id===undefined?1:id, review_type: editid, }).then((response) => { if(response.data.status===0){ this.props.showNotification(response.data.message); this.setState({ visible: false, }); this.getdatas() } }).catch((error) => { console.log(error) }); }; handleCancel = e => { this.setState({ visible: false, }); }; onChange = e => { this.setState({ value: e.target.value, }); }; render() { const { tpmLoading, shixun, user, match } = this.props; let {value,editid,datas}=this.state; console.log(this.props) return ( {this.state.visible===true?
已完成 未完成
this.handleCancel()}>取消 this.handleOk(value,editid)}>确定
:""} { tpmLoading ?
:
{this.props.identity >2||this.props.identity===undefined?"": ( this.showModal(item.id,item.status)} key={key}> , ]} >
{item.name}
{item.status===undefined?"":item.status===1?已完成:未完成}
} description={
{item.time===undefined?"":审核时间: {item.time}} {item.username===undefined?"":审核人: {item.username}}
} /> )} />}
}
); } } export default Audit_situationComponent;