forked from Gitlink/forgeplus-react
修改状态
This commit is contained in:
parent
161c300c08
commit
85b5de7d08
|
@ -1,5 +1,5 @@
|
|||
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
||||
import { Tabs, Button, Form, InputNumber, Modal, Tooltip,} from 'antd';
|
||||
import { Tabs, Button, Form, InputNumber, Modal, Tooltip, } from 'antd';
|
||||
import { Link } from "react-router-dom";
|
||||
import Paginationtable from "../../../components/paginationTable";
|
||||
import { Info, Confirm } from '../../../components/ModalFun';
|
||||
|
@ -53,8 +53,8 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
title: '投稿详情',
|
||||
dataIndex: 'opsContent',
|
||||
key: 'opsContent',
|
||||
className:'text-tooltip',
|
||||
render:(text,record,index)=>{
|
||||
className: 'text-tooltip',
|
||||
render: (text, record, index) => {
|
||||
return <Tooltip overlayClassName="expert-tooltip" title={text} placement="top">{text}</Tooltip>
|
||||
}
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
title: '附件下载',
|
||||
dataIndex: 'opsFilesAttachments',
|
||||
key: 'opsFilesAttachments',
|
||||
className:'text-tooltip',
|
||||
className: 'text-tooltip',
|
||||
render: (text, record) => {
|
||||
return text && text.map(item => {
|
||||
return <a key={item.id} className="link" onClick={() => { downFile(item.id) }}>{item.fileName}</a>
|
||||
|
@ -91,7 +91,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
dataIndex: 'gradesOne',
|
||||
key: 'gradesOne',
|
||||
render: (text, record, index) => {
|
||||
return <InputNumber min={0} max={100} defaultValue={text} precision={0} disabled={disabled}
|
||||
return <InputNumber min={0} max={100} value={text} precision={0} disabled={disabled}
|
||||
onChange={(value) => { editGrade(value, index, 'gradesOne') }}
|
||||
/>
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
dataIndex: 'gradesTwo',
|
||||
key: 'gradesTwo',
|
||||
render: (text, record, index) => {
|
||||
return <InputNumber min={0} max={100} defaultValue={text} precision={0} disabled={disabled}
|
||||
return <InputNumber min={0} max={100} value={text} precision={0} disabled={disabled}
|
||||
onChange={(value) => { editGrade(value, index, 'gradesTwo') }}
|
||||
/>
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
dataIndex: 'gradesThree',
|
||||
key: 'gradesThree',
|
||||
render: (text, record, index) => {
|
||||
return <InputNumber min={0} max={100} defaultValue={text} precision={0} disabled={disabled}
|
||||
return <InputNumber min={0} max={100} value={text} precision={0} disabled={disabled}
|
||||
onChange={(value) => { editGrade(value, index, 'gradesThree') }}
|
||||
/>
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
dataIndex: 'gradesFour',
|
||||
key: 'gradesFour',
|
||||
render: (text, record, index) => {
|
||||
return <InputNumber min={0} max={100} defaultValue={text} precision={0} disabled={disabled}
|
||||
return <InputNumber min={0} max={100} value={text} precision={0} disabled={disabled}
|
||||
onChange={(value) => { editGrade(value, index, 'gradesFour') }}
|
||||
/>
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
dataIndex: 'gradesFive',
|
||||
key: 'gradesFive',
|
||||
render: (text, record, index) => {
|
||||
return <InputNumber min={0} max={100} defaultValue={text} precision={0} disabled={disabled}
|
||||
return <InputNumber min={0} max={100} value={text} precision={0} disabled={disabled}
|
||||
onChange={(value) => { editGrade(value, index, 'gradesFive') }}
|
||||
/>
|
||||
}
|
||||
|
@ -145,9 +145,12 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
getRules({ containerId, containerType}).then(response => {
|
||||
getRules({ containerId, containerType }).then(response => {
|
||||
if (response && response.message === "success") {
|
||||
setRules(response.data);
|
||||
if (response.data.status === 1) {
|
||||
setDisabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, [])
|
||||
|
@ -162,7 +165,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
status: '',
|
||||
parentId: 0,
|
||||
}
|
||||
taskId && current_user.expertId && readyCheckPapers(params).then(data => {
|
||||
taskId && current_user.expertId && readyCheckPapers(params).then(data => {
|
||||
let dataArr = [];
|
||||
if (data && Array.isArray(data.rows)) {
|
||||
for (const item of data.rows) {
|
||||
|
@ -189,12 +192,15 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
}
|
||||
}
|
||||
setDataList(dataArr);
|
||||
setLoading(false);
|
||||
dataArr.length && initScoringDetails(dataArr).then(res => {
|
||||
console.log(res);
|
||||
disabled && setLoading(false);
|
||||
!disabled && dataArr.length && initScoringDetails(dataArr).then(res => {
|
||||
if(res){
|
||||
setReload(Math.random());
|
||||
setLoading(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, [taskId, current_user.expertId]);
|
||||
}, [taskId,disabled, current_user.expertId]);
|
||||
|
||||
function downFile(id) {
|
||||
let url = httpUrl + '/busiAttachments/download/' + id;
|
||||
|
@ -216,8 +222,8 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
if (gradesArr.length === gradesNum) {
|
||||
const sum = gradesArr.reduce((previousValue, currentValue) => { return previousValue + currentValue }, 0);
|
||||
const ave = (sum / gradesNum).toFixed(2);
|
||||
dataListNew[index].gradesAverage = ave > 100 ? 100: ave;
|
||||
}else{
|
||||
dataListNew[index].gradesAverage = ave > 100 ? 100 : ave;
|
||||
} else {
|
||||
dataListNew[index].gradesAverage = '';
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +244,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
if (res.data && res.data.length) {
|
||||
setDataList(res.data);
|
||||
setLoading(false);
|
||||
if (res.data[0].status === 1) {
|
||||
if (response.data[0].status === 1) {
|
||||
setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
|
@ -260,10 +266,25 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
|
||||
// 修改意见
|
||||
function commit() {
|
||||
if(disabled){
|
||||
setVisible(false);
|
||||
}
|
||||
if (comments) {
|
||||
let data = dataList[activeIndex];
|
||||
let dataListNew=dataList.slice();
|
||||
data.comments = comments;
|
||||
updateScoringDetails([data]).then(res => dealCommitRes(res))
|
||||
updateScoringDetails([data]).then(res => {
|
||||
if (res && res.message) {
|
||||
if (res.message.indexOf("成功")) {
|
||||
showNotification("保存成功");
|
||||
dataListNew[activeIndex].comments=comments;
|
||||
setDataList(dataListNew);
|
||||
setVisible(false);
|
||||
} else {
|
||||
showNotification(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,7 +358,6 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
if (res.message.indexOf("成功")) {
|
||||
showNotification("保存成功");
|
||||
setReload(Math.random());
|
||||
setVisible(false);
|
||||
} else {
|
||||
showNotification(res.message);
|
||||
}
|
||||
|
@ -348,7 +368,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
|
|||
<div className='register_right task_detail'>
|
||||
<p className="task-head">
|
||||
创客成果评审
|
||||
<button className="back-button but41_border" onClick={()=>{history.goBack()}}>返回上一页</button>
|
||||
<button className="back-button but41_border" onClick={() => { history.goBack() }}>返回上一页</button>
|
||||
</p>
|
||||
|
||||
<Tabs defaultActiveKey="0" animated={false} onChange={(activeKey) => { setActiveKey(activeKey) }}>
|
||||
|
|
Loading…
Reference in New Issue