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( -
+
tr > td{ padding: 3px 8px; } +} + +.competitionList{ + .ant-select-selection{ + width: 115px; + } } \ No newline at end of file diff --git a/src/military/expert/static.js b/src/military/expert/static.js index 723c41db..c2d3b0fc 100644 --- a/src/military/expert/static.js +++ b/src/military/expert/static.js @@ -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: "已结束" }, ]; \ No newline at end of file diff --git a/src/military/javaFetch.js b/src/military/javaFetch.js index e9a383a3..1a47425a 100644 --- a/src/military/javaFetch.js +++ b/src/military/javaFetch.js @@ -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,