修改bug

This commit is contained in:
何童崇 2021-07-14 14:42:05 +08:00
parent a2aa344e31
commit 8d9d5c3ce3
8 changed files with 436 additions and 127 deletions

View File

@ -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) => (

View File

@ -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,12 +516,20 @@ export function uploadPayProof(data){
}
// 胜出者确认收款
export function confirmReceipt(paperId) {
return fetch({
url: `/api/sign/paper/money/${paperId}`,
method: 'post',
});
}
}
// 管理员修改任务公示方式
export function changeShowUserMode(data) {
return fetch({
url: `/api/tasks/backend/changeShowUserMode`,
method: 'post',
data,
});
}

View File

@ -99,135 +99,132 @@ export default Form.create()(props => {
dataIndex: 'action',
render: (text, record) => {
// return <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.task.id}`}></Link>
return <a className="line_1 color-grey3" onClick={(e) => { goToDeatil(e,record.task.id) }}> 查看详情</a >
return <a className="line_1 color-grey3" onClick={(e) => { goToDeatil(e, record.task.id) }}> 查看详情</a >
}
}];
}, [taskId]);
const rowSelection = useMemo(() => {
return {
type: taskModeId === 1 ? 'radio' : 'checkbox',
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows);
},
}
}, [taskModeId]);
function goToDeatil(e,taskId){
e.stopPropagation();
window.location.href=`/task/taskDetail/${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();
}
},
};
};
function proofItem() {
if (!selectedRows.length) {
showNotification("请至少选择一条数据!");
return;
}
validateFields((err, values) => {
if (!err) {
let paperNumber = [];
let winnerIds = [];
let winnerName = [];
for (const item of selectedRows) {
paperNumber.push(item.number);
winnerIds.push(item.user.id);
winnerName.push(item.user.nickname || item.user.login);
}
let params = {
paperNumber: paperNumber.join(),
winnerIds: winnerIds.join(),
winnerName: winnerName.join(),
proofFileNumbers: values.files,
status: 2,
taskId,
};
proofAdd(params).then(res => {
if (res && res.message === 'success') {
changeVisible(false);
reloadList();
}
});
const rowSelection = useMemo(() => {
return {
type: taskModeId === 1 ? 'radio' : 'checkbox',
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows);
},
}
});
}, [taskModeId]);
}
function goToDeatil(e, taskId) {
e.stopPropagation();
window.location.href = `/task/taskDetail/${taskId}`;
}
return (
<Modal
title="上传评选佐证材料"
visible={visible}
onOk={proofItem}
onCancel={() => { changeVisible(false) }}
className="proof-modal"
draggable={true}
>
<h3 className="margin10">选出胜出者<span className="color-red">*</span></h3>
<div className="center-right-but">
{helper(
"number",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="请输入成果编号进行检索"
/>
)}
const handleRow = record => {
return {
onClick: event => {
let chooseDom = event.currentTarget.getElementsByClassName("ant-checkbox-wrapper") || event.currentTarget.getElementsByClassName("ant-radio-wrapper");
chooseDom && chooseDom[0] && chooseDom[0].click();
},
};
};
{helper(
"userName",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="请输入作者名称进行检索"
/>
)}
<Button className="mr10" type="primary" onClick={onSearch}>搜索</Button>
<Button className="mr10" type="" onClick={clearSearch}>清除</Button>
</div>
<Table
loading={loading}
rowKey={(row) => row.id}
dataSource={dataList}
columns={columns}
pagination={false}
rowSelection={rowSelection}
onRow={handleRow}
/>
{total > 10 &&
<Pagination
onChange={(page) => { setCurPage(page) }}
current={curPage}
total={total}
/>}
function proofItem() {
if (!selectedRows.length) {
showNotification("请至少选择一条数据!");
return;
}
<Form.Item className="upload-form" label="上传附件" required={true} >
<Upload
className="commentStyle"
load={UploadFunc}
size={50}
showNotification={showNotification}
actionUrl={httpUrl}
fileList={fileList}
validateFields((err, values) => {
if (!err) {
let paperNumber = [];
let winnerIds = [];
let winnerName = [];
for (const item of selectedRows) {
paperNumber.push(item.number);
winnerIds.push(item.user.id);
winnerName.push(item.user.nickname || item.user.login);
}
let params = {
paperNumber: paperNumber.join(),
winnerIds: winnerIds.join(),
winnerName: winnerName.join(),
proofFileNumbers: values.files,
status: 2,
taskId,
};
proofAdd(params).then(res => {
if (res && res.message === 'success') {
changeVisible(false);
reloadList();
}
});
}
});
}
return (
<Modal
title="上传评选佐证材料"
visible={visible}
onOk={proofItem}
onCancel={() => { changeVisible(false) }}
className="proof-modal"
draggable={true}
>
<h3 className="margin10">选出胜出者<span className="color-red">*</span></h3>
<div className="center-right-but">
{helper(
"number",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="请输入成果编号进行检索"
/>
)}
{helper(
"userName",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="请输入作者名称进行检索"
/>
)}
<Button className="mr10" type="primary" onClick={onSearch}>搜索</Button>
<Button className="mr10" type="" onClick={clearSearch}>清除</Button>
</div>
<Table
loading={loading}
rowKey={(row) => row.id}
dataSource={dataList}
columns={columns}
pagination={false}
rowSelection={rowSelection}
onRow={handleRow}
/>
{getFieldDecorator('files', {
rules: [{ required: visible, message: "请上传文件" }],
validateFirst: true
})(<Input style={{ display: 'none' }} />)}
</Form.Item>
</Modal>
{total > 10 &&
<Pagination
onChange={(page) => { setCurPage(page) }}
current={curPage}
total={total}
/>}
)
<Form.Item className="upload-form" label="上传附件" required={true} >
<Upload
className="commentStyle"
load={UploadFunc}
size={50}
showNotification={showNotification}
actionUrl={httpUrl}
fileList={fileList}
/>
{getFieldDecorator('files', {
rules: [{ required: visible, message: "请上传文件" }],
validateFirst: true
})(<Input style={{ display: 'none' }} />)}
</Form.Item>
</Modal>
)
}
)

View File

@ -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;
}

View File

@ -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">

View File

@ -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: {

View File

@ -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>
)
}
)

View File

@ -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;;
}
}
}