选择评审专家联调完成

This commit is contained in:
unknown 2021-12-31 12:44:29 +08:00
parent a361415ebc
commit 27ee5ff30b
13 changed files with 402 additions and 121 deletions

View File

@ -4,7 +4,7 @@ import './index.scss';
export default (props) => {
const { loading, dataSource, columns, handleRow, total, setCurPage, current, rowSelection, expandedRowRender, expandIconColumnIndex, expandIconAsCell } =props;
return (
<Fragment>
<Table

View File

@ -1,7 +1,7 @@
import fetch from './fetch';
import { notification } from 'antd';
// 任务列表查询
// 专家列表查询
export async function expertList(params) {
let res = await fetch({
url: '/api/experts/',
@ -71,4 +71,42 @@ export function getFile(id) {
url: `/busiAttachments/${id}`,
method: 'get'
});
}
//编辑评审规则
export async function editRules(data){
let res = await fetch({
url: '/api/taskRuleCriteria/editRuleAndCriteria',
method: 'post',
data,
});
return res;
}
//为创客任务添加评审专家
export async function assignExperts(data){
let res = await fetch({
url: '/api/taskExpert/assignExperts',
method: 'post',
data,
});
return res;
}
//删除指派专家
export function deleteExperts(taskExpertId,isDelete) {
console.log('taskExpertId',taskExpertId,'isDelete',isDelete);
return fetch({
url: `/api/taskExpert/${taskExpertId}?isDelete=${isDelete}`,
method: 'delete'
});
}
//已选专家列表
export function selectExpertList(params) {
return fetch({
url: `/api/taskExpert/selectedExpertPageList`,
method: 'get',
params
});
}

View File

@ -1,16 +1,16 @@
import React, { useState } from "react";
import React, { useState, forwardRef } from "react";
import { Input } from 'antd';
const { TextArea } = Input;
//
function WordsInput(props){
const WordsInput = forwardRef((props, _ref) => {
const [wordCount, setWordCount] = useState(0);
return(
<div style={{position:'relative'}}>
<TextArea placeholder={props.placeholder} rows={props.rows} maxLength={props.maxLength} onChange={(e)=>setWordCount(e.target.value.length)}/>
<TextArea placeholder={props.placeholder} rows={props.rows} maxLength={props.maxLength} onChange={(e)=>{setWordCount(e.target.value.length);props.onChange(e.target.value)}}/>
<span style={{ position: 'absolute', bottom: '-4px', right: '12px', fontSize: '12px' }}>{wordCount}/{props.maxLength}</span>
</div>
)
}
})
export default WordsInput;

View File

@ -147,9 +147,9 @@ function RegisterList({ showNotification }) {
item.detail = item.paperDetail && item.paperDetail.content;
}
}
setDataList(data.rows || []);
setDataList(data && data.rows || []);
setLoading(false);
setTotal(data.total);
setTotal(data && data.total);
});
}, [curPage, reload, searchInput, searchReviewArea, expertType]);

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>shanchu_tc_icon</title>
<g id="首页/竞赛" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="7-资料未保存提示语" transform="translate(-804.000000, -400.000000)" fill-rule="nonzero">
<g id="弹窗" transform="translate(684.000000, 298.000000)">
<g id="编组-3备份" transform="translate(121.000000, 102.000000)">
<g id="shanchu_tc_icon" transform="translate(0.000000, 1.000000)">
<path d="M15,0 C6.7155,0 0,6.7155 0,15 C0,23.2845 6.7155,30 15,30 C23.2845,30 30,23.2845 30,15 C30,6.7155 23.2845,0 15,0 Z" id="路径" stroke="#CA0002" stroke-width="1.5" fill="#CA0002"></path>
<path d="M16,20.844 C16,21.3962847 15.5522847,21.844 15,21.844 C14.4477153,21.844 14,21.3962847 14,20.844 L14,20.344 C14,19.7917152 14.4477153,19.344 15,19.344 C15.5522847,19.344 16,19.7917152 16,20.344 L16,20.844 Z" id="路径" fill="#FFFFFF"></path>
<path d="M16,16.656 C16,17.2082847 15.5522847,17.656 15,17.656 C14.4477153,17.656 14,17.2082847 14,16.656 L14,9.15600001 C14,8.60371526 14.4477153,8.15600001 15,8.15600001 C15.5522847,8.15600001 16,8.60371526 16,9.15600001 L16,16.656 Z" id="路径" fill="#FFFFFF"></path>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g id="组_58" data-name="组 58" transform="translate(-465 -602)">
<g id="注意_2_" data-name="注意 (2)" transform="translate(465 602)">
<path id="形状" d="M0,8a8,8,0,1,1,8,8A8,8,0,0,1,0,8Z" fill="#3078ff"/>
</g>
<g id="感叹号2" transform="translate(-3.7 417.189)">
<path id="路径_12" data-name="路径 12" d="M486.4,189.83v4.85a.3.3,0,0,0,.591,0v-4.85A.3.3,0,0,0,486.4,189.83Z" transform="translate(-9.727)" fill="#fff"/>
<path id="路径_13" data-name="路径 13" d="M476.969,759.04m-.409,0a.409.409,0,1,0,.409-.409A.409.409,0,0,0,476.559,759.04Z" transform="translate(0 -562.513)" fill="#fff"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 748 B

