计图竞赛-评测数据增加字段显示

This commit is contained in:
caishi 2023-05-06 10:23:40 +08:00
parent 8620a5cf98
commit 3d4b4758b1
1 changed files with 58 additions and 20 deletions

View File

@ -18,8 +18,9 @@ interface Ranking{
userinfo:any
Editable:any
dispatch:any
HeaderDetail:any,
HeaderDetail:any
StaffDetail:any
}
function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartRules,userinfo,Editable,dispatch,StaffDetail}:Ranking){
@ -27,13 +28,17 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
const [defaultValue,setDefaultValue]=useState('');
const [ClickButton,setClickButton]=useState(true);
const [item,setItem]=useState<any>();
const [items,setItems]=useState<any>();
const { identifier } = useParams();
useEffect(()=>{
//进入初始化状态为第一个
if(ClickButton){
let data=ChartRules?.stages?.[0];
setItem(data);
let datas=ChartRules?.stages?.[0]?.children?.[0];
setItems(datas);
if(data?.id){
getCharts(data?.id)
setDefaultValue(ChartRules.rule_contents?.filter(item => parseInt(item.competition_stage_id) === parseInt(data?.id))?.[0]?.['content'] || '')
@ -170,6 +175,15 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
return <span>{text||'--'}</span>
}
},
item?.display_one_indicators&&{
title: 'mIoU',
dataIndex: 'data_other',
key: 'data_ranking',
align:'left',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='mIoU')?.value||'--'}</span>
}
},
item?.display_four_indicators&&{
title: '美学评分',
dataIndex: 'data_other',
@ -188,6 +202,15 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
return <span>{text?.find((item:any)=>item?.name==='fid')?.value||'--'}</span>
}
},
item?.display_four_indicators&&{
title: '风格相似度',
dataIndex: 'data_other',
key: 'data_other',
align:'left',
render:(text:any)=>{
return <span>{text?.find((item:any)=>item?.name==='style_similarity')?.value||'--'}</span>
}
},
item?.display_four_indicators&&{
title: '总分',
dataIndex: 'data_other',
@ -255,27 +278,25 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
{
title: '操作',
dataIndex: 'result_url',
key: 'result_url',
width:50,
key: 'result_url',
render:(text:any)=>{
return <a href={text} target="_blank" download="附件"></a>
}
},
].filter(item => !!item);
].filter(item => !!item);;
return(
<div>
{ChartRules?.stages?.length>0?null:<RankingNull/>}
{ChartRules?.stages?.length>0&&
<Tabs animated={true} tabBarExtraContent={(userinfo?.admin||userinfo?.business||Editable)?<Button onClick={()=>{
{ChartRules?.stages?.length>0&&<Tabs animated={true} tabBarExtraContent={(userinfo?.admin||userinfo?.business||Editable)?<Button onClick={()=>{
setIsupdate(true)
}}>
</Button>
:
(StaffDetail.enrolled&&item?.start_time&&item?.end_time)&&
<span>
{moment(item?.start_time).format("YYYY-MM-DD HH:mm:ss")}{moment(item?.end_time).format("YYYY-MM-DD HH:mm:ss")}
</Button>:(StaffDetail.enrolled&&item?.start_time&&item?.end_time)&&<span>{moment(item?.start_time).format("YYYY-MM-DD HH:mm:ss")}{moment(item?.end_time).format("YYYY-MM-DD HH:mm:ss")}
<Button style={{marginLeft:'20px'}} disabled={moment(item?.start_time).unix()>moment(moment().format('YYYY-MM-DD HH:mm:s')).unix()||moment(moment().format('YYYY-MM-DD HH:mm:s')).unix()>moment(item?.end_time).unix()} onClick={()=>{
// <moment(item?.end_time).unix()
dispatch({
@ -283,19 +304,22 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
payload: {
key: 'md-tab',
params:{
value:item?.id,
value:items?.id||item?.id,
id:HeaderDetail?.id
}
},
})
}}></Button>
</span>} onChange={(e)=>{
}}></Button></span>} onChange={(e)=>{
setIsupdate(false)
let data=ChartRules?.stages?.filter(item=>parseInt(e)===parseInt(item?.id))[0];
let datas=data?.children?.[0];
setItems(datas);
setItem(data);
setDefaultValue(ChartRules.rule_contents?.filter(item => parseInt(item.competition_stage_id) === parseInt(data?.id))?.[0]?.['content'] || '')
getCharts(e);
getCharts(datas?.id||e);
}}>
{ChartRules&&ChartRules.stages.map((item:any,index:any)=>{
return(
<TabPane tab={item.name} key={item.id === null ? 0 : item.id}>
@ -320,6 +344,20 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
})}
</Tabs> }
{item?.children?.length>0&&<Tabs activeKey={items?.id+''} onChange={(e)=>{
let data=item?.children?.filter(item=>parseInt(e)===parseInt(item?.id))[0];
setItems(data);
getCharts(e);
//获取参数
}}>
{item?.children?.map((item:any,index:any)=>{
return <TabPane tab={item.name} key={item.id === null ? 0 : item.id}>
</TabPane>
})}
</Tabs>}
{isUpdate&& <div>
<MarkdownEditor defaultValue={defaultValue} onChange={(e:any)=>{
setDefaultValue(e);
@ -329,10 +367,10 @@ function Ranking({ChartRules,ItemData,getCharts,Selectkey,HeaderDetail,getChartR
<Button style={{marginLeft:'30px',width:'90px'}} onClick={()=>setIsupdate(false)} ></Button>
</p>
</div>}
<Table
{HeaderDetail.competition_modules.filter((item:any)=>item.id===Selectkey)?.[0]?.show_leaderboard&&<Table
dataSource={ItemData?.results}
columns={columns}
/>
/>}
{/* {ItemData?.teams?.length>0?<RankingList ItemData={ItemData}/>:null} */}
</div>