集群突击竞赛添加成绩详情弹框

This commit is contained in:
谢思 2023-09-15 17:29:49 +08:00
parent 4e82b0a566
commit 37543cedf3
2 changed files with 245 additions and 2 deletions

View File

@ -0,0 +1,227 @@
import React, { memo, useEffect, useState } from 'react';
import { Modal, Table } from 'antd';
import ColumnGroup from "antd/lib/table/ColumnGroup.js";
import Column from "antd/lib/table/Column.js";
import { encryptionuserId, gradeDetailSimulate } from '../api';
import '../refer/index.scss';
function RecordByJQTJModal(props) {
const {repoId, user_id, id} = props;
const [dataSource1, setDataSource1] = useState(undefined);
const [dataSource2, setDataSource2] = useState(undefined);
const [dataSource3, setDataSource3] = useState(undefined);
const [visible, setVisible] = useState(false);
useEffect(()=>{
id && gradeDetailSimulate({
index: repoId,
user_id: user_id+"",
match_id: id,
sign: encryptionuserId(user_id)
}).then(async res=>{
if(res && res.code === "000"){
await gradeDetail(res.result.grade1_info);
setVisible(true);
}
})
}, [id])
async function gradeDetail(info){
const {score, score_info:{add, minus}, score_info, basic, extra} = info;
//
setDataSource1([{
score, add, basic: score_info.basic, minus
}]);
//
const detail2 = [];
basic && basic.map((item, index)=>{
item.content.map((content1, index1)=>{
content1.content.map((content2, index2)=>{
detail2.push({
item1: item.item,
item1_score: item.item_score,
item1_rowSpan: item.content.length > 1 ? index1 > 0 ? 0 : item.content.length : 1,
item2: content1.sub_item,
item2_score: content1.sub_item_score,
item2_rowSpan: content1.content.length > 1 ? index2 > 0 ? 0 : content1.content.length : 1,
item3: content2.indicator,
item3_score: typeof(content2.indicator_score) === "object" ? content2.indicator_score.join(' | ') : content2.indicator_score,
score: score_info.basic,
score_rowSpan: 0
})
})
})
})
detail2[0].score_rowSpan = detail2.length;
setDataSource2(detail2);
//
const detail3 = [];
extra && extra.map(item=>{
let count = 0;
item.content.map((content1, index1)=>{
content1.content.map((content2, index2)=>{
count++;
detail3.push({
type: item.item,
type_rowSpan: 0,
//
repo: content1.item,
repo_rowSpan: content1.content.length > 1 ? index2 > 0 ? 0 : content1.content.length : 1,
//
repoDetail: content2.sub_item,
//
repoDetailScore: content2.sub_item_score,
// --
repoDetailNum: '--',
//
tpyeScore: item.item === '加分' ? add : minus,
tpyeScore_rowSpan: 0
})
})
})
item.count = count;
})
let index = 0
extra && extra.map(item => {
detail3[index].type_rowSpan = item.count;
detail3[index].tpyeScore_rowSpan = item.count;
index += item.count
})
setDataSource3(detail3);
}
// table
const columns1 = [
{
title: '基础评分',
dataIndex: 'basic',
key: 0
},
{
title: '加分评分',
dataIndex: 'add',
key: 1
},
{
title: '减分评分',
dataIndex: 'minus',
key: 2
},
{
title: '综合评分',
dataIndex: 'score',
key: 3
}
]
// table
const columns3 = [
{
title: '类型',
dataIndex: 'type',
key: 0,
render: (value, row)=>{
return {
children: value,
props:{rowSpan: row.type_rowSpan}
}
}
},
{
title: '加减分项',
dataIndex: 'repo',
key: 1,
render: (value, row)=>{
return {
children: value,
props:{rowSpan: row.repo_rowSpan}
}
}
},
{
title: '加减分子项',
dataIndex: 'repoDetail',
key: 2
},
{
title: '分值',
dataIndex: 'repoDetailScore',
key: 3
},
{
title: '数量',
dataIndex: 'repoDetailNum',
key: 4
},
{
title: '汇总分',
dataIndex: 'tpyeScore',
key: 5,
render: (value, row)=>{
return {
children: value,
props:{rowSpan: row.tpyeScore_rowSpan}
}
}
}
]
return (
<Modal
title="查看详情"
visible={visible}
onCancel={()=>{setVisible(false)}}
footer={null}
width={900}
className="jqtjModal recordDetailModal"
>
<div className="mb15 modalInfoLabel">综合评分</div>
<Table columns={columns1} dataSource={dataSource1} pagination={false} bordered></Table>
<div className="mt20 mb15 modalInfoLabel">基础评分</div>
<Table dataSource={dataSource2} pagination={false} bordered>
<ColumnGroup title="测评项">
<Column title="名称" dataIndex="item1" key={0} render={(value, row)=>{
return {
children: value,
props:{rowSpan: row.item1_rowSpan}
}
}}></Column>
<Column title="分数" dataIndex="item1_score" key={1} render={(value, row)=>{
return {
children: value,
props:{rowSpan: row.item1_rowSpan}
}
}}></Column>
</ColumnGroup>
<ColumnGroup title="测评子项">
<Column title="名称" dataIndex="item2" key={2} render={(value, row)=>{
return {
children: value,
props:{rowSpan: row.item2_rowSpan}
}
}}></Column>
<Column title="分数" dataIndex="item2_score" key={3} render={(value, row)=>{
return {
children: value,
props:{rowSpan: row.item2_rowSpan}
}
}}></Column>
</ColumnGroup>
<Column title="实测指标" dataIndex="item3" key={4}></Column>
<Column title="客观评分" dataIndex="item3_score" key={5}></Column>
<Column title="基础评分" dataIndex="score" key={6} render={(value, row)=>{
return {
children: value,
props:{rowSpan: row.score_rowSpan}
}
}}></Column>
</Table>
<div className="mt20 mb15 modalInfoLabel">加减分</div>
<Table columns={columns3} dataSource={dataSource3} pagination={false} bordered></Table>
</Modal>
)
}
export default memo(RecordByJQTJModal);