View File

@ -1,22 +1,56 @@
import React, { Component } from "react";
import { Button, DatePicker, Form } from "antd";
import { Button, DatePicker, Form, message } from "antd";
import WordsInput from "../components/wordsInput";
import './index.scss';
import '../index.scss';
import Link from "react-router-dom/Link";
import { editRules } from "../api";
const {RangePicker} = DatePicker;
function ReviewRules(props) {
const { getFieldDecorator } = props.form;
function ReviewRules({ location, form, history,state, navigation }) {
const { getFieldDecorator} = form;
const { taskRecord } = location && location.state;
console.log('taskRecord',taskRecord);
function rulesSubmit(){
form.validateFields((err, values) => {
if (!err) {
let data = {
containerId: taskRecord.id,
containerName: taskRecord.name,
containerType: 1,
criteriaOne: values.criteria1,
reviewStartOn: values.reviewDate[0].format('YYYY-MM-DD HH:mm:ss'),
reviewEndOn: values.reviewDate[1].format('YYYY-MM-DD HH:mm:ss'),
rule: values.reviewRule,
criteriaTwo: values.criteria2,
criteriaThree: values.criteria3,
criteriaFour: values.criteria4,
criteriaFive: values.criteria5,
status: 3
}
editRules(data).then(response=>{
console.log('response',response);
if(response && response.message === '成功'){
message.success('保存成功');
}else{
message.error(response.message);
}
})
}
})
}
return (
<div className="centerbox setRules">
<div className="head_title mb20">
<div className="-layout pb10">
<span className="font-16">任务信息</span>
<button className="but41_border">返回上一页</button>
<button className="but41_border" onClick={()=>{history.goBack()}}>返回上一页</button>
</div>
<p className="mt10">任务名称</p>
<p className="mt10 pb20">任务链接</p>
<p className="mt10">任务名称<span className="ml10">{taskRecord.name}</span></p>
<p className="mt10 pb20">任务链接<Link className="taskLink ml10" target="_blank" to={`/task/taskDetail/${taskRecord.id}`} >{`/task/taskDetail/${taskRecord.id}`}</Link></p>
</div>
<Form className="pt10">
<Form.Item
@ -85,14 +119,15 @@ function ReviewRules(props) {
<RangePicker
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
placeholder={['Start Time', 'End Time']}
placeholder={['开始时间', '结束时间']}
/>,
)}
</Form.Item>
</Form>
<div className="rules_buttom mt20">
<button className="but41_fill">保存</button>
<button className="butE3_border ml30">取消</button>
<button className="but41_fill" onClick={rulesSubmit}>保存</button>
<button className="butE3_border ml30" onClick={()=>{history.goBack()}}>取消</button>
</div>
</div>
)

View File

@ -1,7 +1,7 @@
import React, { useState, useEffect, useMemo } from "react";
import { Tabs, Input, Select, Button, Modal, Form } from 'antd';
import { Tabs, Input, Select, Button, Modal, Form, message } from 'antd';
import { professionalType, reviewArea } from '../static.js';
import { expertList } from "../api.js";
import { assignExperts, deleteExperts, expertList, selectExpertList } from "../api.js";
import Paginationtable from "../../components/paginationTable";
import './index.scss';
import '../index.scss';
@ -12,18 +12,9 @@ const { Option } = Select;
const { Search } = Input;
function SelectExpert(props) {
const { history, showNotification, form, location } = props;
const { getFieldDecorator, setFieldsValue, getFieldsValue } = form;
const { history, form, location, current_user } = props;
const { getFieldDecorator, setFieldsValue } = form;
const { taskRecord } = location && location.state;
console.log('信息', taskRecord);
// const TaskDetail = (
// <div>
// <p></p>
// <p className="mt10"></p>
// <p className="mt10 pb20"></p>
// </div>
// )
const [reload, setReload] = useState();
const [loading, setLoading] = useState(false);
const [curPage, setCurPage] = useState(1);
@ -33,16 +24,25 @@ function SelectExpert(props) {
const [searchInput, setSearchInput] = useState('');
const [expertType, setExpertType] = useState('');
const [reviewAreaSel, setReviewAreaSel] = useState('');
//
const [selectExperts, setSelectExperts] = useState(false);
//
const [okConfirmExps, setOkConfirmExps] = useState(false);
//-
const [selectExpertCount, setSelectExpertCount] = useState(0);
//
const [okConfirmDelete, setOkConfirmDelete] = useState(false);
//
const [selectedRowKeys, setSelectedRowKeys] = useState(undefined);
//
const [okConfirmExtract, setOkConfirmExtract] = useState(false);
//
const [deleteExperts, setDeleteExperts] = useState(false);
//
const [randomCount, setRandomCount] = useState(undefined);
//
const [randomErrorMessage, setRandomErrorMessage] = useState(undefined);
//tab
const [activeKey, setActiveKey] = useState(0);
//
const [selectedExperts, setSelectExperts] = useState([]);
const [selectedExpertTotal, setSelectedExpertTotal] = useState(0);
//
const [allSelectedExpertsId, setAllSelectedExpertsId] = useState();
const columns = useMemo(() => {
return [
@ -85,6 +85,9 @@ function SelectExpert(props) {
title: '专家评分',
dataIndex: 'expertScore',
align: 'center',
render:(text,record)=>{
return record.expertScore || '--';
}
},
{
title: '操作',
@ -93,29 +96,69 @@ function SelectExpert(props) {
align: 'center',
render: (text, record) => {
return <React.Fragment>
<Button className="mr5 font-12" type="primary" size="small" onClick={() => { check(record, '1') }}>专家详情</Button>
<Button className="mr5 font-12" type="danger" size="small" onClick={() => { check(record, '2') }}>已添加</Button>
{activeKey == "1" && (record.isExpertTask ? <span className="selected">已添加</span> : <a className="select" onClick={()=>{SelectExperts([record.id])}}>添加</a>)}
{activeKey == "0" && <Button className="mr5 font-12" type="danger" size="small" onClick={() => { deleteExpert(record.taskExpertId, record.id) }}>删除</Button>}
</React.Fragment>
}
}
];
}, []);
}, [activeKey, allSelectedExpertsId]);
const rowSelection = {
selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
setSelectExpertCount(selectedRows.length);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows, selectedRows.length);
setSelectedRowKeys(selectedRowKeys);
},
getCheckboxProps: record => ({
name: record.name,
}),
getCheckboxProps: record =>{
return record.isExpertTask ? {disabled: true} : {};
}
};
// const SelectExpertsBus = (
// <button className="but41_fill" onClick={() => setSelectExperts(false)}></button>
// )
const ExpertDetail = (record)=>{
return <div className="expert_detail_div df">
<div>
<p>工作单位{record.workplace}</p>
<p>单位类别{record.workplaceType}</p>
<p>工作性质{record.workNature}</p>
<p>职称职级{record.titleRank}</p>
</div>
<div>
<p>邮箱地址{record.expertEmail || '--'}</p>
<p>毕业院校{record.graduatedFrom || '--'}</p>
<p>院校专业{record.major || '--'}</p>
</div>
<div>
<p>身份证号{record.idNumber || '--'}</p>
<p>开户银行{record.bankName || '--'}</p>
<p>银行账号{record.bankAccount || '--'}</p>
</div>
</div>
}
//
//
useEffect(()=>{
setLoading(true);
const params = {
containerId: taskRecord.id,
containerType: 1,
curPage:curPage,
pageSize: 10000,
curPage: 1,
}
selectExpertList(params).then(response=>{
if (response && response.data && Array.isArray(response.data.rows)) {
const ids = new Set();
response.data.rows.map((item)=>{
ids.add(item.id);
})
setAllSelectedExpertsId(ids);
}
}).finally(()=>{
setLoading(false);
})
},[])
//
useEffect(() => {
setLoading(true);
let params = {
@ -130,42 +173,114 @@ function SelectExpert(props) {
if (data && Array.isArray(data.rows)) {
let index = 1;
for (const item of 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);
allSelectedExpertsId && allSelectedExpertsId.length!==0 && (item.isExpertTask = allSelectedExpertsId.has(item.id));
}
}
setDataList(data.rows || []);
setDataList(data && data.rows);
setLoading(false);
setTotal(data.total);
setTotal(data && data.total);
});
}, [curPage, reload, searchInput, expertType, reviewAreaSel]);
}, [curPage, reload, searchInput, expertType, reviewAreaSel, allSelectedExpertsId]);
function check(record, checkStatus) {
Modal.confirm({
title: "警告",
content: checkStatus == '1' ? "确认通过吗?通过后该用户将成为专家库的一员" : "确认拒绝吗?拒绝后该用户此次不能成为专家",
okText: '确定',
cancelText: '取消',
onOk() {
// registerCheck({
// expertId: record.id,
// isPassed: checkStatus,
// userId: record.userId,
// }).then(res => {
// if (res.message === 'success') {
// showNotification('!');
// setReload(Math.random());
// }
// });
},
});
//
useEffect(()=>{
setLoading(true);
const params = {
containerId: taskRecord.id,
containerType: 1,
curPage,
pageSize,
}
selectExpertList(params).then(response=>{
if (response && response.data && Array.isArray(response.data.rows)) {
let index = 1;
for (const item of response.data.rows) {
item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo ? `${item.reviewAreaTwo}`:''} ${item.reviewAreaThree ? `${item.reviewAreaThree}`:''}`;
item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0);
}
setSelectExperts(response && response.data.rows);
setSelectedExpertTotal(response && response.data.total);
}
}).finally(()=>{
setLoading(false);
})
},[curPage, reload])
//
function random(){
setRandomErrorMessage('');
if(!randomCount){
setRandomErrorMessage('请输入随机抽取的专家数量!');
}else if(isNaN(randomCount)){
setRandomErrorMessage('请输入数字!');
}else{
let params = {
searchInput,
expertType: expertType === 'all' ? '' : expertType,
reviewArea: reviewAreaSel === 'all' ? '' : reviewAreaSel,
randomCount,
curPage:1,
pageSize: 10000,
selectedExpertIds: Array.from(allSelectedExpertsId).toString(),
};
expertList(params).then(response=>{
if(response && Array.isArray(response.rows)){
const randomIds = [];
response.rows.map(item=>{
randomIds[randomIds.length] = item.id;
})
SelectExperts([...randomIds]);
setOkConfirmExtract(false);
}
})
}
}
//
const SelectExperts = (id) =>{
const params = {
assignorId: parseInt(current_user.user_id),
containerId: taskRecord.id,
containerName: taskRecord.name,
containerType: 1,
expertIds: id.toString(),
status: 3
}
assignExperts(params).then(response=>{
if(response && response.message === '专家指派成功'){
setOkConfirmExps(false);
message.success(response.message);
setSelectedRowKeys([]);
setReload(Math.random());
id.map(i=>setAllSelectedExpertsId(allSelectedExpertsId.add(i)));
}
})
}
//
const deleteExpert=(taskExpertId, expertId)=>{
setLoading(true);
deleteExperts(taskExpertId,1).then(response=>{
if(response && response.message === "删除成功"){
message.success("删除成功");
allSelectedExpertsId.delete(expertId);
setReload(Math.random());
}else{
message.error("删除失败");
}
}).finally(()=>{
setLoading(false);
})
}
return (
<div className="centerbox select_expert">
<p className="title_one font-16">评审专家选取</p>
<Tabs defaultActiveKey="1" animated={false} type="card">
<TabPane tab="已选专家" key='0'>
<Tabs defaultActiveKey="0" animated={false} type="card" onChange={(activeKey)=>{setActiveKey(activeKey);setSelectedRowKeys([]);setCurPage(1);}}>
<TabPane tab="已选专家" key="0">
<div>
<div className="box"></div>
<p className="font-16 pt15">任务信息</p>
@ -175,32 +290,33 @@ function SelectExpert(props) {
<div className="df mb20">
<p className="font-16">已选取评审专家</p>
<div>
{!deleteExperts && <button className="but41_fill" onClick={() => setDeleteExperts(true)}>批量删除</button>}
{deleteExperts && <button className="butE3_border" onClick={() => setDeleteExperts(false)}>取消</button>}
{deleteExperts && <button className="but41_fill ml20" onClick={() => selectExpertCount !== 0 && setOkConfirmExps(true)}>添加</button>}
{/* <button className="but41_fill" onClick={() => {selectedRowKeys && selectedRowKeys.length>0 && setOkConfirmDelete(true)}}>批量删除</button> */}
<Modal
title="批量添加"
visible={okConfirmExps}
title="批量删除"
visible={okConfirmDelete}
onOk={() => { history.go(-1) }}
onCancel={() => setOkConfirmExps(false)}
onCancel={() => setOkConfirmDelete(false)}
wrapClassName="expert_modal"
>
<p className='weight_bold warning'>您确定要添加选中的{selectExpertCount}个专家吗</p>
<p className='ml30'>此操作将添加选中的{selectExpertCount}个专家请进行确认</p>
<p className='weight_bold warning'>您确定要删除选中的{selectedRowKeys && selectedRowKeys.length}个专家吗</p>
<p className='ml_40'>此操作将删除选中的{selectedRowKeys && selectedRowKeys.length}个专家请进行确认以防数据丢失</p>
</Modal>
</div>
</div>
<Paginationtable
loading={loading}
dataSource={dataList}
dataSource={selectedExperts}
columns={columns}
total={total}
total={selectedExpertTotal}
setCurPage={setCurPage}
current={curPage}
rowSelection={selectExperts ? rowSelection : null}
// rowSelection={rowSelection}
expandedRowRender={ExpertDetail}
expandIconColumnIndex={8}
expandIconAsCell={false}
/>
</TabPane>
<TabPane tab="专家选取" key='1'>
<TabPane tab="专家选取" key="1">
<div>
<div className="box"></div>
<p className="font-16 pt15">任务信息</p>
@ -210,29 +326,28 @@ function SelectExpert(props) {
<div className="df mb20">
<p className="font-16">添加评审专家</p>
<div>
{!selectExperts && <button className="but41_fill" onClick={() => setSelectExperts(true)}>批量添加</button>}
{selectExperts && <button className="butE3_border" onClick={() => setSelectExperts(false)}>取消</button>}
{selectExperts && <button className="but41_fill ml20" onClick={() => selectExpertCount !== 0 && setOkConfirmExps(true)}>添加</button>}
<button className="but41_fill" onClick={() => {selectedRowKeys && selectedRowKeys.length>0 && setOkConfirmExps(true)}}>批量添加</button>
<button className="but41_fill ml20" onClick={() => setOkConfirmExtract(true)}>随机抽取</button>
<Modal
title="批量添加"
visible={okConfirmExps}
onOk={() => { history.go(-1) }}
onOk={() => SelectExperts(selectedRowKeys)}
onCancel={() => setOkConfirmExps(false)}
wrapClassName="expert_modal"
>
<p className='weight_bold warning'>您确定要添加选中的{selectExpertCount}个专家吗</p>
<p className='ml30'>此操作将添加选中的{selectExpertCount}个专家请进行确认</p>
<p className='weight_bold warning'>您确定要添加选中的{selectedRowKeys && selectedRowKeys.length}个专家吗</p>
<p className='ml30'>此操作将添加选中的{selectedRowKeys && selectedRowKeys.length}个专家请进行确认</p>
</Modal>
<Modal
title="随机抽取"
visible={okConfirmExtract}
onOk={() => { history.go(-1) }}
onOk={random}
onCancel={() => setOkConfirmExtract(false)}
wrapClassName="expert_modal extract"
>
<span>请输入数量</span><Input placeholder="请输入"></Input>
<div><span>请输入数量</span><Input placeholder="请输入" onChange={(e)=>{setRandomCount(e.target.value)}}></Input></div>
<p>{randomErrorMessage}</p>
</Modal>
</div>
</div>
@ -248,7 +363,7 @@ function SelectExpert(props) {
</Form.Item>
<Form.Item label="专家类别:">
{getFieldDecorator('expertType', {})(
<Select placeholder="所有类别" style={{ width: 220 }} onChange={(value) => { setExpertType(value) }}>
<Select placeholder="所有类别" style={{ width: 220 }} onChange={(value) => { setExpertType(value);setCurPage(1); }}>
<Option value='all'>所有类别</Option>
{professionalType.map(item => {
return <Option key={item.value} value={item.value}>{item.label}</Option>
@ -257,7 +372,7 @@ function SelectExpert(props) {
</Form.Item>
<Form.Item label="评审领域:">
{getFieldDecorator('reviewAreaSel', {})(
<Select placeholder="所有领域" style={{ width: 220 }} onChange={value => setReviewAreaSel(value)}>
<Select placeholder="所有领域" style={{ width: 220 }} onChange={value => {setReviewAreaSel(value);setCurPage(1);}}>
<Option value='all'>所有领域</Option>
{reviewArea.map(item => {
return <Option key={item.value} value={item.value}>{item.label}</Option>
@ -281,12 +396,11 @@ function SelectExpert(props) {
dataSource={dataList}
columns={columns}
total={total}
setCurPage={setCurPage}
setCurPage={(curPage)=>{setCurPage(curPage++);setSelectedRowKeys([])}}
current={curPage}
// rowSelection={selectExperts ? rowSelection : null}
rowSelection={rowSelection}
expandedRowRender={record => <p style={{ margin: 0 }}>{record.graduatedFrom}</p>}
expandIconColumnIndex={5}
expandedRowRender={ExpertDetail}
expandIconColumnIndex={9}
expandIconAsCell={false}
/>
</TabPane>

View File

@ -1,5 +1,6 @@
.centerbox.select_expert{
margin: -10px auto;
margin-bottom: 2vh;
padding-top: 16px;
background: white;
.title_one, .ant-tabs-nav-wrap, .ant-tabs .ant-tabs-top-content{
@ -24,7 +25,7 @@
}
}
.ant-pagination{
text-align: right;
text-align: center;
margin: 20px 0;
}
.ant-table-thead > tr > th, .ant-table-tbody > tr > td{
@ -35,18 +36,53 @@
width: 6em;
}
.taskLink{color:#4154F1}
.ant-table-row-expand-icon{
width: 65px;
height: 26px;
line-height: 24px;
font-size: 12px;
color: white;
background: #4154F1;
}
.ant-table-row-collapsed::after, .ant-table-row-expanded::after {
content: '专家详情';
}
.expert_detail_div{
justify-content: space-around;
align-items: flex-start;
div{width: 28%;}
}
.select{
color: #4154F1;
padding: 0 8px;
}
.selected{
color: #999999;
}
}
.expert_modal.extract{
.ant-modal-content {
width: 387px;
height: 230px;
.ant-modal-body {
padding: 3.5vh 2.1em;
display: flex;
align-items: center;
padding: 3.5vh 3.5vw 0;
div{
display: flex;
align-items: center;
}
p{
color: red;
height: 2.9em;
}
.ml_40{
margin-left: -40px;
}
}
.ant-modal-footer {
margin-top: 0;
}
}
.ant-input{
width: 12vw;
width: 8vw;
}
}

View File

@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useState, useMemo } from 'react';
import classNames from 'classnames';
import { Input, Select, Button, Form, DatePicker, Table, Pagination, Modal } from 'antd';
import { Link } from "react-router-dom";
import { Link } from 'react-router-dom';
import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr, main_web_site_url, expertReviewArr } from '../static';
import { getTaskAdminList, changeShowUserMode, deleteTask, recommendTask } from '../api';
@ -20,9 +20,9 @@ for (const item of paperCheckStatusArr) {
}
export default Form.create()(({ form, showNotification, match, history }) => {
export default Form.create()(({ form, showNotification, match, history, state }) => {
const { getFieldDecorator, setFieldsValue, getFieldsValue } = form;
const { hash} = history && history.location;
const [reload, setReload] = useState();
const [loading, setLoading] = useState(false);
const [statusString, setStatusString] = useState('');
@ -34,13 +34,16 @@ export default Form.create()(({ form, showNotification, match, history }) => {
const [sort, setSort] = useState('Desc');
const [order, setOrder] = useState('createdAt');
const [searchObj, setSearchObj] = useState({});
const [curPage, setCurPage] = useState(1);
const [curPage, setCurPage] = useState(hashDate(hash) || 1);
const [total, setTotal] = useState(0);
const [taskList, setTaskList] = useState([]);
const [expertReview, setExpertReview] = useState('');
useEffect(()=>{
setCurPage(hashDate(hash) || 1);
},[hash])
useEffect(() => {
console.log('ues', curPage);
const params = {
...searchObj,
statusString,
@ -71,13 +74,16 @@ export default Form.create()(({ form, showNotification, match, history }) => {
</Form.Item>
), []);
function hashDate(hash) {
return parseInt(hash.split("&")[0].substring(hash.split("&")[0].indexOf("=")+1));
}
function onSearch() {
let values = getFieldsValue(['nameInput', 'endTime', 'startTime', 'enterpriseNameInput']);
if (values.startTime) values.startTime = values.startTime.format(format);
if (values.endTime) values.endTime = values.endTime.format(format);
if (values.checkStatus === '0,1,2') values.checkStatus = '';
setSearchObj(values);
window.location.href=`/task/taskAdmin`;
}
function clearSearch() {
@ -214,7 +220,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
title: '评审规则',
dataIndex: 'ruleEditedCount',
render: (text, record) => {
return record.expertReview ? '' : <Link className="line_1 primary-link" to={{ pathname:'/expert/admin/task/review/rules',query:{'page':curPage}}}>编辑</Link>
return record.expertReview ? '' : <Link className="line_1 primary-link" to={{ pathname:'/expert/admin/task/review/rules', state: { 'taskRecord': record}}}>编辑</Link>
}
},
{
@ -263,7 +269,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
),
},
]
}, [isDelete]);
}, [isDelete, curPage]);
function recommendItem(id, recommend) {
Modal.confirm({
@ -314,21 +320,26 @@ export default Form.create()(({ form, showNotification, match, history }) => {
}
function setCurPage1(page){
setCurPage(page);
window.location.href=`/task/taskAdmin#page=${page}`;
}
//
const changeSortName = useCallback((sortType) => {
setOrder(sortType);
setCurPage(1);
setCurPage1(1);
}, []);
//
const changeSort = useCallback((sort) => {
setSort(sort);
setCurPage(1);
setCurPage1(1);
}, []);
const changeShow = useCallback((isDelete) => {
setIsDelete(isDelete);
setCurPage(1);
setCurPage1(1);
});
const changeRecommend = useCallback((recommend) => {
@ -337,9 +348,17 @@ export default Form.create()(({ form, showNotification, match, history }) => {
} else {
setRecommend(recommend);
}
setCurPage(1);
setCurPage1(1);
});
const ExpertDetail = (record)=>{
return <div className="expert_detail_div">
<div> 任务编号{record.number} </div>
<div> 截稿时间{record.collectingEndTime || '--'} </div>
<div> 稿件数{record.papersCount || '--'} </div>
</div>
}
function downloadFile() {
window.open(main_web_site_url + '/admin/tasks.xlsx');
}
@ -454,11 +473,11 @@ export default Form.create()(({ form, showNotification, match, history }) => {
columns={columns}
pagination={false}
className="mt10"
expandedRowRender={record => <p style={{textAlign: 'left'}}>{`任务编号: ${record.number} 稿件数:${record.papersCount} 截稿时间:${record.collectingEndTime || '--'}`}</p>}
expandedRowRender={ExpertDetail}
/>
{total > 10 &&
<Pagination
onChange={(page) => { setCurPage(page) }}
onChange={(page) => { setCurPage1(page) }}
current={curPage}
total={total}
/>}

View File

@ -53,7 +53,18 @@
display: flex;
justify-content: space-between;
}
.ant-table-row-expand-icon{
width: 35px;
height: 20px;
line-height: 20px;
}
.ant-table-row-expanded::after, .ant-table-row-collapsed::after{
content: '详情';
}
.expert_detail_div{
display: flex;
justify-content: space-around;
}
}
.inline-form {

View File

@ -57,7 +57,7 @@ class NewHeader extends Component {
}
componentDidMount() {
getUserInfo().then(response =>{
response && this.setState({isExpert: response.data.expert});
response && this.setState({isExpert: response.data && response.data.expert});
});
// this.getAppdata();
this.geturlsdata();

View File

@ -28,7 +28,7 @@ body>.-task-title {
width: 100%;
height:70px;
min-width: 1200px;
z-index: 10000;
z-index: 1000;
background:rgba(255,255,255,1);
position: fixed;
}