From d30787dde59d804ee12533201a3467b7e32bf796 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Jan 2022 17:43:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=AC=E7=A4=BA=E8=AF=84?= =?UTF-8?q?=E5=AE=A1=E7=BB=93=E6=9E=9C=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/military/expert/reviewResult/index.jsx | 36 ++++++++++----------- src/military/expert/reviewResult/index.scss | 3 ++ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/military/expert/reviewResult/index.jsx b/src/military/expert/reviewResult/index.jsx index 7d0ca324..958e55ac 100644 --- a/src/military/expert/reviewResult/index.jsx +++ b/src/military/expert/reviewResult/index.jsx @@ -16,7 +16,7 @@ function ReviewResult({ history, match }) { const [openResultVisible, setOpenResultVisible] = useState(false); const [winIds, setWinIds] = useState(undefined); const [openRange, setOpenRange] = useState(undefined); - const [errorMessage,setErrorMessage] = useState("若未填写此排名,则公示所有名次"); + const [errorMessage,setErrorMessage] = useState(); const [result, setResult] = useState(undefined); // 模态框 @@ -107,9 +107,10 @@ function ReviewResult({ history, match }) { } function onOk(){ - setErrorMessage("若未填写此排名,则公示所有名次"); + setErrorMessage(""); + let ids = []; if(!openRange){ - setOpenRange(dataList.length+''); + dataList.map(i=> {ids[ids.length] = i.applicantInfo.id;}); }else if(openRange && isNaN(openRange)){ setErrorMessage('请输入数字!'); }else if(openRange && (openRange.indexOf('.')!==-1 || openRange.indexOf('-')!==-1)){ @@ -117,22 +118,21 @@ function ReviewResult({ history, match }) { }else if(openRange && openRange > dataList.length){ setErrorMessage('公示范围超过应征者总数!'); }else{ - const ids = []; ids[ids.length] = dataList.filter(item=>item.id<=openRange).map(i=>i.applicantInfo.id); - let params = { - containerId : taskId, - containerType: 1, - id: 0, - publicityUserIds : dataList.filter(item=>item.id<=openRange).map(i=>i.applicantInfo.id).toString(), - winUserIds:winIds.toString() - }; - selectWinnersAndPublicists(params).then(response=>{ - if(response && response.message === "success"){ - message.success("操作成功"); - setOpenResultVisible(false); - } - }) } + let params = { + containerId : taskId, + containerType: 1, + id: 0, + publicityUserIds : ids.toString(), + winUserIds:winIds.toString() + }; + ids.length!=0 && selectWinnersAndPublicists(params).then(response=>{ + if(response && response.message === "success"){ + message.success("操作成功"); + setOpenResultVisible(false); + } + }) } return ( @@ -168,7 +168,7 @@ function ReviewResult({ history, match }) { {setOpenRange(e.target.value)}}/> 名 -

{errorMessage}

+

{errorMessage || "若未填写此排名,则公示所有名次"}