View File

@ -3,8 +3,8 @@ import { Base64 } from 'js-base64';
import { Select, Button, Tooltip, Input, Popconfirm, message } from 'antd';
import { current_main_site_url } from '../fetch';
import PaginationTable from "../../components/paginationTable";
import { getEnrollList, updateEnroll, createUser, encryptionuserId, getScoreList } from "../api.js";
import RecordModal from '../components/recordByJQTJModal';
import { getEnrollList, updateEnroll, createUser, encryptionuserId, getScoreList, gradeDetailSimulate } from "../api.js";
import moment from "moment";
import Nodata from "src/forge/Nodata";
const Option = Select.Option;
@ -24,6 +24,7 @@ function Introduce({ history: { location: { pathname } }, qzDetail, match }) {
const [searchValue, setSearchValue] = useState(undefined);
const [scoreList, setScoreList] = useState({});
const [loadingBut, setLoadingBut] = useState(false);
const [params, setParams] = useState(undefined);
useEffect(() => {
setKeyword(undefined);
@ -72,6 +73,13 @@ function Introduce({ history: { location: { pathname } }, qzDetail, match }) {
})
}
//
function seeDeatil(repoId, user_id, id){
setParams({
repoId, user_id, id
});
}
let columns_apply = useMemo(() => {
return [
{
@ -236,6 +244,7 @@ function Introduce({ history: { location: { pathname } }, qzDetail, match }) {
<div>模拟项目</div>
<div>模拟时间</div>
<div>模拟分数</div>
<div>操作</div>
</div>
{score.map((item, index) => {
return <div className="row" key={index}>
@ -243,6 +252,9 @@ function Introduce({ history: { location: { pathname } }, qzDetail, match }) {
<div>{item.subject_name}</div>
<div>{moment(item.submit_time).format('YYYY-MM-DD HH:mm:ss')}</div>
<div>{item.score}</div>
<div>
<Button onClick={()=>{seeDeatil(item.subject_index, record.user_id, item.id)}}>查看详情</Button>
</div>
</div>
})}
</div> : <Nodata _html="暂无数据"/>
@ -334,6 +346,10 @@ function Introduce({ history: { location: { pathname } }, qzDetail, match }) {
expandIconAsCell={false}
expandIcon={type === "applys" ? customExpandIcon : customExpandIcon1}
pageSize={10} />
{/* 模拟成绩详情 */}
<RecordModal
{...params}
/>
</div>
)
}