From 85b5de7d08dc1d5b5aa0888dd904a061c856f341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com> Date: Fri, 14 Jan 2022 16:00:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expert/expertUser/taskDetail/index.jsx | 62 ++++++++++++------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/src/military/expert/expertUser/taskDetail/index.jsx b/src/military/expert/expertUser/taskDetail/index.jsx index 9202ea24..18763494 100644 --- a/src/military/expert/expertUser/taskDetail/index.jsx +++ b/src/military/expert/expertUser/taskDetail/index.jsx @@ -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 {text} } }, @@ -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 { downFile(item.id) }}>{item.fileName} @@ -91,7 +91,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) { dataIndex: 'gradesOne', key: 'gradesOne', render: (text, record, index) => { - return { editGrade(value, index, 'gradesOne') }} /> } @@ -101,7 +101,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) { dataIndex: 'gradesTwo', key: 'gradesTwo', render: (text, record, index) => { - return { editGrade(value, index, 'gradesTwo') }} /> } @@ -111,7 +111,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) { dataIndex: 'gradesThree', key: 'gradesThree', render: (text, record, index) => { - return { editGrade(value, index, 'gradesThree') }} /> } @@ -121,7 +121,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) { dataIndex: 'gradesFour', key: 'gradesFour', render: (text, record, index) => { - return { editGrade(value, index, 'gradesFour') }} /> } @@ -131,7 +131,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) { dataIndex: 'gradesFive', key: 'gradesFive', render: (text, record, index) => { - return { 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 }) { 创客成果评审 - {history.goBack()}}>返回上一页 + { history.goBack() }}>返回上一页 { setActiveKey(activeKey) }}>
创客成果评审 - {history.goBack()}}>返回上一页 + { history.goBack() }}>返回上一页