Merge pull request '修改任务列表按钮样式及新建组织按钮样式' (#498) from tongChong/forgeplus-react:pre_dev_military into pre_dev_military

This commit is contained in:
tongChong 2023-01-11 11:06:59 +08:00
commit 2253b64c05
6 changed files with 268 additions and 219 deletions

View File

@ -59,7 +59,7 @@ function Team(props){
{ {
current_user && current_user.login === username && current_user && current_user.login === username &&
// <CheckProfile {...props} sureFunc={()=>{props.history.push('/organize/new')}}><i className="iconfont icon-xinjian1 mr3 font-14"></i></CheckProfile> // <CheckProfile {...props} sureFunc={()=>{props.history.push('/organize/new')}}><i className="iconfont icon-xinjian1 mr3 font-14"></i></CheckProfile>
<Link className="ant-btn ant-btn-primary" to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link> <Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>
} }
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
<a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a> <a>排序<i className="iconfont icon-sanjiaoxing-down ml3 font-14"></i></a>

View File

@ -723,4 +723,13 @@ export function checkVerificationCode(data) {
method: 'post', method: 'post',
data: data, data: data,
}); });
}
// 更新置顶顺序
export function changePinnedTaskSort(data){
return fetch({
url: `/api/tasks/backend/admin/changePinnedTaskSort`,
method: 'post',
data
});
} }

View File

