修改bug

This commit is contained in:
何童崇 2021-07-10 10:00:19 +08:00
parent b9888a81f6
commit 3608b7b712
10 changed files with 197 additions and 121 deletions

View File

@ -32,7 +32,7 @@ service.interceptors.request.use(config => {
}
if (window.location.port === "3007") {
// 模拟token为登录用户
const taskToken=sessionStorage.taskToken||'fde0d895b20856ccea4ff2df032c4450d6b692fd';
const taskToken = sessionStorage.taskToken || 'fde0d895b20856ccea4ff2df032c4450d6b692fd';
if (config.url.indexOf('?') === -1) {
config.url = `${config.url}?token=${taskToken}`;
} else {
@ -52,14 +52,14 @@ service.interceptors.response.use(
if (res.status === 400) {
notification.open({
message: "提示",
description: '验证失败',
description: res.data.message || '验证失败',
});
return Promise.reject('error');
}
if (res.status === 401) {
notification.open({
message: "提示",
description: '未授权,请登录!',
description: res.data.message || '未授权,请登录!',
});
return Promise.reject('error');
}

View File

@ -198,6 +198,13 @@ export function updatePaper(data) {
});
}
export function deletePaper(id){
return fetch({
url: `api/paper/${id}`,
method: 'delete',
});
}
//举报成果
export function reportPaper(data) {
return fetch({

View File

@ -112,11 +112,11 @@ export default Form.create()((props) => {
}
function complain() {
if (!fileList || !fileList.length) {
showNotification('请提交申诉文件!');
return;
}
validateFields((error, values) => {
if (!fileList || !fileList.length) {
showNotification('请提交申诉文件!');
return;
}
if (!error) {
let files = [];
for (const item of fileList) {

View File

@ -88,7 +88,8 @@ export default (props) => {
<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 && item.status !== 9 && <span className="spanTitle color-grey-6 fl ml20">已同意</span>}
{item.status === 9 && <span className="spanTitle color-yellow fl ml20">已处理</span>}
{item.status === 2 && <span className="spanTitle color-red fl ml20">已拒绝</span>}
{

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState, useCallback, useMemo } from 'react';
import { Modal, Table, Form, Input, Button, Pagination } from 'antd';
import { Link } from "react-router-dom";
import Upload from 'military/components/Upload';
import { getTaskPaper, proofAdd } from "../../api";
import { readyCheckPapers, proofAdd } from "../../api";
import { httpUrl } from 'military/fetch';
import '../../index.scss';
import './index.scss';
@ -28,12 +28,12 @@ export default Form.create()(props => {
let params = {
...searchObj,
taskId,
orderBy: '',
checkStatus: '1',
pageSize,
curPage,
status: '',
}
taskId && getTaskPaper(params).then(data => {
taskId && readyCheckPapers(params).then(data => {
if (data && Array.isArray(data.rows)) {
for (const item of data.rows) {
item.detail = item.paperDetail && item.paperDetail.content;
@ -43,7 +43,7 @@ export default Form.create()(props => {
setLoading(false);
setTotal(data.total);
});
}, [taskId, curPage,]);
}, [taskId, curPage, searchObj]);
const helper = useCallback(
@ -63,9 +63,8 @@ export default Form.create()(props => {
function clearSearch() {
setFieldsValue({
numberInput: '',
nameInput: '',
enterpriseNameInput: ''
number: '',
userName: '',
});
setSearchObj({});
}
@ -119,7 +118,7 @@ export default Form.create()(props => {
if (!selectedRows.length) {
showNotification("请至少选择一条数据!");
}
if (!fileList && !fileList.length) {
if (!fileList || !fileList.length) {
showNotification("请上传文件!");
}
@ -167,7 +166,7 @@ export default Form.create()(props => {
<h3 className="margin10">选出胜出者<span className="color-red">*</span></h3>
<div className="center-right-but">
{helper(
"numberInput",
"number",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="请输入成果编号进行检索"
@ -175,10 +174,10 @@ export default Form.create()(props => {
)}
{helper(
"author",
"userName",
[{ max: 20, message: '长度不能超过20个字符' }],
<Input
placeholder="请输入作者主体名称进行检索"
placeholder="请输入作者名称进行检索"
/>
)}
<Button className="mr10" type="primary" onClick={onSearch}>搜索</Button>

View File

@ -3,12 +3,14 @@ import { Input, Button, Radio, Form, Table, Pagination, Modal } from 'antd';
import { Link } from "react-router-dom";
import StatusNav from '../../components/statusNav';
import { complainPaperList, checkComplain } from '../api';
import { proofArr } from '../static';
import { paperCheckStatusArr } from '../static';
import { httpUrl } from 'military/fetch';
import '../index.scss';
const TextArea = Input.TextArea;
const proofArrCheck = proofArr.slice(0, 2);
const proofArrCheck = paperCheckStatusArr.slice(1);
export default Form.create()(({ current_user, form, showNotification, match, }) => {
@ -24,12 +26,12 @@ export default Form.create()(({ current_user, form, showNotification, match, })
const [reload, setReload] = useState(0);
const [visible, setVisible] = useState(false);
const [activeId, setActiveId] = useState('');
const [message, setMessage] = useState('');
const [status, setStatus] = useState('0');
useEffect(() => {
const params = {
...searchObj,
status,
curPage,
pageSize: 10,
};
@ -42,7 +44,7 @@ export default Form.create()(({ current_user, form, showNotification, match, })
setLoading(false);
})
}, [reload, curPage, searchObj]);
}, [reload, status, curPage, searchObj]);
@ -57,7 +59,7 @@ export default Form.create()(({ current_user, form, showNotification, match, })
function onSearch() {
validateFields((err, values) => {
if (!err) {
setSearchObj(values);
setSearchObj({ numberInput: values.numberInput });
}
});
}
@ -65,8 +67,6 @@ export default Form.create()(({ current_user, form, showNotification, match, })
function clearSearch() {
setFieldsValue({
numberInput: '',
nameInput: '',
enterpriseNameInput: ''
});
setSearchObj({});
}
@ -75,34 +75,53 @@ export default Form.create()(({ current_user, form, showNotification, match, })
function changeApprove(approve) {
setApprove(approve);
setCurPage(1);
// if (approve === 1) {
// setStatusString('1');
// } else {
// setStatusString('2,3,4,5,6,7,8');
// }
if (approve === 1) {
setStatus('0');
} else {
setStatus('1,2');
}
}
function downFile(item) {
let url = httpUrl + '/busiAttachments/download/' + item.id;
window.open(url);
}
const columns = useMemo(() => {
return [
// {
// title: '来源任务',
// dataIndex: 'name',
// width: "20%",
// render: (text, record) => (
// <span>
// <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.taskId}`}>{text}</Link>
// </span >
// ),
// },
{
title: '来源任务',
dataIndex: 'name',
width: "20%",
render: (text, record) => (
<span>
<Link className="line_1 color-grey3" to={`/task/taskDetail/${record.taskId}`}>{text}</Link>
</span >
),
},
{
title: '评论/成果内容',
title: '申诉内容',
dataIndex: 'content',
width: "30%",
},
{
title: '申诉文件',
dataIndex: 'materials',
width: "20%",
render: (text, record) => {
return record.paperDetail ? <div className="text-ellipsis" dangerouslySetInnerHTML={{ __html: record.paperDetail.content }}></div> : ''
return <div>
{
record.materials && record.materials.map(item => {
return <div className="file-list-box" key={item.id}>
<a onClick={() => { downFile(item) }}><i className="iconfont icon-fujian color-green font-14 mr3"></i>
{item.fileName} </a>
<span className="ml10 color-grey-9">({item.fileSizeString})</span>
</div>
})
}
</div>
}
},
{
title: '评论/提交者',
@ -136,7 +155,7 @@ export default Form.create()(({ current_user, form, showNotification, match, })
]
}, []);
function checkPaperItem(paperId, pass) {
function checkPaperItem(paperId, pass, message) {
setLoading(true);
checkComplain({
paperId,
@ -153,8 +172,16 @@ export default Form.create()(({ current_user, form, showNotification, match, })
});
}
function refuse() {
validateFields((err, values) => {
if (!err) {
checkPaperItem(activeId, 0, values.message);
}
});
}
const changeOptionId = useCallback((option) => {
// setProofStatusString(option.dicItemCode.toString() || '0,1');
setStatus(option.dicItemCode.toString() || '1,2');
setCurPage(1);
}, []);
@ -213,18 +240,20 @@ export default Form.create()(({ current_user, form, showNotification, match, })
<Modal
title="不通过的原因"
visible={visible}
onOk={() => { checkPaperItem(activeId, 0) }}
onOk={refuse}
onCancel={() => { setVisible(false) }}
className="form-edit-modal"
>
<TextArea
value={message}
placeholder="(必填)我想给点什么意见呢,200字以内"
autoSize={{ minRows: 6 }}
className="applyText"
onChange={(e) => { setMessage(e.target.value) }}
maxLength={200}
/>
{helper(
"message",
[{ required: true, message: '请给出不通过的原因' }],
<TextArea
placeholder="(必填)我想给点什么意见呢,200字以内"
autoSize={{ minRows: 6 }}
className="applyText"
maxLength={200}
/>
)}
</Modal>
</div>
)

View File

@ -1,17 +1,18 @@
import React, { useCallback, useEffect, useState, useMemo } from 'react';
import { Input, Radio, Select, Button, Form, DatePicker, Table, Pagination, Modal } from 'antd';
import { Link } from "react-router-dom";
import DelModal from 'military/components/DelModal';
import { paperCheckStatusArr } from '../static';
import { readyCheckPapers, checkPaper } from '../api';
import { readyCheckPapers, checkPaper, deletePaper } from '../api';
import '../index.scss';
const format = "YYYY-MM-DD HH:mm:ss";
const Option = Select.Option;
const TextArea = Input.TextArea;
const checkStatusArr=[];
for(const item of paperCheckStatusArr){
checkStatusArr[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 }) => {
@ -20,7 +21,7 @@ export default Form.create()(({ current_user, form, showNotification, match, his
const [loading, setLoading] = useState(false);
const [searchObj, setSearchObj] = useState({
checkStatus:'0,1,2'
checkStatus: '0,1,2'
});
const [curPage, setCurPage] = useState(1);
const [total, setTotal] = useState(0);
@ -29,8 +30,6 @@ export default Form.create()(({ current_user, form, showNotification, match, his
const [reload, setReload] = useState(0);
const [visible, setVisible] = useState(false);
const [activeId, setActiveId] = useState('');
const [pass, setPass] = useState(2);
const [message, setMessage] = useState('');
useEffect(() => {
@ -60,14 +59,11 @@ export default Form.create()(({ current_user, form, showNotification, match, his
function onSearch() {
validateFields((err, values) => {
if (!err) {
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);
}
});
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() {
@ -114,7 +110,10 @@ export default Form.create()(({ current_user, form, showNotification, match, his
title: '审核状态',
dataIndex: 'checkStatus',
render: (text, record) => {
return checkStatusArr[text]
return text === 0 ? <React.Fragment>
<Button className="mr5 font-12" type="primary" size="small" onClick={() => { checkPaperItem(record.id, true) }}>通过</Button>
<Button className="mr5 font-12" type="info" size="small" onClick={() => { setActiveId(record.id); setVisible(true) }}>不通过</Button>
</React.Fragment> : checkStatusArr[text]
}
},
{
@ -122,40 +121,59 @@ export default Form.create()(({ current_user, form, showNotification, match, his
key: 'action',
render: (text, record) => (
<React.Fragment>
<Button className="mr5 font-12" type="primary" size="small" onClick={() => { checkPaperItem(record.id, true) }}>通过</Button>
<Button className="mr5 font-12" type="info" size="small" onClick={() => { setActiveId(record.id); setVisible(true) }}>不通过</Button>
{/* <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.id}`}>查看详情</Link> */}
{/* <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 checkPaperItem(paperId, passStatus) {
setLoading(true);
checkPaper({
paperId,
auditingVo: {
pass: passStatus ? 1 : pass,
message,
}
}).then(res => {
if (res && res.message === 'success') {
setReload(reload + 1);
setVisible(false);
// if (taskList.length === 1) {
// setCurPage(curPage - 1 || 1);
// }
}
setLoading(false);
function deletItem(id) {
DelModal(() => {
deletePaper(id).then(res => {
if (res.message === 'success') {
showNotification("删除成功");
history.go(-1);
} else {
showNotification("删除失败");
}
})
});
}
function changeStatus(e){
function checkPaperItem(paperId, passStatus) {
validateFields((err, values) => {
if (!err) {
setLoading(true);
checkPaper({
paperId,
auditingVo: {
pass: passStatus ? 1 : values.pass,
message: values.message,
}
}).then(res => {
if (res && res.message === 'success') {
setReload(reload + 1);
setVisible(false);
setFieldsValue({
pass:'',
message:'',
})
}
setLoading(false);
});
}
});
}
function changeStatus(e) {
setSearchObj({
...searchObj,
checkStatus:e,
checkStatus: e,
});
setCurPage(1);
}
return (
@ -185,7 +203,6 @@ export default Form.create()(({ current_user, form, showNotification, match, his
<div className="center-right-but">
{helper(
"发布时间:",
"startCreatedAt",
@ -241,21 +258,31 @@ export default Form.create()(({ current_user, form, showNotification, match, his
onCancel={() => { setVisible(false) }}
className="form-edit-modal"
>
<Radio.Group
className="mb10"
value={pass}
onChange={(e) => { setPass(e.target.value) }}>
<Radio value={2}>允许申诉</Radio>
<Radio value={0}>不允许申诉</Radio>
</Radio.Group>
<TextArea
value={message}
placeholder="(必填)我想说点什么呢,200字以内"
autoSize={{ minRows: 6 }}
className="applyText"
onChange={(e) => { setMessage(e.target.value) }}
maxLength={200}
/>
{helper(
"",
"pass",
[{required:true,message:'请选择是否允许申诉'}],
<Radio.Group
className="mb10"
>
<Radio value={2}>允许申诉</Radio>
<Radio value={0}>不允许申诉</Radio>
</Radio.Group>
)
}
{helper(
"",
"message",
[{required:true,message:'请输入拒绝的原因'}],
<TextArea
placeholder="(必填)我想说点什么呢,200字以内"
autoSize={{ minRows: 6 }}
className="applyText"
maxLength={200}
/>
)
}
</Modal>
</div>
)

View File

@ -41,6 +41,7 @@ export default Form.create()(
const [agreementCheckBox, setAgreementCheckBox] = useState(false);
const [signAgreement, setSignAgreement] = useState(false);
const [isPaper, setIsPaper] = useState(false);
const [paperUploadLoading, setPaperUploadLoading] = useState(false);
const [status, setStatus] = useState('');
const [curPage, setCurPage] = useState(1);
@ -202,7 +203,9 @@ export default Form.create()(
...values,
taskId: id
}
setPaperUploadLoading(true);
addPaper(params).then((res) => {
setPaperUploadLoading(false);
if (res.message === 'success') {
showNotification('成果提交成功');
setIsPaper(true);
@ -303,7 +306,7 @@ export default Form.create()(
validateFirst: true
})(<Input style={{ display: 'none' }} />)}
</Form.Item>
<Button className="mr20" type={"primary"} onClick={() => { saveItem() }}>提交</Button>
<Button className="mr20" type={"primary"} loading={paperUploadLoading} onClick={() => { saveItem() }}>提交</Button>
</div>
)
} else if (detailData.user && (current_user.login !== detailData.user.login)) {
@ -448,7 +451,7 @@ export default Form.create()(
{!detailData.showUserStatus && <Tooltip placement="top" title={"不公示应征者姓名"}>
<i data-tip-down="不公示应征者姓名" className="iconfont icon-yincang1 color-grey9 font-20"></i>
</Tooltip>}
{detailData.status === 4 && dataList.length && (!detailData.isProofBoolean) && detailData.user && (current_user.login === detailData.user.login) ?
{(detailData.status === 3 || detailData.status === 4) && dataList.length && (!detailData.isProofBoolean) && detailData.user && (current_user.admin || current_user.login === detailData.user.login) ?
<a className="line_1 color-blue fr ml20" onClick={() => { setVisibleProofs(true) }}>上传佐证材料</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> */}
{dataList.length > 0 && taskLimit && <a className="line_1 color-blue fr ml20" onClick={exportPaper}>一键导出成果物 &gt;&gt;</a>}
@ -503,19 +506,20 @@ export default Form.create()(
className="form-edit-modal"
width='60vw'
>
<div className="new_li markdown-body editormd-html-preview " style={{ boxSizing: "border-box", padding: "0px 20px" }} dangerouslySetInnerHTML={{ __html: applyContent.content }}></div>
<div className="new_li markdown-body editormd-html-preview agreement-content" dangerouslySetInnerHTML={{ __html: applyContent.content }}></div>
<div className="mt5 mb10 pl20 pr20 ml15">
<Checkbox checked={agreementCheckBox} onChange={(e) => { setAgreementCheckBox(e.target.checked) }}>我已阅读并同意本电子协议内容</Checkbox>
</div>
</Modal>
<ProofModal
taskId={id}
visible={visibleProofs}
changeVisible={setVisibleProofs}
showNotification={showNotification}
reloadList={reloadDetail}
/>
{
visibleProofs && <ProofModal
taskId={id}
visible={visibleProofs}
changeVisible={setVisibleProofs}
showNotification={showNotification}
reloadList={reloadDetail}
/>}
</div>
)

View File

@ -143,4 +143,11 @@
background-color:#409eff;
border-color: #409eff;
}
}
.agreement-content{
box-sizing: border-box;
padding: 0px 20px;
height: 50vh;
overflow-y: scroll;
}

View File

@ -179,7 +179,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
//
const publishDeal = useCallback((status, publishMode, res) => {
if (res && res.message === 'success') {
if (res && res.data) {
showNotification("任务保存成功!");
if (!status) {
history.push("/task/myTask?published=false")
@ -367,6 +367,8 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
"bounty",
[{ required: true, message: "您打算支付多少赏金呢" }],
<InputNumber
min={0}
max={99999999}
className="number-input"
placeholder="您打算支付多少赏金呢"
formatter={value => `${value}¥`}