From 1d4bb3f4fc407a199c65a62f911f1b74b628ff95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Sat, 10 Jul 2021 10:00:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/military/fetch.js | 22 +-- src/military/task/api.js | 7 + .../task/components/itemListPaper/index.jsx | 8 +- .../task/components/itemTaskManage/index.jsx | 3 +- .../task/components/proofModal/index.jsx | 21 ++- src/military/task/paperComplain/index.js | 103 ++++++++----- src/military/task/paperManage/index.jsx | 135 +++++++++++------- src/military/task/taskDetail/index.jsx | 24 ++-- src/military/task/taskDetail/index.scss | 7 + src/military/task/taskEdit/index.jsx | 4 +- 10 files changed, 205 insertions(+), 129 deletions(-) diff --git a/src/military/fetch.js b/src/military/fetch.js index b8b41bda..9098e5f3 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -29,7 +29,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 { @@ -49,40 +49,40 @@ service.interceptors.response.use( }, error => { let res = error.response || {}; - if (res.status == 400) { + if (res.status === 400) { notification.open({ message: "提示", - description: '验证失败', + description: res.data.message || '验证失败', }); return Promise.reject('error'); } - if (res.status == 401) { + if (res.status === 401) { notification.open({ message: "提示", - description: '未授权,请登录!', + description: res.data.message || '未授权,请登录!', }); return Promise.reject('error'); } - if (res.status == 403) { + if (res.status === 403) { notification.open({ message: "提示", - description: '无权限', + description: res.data.message || '无权限', }); // window.location.href="/403"; return Promise.reject('error'); } - if (res.status == 404) { + if (res.status === 404) { notification.open({ message: "提示", - description: '无权限', + description: res.data.message || '无服务', }); // window.location.href="/404"; return Promise.reject('error'); } - if (res.status == 40001) { + if (res.status === 40001) { notification.open({ message: "提示", - description: '账户或密码错误!', + description: res.data.message || '账户或密码错误!', }); return Promise.reject('error'); } diff --git a/src/military/task/api.js b/src/military/task/api.js index c31d3164..6fbc92f2 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -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({ diff --git a/src/military/task/components/itemListPaper/index.jsx b/src/military/task/components/itemListPaper/index.jsx index b86a1cbd..42c87d6d 100644 --- a/src/military/task/components/itemListPaper/index.jsx +++ b/src/military/task/components/itemListPaper/index.jsx @@ -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) { diff --git a/src/military/task/components/itemTaskManage/index.jsx b/src/military/task/components/itemTaskManage/index.jsx index 3ba8b804..072b38ae 100644 --- a/src/military/task/components/itemTaskManage/index.jsx +++ b/src/military/task/components/itemTaskManage/index.jsx @@ -88,7 +88,8 @@ export default (props) => { { goUser(item.user.login) }}>{item.user.nickname || item.user.login} {timeAgo(item.createdAt)} - {item.status > 2 && 已同意} + {item.status > 2 && item.status !== 9 && 已同意} + {item.status === 9 && 已处理} {item.status === 2 && 已拒绝} { diff --git a/src/military/task/components/proofModal/index.jsx b/src/military/task/components/proofModal/index.jsx index 346c9daf..be57de90 100644 --- a/src/military/task/components/proofModal/index.jsx +++ b/src/military/task/components/proofModal/index.jsx @@ -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 => {

选出胜出者*

{helper( - "numberInput", + "number", [{ max: 20, message: '长度不能超过20个字符' }], { )} {helper( - "author", + "userName", [{ max: 20, message: '长度不能超过20个字符' }], )} diff --git a/src/military/task/paperComplain/index.js b/src/military/task/paperComplain/index.js index c369be62..2439065c 100644 --- a/src/military/task/paperComplain/index.js +++ b/src/military/task/paperComplain/index.js @@ -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) => ( + // + // {text} + // + // ), + // }, { - title: '来源任务', - dataIndex: 'name', - width: "20%", - render: (text, record) => ( - - {text} - - ), - }, - { - title: '评论/成果内容', + title: '申诉内容', dataIndex: 'content', width: "30%", + }, + { + title: '申诉文件', + dataIndex: 'materials', + width: "20%", render: (text, record) => { - return record.paperDetail ?
: '' + return
+ { + record.materials && record.materials.map(item => { + return
+ { downFile(item) }}> + {item.fileName} + ({item.fileSizeString}) +
+ }) + } +
} + }, { 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, }) { checkPaperItem(activeId, 0) }} + onOk={refuse} onCancel={() => { setVisible(false) }} className="form-edit-modal" > -