修改issue

This commit is contained in:
何童崇 2022-01-17 17:05:36 +08:00
parent bc3d15c506
commit 0c86f9281a
1 changed files with 26 additions and 6 deletions

View File

@ -45,6 +45,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
{
title: '序号',
dataIndex: 'index',
width:50,
render: (text, record, index) => {
return index + 1
}
@ -74,11 +75,13 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
title: '平均分',
dataIndex: 'gradesAverage',
key: 'gradesAverage',
width:80,
},
{
title: '评审意见',
dataIndex: 'comments',
key: 'comments',
width:90,
render: (text, record, index) => {
return <a className="link" onClick={() => { writeComments(text, index, 'comments') }}>{record.status === 2 ? '填写' : '查看'}意见</a>
}
@ -209,7 +212,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
function editGrade(value, index, dataIndex) {
let dataListNew = dataList.slice();
dataListNew[index][dataIndex] = value;
//
if (gradesNum) {
let gradesArr = [];
@ -228,7 +231,6 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
}
}
dataListNew[index][dataIndex] = value;
setDataList(dataListNew);
}
@ -268,6 +270,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
function commit() {
if(disabled){
setVisible(false);
return;
}
if (comments) {
let data = dataList[activeIndex];
@ -317,6 +320,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
//
function verify() {
let errorArr = [];
let commentsError=[];
let scoringArr = [];
for (const [index, item] of dataList.entries()) {
let gradesArr = [];
@ -327,7 +331,9 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
typeof item.gradesFive === 'number' && gradesArr.push(item.gradesFive);
if (gradesArr.length < gradesNum && gradesArr.length) {
errorArr.push(index);
} else if (gradesArr.length) {
}else if(!item.comments && gradesArr.length ){
commentsError.push(index);
} else if (gradesArr.length ) {
scoringArr.push(index);
}
}
@ -341,6 +347,19 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
title: '提醒',
content: content,
});
return;
}
if(commentsError.length){
let content = '';
for (const item of commentsError) {
content += `${item + 1}行数据请填写意见 `;
}
Info({
title: '提醒',
content: content,
});
return;
}
if (!scoringArr.length) {
@ -348,9 +367,10 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
title: '提醒',
content: '请至少填写一行分数',
});
return;
}
return !errorArr.length
return !errorArr.length && !commentsError.length;
}
function dealCommitRes(res) {
@ -406,7 +426,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
<TabPane tab="专家评分" key="1">
<div>
<div className="box"></div>
<div className="warning">对单个作品评分时需填写完整每个评分项请勿少填漏填</div>
<div className="warning">对单个作品评分时需填写完整每个评分项及评审意见请勿少填漏填</div>
<Paginationtable
loading={loading}
dataSource={dataList}
@ -415,7 +435,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
/>
<div className="text-center">
<Button className="mr10" type="primary" disabled={disabled} onClick={commitGrades}>提交评审结果</Button>
<Button className="mr10" type="primary" disabled={disabled} onClick={commitGrades}>提交评审结果</Button>
<Button className="mr10" disabled={disabled} onClick={draft}>保存评审结果</Button>
<Button className="butE3_border" onClick={cancel}>取消</Button>
</div>