From 50277b4b25614f57536619b0447d8535efc6dfd7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jan 2022 16:50:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E8=AF=84=E5=AE=A1=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/military/expert/api.js | 11 +++- src/military/expert/reviewResult/index.jsx | 61 +++++++++++++++------ src/military/expert/reviewResult/index.scss | 5 ++ src/military/expert/selectExpert/index.jsx | 7 +-- 4 files changed, 60 insertions(+), 24 deletions(-) diff --git a/src/military/expert/api.js b/src/military/expert/api.js index 08d0ae95..d9a1951b 100644 --- a/src/military/expert/api.js +++ b/src/military/expert/api.js @@ -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, }); diff --git a/src/military/expert/reviewResult/index.jsx b/src/military/expert/reviewResult/index.jsx index 5a954755..8ee84481 100644 --- a/src/military/expert/reviewResult/index.jsx +++ b/src/military/expert/reviewResult/index.jsx @@ -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 {changeIsWin(record.applicantInfo.id, e.target.checked)}}>胜出 + return taskRecord.status === 4 ? {changeIsWin(record.applicantInfo.id, e.target.checked)}}>胜出 : 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 (
@@ -109,15 +129,19 @@ function ReviewResult({ location, history }) {

任务名称{taskRecord.name}

-

任务链接{`/task/taskDetail/${taskRecord.id}`}

+

任务链接{`${window.location.host}/task/taskDetail/${taskRecord.id}`}

-

应征者排名

- -
+ {taskRecord.status > 3 ? +

应征者排名

+ +
+ {taskRecord.status === 4 && } +
+
:
暂无数据,此任务暂未进入成果评选阶段。
}

{errorMessage}

- ) + + ) } export default ReviewResult; \ No newline at end of file diff --git a/src/military/expert/reviewResult/index.scss b/src/military/expert/reviewResult/index.scss index f10f17f1..e82292a5 100644 --- a/src/military/expert/reviewResult/index.scss +++ b/src/military/expert/reviewResult/index.scss @@ -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{ diff --git a/src/military/expert/selectExpert/index.jsx b/src/military/expert/selectExpert/index.jsx index 02b6e45d..d8742e67 100644 --- a/src/military/expert/selectExpert/index.jsx +++ b/src/military/expert/selectExpert/index.jsx @@ -96,7 +96,7 @@ function SelectExpert(props) { align: 'center', render: (text, record) => { return - {activeKey == "1" && (record.isExpertTask ? 已添加 : {SelectExperts([record.id])}}>添加)} + {activeKey == "1" && {SelectExperts([record.id])}}>添加} {activeKey == "0" && { deleteExpert(record.taskExpertId, record.id)}} okText="是" cancelText="否">} } @@ -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);