forked from Gitlink/forgeplus-react
优化公示评审结果弹框
This commit is contained in:
parent
fdd442c377
commit
d30787dde5
|
@ -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 }) {
|
|||
<Input placeholder="请输入" onChange={(e)=>{setOpenRange(e.target.value)}}/>
|
||||
名
|
||||
</div>
|
||||
<p className="mt5">{errorMessage}</p>
|
||||
<p className={`mt5 ${errorMessage && 'errorMes'}`}>{errorMessage || "若未填写此排名,则公示所有名次"}</p>
|
||||
</Modal>
|
||||
|
||||
<GradesModal
|
||||
|
|
|
@ -58,4 +58,7 @@
|
|||
.ant-modal-title {
|
||||
text-align: left;
|
||||
}
|
||||
.errorMes{
|
||||
color: #d40000;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue