forked from Gitlink/forgeplus-react
编辑评审规则以及加入专家评审流程生产线
This commit is contained in:
parent
1a30c1023d
commit
ea881ef517
|
|
@ -81,7 +81,17 @@ export function getExpertTasks(params) {
|
|||
params,
|
||||
});
|
||||
}
|
||||
//编辑评审规则
|
||||
|
||||
//获取创客任务评审规则
|
||||
export function getRules(params){
|
||||
return fetch({
|
||||
url: `/api/taskRuleCriteria/getRuleAndCriteria`,
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
//编辑评审规则(第一次)
|
||||
export async function editRules(data){
|
||||
let res = await fetch({
|
||||
url: '/api/taskRuleCriteria/editRuleAndCriteria',
|
||||
|
|
@ -91,6 +101,16 @@ export async function editRules(data){
|
|||
return res;
|
||||
}
|
||||
|
||||
//更新评审规则(第一次)
|
||||
export async function updateRules(data){
|
||||
let res = await fetch({
|
||||
url: '/api/taskRuleCriteria/',
|
||||
method: 'put',
|
||||
data,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
//为创客任务添加评审专家
|
||||
export async function assignExperts(data){
|
||||
let res = await fetch({
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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);props.onChange(e.target.value)}}/>
|
||||
<TextArea placeholder={props.placeholder} rows={props.rows} maxLength={props.maxLength} value={props.value} 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>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,17 +1,34 @@
|
|||
import React, { Component } from "react";
|
||||
import { Button, DatePicker, Form, message } from "antd";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { DatePicker, Form, message,Input } from "antd";
|
||||
import WordsInput from "../components/wordsInput";
|
||||
import './index.scss';
|
||||
import '../index.scss';
|
||||
import Link from "react-router-dom/Link";
|
||||
import { editRules } from "../api";
|
||||
import { editRules, getRules, updateRules } from "../api";
|
||||
import moment from "moment";
|
||||
|
||||
const {RangePicker} = DatePicker;
|
||||
|
||||
function ReviewRules({ location, form, history,state, navigation }) {
|
||||
const { getFieldDecorator} = form;
|
||||
function ReviewRules({ location, form, history }) {
|
||||
const { getFieldDecorator,setFieldsValue } = form;
|
||||
const { taskRecord } = location && location.state;
|
||||
console.log('taskRecord',taskRecord);
|
||||
//是否有初始值
|
||||
const [ initValue, setInitValue] = useState(false);
|
||||
|
||||
useEffect(()=>{
|
||||
//获取评审规则
|
||||
const params = {
|
||||
containerId: taskRecord.id,
|
||||
containerType: 1,
|
||||
statusString: 3,
|
||||
};
|
||||
getRules(params).then(response=>{
|
||||
if(response && response.message === "success"){
|
||||
setFieldsValue(response.data);
|
||||
setInitValue(response.data);
|
||||
}
|
||||
})
|
||||
}, [])
|
||||
|
||||
function rulesSubmit(){
|
||||
form.validateFields((err, values) => {
|
||||
|
|
@ -20,28 +37,39 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
containerId: taskRecord.id,
|
||||
containerName: taskRecord.name,
|
||||
containerType: 1,
|
||||
criteriaOne: values.criteria1,
|
||||
criteriaOne: values.criteriaOne,
|
||||
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,
|
||||
rule: values.rule,
|
||||
criteriaTwo: values.criteriaTwo,
|
||||
criteriaThree: values.criteriaThree,
|
||||
criteriaFour: values.criteriaFour,
|
||||
criteriaFive: values.criteriaFive,
|
||||
status: 3
|
||||
}
|
||||
editRules(data).then(response=>{
|
||||
console.log('response',response);
|
||||
if(response && response.message === '成功'){
|
||||
message.success('保存成功');
|
||||
}else{
|
||||
message.error(response.message);
|
||||
}
|
||||
})
|
||||
if(initValue){
|
||||
updateRules({...data, id: initValue.id}).then(response=>{
|
||||
if(response && response.message === '更新成功'){
|
||||
message.success('更新成功');
|
||||
}else{
|
||||
message.error(response.message);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
editRules(data).then(response=>{
|
||||
if(response && response.message === '成功'){
|
||||
message.success('保存成功');
|
||||
setInitValue({id: response.data});
|
||||
}else{
|
||||
message.error(response.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div className="centerbox setRules">
|
||||
<div className="head_title mb20">
|
||||
|
|
@ -56,7 +84,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
<Form.Item
|
||||
label="评审规则"
|
||||
>
|
||||
{getFieldDecorator('reviewRule', {
|
||||
{getFieldDecorator('rule', {
|
||||
rules: [{ required: true, message: '请输入评审规则' }],
|
||||
})(
|
||||
<WordsInput placeholder="请输入评审规则" rows={4} maxLength='200'/>,
|
||||
|
|
@ -67,7 +95,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
<Form.Item
|
||||
label="评分标准一"
|
||||
>
|
||||
{getFieldDecorator('criteria1', {
|
||||
{getFieldDecorator('criteriaOne', {
|
||||
rules: [{ required: true, message: '请输入一个评分标准' }],
|
||||
})(
|
||||
<WordsInput placeholder="请输入评分项对应分值及评分标准" rows={3} maxLength='100'/>,
|
||||
|
|
@ -76,7 +104,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
<Form.Item
|
||||
label="评分标准二"
|
||||
>
|
||||
{getFieldDecorator('criteria2', {
|
||||
{getFieldDecorator('criteriaTwo', {
|
||||
rules: [{}],
|
||||
})(
|
||||
<WordsInput placeholder="请输入评分项对应分值及评分标准" rows={3} maxLength='100' />,
|
||||
|
|
@ -85,7 +113,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
<Form.Item
|
||||
label="评分标准三"
|
||||
>
|
||||
{getFieldDecorator('criteria3', {
|
||||
{getFieldDecorator('criteriaThree', {
|
||||
rules: [{}],
|
||||
})(
|
||||
<WordsInput placeholder="请输入评分项对应分值及评分标准" rows={3} maxLength='100'/>,
|
||||
|
|
@ -94,7 +122,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
<Form.Item
|
||||
label="评分标准四"
|
||||
>
|
||||
{getFieldDecorator('criteria4', {
|
||||
{getFieldDecorator('criteriaFour', {
|
||||
rules: [{}],
|
||||
})(
|
||||
<WordsInput placeholder="请输入评分项对应分值及评分标准" rows={3} maxLength='100'/>,
|
||||
|
|
@ -103,7 +131,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
<Form.Item
|
||||
label="评分标准五"
|
||||
>
|
||||
{getFieldDecorator('criteria5', {
|
||||
{getFieldDecorator('criteriaFive', {
|
||||
rules: [{}],
|
||||
})(
|
||||
<WordsInput placeholder="请输入评分项对应分值及评分标准" rows={3} maxLength='100'/>,
|
||||
|
|
@ -115,6 +143,7 @@ function ReviewRules({ location, form, history,state, navigation }) {
|
|||
>
|
||||
{getFieldDecorator('reviewDate', {
|
||||
rules: [{ required: true, message: '请选择评审时间' }],
|
||||
initialValue: initValue && [moment(initValue.reviewStartOn) , moment(initValue.reviewEndOn)]
|
||||
})(
|
||||
<RangePicker
|
||||
showTime={{ format: 'HH:mm' }}
|
||||
|
|
|
|||
|
|
@ -583,12 +583,20 @@ export function closeTask(taskId) {
|
|||
});
|
||||
}
|
||||
|
||||
// 任务添加专家评审流程
|
||||
export function addExpertReview(taskId){
|
||||
// 任务添加专家评审流程,expertReview: 1 加入 -1 不加入
|
||||
export function addExpertReview(taskId,expertReview){
|
||||
return fetch({
|
||||
url: `/api/tasks/backend/admin/task/close/${taskId}`,
|
||||
method: 'post',
|
||||
url: `/api/tasks/backend/joinExpertReview/${taskId}?expertReview=${expertReview}`,
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
||||
//发布评审任务
|
||||
export function publishExpertsAndRules(taskId){
|
||||
return fetch({
|
||||
url: `/api/taskRuleCriteria/publishExpertsAndRules?containerId=${taskId}&containerType=1&status=-1`,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 管理页面修改创业
|
||||
|
|
@ -3,7 +3,8 @@ import javaFetch from '../javaFetch';
|
|||
|
||||
|
||||
let settings=JSON.parse(localStorage.chromesetting);
|
||||
let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com';
|
||||
// let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com';
|
||||
let actionUrl = 'http://117.50.100.12:8067'
|
||||
|
||||
const service = javaFetch(actionUrl);
|
||||
export const httpUrl = actionUrl;
|
||||
|
|
|
|||
|
|
@ -170,5 +170,5 @@ export const agreementContent='<p>投稿协议内容示例,请在管理 —
|
|||
|
||||
export const expertReviewArr = [
|
||||
{ dicItemCode: 1, name: "加入评审", dicItemName: '加入评审' },
|
||||
{ dicItemCode: 0, name: "不加入评审", dicItemName: '不加入评审' },
|
||||
{ dicItemCode: -1, name: "不加入评审", dicItemName: '不加入评审' },
|
||||
]
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { Input, Select, Button, Form, DatePicker, Table, Pagination, Modal } from 'antd';
|
||||
import { Input, Select, Button, Form, DatePicker, Table, Pagination, Modal, message } from 'antd';
|
||||
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';
|
||||
import { getTaskAdminList, changeShowUserMode, deleteTask, recommendTask, addExpertReview, publishExpertsAndRules } from '../api';
|
||||
import '../index.scss';
|
||||
import './index.scss';
|
||||
import { getRules, selectExpertList } from 'src/military/expert/api';
|
||||
import PaginationTable from '../../../../src/military/components/paginationTable';
|
||||
const format = "YYYY-MM-DD HH:mm:ss";
|
||||
const Option = Select.Option;
|
||||
|
||||
|
|
@ -122,8 +124,9 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|||
return <Select
|
||||
className="column-select"
|
||||
showArrow
|
||||
defaultValue={text?1:0}
|
||||
onChange={(key) => { changeStatus(key, record.id) }}
|
||||
defaultValue={text?1:-1}
|
||||
onChange={(key) => { changeExpertReviewStatus(key, record.id) }}
|
||||
disabled={!(record.status < 4) || record.assignRuleAndExperts}
|
||||
>
|
||||
{
|
||||
expertReviewArr.map(item => {
|
||||
|
|
@ -220,28 +223,28 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|||
title: '评审规则',
|
||||
dataIndex: 'ruleEditedCount',
|
||||
render: (text, record) => {
|
||||
return record.expertReview ? '' : <Link className="line_1 primary-link" to={{ pathname:'/expert/admin/task/review/rules', state: { 'taskRecord': record}}}>编辑</Link>
|
||||
return record.expertReview && (record.status < 4) && !record.assignRuleAndExperts ? <Link className="line_1 primary-link" to={{ pathname:'/expert/admin/task/review/rules', state: { 'taskRecord': record}}}>编辑</Link>:''
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '专家选取',
|
||||
dataIndex: 'expertSelectedCount',
|
||||
render: (text, record) => {
|
||||
return record.expertReview ? '' : <Link className="line_1 primary-link" to={{ pathname: '/expert/admin/task/review/select', state: { 'taskRecord': record } }}>选择</Link>
|
||||
return record.expertReview && (record.status < 4) && !record.assignRuleAndExperts ? <Link className="line_1 primary-link" to={{ pathname: '/expert/admin/task/review/select', state: { 'taskRecord': record } }}>选择</Link>:''
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '评审任务',
|
||||
dataIndex: 'expertReview1',
|
||||
render: (text, record) => {
|
||||
return <Button size='small'>发布</Button>
|
||||
return record.expertReview && (record.status < 4) ? !record.assignRuleAndExperts?<Button size='small' onClick={()=>{publishTaskReview(record)}}>发布</Button> : '已发布' :''
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '评审结果',
|
||||
dataIndex: 'expertReview2',
|
||||
render: (text, record) => {
|
||||
return <Link className="line_1 primary-link" to='/expert/admin/task/review/results'>查看</Link>
|
||||
return record.assignRuleAndExperts && <Link className="line_1 primary-link" to='/expert/admin/task/review/results'>查看</Link>
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -271,6 +274,55 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|||
]
|
||||
}, [isDelete, curPage]);
|
||||
|
||||
//已选取专家
|
||||
const columnsExperts = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
title: '编号',
|
||||
dataIndex: 'index',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '专家姓名',
|
||||
dataIndex: 'expertName',
|
||||
key: 'expertName',
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'phone',
|
||||
width: 150,
|
||||
key: 'phone',
|
||||
},
|
||||
{
|
||||
title: '最高学历',
|
||||
dataIndex: 'highestDegree',
|
||||
key: 'highestDegree',
|
||||
},
|
||||
{
|
||||
title: '专业职称',
|
||||
dataIndex: 'professionalTitle',
|
||||
},
|
||||
{
|
||||
title: '专家类别',
|
||||
dataIndex: 'expertType',
|
||||
},
|
||||
{
|
||||
title: '评审领域',
|
||||
dataIndex: 'reviewAreas',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '专家评分',
|
||||
dataIndex: 'expertScore',
|
||||
align: 'center',
|
||||
render:(text,record)=>{
|
||||
return record.expertScore || '--';
|
||||
}
|
||||
}
|
||||
];
|
||||
}, []);
|
||||
|
||||
function recommendItem(id, recommend) {
|
||||
Modal.confirm({
|
||||
title: "警告",
|
||||
|
|
@ -305,6 +357,67 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|||
});
|
||||
}
|
||||
|
||||
function publishTaskReview(record){
|
||||
if(!record.ruleEditedCount || !record.expertSelectedCount){
|
||||
message.error("请先编辑评审规则以及选取评选专家再发布此任务");
|
||||
}else{
|
||||
let rules = undefined;
|
||||
let selectedExperts = undefined;
|
||||
getRules({containerId: record.id, containerType: 1, statusString: 3}).then(response=>{
|
||||
if(response && response.message === "success"){
|
||||
let criterias = [];
|
||||
response.data.criteriaOne && (criterias[criterias.length] = (criterias.length+1)+"、"+response.data.criteriaOne);
|
||||
response.data.criteriaTwo && (criterias[criterias.length] = (criterias.length+1)+"、"+response.data.criteriaTwo);
|
||||
response.data.criteriaThree && (criterias[criterias.length] = (criterias.length+1)+"、"+response.data.criteriaThree);
|
||||
response.data.criteriaFour && (criterias[criterias.length] = (criterias.length+1)+"、"+response.data.criteriaFour);
|
||||
response.data.criteriaFive && (criterias[criterias.length] = (criterias.length+1)+"、"+response.data.criteriaFive);
|
||||
response.data.criterias = criterias;
|
||||
rules = response.data;
|
||||
}
|
||||
})
|
||||
selectExpertList({containerId: record.id, containerType: 1, curPage:curPage, pageSize: 10000, curPage: 1,}).then(response=>{
|
||||
if(response && response.message === "success" && 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);
|
||||
}
|
||||
selectedExperts = response.data.rows
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
Modal.confirm({
|
||||
className: 'publishReview',
|
||||
title: "评审规则",
|
||||
content:
|
||||
<React.Fragment>
|
||||
<div>{rules && rules.rule}</div>
|
||||
<p>评分标准</p>
|
||||
<div>
|
||||
{rules.criterias.map(item=>{return <p>{item}</p>})}
|
||||
</div>
|
||||
<p>评审时间</p>
|
||||
<div>{rules.reviewStartOn}~{rules.reviewEndOn}</div>
|
||||
<p>已选取评审专家</p>
|
||||
<PaginationTable
|
||||
dataSource={selectedExperts}
|
||||
columns={columnsExperts}/>
|
||||
</React.Fragment>
|
||||
,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
publishExpertsAndRules(record.id).then(response=>{
|
||||
if(response && response.message==="发布成功"){
|
||||
setReload(Math.random());
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
function changeStatus(showUserMode, taskId) {
|
||||
changeShowUserMode({
|
||||
taskId,
|
||||
|
|
@ -317,7 +430,14 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|||
}
|
||||
|
||||
function changeExpertReviewStatus(expertReviewStatus, taskId) {
|
||||
|
||||
addExpertReview(taskId,expertReviewStatus).then(res => {
|
||||
if (res && res.message === 'success') {
|
||||
showNotification('操作成功!');
|
||||
setReload(Math.random());
|
||||
} else {
|
||||
showNotification('操作失败');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function setCurPage1(page){
|
||||
|
|
@ -365,7 +485,7 @@ export default Form.create()(({ form, showNotification, match, history, state })
|
|||
|
||||
return (
|
||||
<div className="centerbox task-manage-all ">
|
||||
|
||||
|
||||
<div className="search-screen" >
|
||||
{helper(
|
||||
"任务名称",
|
||||
|
|
|
|||
|
|
@ -58,9 +58,6 @@
|
|||
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;
|
||||
|
|
@ -85,3 +82,32 @@
|
|||
.sort-active {
|
||||
color: #29bd8b;
|
||||
}
|
||||
|
||||
// 发布评审任务弹框样式
|
||||
.publishReview{
|
||||
width: 1050px !important;
|
||||
.ant-modal-confirm-title{
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.ant-modal-confirm-body > .anticon{
|
||||
display: none;
|
||||
}
|
||||
.ant-modal-confirm-body > .anticon + .ant-modal-confirm-title + .ant-modal-confirm-content{
|
||||
margin-left: 0;
|
||||
}
|
||||
.ant-modal-confirm-content{
|
||||
&>p{
|
||||
font-size: 16px;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
border-bottom: 1px solid #eeeeee;
|
||||
padding: 10px 0;
|
||||
}
|
||||
&>div{
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
.ant-table-tbody > tr > td{
|
||||
padding: 1px 16px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ export default Form.create()(
|
|||
title: '提示',
|
||||
content: '确定将此创客任务添加专家评审流程?',
|
||||
onOk: () => {
|
||||
addExpertReview(id).then(res => {
|
||||
addExpertReview(id,1).then(res => {
|
||||
if (res && res.message === 'success') {
|
||||
setReload(Math.random());
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue