实训审核全选控制调整

problem_set
杨树明 5 years ago
parent ffbc812709
commit 43744be289

@ -10,46 +10,144 @@ class Audit_situationComponent extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
datas:undefined,
value:undefined,
} }
} }
componentDidMount(){ componentDidMount() {
this.getdatas()
}
getdatas=()=>{
let url=`/shixuns/${this.props.match.params.shixunId}/review_newest_record.json`; let url=`/shixuns/${this.props.match.params.shixunId}/review_newest_record.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log(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) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
showModal = () => {
showModal = (id,status) => {
debugger
this.setState({ this.setState({
visible: true, visible: true,
editid:id,
value:status
}); });
}; };
handleOk = e => { handleOk=(id,editid)=>{
console.log(e); let url = `/shixuns/${this.props.match.params.shixunId}/review_shixun.json`;
this.setState({ axios.post(url, {
visible: false, 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 => { handleCancel = e => {
console.log(e);
this.setState({ this.setState({
visible: false, visible: false,
}); });
}; };
onChange = e => { onChange = e => {
console.log('radio checked', e.target.value);
this.setState({ this.setState({
value: e.target.value, value: e.target.value,
}); });
}; };
render() { render() {
const { tpmLoading, shixun, user, match } = this.props; const { tpmLoading, shixun, user, match } = this.props;
let {value,editid,datas}=this.state;
console.log(this.props)
return ( return (
<React.Fragment> <React.Fragment>
@ -77,14 +175,14 @@ class Audit_situationComponent extends Component {
} }
</style> </style>
<Radio.Group onChange={this.onChange} value={this.state.value}> <Radio.Group onChange={this.onChange} value={this.state.value===undefined?1:this.state.value}>
<Radio value={1}>已完成</Radio> <Radio value={1}>已完成</Radio>
<Radio value={2}>未完成</Radio> <Radio value={0}>未完成</Radio>
</Radio.Group> </Radio.Group>
<div className={"mt30"}> <div className={"mt30"}>
<a className="pop_close task-btn mr20 margin-tp26" onClick={()=>this.handleCancel()}>取消</a> <a className="pop_close task-btn mr20 margin-tp26" onClick={()=>this.handleCancel()}>取消</a>
<a className="task-btn task-btn-orange margin-tp26" onClick={()=>this.handleOk()}>确定</a> <a className="task-btn task-btn-orange margin-tp26" onClick={()=>this.handleOk(value,editid)}>确定</a>
</div> </div>
</div> </div>
@ -102,6 +200,7 @@ class Audit_situationComponent extends Component {
` `
} }
</style> </style>
{ tpmLoading ? <div style={{ minHeight: '886px'}}></div> : { tpmLoading ? <div style={{ minHeight: '886px'}}></div> :
<div className="tpmComment educontent clearfix mt30 mb80"> <div className="tpmComment educontent clearfix mt30 mb80">
@ -116,23 +215,14 @@ class Audit_situationComponent extends Component {
></TPMNav> ></TPMNav>
<div className="padding20 edu-back-white mt20" style={{minHeight: '640px'}}> <div className="padding20 edu-back-white mt20" style={{minHeight: '640px'}}>
<List {this.props.identity >2||this.props.identity===undefined?"":<List
dataSource={[ dataSource={datas}
{
name: '内容审核情况',
id:1,
},
{
name: '性能审核情况',
id:2,
},
]}
bordered bordered
renderItem={(item,key) => ( renderItem={(item,key) => (
<List.Item <List.Item
key={item.id} key={item.id}
actions={[ actions={[
<a onClick={()=>this.showModal(item.id)} key={key}> <a onClick={()=>this.showModal(item.id,item.status)} key={key}>
<i className="iconfont icon-bianjidaibeijing font-22 color-green"></i> <i className="iconfont icon-bianjidaibeijing font-22 color-green"></i>
</a>, </a>,
]} ]}
@ -140,19 +230,18 @@ class Audit_situationComponent extends Component {
<List.Item.Meta <List.Item.Meta
title={<div className={"font-16"}> title={<div className={"font-16"}>
<div className={"Itemtitle"}>{item.name}</div> <div className={"Itemtitle"}>{item.name}</div>
<Tag color="#FF6800">已完成</Tag> {item.status===undefined?"":item.status===1?<Tag color="#FF6800">已完成</Tag>:<Tag color="#bcbcbc"></Tag>}
<Tag color="#bcbcbc">未完成</Tag>
</div>} </div>}
description={ description={
<div> <div>
<span>审核时间: 2019-10-17 10:42</span> {item.time===undefined?"":<span>审核时间: {item.time}</span>}
<span className={"ml30"}>审核人 XXX</span> {item.username===undefined?"":<span className={"ml30"}>审核人: {item.username}</span>}
</div> </div>
} }
/> />
</List.Item> </List.Item>
)} )}
/> />}
</div> </div>
</div> </div>

@ -28,11 +28,9 @@ class TPMNav extends Component {
>背景知识</Link> >背景知识</Link>
} }
<Link to={`/shixuns/${shixunId}/repository`} { this.props.identity >4||this.props.identity===undefined ?"":<Link to={`/shixuns/${shixunId}/repository`}
style={{display: this.props.identity >4||this.props.identity===undefined ? "none" : 'block'}} className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link> {this.props.identity >4||this.props.identity===undefined ?"": secret_repository && <Link to={`/shixuns/${shixunId}/secret_repository`}
{secret_repository && <Link to={`/shixuns/${shixunId}/secret_repository`}
style={{display: this.props.identity >4||this.props.identity===undefined ? "none" : 'block'}}
className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>} className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>}
<Link to={`/shixuns/${shixunId}/collaborators`} <Link to={`/shixuns/${shixunId}/collaborators`}
@ -44,8 +42,8 @@ class TPMNav extends Component {
<Link to={`/shixuns/${shixunId}/ranking_list`} <Link to={`/shixuns/${shixunId}/ranking_list`}
className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl mr40`}>排行榜</Link> className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl mr40`}>排行榜</Link>
<Link to={`/shixuns/${shixunId}/audit_situation`} {this.props.identity >2||this.props.identity===undefined?"":<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link> className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>}
<a <a
href={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr" href={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr"

Loading…
Cancel
Save