diff --git a/src/military/expert/api.js b/src/military/expert/api.js index f773301f..183956b4 100644 --- a/src/military/expert/api.js +++ b/src/military/expert/api.js @@ -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, + }); } \ No newline at end of file diff --git a/src/military/expert/competionList/index.jsx b/src/military/expert/competionList/index.jsx index 4a8e137c..81829d6b 100644 --- a/src/military/expert/competionList/index.jsx +++ b/src/military/expert/competionList/index.jsx @@ -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){ } }, + { + 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( -