修复成果提交时的bug,联调我是创客

This commit is contained in:
何童崇 2021-07-01 10:58:03 +08:00
parent bca9499844
commit 76b23f88db
20 changed files with 797 additions and 301 deletions

View File

@ -72,14 +72,8 @@ export function formatDuring(mss) {
var days = parseInt(mss / (1000 * 60 * 60 * 24));
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
// console.log("formatDuringformatDuring");
// console.log(days);
// console.log(hours);
// console.log(minutes);
// console.log(Math.abs(days));
// console.log(Math.abs(hours));
// console.log(Math.abs(minutes));
var second = parseInt(mss / 1000 % 60);
try {
days = Math.abs(days);
} catch (e) {
@ -95,11 +89,22 @@ export function formatDuring(mss) {
} catch (e) {
}
return days + "天" + hours + "小时" + minutes + "分";
if (days) {
return days + "天" + hours + "小时" + minutes + "分";
}
if (hours) {
return hours + "小时" + minutes + "分";
}
if (minutes) {
return minutes + "分";
}
return second + "秒";
// return days + "天" + hours + "小时" + minutes + "分";
}
/*
返回多久以前
返回多久以前
backDate以前的某个日期
*/
export function timeAgo(backDate) {
@ -114,15 +119,15 @@ export function timeAgo(backDate) {
var minutes = Math.floor((time % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((time % (1000 * 60 * 60)) / 1000);
if (days) {
return days + "天前";
return days + "天前";
}
if (hours) {
return hours + "小时前";
}
if (minutes) {
return minutes + "分前";
return minutes + "分前";
}
if (seconds) {
return seconds + "秒前";
return seconds + "秒前";
}
}

View File

@ -1,8 +1,6 @@
import React, { useEffect, useState } from "react";
import { Upload, Button } from 'antd';
import axios from 'axios';
import { appendFileSizeToUploadFileAll } from 'educoder';
axios.defaults.withCredentials = true;
function Uploads({ className, size, actionUrl, fileList, showNotification, load }) {
const [files, setFiles] = useState(undefined);
@ -32,24 +30,7 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load
return itemId !== id;
});
setFiles(nf);
// fileIdList(nf);
load && load(nf);
//
// const url = actionUrl + `/busiAttachments/${id}`;
// axios.delete(url).then((response) => {
// if (response.data) {
// if (response.data.code === "1") {
// let nf = files.filter(item => (item.response.data.id !== id) && (item.id !== id));
// setFiles(nf);
// fileIdList(nf);
// } else {
// showNotification(response.data.message);
// }
// }
// }).catch(function (error) {
// console.log(error);
// });
}
@ -61,16 +42,6 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load
}
}
// function fileIdList(fileList) {
// let id = [];
// let fileType = [];
// for (const item of fileList) {
// id.push(item.id || item.response.data.id);
// fileType.push(item.fileType || item.response.data.fileType);
// }
// load && load(id.join(), fileType.join());
// }
function beforeUpload(file) {
const isLt100M = file.size / 1024 / 1024 < size;
if (!isLt100M) {

View File

@ -0,0 +1,25 @@
import { httpUrl } from '../fetch';
export const editorConfig = {
placeholder: '请输入',
uploadImgServer: httpUrl + '/busiAttachments/upload',
uploadFileName: 'file',
uploadImgHeaders: {
'X-Requested-With': 'XMLHttpRequest'
},
excludeMenus: [
'list',
'todo',
'emoticon',
'video'
],
uploadImgHooks: {
// 图片上传并返回了结果,想要自己把图片插入到编辑器中
customInsert: function (insertImgFn, result) {
// insertImgFn 可把图片插入到编辑器,传入图片 src ,执行函数即可
if (result && result.data && result.data.id) {
insertImgFn(`${httpUrl}/busiAttachments/view/${result.data.id}`);
}
}
},
}

View File

@ -5,15 +5,21 @@ import cookie from 'react-cookies';
<<<<<<< HEAD
=======
// export const httpUrl='http://117.50.100.12:8001';
// export const httpUrl='http://192.168.31.72:8081';
export const httpUrl='http://192.168.31.72:8081';
// export const httpUrl = 'http://106.75.31.211:58088';
// export const httpUrl = 'http://192.168.31.72:8089';
<<<<<<< HEAD
<<<<<<< HEAD
// export const httpUrl = 'http://192.168.31.104:8081';
>>>>>>> 09e81b9... 添加成果内容
=======
export const httpUrl = 'http://192.168.31.104:8081';
>>>>>>> 6b63cd2... 上传成果修改
=======
// export const httpUrl = 'http://192.168.31.104:8081';
// export const httpUrl = 'http://192.168.31.168:8081';
>>>>>>> 5131dac... 修复成果提交时的bug联调我是创客
let actionUrl = '';

View File

@ -257,6 +257,12 @@
font-size: 100%;
background-color: #f1f1f1;
}
.user-box{
cursor: pointer;
&:hover{
color: #409eff;
}
}
@media screen and (max-width: 1200px){

View File

@ -30,6 +30,11 @@ const MyTask = Loadable({
loading: Loading,
});
const TaskManage = Loadable({
loader: () => import("./task/taskManage"),
loading: Loading,
});
class Index extends Component {
render() {
return (
@ -64,6 +69,13 @@ class Index extends Component {
)}
></Route>
<Route
path="/task/taskManage"
render={(props) => (
<TaskManage {...this.props} {...props} />
)}
></Route>
<Route
path="/task"
render={(props) => (

View File

@ -25,7 +25,7 @@ export async function getTaskCategory() {
}
}
// 列表查询
// 任务列表查询
export async function getTaskList(params) {
let res = await fetch({
url: '/api/tasks/',
@ -77,6 +77,7 @@ export async function getJoinTaskList(params) {
}
// 详情查询
export async function getTaskDetail(id) {
let res = await fetch({
@ -102,6 +103,15 @@ export function addTask(data) {
});
}
//更新任务
export function updateTask(data) {
return fetch({
url: '/api/tasks/',
method: 'PUT',
data: data
});
}
//删除
export function deleteTask(id) {
return fetch({
@ -110,14 +120,6 @@ export function deleteTask(id) {
});
}
//更新任务
export function updateTask(data) {
return fetch({
url: '/api/tasks/',
method: 'put',
data: data
});
}
//新增成果
export function addAchieve(data) {
@ -180,6 +182,17 @@ export function checkAgreement(taskId) {
});
}
// 检查用户是否提交了成果
export function checkAchieve(taskId){
return fetch({
url: `/api/paper/${taskId}/check`,
method: 'get'
});
}
// 获取协议
export function getAgreement() {
return fetch({
@ -204,4 +217,32 @@ export function commentAdd(data) {
method: 'post',
data,
});
}
}
// 审核任务列表查询
export async function manageTaskList(params) {
let res = await fetch({
url: '/api/tasks/backend/list',
method: 'get',
params,
});
if (res.data) {
return res.data;
} else {
notification.open({
message: "提示",
description: res.message || '请求错误',
});
}
}
//管理员审核任务
export function checkTask(data) {
return fetch({
url: `/api/tasks/backend/adminCheck`,
method: 'post',
data: data
});
}

View File

@ -4,15 +4,17 @@ import ReactWEditor from 'wangeditor-for-react';
import { getImageUrl, timeAgo } from 'educoder';
import Nodata from 'forge/Nodata';
import Loading from "src/Loading";
import { editorConfig } from 'military/components/config';
import { reportAchieve, thumbUpAchieve, commentAdd } from '../../api';
import { httpUrl } from '../../../fetch';
import winpng from '../../image/win.png';
import './index.scss';
const { TextArea } = Input;
export default (props) => {
const { list, curPage, total, changePage, loading, applyStatusAllNameArr, relaodList, showNotification } = props;
const { list, curPage, total, changePage, loading, applyStatusAllNameArr, reloadList, showNotification } = props;
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(() => {
return props.pageSize || 10;
@ -51,7 +53,7 @@ export default (props) => {
function thumbUp(id) {
thumbUpAchieve(id).then(res => {
relaodList();
reloadList();
});
}
@ -60,12 +62,19 @@ export default (props) => {
showNotification("请输入评价");
return;
}
if (commentHtml.length > 10000) {
showNotification("评论过长,请减少评论内容或者简化评论格式");
return;
}
commentAdd({
content: commentHtml,
paperId: item.id,
taskId: item.taskId
}).then(res => {
if (res.message === 'success') closeComment();
if (res.message === 'success') {
closeComment();
reloadList();
}
});
}
@ -79,7 +88,10 @@ export default (props) => {
setCommentHtml('');
}
function goUser(login) {
window.location.href = `/users/${login}`;
}
return (
<React.Fragment>
{loading ? <Loading /> :
@ -93,20 +105,24 @@ export default (props) => {
<div className="flex1">
<ul className="clearfix">
<li className="fl pr">
<span className="font-16 mr20 color-grey3">
{item.user.nickName || item.user.login}
<span className="user-box font-16 mr20 color-grey3" onClick={() => { goUser(item.user.login) }}>
<img alt="头像加载失败" className="radius mr5" src={winpng} />
{item.user.nickname || item.user.login}
</span>
<span className="color-grey9">{timeAgo(item.createdAt)}</span>
<span className="color-blue ml10">{!item.verifyStatus && "待审核"}</span>
</li>
<li className="fr">
<a className="base_smallBtn blue_line_btn fl">
<a className="base_smallBtn fl">
{applyStatusAllNameArr[item.status]}
</a>
</li>
</ul>
<div className="paper-detail-content markdown-body editormd-html-preview editor-w-text" dangerouslySetInnerHTML={{ __html: item.paperDetail.content }}>
</div>
<div className="attachments" >
{
item.paperDetail.busiAttachments && item.paperDetail.busiAttachments.map(fileItem => {
@ -120,21 +136,20 @@ export default (props) => {
</div>
<div class="padding20 fileCommentsList">
{item.comments.length > 0 &&
item.comments.map(commentsItem => {
return <div className="comments-item">
<div class="comments-author">
<span class="color-grey3 font-bd mr20">{commentsItem.user.nickname || commentsItem.user.login}</span>
<span class="color-grey9">{timeAgo(commentsItem.createdAt)}</span>
</div>
<div className="editor-w-text comments-content" dangerouslySetInnerHTML={{ __html: commentsItem.details.content }}>
</div>
{item.comments.length > 0 && <div className="padding20 fileCommentsList">
{item.comments.map(commentsItem => {
return <div className="comments-item">
<div className="comments-author">
<span className="color-grey3 font-bd mr20">{commentsItem.user.nickname || commentsItem.user.login}</span>
<span className="color-grey9">{timeAgo(commentsItem.createdAt)}</span>
</div>
})
<div className="editor-w-text comments-content" dangerouslySetInnerHTML={{ __html: commentsItem.details.content }}>
</div>
</div>
})
}
{/* <!-- <a href="javascript:void(0)" class="mt10 mb10 color-blue">查看更多回复>></a>--> */}
</div>
{/* <!-- <a href="javascript:void(0)" className="mt10 mb10 color-blue">查看更多回复>></a>--> */}
</div>}
<li className="clearfix color-grey-6 mt10 mb20">
@ -150,39 +165,14 @@ export default (props) => {
{commentId === item.id && <React.Fragment>
<ReactWEditor
value={commentHtml}
config={
{
placeholder: "请输入评论",
excludeMenus :[
'list',
'todo',
'emoticon',
'video'
],
uploadImgServer: httpUrl + '/busiAttachments/upload',
uploadFileName: 'file',
uploadImgHeaders: {
'X-Requested-With': 'XMLHttpRequest'
},
uploadImgHooks: {
//
customInsert: function (insertImgFn, result) {
// insertImgFn src
if (result && result.data && result.data.id) {
insertImgFn(`${httpUrl}/busiAttachments/view/${result.data.id}`);
}
}
},
}
}
onChange={(html) => {
setCommentHtml(html);
config={{
...editorConfig,
placeholder: "请输入评论",
}}
onChange={(html) => { setCommentHtml(html) }}
/>
<Button className="mt20 mr20 mb20 fr" type={"primary"} onClick={() => { commentPush(item) }}>发表</Button>
<Button className="mt20 mr20 mb20 fr" onClick={closeComment}>取消</Button>
</React.Fragment>}
</div>
@ -223,6 +213,7 @@ export default (props) => {
autoSize={{ minRows: 6 }}
className="applyText"
onChange={(e) => { setReportValue(e.target.value) }}
maxLength={100}
/>
</div>
</Modal>

View File

@ -1,25 +1,22 @@
import React, { useEffect, useState } from 'react';
import { Modal, Pagination } from 'antd';
import { Modal, Pagination } from 'antd';
import { Link } from "react-router-dom";
import Nodata from 'forge/Nodata';
import Loading from "src/Loading";
import { publishModeArr ,taskStatusAllArr} from '../../static';
import { publishModeArr, taskStatusAllArr } from '../../static';
import './index.scss';
const statusArr = [];
for (const item of taskStatusAllArr){
statusArr[item.dicItemCode]=item.dicItemName;
for (const item of taskStatusAllArr) {
statusArr[item.dicItemCode] = item.dicItemName;
}
export default (props) => {
const { list, curPage, total, changePage, taskCategoryValueArr, loading } = props;
const { list, curPage, total, changePage, taskCategoryValueArr, loading, publish } = props;
const [page, setPage] = useState(1);
const [visibleProofs, setVisibleProofs] = useState(false);
const [activeItem,setActiveItem]=useState({});
const [pageSize, setPageSize] = useState(() => {
return props.pageSize || 10;
});
const [activeItem, setActiveItem] = useState({});
const pageSize = props.pageSize || 10;
useEffect(() => {
changePage(page);
@ -30,12 +27,19 @@ export default (props) => {
setActiveItem(item);
}
function repairAdvice(repairAdvice){
Modal.info({
title: '审核意见',
content:repairAdvice
})
}
return (
<React.Fragment>
<ul className="df mt10 needs_condition_content_nav">
<li key={1} className="with35 edu-txt-left">任务</li>
<li key={2} className="with15">类型</li>
<li key={3} className="with10 draft_only">应征投稿</li>
{publish && <li key={3} className="with10 draft_only">应征投稿</li>}
<li key={4} className="with10">金额</li>
<li key={5} className="flex1">任务状态</li>
<li key={6} className="with15">操作</li>
@ -61,7 +65,7 @@ export default (props) => {
<span className="line_1">{publishModeArr[item.publishMode]}</span>
</li>
<li key={3} className="with10 draft_only">{item.papersCount||0}</li>
{publish && <li key={3} className="with10 draft_only">{item.papersCount || 0}</li>}
<li key={4} className="with10 color-orange">{item.bounty}</li>
<li className="flex1">
@ -71,13 +75,15 @@ export default (props) => {
</li>
<li key={5} className="with15 flex-column">
{
item.status == 0 ||item.status == 2 ?
item.status === 0 || item.status === 9 ?
<Link className="line_1 color-grey3" to={`/task/taskEdit/${item.id}`}>编辑草稿</Link> :
<Link className="line_1 color-grey3" to={`/task/taskDetail/${item.id}`}>查看详情</Link>
}
{item.status == 4 && <Link className="line_1 color-blue" to={`/task/taskDetail/${item.id}`}>成果评选</Link>}
{item.status == 4 && item.papersCount && (!item.isProofBoolean) && <a onClick={() => { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料</a>}
{item.status === 4 && <Link className="line_1 color-blue" to={`/task/taskDetail/${item.id}`}>成果评选</Link>}
{item.status === 4 && item.papersCount && (!item.isProofBoolean) && <a onClick={() => { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料</a>}
{(item.status === 9 || item.status === 2) && <a onClick={() => { repairAdvice(item.repairAdvice) }} className="line_1 color-blue">审核意见</a>}
{/* <a href="javascript:void(0)" className="line_1 color-blue" onClick="paying_register_popup()">支付登记</a> */}
{/* <a href="javascript:void(0)" className="color-blue line_1">上传支付凭证</a> */}

View File

@ -1,23 +1,36 @@
import React, { useEffect, useState } from 'react';
import { Icon, Pagination } from 'antd';
import { formatDuring } from 'educoder';
import Nodata from 'forge/Nodata';
import { taskStatusAllArr} from '../../static';
import Loading from "src/Loading";
import winpng from '../../image/win.png';
import './index.scss';
const statusArr = ["草稿", "待审核", "已拒绝", "成果征集中", "成果评选中", "公示中", "协议签订中", "支付中", "已完成"];
const statusArr = [];
for (const item of taskStatusAllArr) {
statusArr[item.dicItemCode] = item.dicItemName;
}
const classArr = ['', 'list-done', 'list-error', 'list-red', 'list-yellow', '', '', 'list-pay', 'list-gray',];
export default (props) => {
const { list, itemClick, curPage, total, changePage, loading } = props;
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(() => {
return props.pageSize || 10;
});
const pageSize = props.pageSize || 10;
useEffect(() => {
changePage(page);
}, [page]);
function goUser(login) {
window.location.href = `/users/${login}`;
}
function surplusTime(item) {
let surplus = item.collectingDays * 24 * 3600 - (new Date() - new Date(item.publishedAt)) / 1000;
return formatDuring(surplus)
}
return (
loading ? <Loading /> :
<React.Fragment>
@ -29,12 +42,17 @@ export default (props) => {
<div className="list-title mb10" onClick={() => { itemClick(item.id) }}>
{item.name || item.title}
{item.status && <span className={classArr[item.status]}>{statusArr[item.status]}</span>}
{(!item.status == '8') && item.delayTime && <span className="list-yellow">延期中</span>}
{(item.status !== 8) && item.delayTime && <span className="list-yellow">延期中</span>}
</div>
<div className="list-other">
<span className=" mr30"><i className="iconfont icon-dianjiliang mr3 font-12" />{item.visits || 0}</span>
<span className=" mr30"><Icon type="user" /><span className="color-orange">{item.papersCount || 0}</span>人参与</span>
{(!item.status == '8') && item.delayTime && <span className=" mr30"><i className="mr5 iconfont icon-shijian color-grey9 font-14"></i>{item.delayTime}</span>}
<span className="user-box mr30" onClick={() => { goUser(item.user.login) }}>
<img alt="头像加载失败" className="radius mr5" src={winpng} />
{item.user.nickname || item.user.login}
</span>
<span className="font-14 mr30"><i className="iconfont icon-dianjiliang mr3 font-12" />{item.visits || 0}</span>
<span className="font-14 mr30"><Icon type="user" /><span className="color-orange">{item.papersCount || 0}</span>人参与</span>
{(item.status !== 8) && item.delayTime && <span className="color-orange mr30 font-14"><i className="mr5 iconfont icon-shijian color-grey9 font-14"></i>{item.delayTime}</span>}
{(item.status === 3) && (!item.delayTime) && <span className="color-orange mr30 font-14"><i className="mr5 iconfont icon-shijian color-grey9 font-14"></i>剩余{surplusTime(item)}</span>}
</div>
</div>

View File

@ -7,6 +7,12 @@
background: #fff;
border-bottom: 1px solid #dedede;
}
.user-box{
cursor: pointer;
&:hover{
color: #409eff;
}
}
.price {
font-weight: 500;
padding-top: 10px;

View File

@ -0,0 +1,201 @@
import React, { useEffect, useState } from 'react';
import { Pagination, Modal, Input, Radio } from 'antd';
import { Link } from "react-router-dom";
import Nodata from 'forge/Nodata';
import Loading from "src/Loading";
import { timeAgo } from 'educoder';
import { checkTask } from '../../api';
import './index.scss';
import winpng from '../../image/win.png';
const { TextArea } = Input;
export default (props) => {
const { list, categoryArr, curPage, total, changePage, loading, showNotification, reloadList } = props;
const [checkedId, setCheckedId] = useState('');
const [page, setPage] = useState(1);
const [visible, setVisible] = useState(false);
const [isRepairDocument, setIsRepairDocument] = useState('0');
const [repairAdvice, setRepairAdvice] = useState('');
const pageSize = props.pageSize || 10;
useEffect(() => {
changePage(page);
}, [page]);
function agreeClick(id) {
Modal.confirm({
title: '是否确认审批通过?',
onOk() {
checkTask({
id,
isPassed: 1,
}).then(res => {
if (res.message === 'success') {
showNotification('操作成功');
reloadList();
}
})
}
});
}
function refuseClick(id) {
setCheckedId(id);
setVisible(true);
}
function refuse() {
if (!repairAdvice) {
showNotification('请输入拒绝的理由');
return;
}
checkTask({
id: checkedId,
isPassed: 0,
isRepairDocument,
repairAdvice: repairAdvice
}).then(res => {
if (res.message === 'success') {
showNotification('操作成功');
reloadList();
setRepairAdvice('');
setVisible(false);
}
});
}
function goUser(login) {
window.location.href = `/users/${login}`;
}
function goUserMes(login) {
window.location.href = `/users/${login}/message_detail`;
}
return (
loading ? <Loading /> :
<React.Fragment>
{
list.map(item => {
return (
<div className="list-box" key={item.id}>
<img alt="头像加载失败" className="radius mr15" height="50px" src={winpng} width="50px" />
<div className="flex1">
<li className="clearfix mb20">
<a className="user-box fl mr15 color-grey-3 font-16" onClick={() => { goUser(item.user.login) }}>{item.user.nickname || item.user.login}</a>
<span className="fl color-grey-9 mt3">{timeAgo(item.createdAt)}</span>
<span className="fr">
{item.status > 2 && <span className="spanTitle color-grey-6 fl ml20">已同意</span>}
{item.status === 2 && <span className="spanTitle color-red fl ml20">已拒绝</span>}
{
item.status === 1 && <React.Fragment>
<a className="edu-default-btn edu-orangeline-btn ml20 fl" onClick={() => { goUserMes(item.user.login) }}>私信</a>
<a className="edu-default-btn edu-blueline-btn ml20 fl" onClick={() => { agreeClick(item.id) }}>同意</a>
<a className="edu-default-btn edu-greyline-btn ml20 fl" onClick={() => { refuseClick(item.id) }}>拒绝</a>
</React.Fragment>
}
</span>
</li>
<ul className="clearfix">
<div className="width100" style={{ display: "inline-flex" }}>
<div className="width100">
<span className="with40 fl lineh-35">
<span className="color-grey-9 fl">主体名称:</span>
<span className="infos_item">{item.enterpriseName}</span>
</span>
<span className="inline-block lineh-35">
<span className="color-grey-9 fl">信用代码:</span>
<span className="infos_item">123456789123456789</span>
</span>
</div>
</div>
<div className="clearfix"></div>
<div className="width100">
<span className="with40 fl lineh-35">
<span className="color-grey-9 fl">联系手机:</span>
<span className="infos_item">{item.contactPhone}位置分析河北-唐山</span>
</span>
<span className="inline-block lineh-35">
<span className="color-grey-9 fl">IP地址:</span>
<span className="infos_item">{item.ip}位置分析北京-北京</span>
</span>
</div>
<div className="clearfix"></div>
<div className="width100">
<span className="with40 fl lineh-35">
<span className="color-grey-9 fl">所在行业:</span>
<span className="infos_item" style={{ maxWidth: '100px' }}>{categoryArr[item.categoryId]}</span>
</span>
<span className="with25 fl lineh-35">
<span className="color-grey-9 fl">企业规模:</span>
<span className="infos_item" style={{ maxWidth: '100px' }}>0-10</span>
</span>
<span className="inline-block lineh-35">
<span className="color-grey-9 fl">所在职位:</span>
<span className="infos_item">普通员工</span>
</span>
</div>
<div className="clearfix"></div>
<div className="width100">
<span className="with40 fl lineh-35">
<span className="color-grey-9 fl">任务编号:</span>
<span className="infos_item">{item.number}</span>
</span>
<span className="inline-block lineh-35">
<span className="color-grey-9 fl">任务名称:</span>
<span className="fl lineh-35 ml5">
<Link className="primary-link" to={`/task/taskDetail/${item.id}`}>{item.name}</Link>
</span>
</span>
</div>
</ul>
</div>
</div>
)
})
}
{list.length > 0 ?
<div className="edu-txt-center mt20 mb20">
{total > pageSize && <Pagination
showQuickJumper
onChange={(page) => { setPage(page) }}
current={curPage}
total={total}
showTotal={total => `${total}`}
/>}
</div> :
<Nodata _html="暂无数据" />}
<Modal
title="拒绝原因"
visible={visible}
onOk={refuse}
onCancel={() => { setVisible(false) }}
className="form-edit-modal"
>
<Radio.Group
className="mb10"
value={isRepairDocument}
onChange={(e) => { setIsRepairDocument(e.target.value) }}>
<Radio value={'0'}>不允许重新发布</Radio>
<Radio value={'1'}>允许修缮后重新发布</Radio>
</Radio.Group>
<TextArea
value={repairAdvice}
placeholder="(必填)我想说点什么呢,200字以内"
autoSize={{ minRows: 6 }}
className="applyText"
onChange={(e) => { setRepairAdvice(e.target.value) }}
maxLength={200}
/>
</Modal>
</React.Fragment>
)
}

View File

@ -0,0 +1,28 @@
.list-box {
position: relative;
display: flex;
justify-content: space-between;
padding: 20px;
margin: 0 1.5rem;
background: #fff;
border-bottom: 1px solid #dedede;
a.edu-orangeline-btn {
padding: 0px 10px;
}
}
a.primary-link {
color: #1890ff;
}
.infos_item {
float: left;
max-width: 273px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #343434;
margin-right: 6px;
line-height: 35px;
margin-left: 5px;
}

View File

@ -1,17 +1,17 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Tabs, Input, } from 'antd';
import { Link } from "react-router-dom";
import StatusNav from '../../components/statusNav';
import ItemListMyTask from '../components/itemListMyTask';
import JoinTask from './joinTask';
import { taskStatusAllArr, publishModeArr } from '../static';
import { taskStatusAllArr, } from '../static';
import { getTaskCategory, getMyTaskList } from '../api';
import './index.scss';
const Search = Input.Search;
const { TabPane } = Tabs;
const publishStatusArr = taskStatusAllArr.slice(3);
const publishStatusArr = taskStatusAllArr.slice(3,9);
const unpublishStatusArr = taskStatusAllArr.slice(0, 3);
unpublishStatusArr.push({ dicItemCode: '9', name: "待修缮", dicItemName: "待修缮" });
const statusArr = [];
for (const item of taskStatusAllArr) {
@ -28,17 +28,14 @@ export default ({ location, history, current_user }) => {
return defaultValue === 'false' ? '2' : '1';
});
const [statusString, setStatusString] = useState(() => {
return defaultValue === 'false' ? '0,1,2' : '3,4,5,6,7,8';
return defaultValue === 'false' ? '0,1,2,9' : '3,4,5,6,7,8';
});
const [requireAchieve, setRequireAchieve] = useState('1');
const [searchInput, setSearchInput] = useState('');
const [orderBy, setOrderBy] = useState('createdAtDesc');
const [curPage, setCurPage] = useState(1);
const [total, setTotal] = useState(0);
const [myTaskList, setMyTaskList] = useState([]);
const [joinTaskList, setJoinTaskList] = useState([]);
const [loading, setLoading] = useState(false);
//
@ -72,57 +69,6 @@ export default ({ location, history, current_user }) => {
})
}, [statusString, searchInput, orderBy, curPage]);
// const columns = useCallback(()=>{
const columns = [
{
title: '任务',
dataIndex: 'name',
},
{
title: '类型',
dataIndex: 'createdAt',
render: (text, record) => {
return <div className="flex-column">
<span className="line_1">{taskCategoryValueArr[record.categoryId]}</span>
<span className="line_1">{publishModeArr[record.publishMode]}</span>
</div>
}
},
{
title: '应征投稿',
dataIndex: 'papersCount',
render: (text) => {
return text || 0
}
},
{
title: '金额',
dataIndex: 'bounty',
render: (text) => {
return <span className="color-orange">{text}</span>
}
},
{
title: '任务状态',
dataIndex: 'status',
render: (text, record) => {
return statusArr[text]
}
},
{
title: '操作',
key: 'action',
render: (text, record) => (
<span>
<Link className="line_1 color-grey3" to={`/task/taskDetail/${record.id}`}>查看详情</Link>
</span >
),
},
];
// },[taskCategoryValueArr,publishModeArr,statusArr]);
function taskClick(id) {
history.push(`/task/taskDetail/${id}`);
}
@ -131,7 +77,7 @@ export default ({ location, history, current_user }) => {
if (type === 'publishStatus') {
setStatusString(option.dicItemCode.toString() || '3,4,5,6,7,8');
} else if (type === 'unpublishStatus') {
setStatusString(option.dicItemCode.toString() || '0,1,2');
setStatusString(option.dicItemCode.toString() || '0,1,2,9');
}
setCurPage(1);
}, [])
@ -141,7 +87,7 @@ export default ({ location, history, current_user }) => {
if (key === '1') {
setStatusString('3,4,5,6,7,8');
} else {
setStatusString('0,1,2');
setStatusString('0,1,2,9');
}
setCurPage(1);
}
@ -150,21 +96,12 @@ export default ({ location, history, current_user }) => {
if (key === '1') {
setStatusString('3,4,5,6,7,8');
} else {
setStatusString('0,1,2');
setStatusString('0,1,2,9');
}
setCurPage(1);
setStatusType(key);
}
function changeRequireAchieve(key) {
if (key === '1') {
setStatusString('3,4,5,6,7,8');
} else {
setStatusString('0,1,2');
}
setCurPage(1);
setRequireAchieve(key);
}
return (
<div className="centerbox my-task">
@ -199,6 +136,7 @@ export default ({ location, history, current_user }) => {
taskCategoryValueArr={taskCategoryValueArr}
changePage={(page) => { setCurPage(page) }}
loading={loading}
publish={true}
/>
</TabPane>
@ -218,6 +156,7 @@ export default ({ location, history, current_user }) => {
taskCategoryValueArr={taskCategoryValueArr}
changePage={(page) => { setCurPage(page) }}
loading={loading}
/>
</TabPane>
</Tabs>

View File

@ -9,7 +9,7 @@ import './index.scss';
const Search = Input.Search;
const { TabPane } = Tabs;
const publishStatusArr = taskStatusAllArr.slice(3);
const publishStatusArr = taskStatusAllArr.slice(3,9);
const statusArr = [];
for (const item of taskStatusAllArr) {

View File

@ -14,6 +14,7 @@ export const taskStatusAllArr = [
{ dicItemCode: 6, name: "协议签订中", dicItemName: '协议签订中' },
{ dicItemCode: 7, name: "支付中", dicItemName: '支付中' },
{ dicItemCode: 8, name: "已完成", dicItemName: '已完成' },
{ dicItemCode: 9, name: "待修缮", dicItemName: "待修缮" },
];
export const taskTimeArr = [
@ -28,6 +29,12 @@ export const taskModeIdArr = [
{ dicItemCode: 3, name: "计件悬赏", dicItemName: "计件悬赏" },
]
export const approveArr = [
{ dicItemCode: '3,4,5,6,7,8', name: "已同意", dicItemName: "已同意" },
{ dicItemCode: '2', name: "已拒绝", dicItemName: "已拒绝" },
{ dicItemCode: '9', name: "待修缮", dicItemName: "待修缮" },
]
export const publishModeArr=["自主提交","统筹任务"];
export const sortArr = [{

View File

@ -1,12 +1,12 @@
import React, { forwardRef, useEffect, useState, useCallback } from 'react';
import { Form, Input, Button, Modal, Table, Pagination, Checkbox } from 'antd';
import { Form, Input, Button, Modal, Table, Pagination, Checkbox, Tooltip } from 'antd';
import classNames from 'classnames';
import { Link } from "react-router-dom";
import { getImageUrl } from 'educoder';
import { getImageUrl, formatDuring } from 'educoder';
import Upload from '../../components/Upload';
import StatusNav from '../../components/statusNav';
import ItemListAchieve from '../components/itemListAchieve';
import { getTaskDetail, getTaskCategory, getTaskAchieve, addAchieve, getAgreement, agreement, checkAgreement, } from '../api';
import { getTaskDetail, getTaskCategory, getTaskAchieve, updateTask, addAchieve, getAgreement, agreement, checkAgreement, checkAchieve } from '../api';
import { taskModeIdArr, applyStatusArr, applyStatusAllArr, agreementContent } from '../static';
import { httpUrl } from '../../fetch';
import winpng from '../image/win.png';
@ -24,7 +24,6 @@ for (const item of applyStatusAllArr) {
applyStatusAllNameArr[item.dicItemCode] = item.dicItemName;
}
const columns = [
{
title: '应征者姓名',
@ -60,6 +59,7 @@ export default Form.create()(
const [applyContent, setApplyContent] = useState({ title: '应征投稿协议内容', content: agreementContent });
const [agreementCheckBox, setAgreementCheckBox] = useState(false);
const [signAgreement, setSignAgreement] = useState(false);
const [isAchieve, setIsAchieve] = useState(false);
const [status, setStatus] = useState('');
const [curPage, setCurPage] = useState(1);
@ -87,7 +87,6 @@ export default Form.create()(
useEffect(() => {
id && getTaskDetail(id).then(data => {
setDetailData(data || {});
console.log(data);
})
}, [id, reload]);
@ -100,6 +99,15 @@ export default Form.create()(
})
}, []);
//
useEffect(() => {
id && checkAchieve(id).then(res => {
if (res && res.data && res.data.status === 1) {
setIsAchieve(true);
}
})
}, []);
//
useEffect(() => {
applyModal && getAgreement().then(res => {
@ -134,20 +142,40 @@ export default Form.create()(
});
}, [id, status, curPage, reload, relaodChildList]);
;
//
const process = useCallback((title, days, active) => {
const process = useCallback((title, status, days) => {
let surplusTimetext = '';
if (detailData.status === status) {
let surplus = detailData.collectingDays * 24 * 3600 - (new Date() - new Date(detailData.publishedAt)) / 1000;
if (status === 4) {
surplus += detailData.choosingDays * 24 * 3600;
}
if (status === 5) {
surplus += detailData.makePublicDays * 24 * 3600;
}
if (status === 6) {
surplus += detailData.signingDays * 24 * 3600;
}
if (status === 7) {
surplus += detailData.payingDays * 24 * 3600;
}
surplusTimetext = formatDuring(surplus);
}
return (
<li key={title} className={classNames({ active: active })} >
<li key={title} className={classNames({ active: (detailData.status !== 9 && detailData.status >= status) })} >
<span>{title}</span>
{typeof days === 'string' && days.includes('延期') && <p className="color-grey-6 font-12">{days}</p>}
{(typeof days === 'number') && <p className="color-grey-6 font-12">
{days}
</p>}
{detailData.status !== status && <p className="color-grey-6 font-12">{days}</p>}
{detailData.status === status && detailData.delayTime && <p className="color-grey-6 font-12">{detailData.delayTime}</p>}
{detailData.status === status && (!detailData.delayTime) && <p className="color-grey-6 font-12">剩余{surplusTimetext}</p>}
</li>
)
}, [detailData]);
function downFile(item) {
let url = httpUrl + '/busiAttachments/download/' + item.id;
window.open(url);
@ -185,6 +213,7 @@ export default Form.create()(
addAchieve(params).then((res) => {
if (res.message === 'success') {
showNotification('成果提交成功');
setIsAchieve(true);
setReload(reload + 1);
setCurPage(1);
}
@ -200,6 +229,10 @@ export default Form.create()(
//
function agreementSign() {
if (!agreementCheckBox) {
showNotification("请阅读并同意本电子协议内容!");
return;
}
agreement(id).then(res => {
if (res.message === 'success') {
Modal.success({
@ -211,14 +244,83 @@ export default Form.create()(
});
}
function relaodList() {
function showUser() {
if (dataList.length === 0) {
Modal.info({
title: '提示',
content: '暂无应征者提交',
});
} else {
updateTask({
...detailData,
id,
showUserStatus: 1,
}).then(res => {
if (res && res.message === 'success') {
setDetailData(res.data || {});
} else {
showNotification('操作失败');
}
})
}
}
function reloadList() {
setRelaodChildList(relaodChildList + 1);
}
const signContent = useCallback(() => {
if (signAgreement && isAchieve) {
return <div class="edu-back-white padding30 mt20 font-16 color-orange text-center">
您已成功提交请等待审核
</div>
} else if (signAgreement) {
return (<div className="edu-back-white padding30 mt20">
<div className="font-16 font-bd">我要应征投稿</div>
{helper(
"",
"content",
[{ required: true, message: "请根据具体要求提交有效的稿件,才能打动需求方哟!" },
{ max: 1000, message: '长度不能超过1000个字符' }],
<TextArea
placeholder="请根据具体要求提交有效的稿件,才能打动需求方哟!"
autoSize={{ minRows: 6 }}
className="applyText"
/>
)}
<Form.Item >
<Upload
className="commentStyle"
load={UploadFunc}
size={50}
showNotification={showNotification}
actionUrl={httpUrl}
fileList={fileList}
/>
{getFieldDecorator('files', {
validateFirst: true
})(<Input style={{ display: 'none' }} />)}
</Form.Item>
<Button className="mr20" type={"primary"} onClick={() => { saveItem() }}>提交</Button>
</div>
)
} else {
return <div className="edu-back-white padding30 mt20 text-center">
<Button className="mr20" type={"primary"} onClick={() => { setApplyModal(true) }}>我要应征投稿</Button>
</div>
}
}, [signAgreement, isAchieve]);
function goUser(login) {
window.location.href = `/users/${login}`;
}
function exportAchieve() {
Modal.info({ title: '暂未提供接口' });
}
return (
<div className="centerbox task-detail">
<div className="head-navigation">
<Link to="/task">创客空间 &gt;</Link>
@ -229,8 +331,7 @@ export default Form.create()(
<div className="edu-back-white padding30">
<div className="df mb20">
<div className="mr30">
{/* <Link to={`/users/${detailData.user.login}`} alt="用户头像"><img alt="头像加载失败" className="bor-radius-all" height="60" src={getImageUrl("images/educoder/competition/1.png")} width="60" /></Link> */}
<a href="/users/p51497208" alt="用户头像"><img alt="头像加载失败" className="bor-radius-all" height="60" src={getImageUrl("images/educoder/competition/1.png")} width="60" /></a>
<a onClick={() => { goUser(detailData.user.login) }} alt="用户头像"><img alt="头像加载失败" className="bor-radius-all" height="60" src={getImageUrl("images/educoder/competition/1.png")} width="60" /></a>
<p className="lineh-20 mt10 edu-txt-center">{current_user.username}</p>
</div>
<div className="flex1">
@ -260,17 +361,18 @@ export default Form.create()(
<ul className="tasks_status clearfix">
<li className="active"><span>发布任务</span></li>
{process('成果提交', detailData.status === 3 && detailData.delayTime ? detailData.delayTime : detailData.collectingDays, detailData.status > 2)}
{process('成果评选', detailData.status === 4 && detailData.delayTime ? detailData.delayTime : detailData.choosingDays, detailData.status > 3)}
{process('成果提交', 3, detailData.collectingDays)}
{process('结果公示', detailData.status === 5 && detailData.delayTime ? detailData.delayTime : detailData.makePublicDays, detailData.status > 4)}
{process('成果评选', 4, detailData.choosingDays)}
{process('任务协议签订', detailData.status === 6 && detailData.delayTime ? detailData.delayTime : detailData.signingDays, detailData.status > 5)}
{process('结果公示', 5, detailData.makePublicDays)}
{process('支付', detailData.status === 7 && detailData.delayTime ? detailData.delayTime : detailData.payingDays, detailData.status > 6)}
{process('任务协议签订', 6, detailData.signingDays)}
{process('任务完成', undefined, detailData.status > 7)}
{process('支付', 7, detailData.payingDays)}
{process('任务完成', 8)}
</ul>
</div>
@ -279,7 +381,7 @@ export default Form.create()(
{/* 富文本内容插入 */}
<div className="content-text editor-w-text" dangerouslySetInnerHTML={{ __html: detailData.description }}></div>
{detailData.tasksAttachments && <React.Fragment>
{detailData.uploadFileNumbers && <React.Fragment>
<div className="font-16 font-bd">任务文件</div>
{
detailData.tasksAttachments.map(item => {
@ -304,46 +406,17 @@ export default Form.create()(
</p>
</div>
{detailData.status === 3 && (signAgreement ?
<div className="edu-back-white padding30 mt20">
<div className="font-16 font-bd">我要应征投稿</div>
{helper(
"",
"content",
[{ required: true, message: "请输入" }],
<TextArea
placeholder="请输入"
autoSize={{ minRows: 6 }}
className="applyText"
/>
)}
<Form.Item >
<Upload
className="commentStyle"
load={UploadFunc}
size={50}
showNotification={showNotification}
actionUrl={httpUrl}
fileList={fileList}
/>
{getFieldDecorator('files', {
validateFirst: true
})(<Input style={{ display: 'none' }} />)}
</Form.Item>
<Button className="mr20" type={"primary"} onClick={() => { saveItem() }}>提交</Button>
</div> :
<div className="edu-back-white padding30 mt20 text-center">
<Button className="mr20" type={"primary"} onClick={() => { setApplyModal(true) }}>我要应征投稿</Button>
</div>
)
}
{detailData.status === 3 && signContent()}
<div className="applyList edu-back-white padding30 mt20">
<div className="font-16 font-bd">交稿{dataList.length}<i data-tip-down="不公示应征者姓名" className="iconfont icon-yincang1 color-grey9 font-20"></i>
<div className="font-16 font-bd">交稿{dataList.length}
{!detailData.showUserStatus && <Tooltip placement="top" title={"不公示应征者姓名"}>
<i data-tip-down="不公示应征者姓名" className="iconfont icon-yincang1 color-grey9 font-20"></i>
</Tooltip>}
{/* <a href="javascript:void(0)" onclick="upload_proofs_popup(130)" className="line_1 color-blue fr ml20" id="proof-upload-button">上传佐证材料</a> */}
{/* <a href="/tasks/130/export_papers" className="line_1 color-blue fr ml20" data-disable-with="<img alt=&quot;Loading&quot; className=&quot;download-loading&quot; src=&quot;/images/loading.gif?1564989000&quot; ></a>下载中..." target="_blank">一键导出成果物</a> */}
{/* <a href="javascript:notice_box('暂无应征者提交')"><span className="fr color-orange ml20">应征者名单公示 &gt;&gt;</span></a> */}
{dataList.length > 0 && <a className="line_1 color-blue fr ml20" onClick={exportAchieve}>一键导出成果物 &gt;&gt;</a>}
{!detailData.showUserStatus && <a className="fr color-orange ml20" onClick={showUser}>应征者名单公示 &gt;&gt;</a>}
</div>
<StatusNav
@ -379,7 +452,7 @@ export default Form.create()(
changePage={(page) => { setCurPage(page) }}
loading={loading}
applyStatusAllNameArr={applyStatusAllNameArr}
relaodList={relaodList}
reloadList={reloadList}
showNotification={showNotification}
/>}
</div>
@ -392,7 +465,7 @@ export default Form.create()(
className="form-edit-modal"
width='60vw'
>
<div className="new_li markdown-body editormd-html-preview " id="agreement_content" style={{ boxSizing: "border-box", padding: "0px 20px" }} dangerouslySetInnerHTML={{ __html: applyContent.content }}></div>
<div className="new_li markdown-body editormd-html-preview " style={{ boxSizing: "border-box", padding: "0px 20px" }} dangerouslySetInnerHTML={{ __html: applyContent.content }}></div>
<div className="mt5 mb10 pl20 pr20 ml15">
<Checkbox checked={agreementCheckBox} onChange={(e) => { setAgreementCheckBox(e.target.checked) }}>我已阅读并同意本电子协议内容</Checkbox>
</div>

View File

@ -8,14 +8,11 @@ import Upload from '../../components/Upload';
import { httpUrl } from '../../fetch';
import { getTaskDetail, addTask, updateTask, getTaskCategory } from '../api';
import { formItemLayout, formModalLayout } from '../static';
import { editorConfig } from '../../components/config';
import './index.scss';
const { info } = Modal;
let actionUrl = '';
if (window.location.href.indexOf('localhost') > -1) {
actionUrl = httpUrl;
}
function getSomeDayAfter(nDay) {
return moment(new Date().setDate(new Date().getDate() + nDay)).format('YYYY-MM-DD HH:mm');
@ -28,7 +25,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
const [publishMode, setPublishMode] = useState('0');
const [categoryId, setCategoryId] = useState('7');
const [description, setDescription] = useState('');
const [descriptionHtml, setDescriptionHtml] = useState('');
const [enterpriseName, setEnterpriseName] = useState('神马科技股份有限公司');
const [displayTime, setDisplayTime] = useState(() => {
return {
@ -60,7 +57,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
bounty: data.bounty,
taskModeId: data.taskModeId,
collectionMode: data.collectionMode,
publishMode: data.publishMode,
publishMode: data.publishMode + '',
description: data.description,
collectingDays: data.collectingDays,
@ -80,7 +77,8 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
setFieldsValue(formValue);
setEnterpriseName(data.enterpriseName);
setCategoryId(data.categoryId);
setDescription(data.description);
setDescriptionHtml(data.description);
setPublishMode(data.publishMode + '');
let collectingTime = getSomeDayAfter(data.collectingDays);
let choosingTime = getSomeDayAfter(data.collectingDays + data.choosingDays);
@ -88,8 +86,6 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
let signingTime = getSomeDayAfter(data.collectingDays + data.choosingDays + data.makePublicDays + data.signingDays);
let payingTime = getSomeDayAfter(data.collectingDays + data.choosingDays + data.makePublicDays + data.signingDays + data.payingDays);
setDisplayTime({ collectingTime, choosingTime, makePublicTime, signingTime, payingTime });
console.log(data);
});
} else {
let formValue = {
@ -149,7 +145,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
setFileList(fileList);
let files = [];
for (const item of fileList) {
files.push(item.id || item.response.data.id);
item && files.push(item.id || item.response.data.id);
}
setFieldsValue({
uploadFileNumbers: files.join()
@ -176,16 +172,9 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
</div>
), [publishMode]);
function changeHtml(html) {
setFieldsValue({
description: html
});
setDescription(html);
}
//
const publishDeal = useCallback((status, publishMode, res) => {
if (res && res.data) {
if (res && res.message==='success') {
showNotification("任务保存成功!");
if (!status) {
history.push("/task/myTask?published=false")
@ -329,31 +318,14 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
)}
<Form.Item >
<ReactWEditor
value={description}
config={
{
placeholder: "把您的任务内容补充详细一些吧,越清晰具体,任务完成质量越高哟~",
uploadImgServer: actionUrl + '/busiAttachments/upload',
uploadFileName: 'file',
uploadImgHeaders: {
'X-Requested-With': 'XMLHttpRequest'
},
uploadImgHooks: {
//
customInsert: function (insertImgFn, result) {
// insertImgFn src
if (result && result.data && result.data.id) {
insertImgFn(`${actionUrl}/busiAttachments/view/${result.data.id}`);
}
}
},
}
}
onChange={(html) => {
changeHtml(html);
{(!id || (id && descriptionHtml)) && <ReactWEditor
defaultValue={descriptionHtml}
config={{
...editorConfig,
placeholder: "把您的任务内容补充详细一些吧,越清晰具体,任务完成质量越高哟~",
}}
/>
onChange={(html) => { setFieldsValue({ description: html }) }}
/>}
{/* 用一个隐藏的input实现上必填校验 */}
{getFieldDecorator('description', {
rules: [{ required: true, message: "把您的任务内容补充详细一些吧,越清晰具体,任务完成质量越高哟~" }],
@ -372,8 +344,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
load={UploadFunc}
size={50}
showNotification={showNotification}
// actionUrl={httpUrl}
actionUrl={'http://117.50.100.12:8001'}
actionUrl={httpUrl}
fileList={fileList}
/>
{getFieldDecorator('uploadFileNumbers', {

View File

@ -0,0 +1,166 @@
import React, { useCallback, forwardRef, useEffect, useState } from 'react';
import { Input, Button, Form } from 'antd';
import ItemTaskManage from '../components/itemTaskManage';
import StatusNav from '../../components/statusNav';
import { approveArr } from '../static';
import { manageTaskList, getTaskCategory } from '../api';
import './index.scss';
export default Form.create()(({ current_user, form, showNotification, match, history }) => {
const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form;
const [categoryArr, setCategoryArr] = useState([]);
const [approve, setApprove] = useState(1);
const [loading, setLoading] = useState(false);
const [searchObj, setSearchObj] = useState({});
const [statusString, setStatusString] = useState('1');
const [curPage, setCurPage] = useState(1);
const [total, setTotal] = useState(0);
const [taskList, setTaskList] = useState([]);
const [reload, setReload] = useState(0);
useEffect(() => {
getTaskCategory().then(data => {
if (data) {
let categoryArr = [];
for (const item of data) {
categoryArr[item.id] = item.name;
}
setCategoryArr(categoryArr);
}
});
}, []);
useEffect(() => {
const params = {
...searchObj,
statusString,
orderBy: 'createdAtDesc',
curPage,
pageSize: 10,
};
setLoading(true);
manageTaskList(params).then(data => {
if (data) {
setTaskList(data.rows);
setTotal(data.total);
}
setLoading(false);
})
}, [reload, statusString, curPage, searchObj]);
const helper = useCallback(
(name, rules, widget) => (
<Form.Item>
{getFieldDecorator(name, { rules, validateFirst: true, })(widget)}
</Form.Item>
), []);
function onSearch() {
validateFields((err, values) => {
if (!err) {
setSearchObj(values);
}
});
}
const changeOptionId = useCallback((option) => {
setStatusString(option.dicItemCode.toString() || '2,3,4,5,6,7,8');
setCurPage(1);
}, []);
function changeApprove(approve) {
setApprove(approve);
setCurPage(1);
if (approve === 1) {
setStatusString('1');
} else {
setStatusString('2,3,4,5,6,7,8');
}
}
function clearSearch() {
setFieldsValue({
numberInput: '',
nameInput: '',
enterpriseNameInput: ''
});
setSearchObj({});
}
const reloadList = useCallback(() => {
setReload(reload + 1);
}, [])
return (
<div className="centerbox task-manage">
<div className="center-screen" >
<div className="center-left-but">
<Button className="circle-button" type={approve === 1 ? 'primary' : ''} onClick={() => { changeApprove(1) }}>待审批</Button>
<Button className="circle-button" type={approve === 2 ? 'primary' : ''} onClick={() => { changeApprove(2) }}>已审批</Button>
</div>
<div className="center-right-but">
{helper(
"numberInput",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="输入任务编号进行检索"
/>
)}
{helper(
"nameInput",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="输入任务名称进行检索"
/>
)}
{helper(
"enterpriseNameInput",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="输入任务名称进行检索"
/>
)}
<Button className="mr10" type="primary" onClick={onSearch}>搜索</Button>
<Button className="mr10" type="" onClick={clearSearch}>清除</Button>
</div>
</div>
<div className="center-content">
{
approve === 2 && <StatusNav
key={'approveStatus'}
type={'approveStatus'}
options={approveArr}
changeOptionId={changeOptionId}
/>
}
<ItemTaskManage
list={taskList}
curPage={curPage}
total={total}
changePage={(page) => { setCurPage(page) }}
loading={loading}
categoryArr={categoryArr}
showNotification={showNotification}
reloadList={reloadList}
/>
</div>
</div>
)
}
)

View File

@ -0,0 +1,24 @@
.task-manage{
margin-top:1.25rem;
.status-list{
margin: 0 1.5rem;
}
}
.center-screen {
display: flex;
justify-content: space-between;
height: 4.5rem;
margin:1.25rem 0;
background-color: #fff;
}
.center-left-but {
.circle-button {
border-radius: 1rem;
margin-right: 0.5rem;
}
}
.center-right-but {
.ant-form-item {
margin: 0 1rem 0 0;
}
}