From 3260e2483b5e776feb9963a651c2d51aa69bed7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <1261960504@qq.com> Date: Wed, 5 Jan 2022 17:40:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=93=E5=88=86=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/paginationTable/index.jsx | 8 +- .../components/paginationTable/index.scss | 1 + src/military/expert/api.js | 28 +++++ src/military/expert/expertUser/index.jsx | 2 +- .../expert/expertUser/reviewTasks/index.jsx | 44 +++++--- .../expert/expertUser/reviewTasks/index.scss | 4 + .../expert/expertUser/taskDetail/index.jsx | 103 ++++++++++++++---- src/modules/tpm/NewHeader.js | 5 +- src/modules/tpm/TPMIndexHOC.js | 31 +++++- 9 files changed, 178 insertions(+), 48 deletions(-) diff --git a/src/military/components/paginationTable/index.jsx b/src/military/components/paginationTable/index.jsx index 94db6621..22798570 100644 --- a/src/military/components/paginationTable/index.jsx +++ b/src/military/components/paginationTable/index.jsx @@ -3,15 +3,14 @@ import { Table, Pagination } from 'antd'; import './index.scss'; export default (props) => { - const { loading, dataSource, columns, handleRow, total, setCurPage, current, rowSelection, expandedRowRender, expandIconColumnIndex,expandIconAsCell, onShowSizeChange,showSizeChanger } = props; + const { loading, dataSource, columns, handleRow, total, setCurPage, current, rowSelection, expandedRowRender, expandIconColumnIndex, expandIconAsCell, onShowSizeChange, showSizeChanger, pagination } = props; - return (
row.id} + rowKey={(row,i) => row.id || i} dataSource={dataSource} columns={columns} pagination={false} @@ -20,8 +19,9 @@ export default (props) => { expandedRowRender={expandedRowRender} expandIconColumnIndex={expandIconColumnIndex} expandIconAsCell={expandIconAsCell} + /> - {total > 10 && + {total > 10 && (!pagination) && { ( )} diff --git a/src/military/expert/expertUser/reviewTasks/index.jsx b/src/military/expert/expertUser/reviewTasks/index.jsx index 33f1ae34..7996fd72 100644 --- a/src/military/expert/expertUser/reviewTasks/index.jsx +++ b/src/military/expert/expertUser/reviewTasks/index.jsx @@ -1,5 +1,7 @@ import React, { useState, useCallback, useMemo, useEffect } from "react"; import { Input, Select, Button, Form, DatePicker, Table, Pagination, Upload, Modal } from 'antd'; +import { Link } from "react-router-dom"; +import { formatDuring } from 'educoder'; import Paginationtable from "../../../components/paginationTable"; import { getExpertTasks } from "../../api"; import { taskType } from "../../static"; @@ -37,27 +39,29 @@ function ReviewTasks({ form, showNotification, match, history }) { }, { title: '任务名称', - dataIndex: 'expertName', - key: 'expertName', - // render: (text, record) => { - // return record.user ? record.user.nickname || record.user.login : '' - // } + dataIndex: 'containerName', + key: 'containerName', + render: (text, record) => { + return {text} + } }, { title: '评审截止时间', - dataIndex: 'highestDegree', - key: 'highestDegree', + dataIndex: 'reviewEndOn', + key: 'reviewEndOn', }, { title: '剩余评审时间', - dataIndex: 'phone', - key: 'phone', + dataIndex: 'surplus', + key: 'surplus', }, { title: '评审状态', - dataIndex: 'workplace', - key: 'workplace', - + dataIndex: 'status', + key: 'status', + render: (text, record) => { + return text === -1 ? 未审核 : 已审核 + } }, ]; }, []); @@ -71,12 +75,19 @@ function ReviewTasks({ form, showNotification, match, history }) { curPage, statusString: '1,-1', }; - getExpertTasks(params).then(data => { - setDataList(data.rows || []); + getExpertTasks(params).then(res => { + for(const item of res.data.rows){ + if( new Date(item.reviewEndOn)>new Date()){ + item.surplus=formatDuring((new Date(item.reviewEndOn)-new Date())/1000); + }else{ + item.surplus='- -'; + } + } + setDataList(res.data.rows || []); setLoading(false); - setTotal(data.total); + setTotal(res.data.total); }); - }, [searchObj,curPage, reload, pageSize]); + }, [searchObj, curPage, reload, pageSize]); function onSearch() { @@ -104,6 +115,7 @@ function ReviewTasks({ form, showNotification, match, history }) { ), []); + console.log(dataList) return (

diff --git a/src/military/expert/expertUser/reviewTasks/index.scss b/src/military/expert/expertUser/reviewTasks/index.scss index 4d2df119..62bb6bd8 100644 --- a/src/military/expert/expertUser/reviewTasks/index.scss +++ b/src/military/expert/expertUser/reviewTasks/index.scss @@ -29,5 +29,9 @@ } .pagination-table{ margin:0 2rem; + + .red{ + color: #DE0000; + } } } diff --git a/src/military/expert/expertUser/taskDetail/index.jsx b/src/military/expert/expertUser/taskDetail/index.jsx index d3245b8d..f29dd04e 100644 --- a/src/military/expert/expertUser/taskDetail/index.jsx +++ b/src/military/expert/expertUser/taskDetail/index.jsx @@ -1,8 +1,9 @@ import React, { useState, useCallback, useMemo, useEffect } from "react"; -import { Tabs, Input, Select, Button, Form, DatePicker, Table, Pagination, Upload, Modal } from 'antd'; +import { Tabs, Input, Select, Button, Form, DatePicker, InputNumber, Table, Pagination, Upload, Modal } from 'antd'; import { Link } from "react-router-dom"; import Paginationtable from "../../../components/paginationTable"; -import { getExpertTasks } from "../../api"; +import { getScoringDetails, } from "../../api"; +import { readyCheckPapers } from "../../../task/api"; import { taskType } from "../../static"; import { httpUrl } from '../../fetch'; @@ -12,24 +13,29 @@ const Option = Select.Option; const { TabPane } = Tabs; -function ReviewTasks({ form, showNotification, match, history }) { - const id = match.params.id; +function ReviewTasks({ form, showNotification, match, history, current_user }) { + const containerId = match.params.containerId; + const containerType = match.params.containerType; const { getFieldDecorator, setFieldsValue, getFieldsValue } = form; + + // 主table参数 const [reload, setReload] = useState(); const [loading, setLoading] = useState(false); const [curPage, setCurPage] = useState(1); const [pageSize, setPageSize] = useState(10); const [dataList, setDataList] = useState([]); const [total, setTotal] = useState(0); - - //tab栏 - const [activeKey, setActiveKey] = useState(0); - const [searchObj, setSearchObj] = useState({ containerName: '', containerType: 1 }); + const [taskId, setTaskId] = useState(461); + const [competitionId, setCompetitionId] = useState(461); + + //tab栏 + const [activeKey, setActiveKey] = useState(0); + const columns = useMemo(() => { return [ @@ -47,13 +53,21 @@ function ReviewTasks({ form, showNotification, match, history }) { }, { title: '附件下载', - dataIndex: 'highestDegree', - key: 'highestDegree', + dataIndex: 'opsFilesAttachments', + key: 'opsFilesAttachments', + render: (text, record) => { + return text && text.map(item => { + return { downFile(item.id) }}>{item.fileName} + }) + } }, { title: '评分一', dataIndex: 'gradesOne', key: 'gradesOne', + render: (text, record, index) => { + return + } }, { title: '评分二', @@ -88,19 +102,66 @@ function ReviewTasks({ form, showNotification, match, history }) { ]; }, []); - // 获取列表 + // 获取成果列表 + useEffect(() => { + let params = { + taskId, + checkStatus: '1', + pageSize: 10000, + curPage, + status: '', + parentId: 0, + } + taskId && readyCheckPapers(params).then(data => { + let dataArr = []; + if (data && Array.isArray(data.rows)) { + for (const item of data.rows) { + dataArr.push({ + comments: "", + expertId: current_user.expertId, + gradesAverage: '', + gradesFive: '', + gradesFour: '', + gradesOne: '', + gradesThree: '', + gradesTwo: '', + opsContent: item.paperDetail && item.paperDetail.content, + opsFiles: item.paperDetail && item.paperDetail.busiAttachments && item.paperDetail.busiAttachments[0].id, + opsFilesAttachments: item.paperDetail && item.paperDetail.busiAttachments, + opsId: item.id, + opsParentId: containerId, + opsType: containerType, + status: 2 + }); + // item.detail = item.paperDetail && item.paperDetail.content; + // item.busiAttachments = item.paperDetail && item.paperDetail.busiAttachments; + } + } + setDataList(dataArr); + setLoading(false); + }); + }, [taskId]); + + function downFile(id) { + let url = httpUrl + '/busiAttachments/download/' + id; + window.open(url); + } + + // 获取评分列表 useEffect(() => { setLoading(true); let params = { - ...searchObj, - pageSize, - curPage, - statusString: '1,-1', + containerId, + containerType, + isDistinct: false, }; - getExpertTasks(params).then(data => { - setDataList(data.rows || []); - setLoading(false); - setTotal(data.total); + getScoringDetails(params).then(res => { + if (res.data && res.data.rows && res.data.rows.length) { + setDataList(res.data.rows); + setLoading(false); + } else { + containerType == 1 ? setTaskId(containerId) : setCompetitionId(containerId); + } }); }, [curPage, reload, pageSize]); @@ -160,9 +221,7 @@ function ReviewTasks({ form, showNotification, match, history }) { loading={loading} dataSource={dataList} columns={columns} - total={total} - setCurPage={setCurPage} - current={curPage} + pagination={false} /> diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index dfcefaae..5e1a4771 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -606,7 +606,7 @@ class NewHeader extends Component { }) } render() { - const { match } = this.props; + const { match,current_user } = this.props; let { Addcoursestypes, tojoinitemtype, @@ -701,6 +701,7 @@ class NewHeader extends Component { } }) } + return (

@@ -770,7 +771,7 @@ class NewHeader extends Component {
{this.props.user && this.props.user.login && diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index bc81e037..15aebb9f 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -1,7 +1,8 @@ import React from 'react'; import NewHeader from './NewHeader' import NewFooter from './NewFooter' -import { downloadFile } from 'educoder' +import { downloadFile } from 'educoder'; +import { getCurrentExpert } from 'src/military/expert/api'; import axios from 'axios'; import { Spin } from 'antd'; import './TPMIndex.css'; @@ -165,10 +166,34 @@ export function TPMIndexHOC(WrappedComponent, headFoot) { // if (this.props.match.path === "/" && response.data.login) { // this.props.history.push(`/users/${response.data.login}`); // } + + // 考虑到以后部分系统不会用到专家评审系统,所以这里没有使用Promise.All + getCurrentExpert().then(res => { + let isExpert = false; + let expertId = ''; + let expertDraft = false; + if (res && res.data && res.data.length) { + for (const item of res.data) { + if (item.status === 1) { + isExpert = true; + expertId = item.id; + } else { + expertDraft = true; + } + } + } + const newUser = { ...this.state.current_user, isExpert, expertId, expertDraft }; + this.setState({ + user: newUser, + current_user: newUser + }); + }); } }).catch((error) => { console.log(error) - }) + }); + + }; //截取url 数据的 foo = (url) => { @@ -414,7 +439,7 @@ export function TPMIndexHOC(WrappedComponent, headFoot) { {...this.state} {...this.props} Footerdown={Footerdown} /> - } + }
); }