修改专家评审初始化代码

This commit is contained in:
何童崇 2022-01-24 16:19:12 +08:00
parent fdc9d9432e
commit b927d471a5
2 changed files with 26 additions and 19 deletions

View File

@ -20,12 +20,16 @@ function ReviewTasks({ form, showNotification, match, history }) {
const [dataList, setDataList] = useState([]);
const [total, setTotal] = useState(0);
const [searchObj, setSearchObj] = useState({
let initSearchObj = sessionStorage.expertTask ? JSON.parse(sessionStorage.expertTask) : {
containerName: '',
containerType: 1,
statusString:-1,
});
statusString: -1,
};
const [searchObj, setSearchObj] = useState(initSearchObj);
useEffect(() => {
setFieldsValue(initSearchObj);
}, []);
const columns = useMemo(() => {
return [
@ -59,7 +63,7 @@ function ReviewTasks({ form, showNotification, match, history }) {
dataIndex: 'status',
key: 'status',
render: (text, record) => {
return text === -1 ? '未评审' : record.commitReview ? '已评审':'已过期'
return text === -1 ? '未评审' : record.commitReview ? '已评审' : '已过期'
}
},
{
@ -98,20 +102,19 @@ function ReviewTasks({ form, showNotification, match, history }) {
function onSearch() {
let values = getFieldsValue(['containerName', 'containerType', 'statusString']);
sessionStorage.setItem('expertTask', JSON.stringify(values));
setSearchObj(values);
}
function clearSearch() {
setFieldsValue({
let initSearchObj={
containerName: '',
containerType: 1,
statusString: -1,
});
setSearchObj({
containerName: '',
containerType: 1,
statusString: -1,
});
};
setFieldsValue(initSearchObj);
setSearchObj(initSearchObj);
sessionStorage.setItem('expertTask', JSON.stringify(initSearchObj));
setCurPage(1);
}
@ -123,6 +126,12 @@ function ReviewTasks({ form, showNotification, match, history }) {
</Form.Item>
), []);
function onShowSizeChange(current, pageSize) {
setCurPage(current);
setPageSize(pageSize);
}
return (
<div className='register_right task_right'>
<p className="task-head">
@ -147,7 +156,6 @@ function ReviewTasks({ form, showNotification, match, history }) {
style={{ width: "250px" }}
placeholder="所有领域"
dropdownClassName="expert_register"
// onChange={(value) => { setSearchReviewArea(value) }}
>
{taskType.map(item => {
return <Option key={item.value} value={item.value}>{item.label}</Option>
@ -185,6 +193,7 @@ function ReviewTasks({ form, showNotification, match, history }) {
total={total}
setCurPage={setCurPage}
current={curPage}
onShowSizeChange={onShowSizeChange}
/>
</div>
)

View File

@ -63,7 +63,6 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
return text && text.map(item => {
return <Tooltip key={item.id} overlayClassName="expert-tooltip" title={item.fileName} placement="top">
<p className="link" onClick={() => { downFile(item) }}>{item.fileName}</p>
{/* <a className="link" href={main_web_site_url + item.fileDownPath} download={item.fileName}>{item.fileName}</a> */}
</Tooltip>
})
}
@ -212,8 +211,6 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
let dataArr = [];
if (res && Array.isArray(res.data)) {
for (const item of res.data) {
let fileId = item.work_attachments && item.work_attachments.split('?')[0].split('/')[3];
console.log(fileId);
dataArr.push({
comments: "",
expertId: current_user.expertId,
@ -224,8 +221,8 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
gradesThree: '',
gradesTwo: '',
opsContent: item.works_remark,
opsFiles: fileId,
opsFilesAttachments: item.work_attachments ? [{ id: fileId, fileName: '作品下载', fileDownPath: item.work_attachments }] : [],
opsFiles: item.work_file.id,
opsFilesAttachments: item.work_file,
opsId: item.id,
opsParentId: containerId,
opsParentType: containerType,
@ -235,6 +232,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
}
}
setDataList(dataArr);
!dataArr.length && setLoading(false);
disabled && setLoading(false);
!disabled && dataArr.length && rules && initScoringDetails(dataArr).then(res => {
if (res) {
@ -251,7 +249,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
let url = httpUrl + '/busiAttachments/download/' + item.id;
window.open(url);
} else {
let url = main_web_site_url + item.fileDownPath;
let url = main_web_site_url + `/attachments/send_file/${item.id}?disposition=attachment`;
window.open(url);
}
}
@ -443,7 +441,7 @@ function ReviewTasks({ showNotification, match, history, current_user }) {
<div className="rules-content-item">
<span className="font-w">{containerType == 1 ? '任务' : '赛事'}链接</span>
{containerType == 1 && <Link className="taskLink ml10" target="_blank" to={`/task/taskDetail/${rules.containerId}`} >{`${window.location.origin}/task/taskDetail/${rules.containerId}`}</Link>}
{containerType == 2 && <Link className="taskLink ml10" target="_blank" to={`${main_web_site_url}/competitions/${rules.containerId}/home`} >{`${main_web_site_url}/competitions/${rules.containerId}/home`}</Link>}
{containerType == 2 && <a className="taskLink ml10" target="_blank" href={`${main_web_site_url}/competitions/${rules.containerId}/home`} >{`${main_web_site_url}/competitions/${rules.containerId}/home`}</a>}
</div>
</div>
</div>