forked from Gitlink/forgeplus-react
新增打分详情
This commit is contained in:
parent
57dc08e59c
commit
3260e2483b
|
@ -3,15 +3,14 @@ import { Table, Pagination } from 'antd';
|
|||
import './index.scss';
|
||||
|
||||
export default (props) => {
|
||||
const { loading, dataSource, columns, handleRow, total, setCurPage, current, rowSelection, expandedRowRender, expandIconColumnIndex,expandIconAsCell, onShowSizeChange,showSizeChanger } = props;
|
||||
const { loading, dataSource, columns, handleRow, total, setCurPage, current, rowSelection, expandedRowRender, expandIconColumnIndex, expandIconAsCell, onShowSizeChange, showSizeChanger, pagination } = props;
|
||||
|
||||
|
||||
return (
|
||||
<div className='pagination-table'>
|
||||
<Table
|
||||
{...props}
|
||||
loading={loading}
|
||||
rowKey={(row) => row.id}
|
||||
rowKey={(row,i) => row.id || i}
|
||||
dataSource={dataSource}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
|
@ -20,8 +19,9 @@ export default (props) => {
|
|||
expandedRowRender={expandedRowRender}
|
||||
expandIconColumnIndex={expandIconColumnIndex}
|
||||
expandIconAsCell={expandIconAsCell}
|
||||
|
||||
/>
|
||||
{total > 10 &&
|
||||
{total > 10 && (!pagination) &&
|
||||
<Pagination
|
||||
showQuickJumper
|
||||
onShowSizeChange={onShowSizeChange}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
.pagination-table {
|
||||
.ant-table {
|
||||
border: 1px solid #ececec;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
.ant-table-thead tr th div {
|
||||
color: #181818;
|
||||
|
|
|
@ -81,6 +81,34 @@ export function getExpertTasks(params) {
|
|||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 查看单个竞赛/任务的评分细则
|
||||
export function getScoringDetails(params) {
|
||||
return fetch({
|
||||
url: `/api/expertScoringDetails/getExpertScoringDetailsList`,
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化评分细则
|
||||
export function initScoringDetails(data){
|
||||
return fetch({
|
||||
url: '/api/expertScoringDetails/initExpertScoringDetails',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 更新评分细则
|
||||
export function updateScoringDetails(data){
|
||||
return fetch({
|
||||
url: '/api/expertScoringDetails/',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
//编辑评审规则
|
||||
export async function editRules(data){
|
||||
let res = await fetch({
|
||||
|
|
|
@ -40,7 +40,7 @@ const ExpertUser = (propsF) => {
|
|||
<Switch {...propsF}>
|
||||
|
||||
<Route
|
||||
path="/expert/user/tasks/:id"
|
||||
path="/expert/user/tasks/:containerType/:containerId"
|
||||
render={(props) => (
|
||||
<TaskDetail {...props} {...propsF} />
|
||||
)}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
||||
import { Input, Select, Button, Form, DatePicker, Table, Pagination, Upload, Modal } from 'antd';
|
||||
import { Link } from "react-router-dom";
|
||||
import { formatDuring } from 'educoder';
|
||||
import Paginationtable from "../../../components/paginationTable";
|
||||
import { getExpertTasks } from "../../api";
|
||||
import { taskType } from "../../static";
|
||||
|
@ -37,27 +39,29 @@ function ReviewTasks({ form, showNotification, match, history }) {
|
|||
},
|
||||
{
|
||||
title: '任务名称',
|
||||
dataIndex: 'expertName',
|
||||
key: 'expertName',
|
||||
// render: (text, record) => {
|
||||
// return record.user ? record.user.nickname || record.user.login : ''
|
||||
// }
|
||||
dataIndex: 'containerName',
|
||||
key: 'containerName',
|
||||
render: (text, record) => {
|
||||
return <Link to={`/expert/user/tasks/${record.containerType}/${record.id}`}>{text}</Link>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '评审截止时间',
|
||||
dataIndex: 'highestDegree',
|
||||
key: 'highestDegree',
|
||||
dataIndex: 'reviewEndOn',
|
||||
key: 'reviewEndOn',
|
||||
},
|
||||
{
|
||||
title: '剩余评审时间',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
dataIndex: 'surplus',
|
||||
key: 'surplus',
|
||||
},
|
||||
{
|
||||
title: '评审状态',
|
||||
dataIndex: 'workplace',
|
||||
key: 'workplace',
|
||||
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
render: (text, record) => {
|
||||
return text === -1 ? <span className="red">未审核</span> : <span>已审核</span>
|
||||
}
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
@ -71,12 +75,19 @@ function ReviewTasks({ form, showNotification, match, history }) {
|
|||
curPage,
|
||||
statusString: '1,-1',
|
||||
};
|
||||
getExpertTasks(params).then(data => {
|
||||
setDataList(data.rows || []);
|
||||
getExpertTasks(params).then(res => {
|
||||
for(const item of res.data.rows){
|
||||
if( new Date(item.reviewEndOn)>new Date()){
|
||||
item.surplus=formatDuring((new Date(item.reviewEndOn)-new Date())/1000);
|
||||
}else{
|
||||
item.surplus='- -';
|
||||
}
|
||||
}
|
||||
setDataList(res.data.rows || []);
|
||||
setLoading(false);
|
||||
setTotal(data.total);
|
||||
setTotal(res.data.total);
|
||||
});
|
||||
}, [searchObj,curPage, reload, pageSize]);
|
||||
}, [searchObj, curPage, reload, pageSize]);
|
||||
|
||||
|
||||
function onSearch() {
|
||||
|
@ -104,6 +115,7 @@ function ReviewTasks({ form, showNotification, match, history }) {
|
|||
</Form.Item>
|
||||
), []);
|
||||
|
||||
console.log(dataList)
|
||||
return (
|
||||
<div className='register_right task_right'>
|
||||
<p className="task-head">
|
||||
|
|
|
@ -29,5 +29,9 @@
|
|||
}
|
||||
.pagination-table{
|
||||
margin:0 2rem;
|
||||
|
||||
.red{
|
||||
color: #DE0000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
||||
import { Tabs, Input, Select, Button, Form, DatePicker, Table, Pagination, Upload, Modal } from 'antd';
|
||||
import { Tabs, Input, Select, Button, Form, DatePicker, InputNumber, Table, Pagination, Upload, Modal } from 'antd';
|
||||
import { Link } from "react-router-dom";
|
||||
import Paginationtable from "../../../components/paginationTable";
|
||||
import { getExpertTasks } from "../../api";
|
||||
import { getScoringDetails, } from "../../api";
|
||||
import { readyCheckPapers } from "../../../task/api";
|
||||
import { taskType } from "../../static";
|
||||
import { httpUrl } from '../../fetch';
|
||||
|
||||
|
@ -12,24 +13,29 @@ const Option = Select.Option;
|
|||
const { TabPane } = Tabs;
|
||||
|
||||
|
||||
function ReviewTasks({ form, showNotification, match, history }) {
|
||||
const id = match.params.id;
|
||||
function ReviewTasks({ form, showNotification, match, history, current_user }) {
|
||||
const containerId = match.params.containerId;
|
||||
const containerType = match.params.containerType;
|
||||
const { getFieldDecorator, setFieldsValue, getFieldsValue } = form;
|
||||
|
||||
// 主table参数
|
||||
const [reload, setReload] = useState();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
const [dataList, setDataList] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
|
||||
//tab栏
|
||||
const [activeKey, setActiveKey] = useState(0);
|
||||
|
||||
const [searchObj, setSearchObj] = useState({
|
||||
containerName: '',
|
||||
containerType: 1
|
||||
});
|
||||
|
||||
const [taskId, setTaskId] = useState(461);
|
||||
const [competitionId, setCompetitionId] = useState(461);
|
||||
|
||||
//tab栏
|
||||
const [activeKey, setActiveKey] = useState(0);
|
||||
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
|
@ -47,13 +53,21 @@ function ReviewTasks({ form, showNotification, match, history }) {
|
|||
},
|
||||
{
|
||||
title: '附件下载',
|
||||
dataIndex: 'highestDegree',
|
||||
key: 'highestDegree',
|
||||
dataIndex: 'opsFilesAttachments',
|
||||
key: 'opsFilesAttachments',
|
||||
render: (text, record) => {
|
||||
return text && text.map(item => {
|
||||
return <a key={item.id} className="link" onClick={() => { downFile(item.id) }}>{item.fileName}</a>
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '评分一',
|
||||
dataIndex: 'gradesOne',
|
||||
key: 'gradesOne',
|
||||
render: (text, record, index) => {
|
||||
return <InputNumber min={0} max={100} defaultValue={text} precision={0}/>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '评分二',
|
||||
|
@ -88,19 +102,66 @@ function ReviewTasks({ form, showNotification, match, history }) {
|
|||
];
|
||||
}, []);
|
||||
|
||||
// 获取列表
|
||||
// 获取成果列表
|
||||
useEffect(() => {
|
||||
let params = {
|
||||
taskId,
|
||||
checkStatus: '1',
|
||||
pageSize: 10000,
|
||||
curPage,
|
||||
status: '',
|
||||
parentId: 0,
|
||||
}
|
||||
taskId && readyCheckPapers(params).then(data => {
|
||||
let dataArr = [];
|
||||
if (data && Array.isArray(data.rows)) {
|
||||
for (const item of data.rows) {
|
||||
dataArr.push({
|
||||
comments: "",
|
||||
expertId: current_user.expertId,
|
||||
gradesAverage: '',
|
||||
gradesFive: '',
|
||||
gradesFour: '',
|
||||
gradesOne: '',
|
||||
gradesThree: '',
|
||||
gradesTwo: '',
|
||||
opsContent: item.paperDetail && item.paperDetail.content,
|
||||
opsFiles: item.paperDetail && item.paperDetail.busiAttachments && item.paperDetail.busiAttachments[0].id,
|
||||
opsFilesAttachments: item.paperDetail && item.paperDetail.busiAttachments,
|
||||
opsId: item.id,
|
||||
opsParentId: containerId,
|
||||
opsType: containerType,
|
||||
status: 2
|
||||
});
|
||||
// item.detail = item.paperDetail && item.paperDetail.content;
|
||||
// item.busiAttachments = item.paperDetail && item.paperDetail.busiAttachments;
|
||||
}
|
||||
}
|
||||
setDataList(dataArr);
|
||||
setLoading(false);
|
||||
});
|
||||
}, [taskId]);
|
||||
|
||||
function downFile(id) {
|
||||
let url = httpUrl + '/busiAttachments/download/' + id;
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
// 获取评分列表
|
||||
useEffect(() => {
|
||||
setLoading(true);
|
||||
let params = {
|
||||
...searchObj,
|
||||
pageSize,
|
||||
curPage,
|
||||
statusString: '1,-1',
|
||||
containerId,
|
||||
containerType,
|
||||
isDistinct: false,
|
||||
};
|
||||
getExpertTasks(params).then(data => {
|
||||
setDataList(data.rows || []);
|
||||
setLoading(false);
|
||||
setTotal(data.total);
|
||||
getScoringDetails(params).then(res => {
|
||||
if (res.data && res.data.rows && res.data.rows.length) {
|
||||
setDataList(res.data.rows);
|
||||
setLoading(false);
|
||||
} else {
|
||||
containerType == 1 ? setTaskId(containerId) : setCompetitionId(containerId);
|
||||
}
|
||||
});
|
||||
}, [curPage, reload, pageSize]);
|
||||
|
||||
|
@ -160,9 +221,7 @@ function ReviewTasks({ form, showNotification, match, history }) {
|
|||
loading={loading}
|
||||
dataSource={dataList}
|
||||
columns={columns}
|
||||
total={total}
|
||||
setCurPage={setCurPage}
|
||||
current={curPage}
|
||||
pagination={false}
|
||||
/>
|
||||
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ class NewHeader extends Component {
|
|||
})
|
||||
}
|
||||
render() {
|
||||
const { match } = this.props;
|
||||
const { match,current_user } = this.props;
|
||||
|
||||
let { Addcoursestypes,
|
||||
tojoinitemtype,
|
||||
|
@ -701,6 +701,7 @@ class NewHeader extends Component {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`newHeaders ${activeIndex && 'homePage'}`} id="nHeader">
|
||||
<div className="headerContent">
|
||||
|
@ -770,7 +771,7 @@ class NewHeader extends Component {
|
|||
<div className="head-right">
|
||||
{this.props.user && this.props.user.login &&
|
||||
<div className='mr30'>
|
||||
<a href={this.state.isExpert ? '/expert/user/tasks' :'/expert'}>
|
||||
<a href={current_user.isExpert ? '/expert/user/tasks' : current_user.expertDraft ? '/expert/user/register' : '/expert'}>
|
||||
<i className="iconfont icon-xiaoxilingdang color-grey-6"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
import NewHeader from './NewHeader'
|
||||
import NewFooter from './NewFooter'
|
||||
import { downloadFile } from 'educoder'
|
||||
import { downloadFile } from 'educoder';
|
||||
import { getCurrentExpert } from 'src/military/expert/api';
|
||||
import axios from 'axios';
|
||||
import { Spin } from 'antd';
|
||||
import './TPMIndex.css';
|
||||
|
@ -165,10 +166,34 @@ export function TPMIndexHOC(WrappedComponent, headFoot) {
|
|||
// if (this.props.match.path === "/" && response.data.login) {
|
||||
// this.props.history.push(`/users/${response.data.login}`);
|
||||
// }
|
||||
|
||||
// 考虑到以后部分系统不会用到专家评审系统,所以这里没有使用Promise.All
|
||||
getCurrentExpert().then(res => {
|
||||
let isExpert = false;
|
||||
let expertId = '';
|
||||
let expertDraft = false;
|
||||
if (res && res.data && res.data.length) {
|
||||
for (const item of res.data) {
|
||||
if (item.status === 1) {
|
||||
isExpert = true;
|
||||
expertId = item.id;
|
||||
} else {
|
||||
expertDraft = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
const newUser = { ...this.state.current_user, isExpert, expertId, expertDraft };
|
||||
this.setState({
|
||||
user: newUser,
|
||||
current_user: newUser
|
||||
});
|
||||
});
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
//截取url 数据的
|
||||
foo = (url) => {
|
||||
|
@ -414,7 +439,7 @@ export function TPMIndexHOC(WrappedComponent, headFoot) {
|
|||
{...this.state} {...this.props}
|
||||
Footerdown={Footerdown}
|
||||
/>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue