diff --git a/src/military/components/Upload.jsx b/src/military/components/Upload.jsx index af85624c..6dc9f415 100644 --- a/src/military/components/Upload.jsx +++ b/src/military/components/Upload.jsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from "react"; import { Upload, Button } from 'antd'; import { appendFileSizeToUploadFileAll } from 'educoder'; +import { httpUrl } from '../fetch'; function Uploads({ className, size, actionUrl, fileList, showNotification, load }) { const [files, setFiles] = useState(undefined); @@ -30,7 +31,20 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load return itemId !== id; }); setFiles(nf); - load && load(nf); + backFiles(nf); + } + + function backFiles(fileList) { + if (fileList && fileList.length) { + let filesId = []; + for (const item of fileList) { + if (item) { + let itemId = (item.response && item.response.data && item.response.data.id) || item.id; + itemId && filesId.push(itemId); + } + } + load && load(fileList, filesId.join()); + } } @@ -44,7 +58,7 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load fileList.splice(i, 1); } } - load && load(fileList); + backFiles(fileList); if (!info.file.response.data) { info.file.response && showNotification(info.file.response.message) } @@ -63,7 +77,7 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load const upload = { name: 'file', fileList: files, - action: actionUrl + `/busiAttachments/upload`, + action: (httpUrl || actionUrl) + `/busiAttachments/upload`, onChange: handleChange, onRemove: onAttachmentRemove, beforeUpload: beforeUpload, diff --git a/src/military/task.js b/src/military/task.js index 457f79d7..abf79060 100644 --- a/src/military/task.js +++ b/src/military/task.js @@ -56,6 +56,11 @@ const PublicityComplain = Loadable({ loading: Loading, }); +const AgreementManage = Loadable({ + loader: () => import("./task/agreementManage"), + loading: Loading, +}); + const Index = (propsTransmit) => { // 开发时,从代理的位置获取用户信息 const [currentUser, setCurrentUser] = useState(null); @@ -148,6 +153,14 @@ const Index = (propsTransmit) => { )} > + {/* 协议审核 */} + ( + + )} + > + {/* 成果列表 */} { + const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form; + + const [approve, setApprove] = useState(1); + const [loading, setLoading] = useState(false); + const [searchObj, setSearchObj] = useState({}); + const [status, setStatus] = useState('1'); + const [curPage, setCurPage] = useState(1); + const [total, setTotal] = useState(0); + const [taskList, setTaskList] = useState([]); + + const [reload, setReload] = useState(0); + + useEffect(() => { + const params = { + ...searchObj, + status, + type:'', + currentPage:curPage, + pageSize: 10, + }; + setLoading(true); + agreementList(params).then(data => { + if (data) { + setTaskList(data.rows); + setTotal(data.total); + } + setLoading(false); + }) + }, [reload, status, curPage, searchObj]); + + + const helper = useCallback( + (name, rules, widget) => ( + + {getFieldDecorator(name, { rules, validateFirst: true, })(widget)} + + ), []); + + + function onSearch() { + validateFields((err, values) => { + if (!err) { + setSearchObj(values); + } + }); + } + + const changeOptionId = useCallback((option) => { + setStatus(option.dicItemCode.toString() || '0,2'); + setCurPage(1); + }, []); + + function changeApprove(approve) { + setApprove(approve); + setCurPage(1); + if (approve === 1) { + setStatus('1'); + } else { + setStatus('0,2'); + } + } + + function clearSearch() { + setFieldsValue({ + numberInput: '', + nameInput: '', + enterpriseNameInput: '' + }); + setSearchObj({}); + } + + const reloadList = useCallback(() => { + setReload(reload + 1); + }, []) + + return ( +
+ +
+
+ + +
+ +
+ {helper( + "numberInput", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + {helper( + "nameInput", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + {helper( + "enterpriseNameInput", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + + + +
+
+ + +
+ + { + approve === 2 && + } + { setCurPage(page) }} + loading={loading} + showNotification={showNotification} + reloadList={reloadList} + /> + +
+ + +
+ ) +} +) \ No newline at end of file diff --git a/src/military/task/api.js b/src/military/task/api.js index 6fbc92f2..c2940197 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -1,4 +1,4 @@ -import fetch,{} from '../fetch'; +import fetch, { } from '../fetch'; import { notification } from 'antd'; // 获取字典分类列表 @@ -139,7 +139,7 @@ export function addPaper(data) { } // 任务成果 -export async function getTaskPaper(params){ +export async function getTaskPaper(params) { let res = await fetch({ url: '/api/paper/', method: 'get', @@ -156,7 +156,7 @@ export async function getTaskPaper(params){ } // 审核任务成果 -export async function readyCheckPapers(params){ +export async function readyCheckPapers(params) { let res = await fetch({ url: '/api/paper/admin/readyCheckPapers', method: 'get', @@ -173,7 +173,7 @@ export async function readyCheckPapers(params){ } // 我的成果 -export async function myPapers(params){ +export async function myPapers(params) { let res = await fetch({ url: '/api/paper/my', method: 'get', @@ -198,7 +198,7 @@ export function updatePaper(data) { }); } -export function deletePaper(id){ +export function deletePaper(id) { return fetch({ url: `api/paper/${id}`, method: 'delete', @@ -219,7 +219,7 @@ export function thumbUpPaper(id) { return fetch({ url: `/api/paper/${id}/thumbUp`, method: 'post', - data: {paperId:id} + data: { paperId: id } }); } @@ -232,7 +232,7 @@ export function checkAgreement(taskId) { } // 检查用户是否提交了成果 -export function checkHavePaper(taskId){ +export function checkHavePaper(taskId) { return fetch({ url: `/api/paper/${taskId}/check`, method: 'get' @@ -253,7 +253,7 @@ export function agreement(taskId) { return fetch({ url: `/api/paper/${taskId}/agreement`, method: 'post', - data: {taskId} + data: { taskId } }); } @@ -295,7 +295,7 @@ export function checkTask(data) { // 审核成果/评论 -export function checkPaper(data){ +export function checkPaper(data) { return fetch({ url: `/api/paper/admin/complainPaper/${data.paperId}`, method: 'post', @@ -304,7 +304,7 @@ export function checkPaper(data){ } // 成果申诉 -export function complainPaper(data){ +export function complainPaper(data) { return fetch({ url: `/api/paper/complainInfo/${data.paperId}`, method: 'post', @@ -330,7 +330,7 @@ export async function complainPaperList(params) { } // 审核申诉材料 -export function checkComplain(data){ +export function checkComplain(data) { return fetch({ url: `/api/paper/admin/complainMaterial/${data.paperId}`, method: 'post', @@ -340,7 +340,7 @@ export function checkComplain(data){ // 佐证上传 -export function proofAdd(data){ +export function proofAdd(data) { return fetch({ url: `/api/taskResultProof/addTaskResultProof`, method: 'post', @@ -366,7 +366,7 @@ export async function proofList(params) { } // 审核佐证 -export function checkProof(data){ +export function checkProof(data) { return fetch({ url: `/api/taskResultProof/adminCheckResultAndProof`, method: 'post', @@ -375,7 +375,7 @@ export function checkProof(data){ } // 应征者公示期申诉 -export function publicityComplain(data){ +export function publicityComplain(data) { return fetch({ url: `/api/myTasks/applicantComplaintDuringPublicity`, method: 'post', @@ -401,7 +401,7 @@ export async function publicityComplainList(params) { } // 审核公示期申诉 -export function checkPublicity(data){ +export function checkPublicity(data) { return fetch({ url: `/api/tasks/backend/adminCheck/complaintMaterialDuringPublicity`, method: 'post', @@ -409,11 +409,64 @@ export function checkPublicity(data){ }); } - -export function signMethod(data){ +// 选择签订协议的方式 +export function signMethod(data) { return fetch({ url: `/api/sign/method/${data.taskId}/${data.method}`, method: 'post', - // data, + }); +} + +// 上传委托协议 +export function uploadAgreeRequire(data) { + return fetch({ + url: `/api/sign/task/contract/${data.taskId}`, + method: 'post', + data: data.params + }); +} + +// 审核委托协议列表 +export async function agreementList(params) { + let res = await fetch({ + url: '/api/sign/task/contract', + method: 'get', + params, + }); + if (res.data) { + return res.data; + } else { + notification.open({ + message: "提示", + description: res.message || '请求错误', + }); + } +} + +// 审核协议 +export function adminCheckAgreement(data) { + return fetch({ + url: `/api/sign/admin/${data.type === 1 ? 'task' : 'paper'}/contract/${data.agreementId}`, + method: 'post', + data: data.params + }); +} + + +// 上传委托协议 +export function uploadAgreePaper(data) { + return fetch({ + url: `/api/sign/paper/contract/${data.paperId}`, + method: 'post', + data: data.params + }); +} + + +// 胜出者确认收款 +export function confirmReceipt(paperId) { + return fetch({ + url: `/api/sign/paper/money/${paperId}`, + method: 'post', }); } \ No newline at end of file diff --git a/src/military/task/components/complainModal/index.jsx b/src/military/task/components/complainModal/index.jsx index e28499d8..7e70d632 100644 --- a/src/military/task/components/complainModal/index.jsx +++ b/src/military/task/components/complainModal/index.jsx @@ -1,14 +1,13 @@ import React, { useEffect, useState, useCallback, useMemo } from 'react'; import { Modal, Form, Input, } from 'antd'; import Upload from 'military/components/Upload'; -import { uploadAgreePaper } from "../../api"; -import { httpUrl } from 'military/fetch'; +import { complainPaper, publicityComplain, } from "../../api"; import '../../index.scss'; const { TextArea } = Input; export default Form.create()(props => { - const { visible, setVisible, paperId, form, showNotification, reloadList } = props; + const { visible, setVisible, checkedItem, detailStatus, form, showNotification, reloadList } = props; const { getFieldDecorator, validateFields, setFieldsValue, } = form; const [fileList, setFileList] = useState([]); @@ -22,29 +21,6 @@ export default Form.create()(props => { }); } - function uploadAgree() { - validateFields((err, values) => { - if (!err) { - uploadAgreePaper({ - paperId, - params: { - files: values.files, - } - }).then(res => { - if (res.message === 'success') { - setFieldsValue({ - files: '', - }); - setVisible(false); - showNotification("上传协议成功!"); - } else { - showNotification(res.message || "上传协议失败") - } - }) - } - }) - } - const helper = useCallback( (name, rules, widget) => ( @@ -56,30 +32,41 @@ export default Form.create()(props => { function complain() { validateFields((error, values) => { - // if (!error) { - // if (detailStatus === 5) { - // publicityComplain({ - // content: values.complainValue, - // files: values.files, - // paperId: checkedItem.id, - // }).then(res => { - // complainDeal(res); - // }); - // } else { - // complainPaper({ - // paperId: checkedItem.id, - // params: { - // content: values.complainValue, - // files: values.files, - // } - // }).then(res => { - // complainDeal(res); - // }); - // } - // } + if (!error) { + if (detailStatus === 5) { + publicityComplain({ + content: values.complainValue, + files: values.files, + paperId: checkedItem.id, + }).then(res => { + complainDeal(res); + }); + } else { + complainPaper({ + paperId: checkedItem.id, + params: { + content: values.complainValue, + files: values.files, + } + }).then(res => { + complainDeal(res); + }); + } + } }); } + function complainDeal(res) { + if (res && res.message === 'success') { + showNotification('申诉提交成功'); + setVisible(false); + setFileList(null); + setFieldsValue({ + files: '' + }); + } + } + return ( { onCancel={() => { setVisible(false) }} className="form-edit-modal" > -
-

你的申诉信息将发送给平台管理员

-

请如实填写有效的申诉原由,我们将尽快完成审核

- { - helper('complainValue', [{ required: visible, message: "(必填)请在此输入发起申诉的原因,最大限制100个字符" }, - { max: 100, message: '长度不能超过100个字符' }], -