查看评审结果

This commit is contained in:
unknown 2022-01-11 16:50:40 +08:00
parent f49de16e2a
commit 50277b4b25
4 changed files with 60 additions and 24 deletions

View File

@ -119,9 +119,18 @@ export function updateScoringDetails(data){
}
//评选胜出者和公示者
export function selectWinnersAndPublicists(params){
export function selectWinnersAndPublicists(data){
return fetch({
url: '/api/expertScoringDetails/selectWinnersAndPublicists',
method: 'post',
data,
});
}
//查看胜出者和公示名单
export function getWinnersAndPublicists(params) {
return fetch({
url: `/api/expertScoringDetails/getWinnersAndPublicists`,
method: 'get',
params,
});

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import Link from "react-router-dom/Link";
import PaginationTable from "src/military/components/paginationTable";
import { getScoringDetails, selectWinnersAndPublicists } from "../api";
import { getScoringDetails, getWinnersAndPublicists, selectWinnersAndPublicists } from "../api";
import { Checkbox, Input, message, Modal } from "antd";
import './index.scss';
import '../index.scss';
@ -13,12 +13,12 @@ function ReviewResult({ location, history }) {
const [winIds, setWinIds] = useState(undefined);
const [openRange, setOpenRange] = useState(undefined);
const [errorMessage,setErrorMessage] = useState("若未填写此排名,则公示所有名次");
const [result, setResult] = useState(undefined);
const columns = [
{
title: '综合排名',
dataIndex: 'id',
// align: 'left',applicantInfo.nickname
},
{
title: '应征者',
@ -40,8 +40,9 @@ function ReviewResult({ location, history }) {
{
title: '是否胜出',
ket: 'isWin',
align: 'center',
render: (text, record) => {
return <Checkbox onChange={(e)=>{changeIsWin(record.applicantInfo.id, e.target.checked)}}>胜出</Checkbox>
return taskRecord.status === 4 ? <Checkbox onChange={(e)=>{changeIsWin(record.applicantInfo.id, e.target.checked)}}>胜出</Checkbox> : record.isWin ? '胜出':'未胜出';
}
}
];
@ -49,15 +50,28 @@ function ReviewResult({ location, history }) {
useEffect(()=>{
//
const params = {
containerId: 478,//taskRecord.id
containerId: taskRecord.id,
containerType: 1,
// isDistinct: true,
isDistinct: true,
expertId: -1,
orderBy: 'finalGradesDesc'
}
getScoringDetails(params).then(response=>{
if(response && Array.isArray(response.data)){
setDateList(response.data);
let index = 1;
response.data.map(item=>{item.id = index++;setResult(item.finalGrades) })
taskRecord && taskRecord.status >4 ? getWinnersAndPublicists({
containerId: taskRecord.id,
containerType: 1
}).then(res=>{
if(res && res.message === "success"){
response.data.map(item=>{
item.isWin = res.data.winUserIds.indexOf(item.applicantInfo.id) !== -1;
item.isPublic = res.data.publicityUserIds.indexOf(item.applicantInfo.id) !== -1;
})
}
setDateList(response.data);
}):setDateList(response.data)
}
})
},[])
@ -70,6 +84,10 @@ function ReviewResult({ location, history }) {
}
function openResult(){
if(!result){
message.error("还没有到评审结束时间,不能公示结果! ");
return;
}
if(winIds && winIds.length>0){
taskRecord.taskModeId == 1 && winIds.length >1 ? message.error("此任务是单人悬赏模式, 只能设置一个中标者 ! ") : setOpenResultVisible(true);
}
@ -89,18 +107,20 @@ function ReviewResult({ location, history }) {
const ids = [];
ids[ids.length] = dataList.filter(item=>item.id<=openRange).map(i=>i.applicantInfo.id);
let params = {
containerId : 478,//taskRecord.id,
containerId : taskRecord.id,
containerType: 1,
id: 0,
publicityUserIds : dataList.filter(item=>item.id<=openRange).map(i=>i.applicantInfo.id).toString(),
winUserIds:winIds.toString()
};
selectWinnersAndPublicists(params).then(response=>{
console.log('response', response);
if(response && response.message === "success"){
message.success("操作成功");
}
})
}
}
return (
<div className="expert_review_system centerbox">
<div className="head_title mb20">
@ -109,15 +129,19 @@ function ReviewResult({ location, history }) {
<button className="but41_border goback_but" onClick={()=>{history.goBack()}}>返回上一页</button>
</div>
<p className="mt10"><span className="font-w">任务名称</span><span className="ml10">{taskRecord.name}</span></p>
<p className="mt10 pb20"><span className="font-w">任务链接</span><Link className="taskLink ml10" target="_blank" to={`/task/taskDetail/${taskRecord.id}`} >{`/task/taskDetail/${taskRecord.id}`}</Link></p>
<p className="mt10 pb20"><span className="font-w">任务链接</span><Link className="taskLink ml10" target="_blank" to={`/task/taskDetail/${taskRecord.id}`} >{`${window.location.host}/task/taskDetail/${taskRecord.id}`}</Link></p>
</div>
<p className="font-16 font-w mb10">应征者排名</p>
<PaginationTable
dataSource= {dataList}
columns= {columns}
scroll={{ y: 400 }}
/>
<div className="openResult"><button className={winIds && taskRecord.taskModeId == 1 && winIds.length >1 ? 'disableBut': 'but41_fill'} onClick={openResult}>公示结果</button></div>
{taskRecord.status > 3 ? <React.Fragment>
<p className="font-16 font-w mb10">应征者排名</p>
<PaginationTable
dataSource= {dataList}
columns= {columns}
scroll={{ y: 400 }}
/>
<div className="openResult">
{taskRecord.status === 4 && <button className={(winIds && taskRecord.taskModeId == 1 && winIds.length >1) || !result ? 'disableBut': 'but41_fill'} onClick={openResult}>公示结果</button>}
</div>
</React.Fragment>:<div className="nodata font-w font-22">暂无数据此任务暂未进入成果评选阶段</div>}
<Modal
title= "请确认公示范围"
visible= {openResultVisible}
@ -132,6 +156,7 @@ function ReviewResult({ location, history }) {
</div>
<p className="mt5">{errorMessage}</p>
</Modal>
</div>)
</div>
)
}
export default ReviewResult;

View File

@ -31,6 +31,11 @@
.pagination-table .ant-table-thead > tr > th span{
font-weight: bold;
}
.nodata{
height: 350px;
line-height: 350px;
text-align: center;
}
}
.openResultModal{
.ant-modal-body{

View File

@ -96,7 +96,7 @@ function SelectExpert(props) {
align: 'center',
render: (text, record) => {
return <React.Fragment>
{activeKey == "1" && (record.isExpertTask ? <span className="selected">已添加</span> : <a className="select" onClick={()=>{SelectExperts([record.id])}}>添加</a>)}
{activeKey == "1" && <a className="select" onClick={()=>{SelectExperts([record.id])}}>添加</a>}
{activeKey == "0" && <Popconfirm placement="bottom" title="你确认要删除此专家吗?" onConfirm={() => { deleteExpert(record.taskExpertId, record.id)}} okText="是" cancelText="否"><Button className="mr5 font-12" type="danger" size="small">删除</Button></Popconfirm>}
</React.Fragment>
}
@ -108,9 +108,6 @@ function SelectExpert(props) {
selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRowKeys(selectedRowKeys);
},
getCheckboxProps: record =>{
return record.isExpertTask ? {disabled: true} : {};
}
};
@ -168,6 +165,7 @@ function SelectExpert(props) {
pageSize,
curPage,
statusString: '1',
selectedExpertIds: allSelectedExpertsId && Array.from(allSelectedExpertsId).toString()
};
expertList(params).then(data => {
if (data && Array.isArray(data.rows)) {
@ -175,7 +173,6 @@ function SelectExpert(props) {
for (const item of data.rows) {
item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo ? `${item.reviewAreaTwo}`:''} ${item.reviewAreaThree ? `${item.reviewAreaThree}`:''}`;
item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0);
allSelectedExpertsId && allSelectedExpertsId.length!==0 && (item.isExpertTask = allSelectedExpertsId.has(item.id));
}
}
setDataList(data && data.rows);