@ -66,7 +66,7 @@ export default ({downloading,setDownloading}) => {
}, },
{ {
title: '赏金分配方式', title: '赏金分配方式',
dataIndex: 'bounty', dataIndex: 'task_mode_id',
width:130, width:130,
render:(text) => ( render:(text) => (
text||'--' text||'--'
@ -100,8 +100,8 @@ export default ({downloading,setDownloading}) => {
title: '身份证/信用代码', title: '身份证/信用代码',
dataIndex: 'card', dataIndex: 'card',
width:200, width:200,
render:(text) => ( render:(text,record) => (
text||'--' text||record.credit_code||'--'
) )
}, },
{ {

View File

@ -1,11 +1,11 @@
import React, { useCallback, useEffect, useState, useMemo } from 'react'; import React, { useCallback, useEffect, useState, useMemo } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { Input, Select, Button, Form, DatePicker, Modal, message, Popover } from 'antd'; import { Input, Select, Button, Form, DatePicker, Modal, message, Popover, InputNumber } from 'antd';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr, main_web_site_url } from '../static'; import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr, main_web_site_url } from '../static';
import { getTaskAdminList, changeShowUserMode, deleteTask, recommendTask, addExpertReview, publishExpertsAndRules,delayTask ,resetTask} from '../api'; import { getTaskAdminList, changeShowUserMode, deleteTask, recommendTask, addExpertReview, publishExpertsAndRules, delayTask, resetTask, changePinnedTaskSort } from '../api';
import '../index.scss'; import '../index.scss';
import './index.scss'; import './index.scss';
import { getRules, selectExpertList } from 'src/military/expert/api'; import { getRules, selectExpertList } from 'src/military/expert/api';
@ -27,7 +27,7 @@ for (const item of paperCheckStatusArr) {
// //
export default Form.create()(({ form, showNotification, match, history, state }) => { export default Form.create()(({ form, showNotification, match, history, state }) => {
const { getFieldDecorator, setFieldsValue, getFieldsValue, validateFields } = form; const { getFieldDecorator, setFieldsValue, getFieldsValue, validateFields } = form;
const { hash} = history && history.location; const { hash } = history && history.location;
const [reload, setReload] = useState(); const [reload, setReload] = useState();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [statusString, setStatusString] = useState(''); const [statusString, setStatusString] = useState('');
@ -37,15 +37,15 @@ export default Form.create()(({ form, showNotification, match, history, state })
const [recommend, setRecommend] = useState(''); const [recommend, setRecommend] = useState('');
const [sort, setSort] = useState('Desc'); const [sort, setSort] = useState('Desc');
const [order, setOrder] = useState('createdAt'); const [order, setOrder] = useState('default');
const [searchObj, setSearchObj] = useState({}); const [searchObj, setSearchObj] = useState({});
const [curPage, setCurPage] = useState(hashDate(hash) || 1); const [curPage, setCurPage] = useState(hashDate(hash) || 1);
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const [taskList, setTaskList] = useState([]); const [taskList, setTaskList] = useState([]);
const [expertReview, setExpertReview] = useState(''); const [expertReview, setExpertReview] = useState('');
const [downloading,setDownloading] = useState(false); const [downloading, setDownloading] = useState(false);
const [restartVisible,setRestartVisible]= useState(false); //modal const [restartVisible, setRestartVisible] = useState(false); //modal
// //
const [lookRules, setLookRules] = useState(false); const [lookRules, setLookRules] = useState(false);
@ -58,10 +58,11 @@ export default Form.create()(({ form, showNotification, match, history, state })
const [reviewTaskId, setReviewTaskId] = useState(undefined); const [reviewTaskId, setReviewTaskId] = useState(undefined);
const [visible, setVisible] = useState(false); //modal const [visible, setVisible] = useState(false); //modal
const [checkedItem, setCheckedItem] = useState(''); const [checkedItem, setCheckedItem] = useState('');
const [orderVisible, setOrderVisible] = useState(false);
useEffect(()=>{ useEffect(() => {
setCurPage(hashDate(hash) || 1); setCurPage(hashDate(hash) || 1);
},[hash]) }, [hash])
useEffect(() => { useEffect(() => {
const params = { const params = {
@ -71,16 +72,16 @@ export default Form.create()(({ form, showNotification, match, history, state })
showUserMode: showUserMode.length > 1 ? '' : showUserMode, showUserMode: showUserMode.length > 1 ? '' : showUserMode,
curPage, curPage,
pageSize: 10, pageSize: 10,
orderBy: order + sort, orderBy: order === 'default' ? '' : order + sort,
isDelete, isDelete,
recommend, recommend,
expertReview: expertReview==='-1'?"":expertReview, expertReview: expertReview === '-1' ? "" : expertReview,
}; };
setLoading(true); setLoading(true);
getTaskAdminList(params).then(data => { getTaskAdminList(params).then(data => {
if (data) { if (data) {
let taskIds = []; let taskIds = [];
for(const item of data.rows){ for (const item of data.rows) {
item.expertReview && (taskIds[taskIds.length] = item.id) item.expertReview && (taskIds[taskIds.length] = item.id)
} }
setReviewTaskId(taskIds.toString()); setReviewTaskId(taskIds.toString());
@ -100,7 +101,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
), []); ), []);
function hashDate(hash) { function hashDate(hash) {
return parseInt(hash.split("&")[0].substring(hash.split("&")[0].indexOf("=")+1)); return parseInt(hash.split("&")[0].substring(hash.split("&")[0].indexOf("=") + 1));
} }
function onSearch() { function onSearch() {
let values = getFieldsValue(['nameInput', 'endTime', 'startTime', 'enterpriseNameInput']); let values = getFieldsValue(['nameInput', 'endTime', 'startTime', 'enterpriseNameInput']);
@ -124,7 +125,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
expertReviewStatus: '-1', expertReviewStatus: '-1',
showStatus: '0', showStatus: '0',
isRecommend: 'all', isRecommend: 'all',
sortBy: 'createdAt' sortBy: 'default'
}); });
setStatusString('0,1,2,3,4,5,6,7,8,9'); setStatusString('0,1,2,3,4,5,6,7,8,9');
setShowUserMode('0,1,2'); setShowUserMode('0,1,2');
@ -132,35 +133,36 @@ export default Form.create()(({ form, showNotification, match, history, state })
setExpertReview('-1'); setExpertReview('-1');
setIsDelete('0'); setIsDelete('0');
setRecommend(''); setRecommend('');
setOrder("createdAt"); setOrder("default");
setSearchObj({}); setSearchObj({});
} }
function delayClick(item,restart) { //
function delayClick(item, restart) {
setCheckedItem(item); setCheckedItem(item);
if(restart){ if (restart) {
setVisible(true); setVisible(true);
}else{ } else {
setRestartVisible(true); setRestartVisible(true);
} }
} }
//
const columns = useMemo(() => { const columns = useMemo(() => {
return [ return [
{ {
title: '任务编号', title: '任务编号',
dataIndex: 'number', dataIndex: 'number',
width: "26%"
}, },
{ {
title: '任务名称', title: '任务名称',
dataIndex: 'name', dataIndex: 'name',
width: "10%", width: "10%",
render: (text, record) => ( render: (text, record) => (
<Popover content = { <Popover content={
<div className='taskPopover'> <div className='taskPopover'>
<p><span>任务名称:</span>{text}</p> <p><span>任务名称:</span>{text}</p>
<p className='mt5'><span>截稿时间:</span>{record.collectingEndTime && record.collectingEndTime.replaceAll('-','/').substring(0,16) || '--'}</p> <p className='mt5'><span>截稿时间:</span>{record.collectingEndTime && record.collectingEndTime.replaceAll('-', '/').substring(0, 16) || '--'}</p>
<p className='mt5'><span>稿件数:</span>{record.papersCount || '--'}</p> <p className='mt5'><span>稿件数:</span>{record.papersCount || '--'}</p>
</div> </div>
}> }>
@ -177,7 +179,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
dataIndex: 'publishedAt', dataIndex: 'publishedAt',
width: "8%", width: "8%",
render: (text, record) => { render: (text, record) => {
text = text && text.replaceAll('-','/').substring(0,16); text = text && text.replaceAll('-', '/').substring(0, 16);
return text || '--' return text || '--'
} }
}, },
@ -209,12 +211,17 @@ export default Form.create()(({ form, showNotification, match, history, state })
{ {
showUserModeArr.map(item => { showUserModeArr.map(item => {
// //
return <Option key={item.dicItemCode} value={item.dicItemCode} disabled={item.dicItemCode===1 && [5,6,7,8].includes(record.status)}>{item.dicItemName}</Option> return <Option key={item.dicItemCode} value={item.dicItemCode} disabled={item.dicItemCode === 1 && [5, 6, 7, 8].includes(record.status)}>{item.dicItemName}</Option>
}) })
} }
</Select> </Select>
} }
}, },
{
title: '排序',
key: 'orderNum',
dataIndex: 'orderNum'
},
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
@ -222,28 +229,17 @@ export default Form.create()(({ form, showNotification, match, history, state })
align: 'center', align: 'center',
render: (text, record) => { render: (text, record) => {
const disabled = record.assignRuleAndExperts || !(record.status == 1 || record.status == 3); const disabled = record.assignRuleAndExperts || !(record.status == 1 || record.status == 3);
return( return (
<React.Fragment> <React.Fragment>
{[3,4,6,7].includes(record.status)&&<Button className="mr5 mb5 f89" onClick={() => { delayClick(record,true) }}>延期</Button>} {[3, 4, 6, 7].includes(record.status) && <Button className="mr5 mb5 f89" onClick={() => { delayClick(record, true) }}>延期</Button>}
{record.status==8&& record.exceptClosedBoolean&&<Button className="mr5 mb5 f89" onClick={() => { delayClick(record)}}>重启</Button>} {record.status == 8 && record.exceptClosedBoolean && <Button className="mr5 mb5 f89" onClick={() => { delayClick(record) }}>重启</Button>}
<Button className="mr5 mb5 f20" onClick={() => { deleteItem(record.id,isDelete == '0' ? '1':'0') }}>{isDelete == '0' ? '隐藏任务':'恢复任务'}</Button> <Button className="mr5 mb5 f20" onClick={() => { deleteItem(record.id, isDelete == '0' ? '1' : '0') }}>{isDelete == '0' ? '隐藏' : '恢复'}</Button>
<Button className="mr5 mb5 f89" onClick={() => { recommendItem(record.id, record.recommend ? '0' :'1') }}>{record.recommend ? '撤销推荐':'首页推荐'}</Button> <Button className="mr5 mb5 f89" onClick={() => { recommendItem(record.id, record.recommend ? '0' : '1') }}>{record.recommend ? '撤销推荐' : '首页推荐'}</Button>
<Button className={`mr5 mb5 c2a3 ${text ? 'bor':'full'} ${disabled && 'disabled'}`} onClick={() => { changeExpertReviewStatus(text ? '-1':'1', record.id) }} disabled={disabled}>{text ? '取消专家评审':'加入专家评审'}</Button> <Button className="mr5 mb5" type='primary' onClick={() => { setCheckedItem(record); setOrderVisible(true); }}>排序</Button>
{/* { <Button className={`mr5 mb5 c2a3 ${text ? 'bor' : 'full'} ${disabled && 'disabled'}`} onClick={() => { changeExpertReviewStatus(text ? '-1' : '1', record.id) }} disabled={disabled}>{text ? '取消评审' : '加入评审'}</Button>
isDelete == '0' ? <Button className="mr5 font-12" type="danger" size="small" onClick={() => { deleteItem(record.id, '1') }}>隐藏任务</Button> </React.Fragment>
: <Button className="mr5 font-12" type="primary" size="small" onClick={() => { deleteItem(record.id, '0') }}>恢复任务</Button> )
} },
{
!record.recommend && [3, 4, 5, 6, 7, 8].includes(record.status) && <Button className="mr5 font-12" type="primary" size="small" onClick={() => { recommendItem(record.id, '1') }}>首页推荐</Button>
}
{
record.recommend && <Button className="mr5 font-12" type="danger" size="small" onClick={() => { recommendItem(record.id, '0') }}>撤销推荐</Button>
} */}
{/* <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.taskId}`}>查看</Link> */}
</React.Fragment>
)},
}, },
] ]
}, [isDelete, curPage]); }, [isDelete, curPage]);
@ -293,13 +289,18 @@ export default Form.create()(({ form, showNotification, match, history, state })
title: '专家评估', title: '专家评估',
dataIndex: 'expertScore', dataIndex: 'expertScore',
align: 'center', align: 'center',
render:(text,record)=>{ render: (text, record) => {
return record.expertScore || '--'; return record.expertScore || '--';
} }
} }
]; ];
}, []); }, []);
//
useEffect(()=>{
orderVisible&&setFieldsValue({ orderNum: checkedItem.orderNum })
},[orderVisible])
// function resetTaskModal // function resetTaskModal
function recommendItem(id, recommend) { function recommendItem(id, recommend) {
@ -337,7 +338,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
} }
//lookRules,lookExperts,pulicReview //lookRules,lookExperts,pulicReview
useEffect(()=>{ useEffect(() => {
// //
lookRules && rules && Modal.info({ lookRules && rules && Modal.info({
className: 'publishReview', className: 'publishReview',
@ -347,7 +348,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
<div>{rules && rules.rule}</div> <div>{rules && rules.rule}</div>
<p>评分标准</p> <p>评分标准</p>
<div> <div>
{rules.criterias.map(item=>{return <p key={Math.random()}>{item}</p>})} {rules.criterias.map(item => { return <p key={Math.random()}>{item}</p> })}
</div> </div>
<p>评审时间</p> <p>评审时间</p>
<div>{rules.reviewData}</div> <div>{rules.reviewData}</div>
@ -362,9 +363,9 @@ export default Form.create()(({ form, showNotification, match, history, state })
title: "已选取评审专家", title: "已选取评审专家",
content: content:
<PaginationTable <PaginationTable
dataSource={selectedExperts} dataSource={selectedExperts}
columns={columnsExperts} columns={columnsExperts}
scroll={{ y: 395 }}/>, scroll={{ y: 395 }} />,
}); });
lookExperts && setLookExperts(false); lookExperts && setLookExperts(false);
@ -383,7 +384,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
<div>{rules && rules.rule}</div> <div>{rules && rules.rule}</div>
<p>评分标准</p> <p>评分标准</p>
<div> <div>
{rules.criterias.map(item=>{return <p key={Math.random()}>{item}</p>})} {rules.criterias.map(item => { return <p key={Math.random()}>{item}</p> })}
</div> </div>
<p>评审时间</p> <p>评审时间</p>
<div>{rules.reviewData}</div> <div>{rules.reviewData}</div>
@ -391,37 +392,37 @@ export default Form.create()(({ form, showNotification, match, history, state })
<PaginationTable <PaginationTable
dataSource={selectedExperts} dataSource={selectedExperts}
columns={columnsExperts} columns={columnsExperts}
scroll={{ y: 230 }}/> scroll={{ y: 230 }} />
</React.Fragment> </React.Fragment>
, ,
okText: '确定', okText: '确定',
cancelText: '取消', cancelText: '取消',
onOk() { onOk() {
publishExpertsAndRules(publicTaskId,1).then(response=>{ publishExpertsAndRules(publicTaskId, 1).then(response => {
if(response && response.message==="发布成功"){ if (response && response.message === "发布成功") {
setReload(Math.random()); setReload(Math.random());
} }
}) })
}, },
}); });
pulicReview && setPublicReview(false); pulicReview && setPublicReview(false);
},[lookRules,lookExperts,pulicReview]) }, [lookRules, lookExperts, pulicReview])
// //
function publishTaskReview(record){ function publishTaskReview(record) {
if(!record.ruleEditedCount || !record.expertSelectedCount){ if (!record.ruleEditedCount || !record.expertSelectedCount) {
message.error("请先编辑评审规则以及选取评选专家再发布此任务"); message.error("请先编辑评审规则以及选取评选专家再发布此任务");
}else{ } else {
getRules({containerId: record.id, containerType: 1, statusString: 3}).then(response=>{ getRules({ containerId: record.id, containerType: 1, statusString: 3 }).then(response => {
if(response && response.message === "success"){ if (response && response.message === "success") {
setRules(response.data); setRules(response.data);
} }
}) })
selectExpertList({containerId: record.id, containerType: 1, curPage:curPage, pageSize: 10000, curPage: 1,}).then(response=>{ selectExpertList({ containerId: record.id, containerType: 1, curPage: curPage, pageSize: 10000, curPage: 1, }).then(response => {
if(response && response.message === "success" && Array.isArray(response.data.rows)){ if (response && response.message === "success" && Array.isArray(response.data.rows)) {
let index = 1; let index = 1;
for (const item of response.data.rows) { for (const item of response.data.rows) {
item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo ? `${item.reviewAreaTwo}`:''} ${item.reviewAreaThree ? `${item.reviewAreaThree}`:''}`; item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo ? `${item.reviewAreaTwo}` : ''} ${item.reviewAreaThree ? `${item.reviewAreaThree}` : ''}`;
item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0); item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0);
} }
setPublicTaskId(record.id); setPublicTaskId(record.id);
@ -433,9 +434,9 @@ export default Form.create()(({ form, showNotification, match, history, state })
} }
// //
function viewRules(record){ function viewRules(record) {
getRules({containerId: record.id, containerType: 1, statusString: '-1,1,2'}).then(response=>{ getRules({ containerId: record.id, containerType: 1, statusString: '-1,1,2' }).then(response => {
if(response && response.message === "success"){ if (response && response.message === "success") {
setRules(response.data); setRules(response.data);
setLookRules(true); setLookRules(true);
} }
@ -443,12 +444,12 @@ export default Form.create()(({ form, showNotification, match, history, state })
} }
// //
function viewExperts(record){ function viewExperts(record) {
selectExpertList({containerId: record.id, containerType: 1, curPage:curPage, pageSize: 10000, curPage: 1,}).then(response=>{ selectExpertList({ containerId: record.id, containerType: 1, curPage: curPage, pageSize: 10000, curPage: 1, }).then(response => {
if(response && response.message === "success" && Array.isArray(response.data.rows)){ if (response && response.message === "success" && Array.isArray(response.data.rows)) {
let index = 1; let index = 1;
for (const item of response.data.rows) { for (const item of response.data.rows) {
item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo ? `${item.reviewAreaTwo}`:''} ${item.reviewAreaThree ? `${item.reviewAreaThree}`:''}`; item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo ? `${item.reviewAreaTwo}` : ''} ${item.reviewAreaThree ? `${item.reviewAreaThree}` : ''}`;
item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0); item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0);
} }
setSelectedExperts(response.data.rows); setSelectedExperts(response.data.rows);
@ -469,7 +470,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
} }
function changeExpertReviewStatus(expertReviewStatus, taskId) { function changeExpertReviewStatus(expertReviewStatus, taskId) {
addExpertReview(taskId,expertReviewStatus).then(res => { addExpertReview(taskId, expertReviewStatus).then(res => {
if (res && res.message === 'success') { if (res && res.message === 'success') {
showNotification('操作成功!'); showNotification('操作成功!');
setReload(Math.random()); setReload(Math.random());
@ -479,9 +480,9 @@ export default Form.create()(({ form, showNotification, match, history, state })
}) })
} }
function setCurPage1(page){ function setCurPage1(page) {
setCurPage(page); setCurPage(page);
window.location.href=`/managements/task/taskAdmin#page=${page}`; window.location.href = `/managements/task/taskAdmin#page=${page}`;
} }
// //
@ -510,21 +511,17 @@ export default Form.create()(({ form, showNotification, match, history, state })
setCurPage1(1); setCurPage1(1);
}); });
const ExpertDetail = (record)=>{ const ExpertDetail = (record) => {
const unDisabled = record.expertReview && (record.status === 1 || record.status === 3); const unDisabled = record.expertReview && (record.status === 1 || record.status === 3);
return <div className="expert_detail_div"> return <div className="expert_detail_div">
<div> 专家评审信息: </div> <div> 专家评审信息: </div>
<div> 评审规则 {record.assignRuleAndExperts ? <Button className='c2a3 bor' onClick={()=>{viewRules(record)}}>查看</Button> : unDisabled ? <Button className="c2a3 bor" href={`/managements/expert/task/review/rules/${1}/${record.id}/?status=${record.status}&name=${record.name}&createdAt=${record.createdAt}&collectingEndTime=${record.collectingEndTime}&choosingDays=${record.choosingDays}`}>编辑</Button> : <Button className='c2a3 disabled'>编辑</Button>}</div> <div> 评审规则 {record.assignRuleAndExperts ? <Button className='c2a3 bor' onClick={() => { viewRules(record) }}>查看</Button> : unDisabled ? <Button className="c2a3 bor" href={`/managements/expert/task/review/rules/${1}/${record.id}/?status=${record.status}&name=${record.name}&createdAt=${record.createdAt}&collectingEndTime=${record.collectingEndTime}&choosingDays=${record.choosingDays}`}>编辑</Button> : <Button className='c2a3 disabled'>编辑</Button>}</div>
<div> 专家选取 {record.assignRuleAndExperts ? <Button className='c2a3 bor' onClick={()=>{viewExperts(record)}}>查看</Button> : unDisabled ? <Button className="c2a3 bor" href={`/managements/expert/task/review/select/${1}/${record.id}/?name=${record.name}`}>选择</Button> : <Button className='c2a3 disabled'>选择</Button>}</div> <div> 专家选取 {record.assignRuleAndExperts ? <Button className='c2a3 bor' onClick={() => { viewExperts(record) }}>查看</Button> : unDisabled ? <Button className="c2a3 bor" href={`/managements/expert/task/review/select/${1}/${record.id}/?name=${record.name}`}>选择</Button> : <Button className='c2a3 disabled'>选择</Button>}</div>
<div> 评审任务 {record.assignRuleAndExperts ? <Button className='c2a3 disabled'>已发布</Button> : unDisabled ? <Button className='c2a3 full' onClick={()=>{publishTaskReview(record)}}>发布</Button> : <Button className='c2a3 disabled'>发布</Button>}</div> <div> 评审任务 {record.assignRuleAndExperts ? <Button className='c2a3 disabled'>已发布</Button> : unDisabled ? <Button className='c2a3 full' onClick={() => { publishTaskReview(record) }}>发布</Button> : <Button className='c2a3 disabled'>发布</Button>}</div>
<div> 评审结果 {record.assignRuleAndExperts ? <Button className="c2a3 bor" href={`/managements/expert/task/review/results/${1}/${record.id}/#status=${record.status}&name=${record.name}&taskModeId=${record.taskModeId}`}>查看</Button>:<Button className='c2a3 disabled'>查看</Button>}</div> <div> 评审结果 {record.assignRuleAndExperts ? <Button className="c2a3 bor" href={`/managements/expert/task/review/results/${1}/${record.id}/#status=${record.status}&name=${record.name}&taskModeId=${record.taskModeId}`}>查看</Button> : <Button className='c2a3 disabled'>查看</Button>}</div>
</div> </div>
} }
function downloadFile() {
window.open(main_web_site_url + '/admin/tasks.xlsx');
}
function disabledDate(current) { function disabledDate(current) {
return current && current < moment(checkedItem.eachPhaseEndTime).endOf('day'); return current && current < moment(checkedItem.eachPhaseEndTime).endOf('day');
} }
@ -534,7 +531,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
} }
function delayTime() { function delayTime() {
validateFields(['delayedTo'],(err, values) => { validateFields(['delayedTo'], (err, values) => {
if (!err) { if (!err) {
delayTask({ delayTask({
taskId: checkedItem.id, taskId: checkedItem.id,
@ -552,13 +549,13 @@ export default Form.create()(({ form, showNotification, match, history, state })
}); });
} }
function restartTask(){ function restartTask() {
validateFields(["restartEndTime"],(err, values) => { validateFields(["restartEndTime"], (err, values) => {
if (!err) { if (!err) {
resetTask({ resetTask({
taskId: checkedItem.id, taskId: checkedItem.id,
endTime: moment(values.restartEndTime).format(format) endTime: moment(values.restartEndTime).format(format)
}).then(res => { }).then(res => {
if (res && res.message === 'success') { if (res && res.message === 'success') {
showNotification('操作成功'); showNotification('操作成功');
setReload(Math.random()); setReload(Math.random());
@ -569,6 +566,26 @@ export default Form.create()(({ form, showNotification, match, history, state })
}); });
} }
function changeOrderNum() {
validateFields(["orderNum"], (err, values) => {
if (!err) {
changePinnedTaskSort([{
id: checkedItem.id,
orderNum: values.orderNum
}]
).then(res => {
if (res && res.data) {
showNotification('操作成功');
setOrderVisible(false);
setReload(Math.random())
} else {
showNotification(res && res.message || '操作失败')
}
})
}
});
}
return ( return (
<div className="task-manage-all "> <div className="task-manage-all ">
<div className='management-content-head'> <div className='management-content-head'>
@ -594,27 +611,27 @@ export default Form.create()(({ form, showNotification, match, history, state })
<div className="center-right-but time"> <div className="center-right-but time">
{helper( {helper(
"发布时间:", "发布时间:",
"startTime", "startTime",
[], [],
<DatePicker <DatePicker
showTime showTime
format={format} format={format}
placeholder="请选择开始时间" placeholder="请选择开始时间"
/> />
)} )}
{helper( {helper(
"", "",
"endTime", "endTime",
[], [],
<DatePicker <DatePicker
showTime showTime
format={format} format={format}
placeholder="请选择结束时间" placeholder="请选择结束时间"
/> />
)} )}
</div> </div>
{helper( {helper(
@ -624,7 +641,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
<Select <Select
className="column-select" className="column-select"
showArrow showArrow
onChange={(value)=>{setStatusString(value);setCurPage1(1);}} onChange={(value) => { setStatusString(value); setCurPage1(1); }}
> >
<Option key={'0,1,2,3,4,5,6,7,8,9'} >全部</Option> <Option key={'0,1,2,3,4,5,6,7,8,9'} >全部</Option>
{ {
@ -644,7 +661,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
className="column-select" className="column-select"
showArrow showArrow
placeholder="请选择审核状态" placeholder="请选择审核状态"
onChange={(value)=>{setShowUserMode(value);setCurPage1(1);}} onChange={(value) => { setShowUserMode(value); setCurPage1(1); }}
> >
<Option key={'0,1,2'}>全部</Option> <Option key={'0,1,2'}>全部</Option>
{ {
@ -656,7 +673,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
'0,1,2' '0,1,2'
)} )}
{helper( {helper(
"发布方式", "发布方式",
"publishMode1", "publishMode1",
@ -664,7 +681,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
<Select <Select
className="column-select" className="column-select"
showArrow showArrow
onChange={(value)=>{setPublishMode(value);setCurPage1(1);}} onChange={(value) => { setPublishMode(value); setCurPage1(1); }}
> >
<Option key={'0,1'} >全部</Option> <Option key={'0,1'} >全部</Option>
<Option key={'0'} >自主提交</Option> <Option key={'0'} >自主提交</Option>
@ -679,7 +696,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
<Select <Select
className="column-select" className="column-select"
showArrow showArrow
onChange={(value)=>{setExpertReview(value);setCurPage1(1);}} onChange={(value) => { setExpertReview(value); setCurPage1(1); }}
> >
<Option key={'-1'} >全部</Option> <Option key={'-1'} >全部</Option>
<Option key={'1'} >已提交评审</Option> <Option key={'1'} >已提交评审</Option>
@ -687,63 +704,61 @@ export default Form.create()(({ form, showNotification, match, history, state })
</Select>, </Select>,
'-1' '-1'
)} )}
{/* <div className='center-right-but search'> */} {helper(
{helper( "显示状态",
"显示状态", "showStatus",
"showStatus", [],
[], <Select
<Select className="column-select"
className="column-select" showArrow
showArrow onChange={changeShow}
onChange={changeShow} >
> <Option key={'0'} >正常显示</Option>
<Option key={'0'} >正常显示</Option> <Option key={'1'} >已隐藏</Option>
<Option key={'1'} >已隐藏</Option> </Select>,
</Select>, '0'
'0' )}
)} {helper(
{helper( "是否推荐",
"是否推荐", "isRecommend",
"isRecommend", [],
[], <Select
<Select className="column-select"
className="column-select" showArrow
showArrow onChange={changeRecommend}
onChange={changeRecommend} >
> <Option key={'all'} >不限</Option>
<Option key={'all'} >不限</Option> <Option key={'0'} >未推荐</Option>
<Option key={'0'} >未推荐</Option> <Option key={'1'} >已推荐</Option>
<Option key={'1'} >已推荐</Option> </Select>,
</Select>, 'all'
'all' )}
)} {helper(
{helper( "排序",
"排序", "sortBy",
"sortBy", [],
[], <Select
<Select className="column-select"
className="column-select" showArrow
showArrow onChange={changeSortName}
onChange={changeSortName} >
> <Option key={'default'} >默认</Option>
<Option key={'createdAt'} >创建时间</Option> <Option key={'createdAt'} >创建时间</Option>
<Option key={'publishedAt'} >发布时间</Option> <Option key={'publishedAt'} >发布时间</Option>
</Select>, </Select>,
'createdAt' 'default'
)} )}
<div className="button-div"> <div className="button-div">
{/* <a href="/admin/tasks.xlsx" class="fr edu-default-btn edu-blueback-btn plr30">导出</a> downloadFile*/} <Button className="mr10" type="primary" onClick={onSearch}>搜索</Button>
<Button className="mr10" type="primary" onClick={onSearch}>搜索</Button> <Button className="mr10" onClick={clearSearch}>清除</Button>
<Button className="mr10" onClick={clearSearch}>清除</Button> <Button loading={downloading} className="mr10" type="primary" onClick={() => { setDownloading(true) }}>导出</Button>
<Button loading={downloading} className="mr10" type="primary" onClick={()=>{setDownloading(true)}}>导出</Button> </div>
</div> <span className={classNames({ "sort-active": sort === 'Desc', 'sort-icon': true, 'mt5': true })} onClick={() => { changeSort('Desc') }}>
<span className={classNames({ "sort-active": sort === 'Desc', 'sort-icon': true, 'mt5': true })} onClick={() => { changeSort('Desc') }}> <i className="fa fa-long-arrow-down font-16 "></i>
<i className="fa fa-long-arrow-down font-16 "></i> </span>
</span> <span className={classNames({ "sort-active": sort === 'Asc', 'sort-icon': true, 'mt5': true })} onClick={() => { changeSort('Asc') }}>
<span className={classNames({ "sort-active": sort === 'Asc', 'sort-icon': true, 'mt5': true })} onClick={() => { changeSort('Asc') }}> <i className="fa fa-long-arrow-up font-16 "></i>
<i className="fa fa-long-arrow-up font-16 "></i> </span>
</span>
{/* </div> */}
</div> </div>
</div> </div>
<div className="center-content taskListCont"> <div className="center-content taskListCont">
@ -754,58 +769,76 @@ export default Form.create()(({ form, showNotification, match, history, state })
columns={columns} columns={columns}
total={total} total={total}
current={curPage} current={curPage}
setCurPage={(page)=>{setCurPage1(page)}} setCurPage={(page) => { setCurPage1(page) }}
className="expertReviewTable" className="expertReviewTable"
expandedRowRender={ExpertDetail} expandedRowRender={ExpertDetail}
expandedRowKeys={reviewTaskId} expandedRowKeys={reviewTaskId}
/> />
</div> </div>
<Modal <Modal
title="请输入延期截止的具体时间" title="请输入延期截止的具体时间"
visible={visible} visible={visible}
onOk={delayTime} onOk={delayTime}
onCancel={() => { setVisible(false) }} onCancel={() => { setVisible(false) }}
className="time-edit-modal" className="time-edit-modal"
destroyOnClose destroyOnClose
> >
{helper( {helper(
"", "",
"delayedTo", "delayedTo",
[{ required: true, message: "请选择日期" }], [{ required: true, message: "请选择日期" }],
<DatePicker <DatePicker
format={formatDelay} format={formatDelay}
placeholder="请选择日期" placeholder="请选择日期"
disabledDate={disabledDate} disabledDate={disabledDate}
/>, />,
null null
)} )}
</Modal> </Modal>
<Modal <Modal
title="重启任务" title="重启任务"
visible={restartVisible} visible={restartVisible}
onOk={restartTask} onOk={restartTask}
onCancel={() => { setRestartVisible(false) }} onCancel={() => { setRestartVisible(false) }}
// className="time-edit-modal" // className="time-edit-modal"
destroyOnClose destroyOnClose
> >
<div>当前任务将恢复至<span className="imoptantText">{statusArr[checkedItem.currentStatus]}</span>请选择该阶段的截止日期</div> <div>当前任务将恢复至<span className="imoptantText">{statusArr[checkedItem.currentStatus]}</span>请选择该阶段的截止日期</div>
{helper( {helper(
"", "",
"restartEndTime", "restartEndTime",
[{ required: true, message: "请选择时间" }], [{ required: true, message: "请选择时间" }],
<DatePicker <DatePicker
format={format} format={format}
placeholder="请选择时间" placeholder="请选择时间"
disabledDate={disabledDate2} disabledDate={disabledDate2}
/>, />,
moment(moment(new Date()).format(formatDelay)+' 23:59:59') moment(moment(new Date()).format(formatDelay) + ' 23:59:59')
)} )}
</Modal> </Modal>
<ExportTable downloading={downloading} setDownloading={setDownloading}/> <Modal
title="请输入排序值,请输入正整数"
visible={orderVisible}
onOk={changeOrderNum}
onCancel={() => { setOrderVisible(false) }}
className="time-edit-modal"
destroyOnClose
>
{helper(
"",
"orderNum",
[{ required: true, message: "请输入正整数" }],
<InputNumber min={0} max={2100000000} precision={0} />
)}
</Modal>
{/* 导出创客任务的组件 */}
<ExportTable downloading={downloading} setDownloading={setDownloading} />
</div> </div>
) )

View File

@ -2,6 +2,7 @@ import React, { useEffect, useState } from "react";
import { Form, Input, Button, Checkbox } from "antd"; import { Form, Input, Button, Checkbox } from "antd";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
import { Base64 } from 'js-base64';
// import educoderLogo from '../login/educoder.png'; // import educoderLogo from '../login/educoder.png';
import openKylin from '../login/openKylin.svg'; import openKylin from '../login/openKylin.svg';
import gitLink from '../login/gitLink.png'; import gitLink from '../login/gitLink.png';
@ -32,7 +33,7 @@ function Login(props) {
if (!err) { if (!err) {
axios.post(`/accounts/login.json`, { axios.post(`/accounts/login.json`, {
login: values.username, login: values.username,
password: values.password, password: Base64.encode(values.password),
autologin: values.remember ? 1 : 0, autologin: values.remember ? 1 : 0,
}).then((response) => { }).then((response) => {
if (!response.data.login) { if (!response.data.login) {

View File

@ -149,11 +149,17 @@
color: #808080; color: #808080;
font-size: 0.9em; font-size: 0.9em;
} }
.message, .ant-form-explain{ .ant-form-explain{
position: absolute; position: absolute;
bottom: -1.45em; bottom: -1.45em;
color: #D40000; color: #D40000;
font-size: 13px; font-size: 13px;
}
.message{
position: absolute;
// bottom: -1.45em;
color: #D40000;
font-size: 13px;
} }
.message.active{ .message.active{
margin-bottom: -30px !important; margin-bottom: -30px !important;