竞赛列表修改是否加入专家评审流程

This commit is contained in:
unknown 2022-01-25 16:34:40 +08:00
parent feaf59c146
commit 553901c8e0
5 changed files with 57 additions and 5 deletions

View File

@ -244,4 +244,13 @@ export function getCompetitionList(params) {
method: 'get',
params
});
}
// 修改竞赛是否加入专家评审流程
export function updateCompetitionReview(data) {
return fetch({
url: `${main_web_site_url}/api/v1/competitions/update_expert_audit`,
method: 'post',
data,
});
}

View File

@ -4,13 +4,19 @@ import Link from "react-router-dom/Link";
import { publishExpertsAndRules } from "src/military/task/api";
import PaginationTable from "../../components/paginationTable";
import { expertReviewArr } from "../../task/static";
import { getCompetitionList, getRules, selectExpertList } from "../api";
import { getCompetitionList, getRules, selectExpertList, updateCompetitionReview } from "../api";
import { competitionStatus } from "../static";
import './index.scss';
const statusArr = [];
for (const item of competitionStatus) {
statusArr[item.value] = item.label;
}
// current_status 1 2 3 4 5 6
function Competition(props){
const {mygetHelmetapi} = props;
const {mygetHelmetapi, showNotification} = props;
const {main_web_site_url} = mygetHelmetapi;
const [loading, setLoading] = useState(false);
const [curPage, setCurPage] = useState(1);
@ -66,7 +72,7 @@ function Competition(props){
className="column-select"
showArrow
defaultValue={text?1:-1}
// onChange={(key) => { changeExpertReviewStatus(key, record.id) }}
onChange={(key) => { changeExpertReviewStatus(key, record.id) }}
disabled={record.current_status >3 || record.assignRuleAndExperts}
>
{
@ -77,6 +83,15 @@ function Competition(props){
</Select>
}
},
{
title: "竞赛状态",
dataIndex: "current_status",
key: "current_status",
align: "center",
render:(text, record)=>{
return statusArr[text];
}
},
{
title: "开始时间",
dataIndex: "start_time",
@ -231,6 +246,18 @@ function Competition(props){
});
}
//
function changeExpertReviewStatus(expertReviewStatus, taskId) {
updateCompetitionReview({id: taskId, is_expert_audit: expertReviewStatus==1}).then(res => {
if (res && res.message === '更新成功') {
showNotification('操作成功!');
setReload(Math.random());
} else {
showNotification('操作失败');
}
})
}
//
useEffect(()=>{
setLoading(true);
@ -326,7 +353,7 @@ function Competition(props){
},[lookRules,lookExperts,pulicReview])
return(
<div className="centerbox">
<div className="centerbox competitionList">
<PaginationTable
loading={loading}
dataSource={competitionList}

View File

@ -54,4 +54,10 @@ a.primary-link{
.pagination-table .ant-table-tbody > tr > td{
padding: 3px 8px;
}
}
.competitionList{
.ant-select-selection{
width: 115px;
}
}

View File

@ -61,4 +61,14 @@ export const taskType = [
export const expertTaskStatus = [
{ value: -1, label: "未评审" },
{ value: '1,2', label: "已评审" },
];
export const competitionStatus = [
{ value: 0, label: "未开始" },
{ value: 1, label: "报名中" },
{ value: 2, label: "即将开始" },
{ value: 3, label: "竞赛进行中" },
{ value: 4, label: "竞赛评选中" },
{ value: 5, label: "公示中" },
{ value: 6, label: "已结束" },
];

View File

@ -66,7 +66,7 @@ service.interceptors.response.use(
});
return Promise.reject('error');
}
if (response.status !== 200 && res.status !== 200) {
if (!res.status.toString().startsWith('2')) {
notification.open({
message: "提示",
description: res.message,