forked from Gitlink/forgeplus-react
修改bug
This commit is contained in:
parent
a2aa344e31
commit
8d9d5c3ce3
|
@ -66,6 +66,11 @@ const PayProof = Loadable({
|
|||
loading: Loading,
|
||||
});
|
||||
|
||||
const TaskAdmin = Loadable({
|
||||
loader: () => import("./task/taskAdmin"),
|
||||
loading: Loading,
|
||||
});
|
||||
|
||||
const Index = (propsTransmit) => {
|
||||
// 开发时,从代理的位置获取用户信息
|
||||
const [currentUser, setCurrentUser] = useState(null);
|
||||
|
@ -166,7 +171,7 @@ const Index = (propsTransmit) => {
|
|||
)}
|
||||
></Route>
|
||||
|
||||
{/* 管理员待办 */}
|
||||
{/* 管理员上传支付凭证 */}
|
||||
<Route
|
||||
path="/task/payProof"
|
||||
render={(props) => (
|
||||
|
@ -174,7 +179,15 @@ const Index = (propsTransmit) => {
|
|||
)}
|
||||
></Route>
|
||||
|
||||
{/* 成果列表 */}
|
||||
{/* 管理员任务列表 */}
|
||||
<Route
|
||||
path="/task/taskAdmin"
|
||||
render={(props) => (
|
||||
<TaskAdmin {...propsF} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
|
||||
{/* 任务列表 */}
|
||||
<Route
|
||||
path="/task"
|
||||
render={(props) => (
|
||||
|
|
|
@ -59,6 +59,23 @@ export async function getTaskList(params) {
|
|||
}
|
||||
}
|
||||
|
||||
// 管理员任务列表查询
|
||||
export async function getTaskAdminList(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 async function getMyTaskList(params) {
|
||||
let res = await fetch({
|
||||
|
@ -499,8 +516,6 @@ export function uploadPayProof(data){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 胜出者确认收款
|
||||
export function confirmReceipt(paperId) {
|
||||
return fetch({
|
||||
|
@ -508,3 +523,13 @@ export function confirmReceipt(paperId) {
|
|||
method: 'post',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 管理员修改任务公示方式
|
||||
export function changeShowUserMode(data) {
|
||||
return fetch({
|
||||
url: `/api/tasks/backend/changeShowUserMode`,
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -121,11 +121,8 @@ function goToDeatil(e,taskId){
|
|||
const handleRow = record => {
|
||||
return {
|
||||
onClick: event => {
|
||||
if (event.currentTarget.getElementsByClassName("ant-checkbox-wrapper")) {
|
||||
event.currentTarget.getElementsByClassName("ant-checkbox-wrapper")[0].click();
|
||||
} else {
|
||||
event.currentTarget.getElementsByClassName("ant-radio-wrapper")[0].click();
|
||||
}
|
||||
let chooseDom = event.currentTarget.getElementsByClassName("ant-checkbox-wrapper") || event.currentTarget.getElementsByClassName("ant-radio-wrapper");
|
||||
chooseDom && chooseDom[0] && chooseDom[0].click();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
.ant-form-item {
|
||||
margin: 0 1rem 0 0;
|
||||
}
|
||||
.ant-form-item-control-wrapper {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.center-left-but {
|
||||
.circle-button {
|
||||
|
@ -23,6 +26,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
// .center-right-but {
|
||||
|
||||
// }
|
||||
|
||||
.ant-select {
|
||||
min-width: 200px;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ agreementArr.splice(1,1);
|
|||
export default Form.create()(({ current_user, form, showNotification, match, history }) => {
|
||||
const { getFieldDecorator, validateFields, setFieldsValue, } = form;
|
||||
|
||||
const [approve, setApprove] = useState(1);
|
||||
const [approve, setApprove] = useState(2);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [searchObj, setSearchObj] = useState({});
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
|
@ -78,8 +78,8 @@ export default Form.create()(({ current_user, form, showNotification, match, his
|
|||
|
||||
<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>
|
||||
<Button className="circle-button" type={approve === 2 ? 'primary' : ''} onClick={() => { changeApprove(2) }}>待上传</Button>
|
||||
<Button className="circle-button" type={approve === 1 ? 'primary' : ''} onClick={() => { changeApprove(1) }}>已上传</Button>
|
||||
</div>
|
||||
|
||||
<div className="center-right-but">
|
||||
|
|
|
@ -102,6 +102,11 @@ export const paperComplainStatusArr=[
|
|||
{ dicItemCode: '2', name: "待审核", dicItemName: '待审核' },
|
||||
]
|
||||
|
||||
export const showUserModeArr=[
|
||||
{ dicItemCode: 0, name: "不公示", dicItemName: '不公示' },
|
||||
{ dicItemCode: 1, name: "自动公示", dicItemName: '自动公示' },
|
||||
{ dicItemCode: 2, name: "手动公示", dicItemName: '手动公示' },
|
||||
]
|
||||
|
||||
export const formItemLayout = {
|
||||
labelCol: {
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
||||
import { Input, Select, Button, Form, DatePicker, Table, Pagination, } from 'antd';
|
||||
import { Link } from "react-router-dom";
|
||||
import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr } from '../static';
|
||||
import { getTaskAdminList, changeShowUserMode } from '../api';
|
||||
import '../index.scss';
|
||||
import './index.scss';
|
||||
const format = "YYYY-MM-DD HH:mm:ss";
|
||||
const Option = Select.Option;
|
||||
|
||||
const statusArr = [];
|
||||
for (const item of taskStatusAllArr) {
|
||||
statusArr[item.dicItemCode] = item.dicItemName;
|
||||
}
|
||||
const checkStatusArr = [];
|
||||
for (const item of paperCheckStatusArr) {
|
||||
checkStatusArr[item.dicItemCode] = item.dicItemName;
|
||||
}
|
||||
export default Form.create()(({ current_user, form, showNotification, match, history }) => {
|
||||
|
||||
|
||||
const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form;
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [searchObj, setSearchObj] = useState({
|
||||
// checkStatus: '0'
|
||||
});
|
||||
const [curPage, setCurPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [taskList, setTaskList] = useState([]);
|
||||
|
||||
const [reload, setReload] = useState(0);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [activeId, setActiveId] = useState('');
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const params = {
|
||||
...searchObj,
|
||||
curPage,
|
||||
pageSize: 10,
|
||||
};
|
||||
setLoading(true);
|
||||
getTaskAdminList(params).then(data => {
|
||||
if (data) {
|
||||
setTaskList(data.rows);
|
||||
setTotal(data.total);
|
||||
}
|
||||
setLoading(false);
|
||||
})
|
||||
}, [reload, curPage, searchObj]);
|
||||
|
||||
|
||||
const helper = useCallback(
|
||||
(label, name, rules, widget, initialValue) => (
|
||||
<Form.Item label={label}>
|
||||
{getFieldDecorator(name, { rules, initialValue, validateFirst: true, })(widget)}
|
||||
</Form.Item>
|
||||
), []);
|
||||
|
||||
|
||||
function onSearch() {
|
||||
let values = getFieldsValue(['checkStatus', 'endCreatedAt', 'startCreatedAt']);
|
||||
if (values.startCreatedAt) values.startCreatedAt = values.startCreatedAt.format(format);
|
||||
if (values.endCreatedAt) values.endCreatedAt = values.endCreatedAt.format(format);
|
||||
if (values.checkStatus === '0,1,2') values.checkStatus = '';
|
||||
setSearchObj(values);
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
setFieldsValue({
|
||||
startCreatedAt: '',
|
||||
endCreatedAt: '',
|
||||
checkStatus: '0,1,2'
|
||||
});
|
||||
setSearchObj({});
|
||||
}
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
render: (text, record, index) => {
|
||||
return <div style={{ textAlign: 'center' }}>{index + 1}</div>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '任务编号',
|
||||
dataIndex: 'number',
|
||||
},
|
||||
{
|
||||
title: '任务名称',
|
||||
dataIndex: 'name',
|
||||
width: "20%",
|
||||
render: (text, record) => (
|
||||
<Link className="line_1 color-grey3" to={`/task/taskDetail/${record.id}`}>{text}</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '发布方式',
|
||||
dataIndex: 'publishMode',
|
||||
render: (text, record) => {
|
||||
return publishModeArr[text]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '任务状态',
|
||||
dataIndex: 'status',
|
||||
render: (text, record) => {
|
||||
return statusArr[text]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '提交时间',
|
||||
dataIndex: 'createdAt',
|
||||
},
|
||||
{
|
||||
title: '截稿时间',
|
||||
dataIndex: 'collectingEndTime',
|
||||
},
|
||||
{
|
||||
title: '应征者名单公示',
|
||||
dataIndex: 'showUserMode',
|
||||
render: (text, record) => {
|
||||
return <Select
|
||||
showArrow
|
||||
placeholder="请选择审核状态"
|
||||
defaultValue={text}
|
||||
onChange={(key) => { changeStatus(key, record.id) }}
|
||||
>
|
||||
{
|
||||
showUserModeArr.map(item => {
|
||||
return <Option key={item.dicItemCode} value={item.dicItemCode}>{item.dicItemName}</Option>
|
||||
})
|
||||
}
|
||||
</Select>
|
||||
}
|
||||
},
|
||||
// {
|
||||
// title: '操作',
|
||||
// key: 'action',
|
||||
// render: (text, record) => (
|
||||
// <React.Fragment>
|
||||
// {/* <Button className="mr5 font-12" type="danger" size="small" onClick={() => { deletItem(record.id) }}>删除</Button> */}
|
||||
// <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.taskId}`}>查看</Link>
|
||||
// </React.Fragment>
|
||||
// ),
|
||||
// },
|
||||
]
|
||||
}, []);
|
||||
|
||||
function changeStatus(showUserMode, taskId) {
|
||||
changeShowUserMode({
|
||||
taskId,
|
||||
showUserMode
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="centerbox task-manage">
|
||||
<div className="search-screen" >
|
||||
{helper(
|
||||
"任务名称",
|
||||
"nameInput",
|
||||
[{ max: 20, message: '长度不能超过20个字符' }],
|
||||
<Input
|
||||
placeholder="输入任务名称进行检索"
|
||||
/>
|
||||
)}
|
||||
|
||||
{helper(
|
||||
"发布主体名称",
|
||||
"enterpriseNameInput",
|
||||
[{ max: 20, message: '长度不能超过20个字符' }],
|
||||
<Input
|
||||
placeholder="输入发布主体名称进行检索"
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="center-right-but">
|
||||
|
||||
{helper(
|
||||
"发布时间:",
|
||||
"startCreatedAt",
|
||||
[],
|
||||
<DatePicker
|
||||
showTime
|
||||
format={format}
|
||||
placeholder="请选择开始时间"
|
||||
/>
|
||||
)}
|
||||
|
||||
{helper(
|
||||
"",
|
||||
"endCreatedAt",
|
||||
[],
|
||||
<DatePicker
|
||||
showTime
|
||||
format={format}
|
||||
placeholder="请选择结束时间"
|
||||
/>
|
||||
)}
|
||||
|
||||
<Button className="mr10" type="primary" onClick={onSearch}>搜索</Button>
|
||||
<Button className="mr10" type="" onClick={clearSearch}>清除</Button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="center-content">
|
||||
|
||||
<Table
|
||||
loading={loading}
|
||||
rowKey={(row) => row.id}
|
||||
dataSource={taskList}
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
className="mt10"
|
||||
/>
|
||||
{total > 10 &&
|
||||
<Pagination
|
||||
onChange={(page) => { setCurPage(page) }}
|
||||
current={curPage}
|
||||
total={total}
|
||||
/>}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
)
|
|
@ -0,0 +1,25 @@
|
|||
.search-screen {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
justify-content: space-between;
|
||||
margin: 1.25rem 0;
|
||||
padding:1.25rem;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #dedede;
|
||||
|
||||
>.ant-row{
|
||||
min-width: 40%;
|
||||
.ant-form-item-control-wrapper{
|
||||
min-width: 60%;
|
||||
}
|
||||
}
|
||||
.ant-form-item-control-wrapper{
|
||||
display: inline-block;
|
||||
}
|
||||
.center-right-but{
|
||||
.ant-form-item{
|
||||
margin: 0 1rem 0 0;;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue