|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
|
|
|
|
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 moment from 'moment';
|
|
|
|
|
|
|
|
|
|
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 { getRules, selectExpertList } from 'src/military/expert/api';
|
|
|
|
@ -37,7 +37,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
const [recommend, setRecommend] = useState('');
|
|
|
|
|
|
|
|
|
|
const [sort, setSort] = useState('Desc');
|
|
|
|
|
const [order, setOrder] = useState('createdAt');
|
|
|
|
|
const [order, setOrder] = useState('default');
|
|
|
|
|
const [searchObj, setSearchObj] = useState({});
|
|
|
|
|
const [curPage, setCurPage] = useState(hashDate(hash) || 1);
|
|
|
|
|
const [total, setTotal] = useState(0);
|
|
|
|
@ -58,6 +58,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
const [reviewTaskId, setReviewTaskId] = useState(undefined);
|
|
|
|
|
const [visible, setVisible] = useState(false); //延期任务modal
|
|
|
|
|
const [checkedItem, setCheckedItem] = useState('');
|
|
|
|
|
const [orderVisible, setOrderVisible] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setCurPage(hashDate(hash) || 1);
|
|
|
|
@ -71,7 +72,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
showUserMode: showUserMode.length > 1 ? '' : showUserMode,
|
|
|
|
|
curPage,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
orderBy: order + sort,
|
|
|
|
|
orderBy: order === 'default' ? '' : order + sort,
|
|
|
|
|
isDelete,
|
|
|
|
|
recommend,
|
|
|
|
|
expertReview: expertReview === '-1' ? "" : expertReview,
|
|
|
|
@ -124,7 +125,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
expertReviewStatus: '-1',
|
|
|
|
|
showStatus: '0',
|
|
|
|
|
isRecommend: 'all',
|
|
|
|
|
sortBy: 'createdAt'
|
|
|
|
|
sortBy: 'default'
|
|
|
|
|
});
|
|
|
|
|
setStatusString('0,1,2,3,4,5,6,7,8,9');
|
|
|
|
|
setShowUserMode('0,1,2');
|
|
|
|
@ -132,10 +133,11 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
setExpertReview('-1');
|
|
|
|
|
setIsDelete('0');
|
|
|
|
|
setRecommend('');
|
|
|
|
|
setOrder("createdAt");
|
|
|
|
|
setOrder("default");
|
|
|
|
|
setSearchObj({});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 延期任务
|
|
|
|
|
function delayClick(item, restart) {
|
|
|
|
|
setCheckedItem(item);
|
|
|
|
|
if (restart) {
|
|
|
|
@ -145,12 +147,12 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 主列表
|
|
|
|
|
const columns = useMemo(() => {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
title: '任务编号',
|
|
|
|
|
dataIndex: 'number',
|
|
|
|
|
width: "26%"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '任务名称',
|
|
|
|
@ -215,6 +217,11 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
</Select>
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '排序',
|
|
|
|
|
key: 'orderNum',
|
|
|
|
|
dataIndex: 'orderNum'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
|
|
|
@ -226,24 +233,13 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{[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>}
|
|
|
|
|
<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 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>
|
|
|
|
|
: <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> */}
|
|
|
|
|
<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>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
)},
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
}, [isDelete, curPage]);
|
|
|
|
@ -300,6 +296,11 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
];
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
// 打开排序弹框后执行赋值语句
|
|
|
|
|
useEffect(()=>{
|
|
|
|
|
orderVisible&&setFieldsValue({ orderNum: checkedItem.orderNum })
|
|
|
|
|
},[orderVisible])
|
|
|
|
|
|
|
|
|
|
// function resetTaskModal
|
|
|
|
|
|
|
|
|
|
function recommendItem(id, recommend) {
|
|
|
|
@ -521,10 +522,6 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function downloadFile() {
|
|
|
|
|
window.open(main_web_site_url + '/admin/tasks.xlsx');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function disabledDate(current) {
|
|
|
|
|
return current && current < moment(checkedItem.eachPhaseEndTime).endOf('day');
|
|
|
|
|
}
|
|
|
|
@ -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 (
|
|
|
|
|
<div className="task-manage-all ">
|
|
|
|
|
<div className='management-content-head'>
|
|
|
|
@ -687,7 +704,6 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
</Select>,
|
|
|
|
|
'-1'
|
|
|
|
|
)}
|
|
|
|
|
{/* <div className='center-right-but search'> */}
|
|
|
|
|
{helper(
|
|
|
|
|
"显示状态",
|
|
|
|
|
"showStatus",
|
|
|
|
@ -726,13 +742,13 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
showArrow
|
|
|
|
|
onChange={changeSortName}
|
|
|
|
|
>
|
|
|
|
|
<Option key={'default'} >默认</Option>
|
|
|
|
|
<Option key={'createdAt'} >创建时间</Option>
|
|
|
|
|
<Option key={'publishedAt'} >发布时间</Option>
|
|
|
|
|
</Select>,
|
|
|
|
|
'createdAt'
|
|
|
|
|
'default'
|
|
|
|
|
)}
|
|
|
|
|
<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" onClick={clearSearch}>清除</Button>
|
|
|
|
|
<Button loading={downloading} className="mr10" type="primary" onClick={() => { setDownloading(true) }}>导出</Button>
|
|
|
|
@ -743,7 +759,6 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
<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>
|
|
|
|
|
</span>
|
|
|
|
|
{/* </div> */}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="center-content taskListCont">
|
|
|
|
@ -805,6 +820,24 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|
|
|
|
)}
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
<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>
|
|
|
|
|