增加一键导出应征者信息功能

This commit is contained in:
何童崇 2023-01-03 16:21:08 +08:00
parent f2d3c899ff
commit a657866dd0
4 changed files with 134 additions and 25 deletions

View File

@ -33,8 +33,8 @@ export function initAxiosInterceptors(props) {
initOnlineOfflineListener();
// var proxy = "http://192.168.1.40:3000";
// var proxy = "http://111.8.36.180:8000";
var proxy = "http://117.50.100.12:49999";
var proxy = "http://111.8.36.180:8000";
// var proxy = "http://117.50.100.12:49999";
// var proxy = "https://www.osredm.com";
//响应前的设置

View File

@ -243,6 +243,22 @@ export async function getTaskPaper(params) {
}
}
// 导出应征者信息
export async function getPaperApplicant(taskId) {
let res = await fetch({
url: `/api/tasks/backend/admin/exportApplicantInfo/${taskId}`,
method: 'get',
});
if (res.data) {
return res.data;
} else {
notification.open({
message: "提示",
description: res.message || '请求错误',
});
}
}
// 审核任务成果
export async function readyCheckPapers(params) {
let res = await fetch({

View File

@ -0,0 +1,85 @@
import React ,{ useEffect, useState}from "react";
import { Table } from "antd";
import moment from 'moment';
import { exportExcel } from 'military/components/exportExcel';
import {getPaperApplicant } from "../api";
export default ({id,download,taskName})=>{
const [dataAll ,setDataAll]=useState([]);
const exportColumn=[
{
title: '序号',
dataIndex: "index",
render: (text, record, index) => {
return index + 1
}
},
{
title: '创客任务名称',
dataIndex: "name",
},
{
title: '用户名',
dataIndex: "nickname",
},
{
title: '成果编号',
key: 'number',
dataIndex: 'number',
},
{
title: '成果简介',
key: 'content',
dataIndex: 'content',
},
{
title: '提交时间',
key: 'createdAt',
dataIndex: 'createdAt',
},
{
title: '联系方式',
key: 'phone',
dataIndex: 'phone',
},
{
title: '真实姓名',
key: 'realName',
dataIndex: 'realName',
},
{
title: '身份证号',
key: 'card',
dataIndex: 'card',
},
{
title: '企业名称',
key: 'enterpriseName',
dataIndex: 'enterpriseName',
},
]
//
useEffect(() => {
if (!download) {
return;
}
getPaperApplicant(id).then(data => {
setDataAll(data || []);
// setDownloading(false);
exportExcel("#exportList .ant-table-body", `${taskName}-应征者信息-${moment().format("YYYY-MM-DD HH:mm:ss")}`);
});
}, [download]);
return (
<Table
id="exportList"
style={{ display: "none" }}
columns={exportColumn}
dataSource={dataAll}
pagination={false}
rowKey={(row) => row.id}
/>
)
}

View File

@ -8,8 +8,9 @@ import Upload from '../../components/Upload';
import StatusNav from '../../components/statusNav';
import ItemListPaper from '../components/itemListPaper';
import ProofModal from '../components/proofModal';
import ExportPaper from './exportPaper';
import { getTaskDetail, getTaskCategory, getTaskPaper, makePublic, addPaper, getAgreement, agreement, checkAgreement, checkHavePaper, addExpertReview, followTask, unfollowTask } from '../api';
import { taskModeIdArr, applyStatusArr, applyStatusAllArr,paperCheckSearchArr, agreementContent, paperCheckTextArr, surplusTime } from '../static';
import { taskModeIdArr, applyStatusArr, applyStatusAllArr, paperCheckSearchArr, agreementContent, paperCheckTextArr, surplusTime } from '../static';
import { httpUrl } from '../fetch';
import './index.scss';
import { getRules } from 'src/military/expert/api';
@ -45,7 +46,7 @@ export default Form.create()(
const [paperUploadLoading, setPaperUploadLoading] = useState(false);
const [status, setStatus] = useState('');
const [checkStatus, setCheckStatus] = useState('');
const [checkStatus, setCheckStatus] = useState('');
const [curPage, setCurPage] = useState(1);
const [total, setTotal] = useState(0);
const [dataList, setDataList] = useState([]);
@ -57,6 +58,7 @@ export default Form.create()(
const [visibleProofs, setVisibleProofs] = useState(false);
//
const [publishedReviewRules, setPublishedReviewRules] = useState(undefined);
const [download, setDownload] = useState();
// useEffect(()=>{
// !current_user.login&&showLoginDialog();
@ -109,6 +111,7 @@ export default Form.create()(
})
}, [current_user.login]);
//
const taskLimit = useMemo(() => {
if (current_user.admin) {
return true;
@ -219,7 +222,7 @@ export default Form.create()(
...values,
taskId: id
};
if (!params.files){
if (!params.files) {
delete params.files;
}
setPaperUploadLoading(true);
@ -241,14 +244,14 @@ export default Form.create()(
// setCurPage(1);
// }
//
const changeOptionId = useCallback((option, type) => {
if (type === 'applyStatus') {
setStatus(option.dicItemCode.toString() || '');
} else if (type === 'checkStatus') {
setCheckStatus(option.dicItemCode);
}
setCurPage(1);
}, []);
const changeOptionId = useCallback((option, type) => {
if (type === 'applyStatus') {
setStatus(option.dicItemCode.toString() || '');
} else if (type === 'checkStatus') {
setCheckStatus(option.dicItemCode);
}
setCurPage(1);
}, []);
//
function agreementSign() {
@ -424,10 +427,10 @@ export default Form.create()(
}
// 线
function showProof(){
let pdfId=detailData.taskResultProof&&detailData.taskResultProof.proofFileNumbers;
function showProof() {
let pdfId = detailData.taskResultProof && detailData.taskResultProof.proofFileNumbers;
Number(pdfId)>0&&window.open(`${httpUrl}/busiAttachments/view/${pdfId}?disposition=inline`, '_blank');
Number(pdfId) > 0 && window.open(`${httpUrl}/busiAttachments/view/${pdfId}?disposition=inline`, '_blank');
}
console.log(detailData.status === 4 && dataList.length && (!detailData.isProofBoolean) && (!detailData.expertReview) && detailData.user)
@ -456,7 +459,7 @@ export default Form.create()(
</span>
<span>
{
current_user && current_user.roles && current_user.roles.includes('管理员') && <Link class="adminEdit" to={`/task/taskEdit/${id}`}>编辑</Link>
current_user && current_user.roles && current_user.roles.includes('管理员') && <Link className="adminEdit" to={`/task/taskEdit/${id}`}>编辑</Link>
}
<span className='detail_tag_btn '>
{
@ -573,29 +576,33 @@ export default Form.create()(
<a className="line_1 color-blue fr ml20" onClick={() => { setVisibleProofs(true) }}>上传佐证材料</a> : ''}
{dataList.length > 0 && taskLimit && <a className="line_1 color-blue fr ml20" onClick={() => { window.open(`${httpUrl}/api/paper/papers/download/${id}`) }}>一键导出成果物 &gt;&gt;</a>}
{/* 若后台为“手动公示”,则显示按钮,是否公示由雇主与管理员是否点击“应征者名单公示”按钮决定,同时必须有成果,非关闭状态 */}
{!detailData.showUserStatus && !detailData.expertReview && taskLimit && detailData.showUserMode===2 && <a className="fr color-orange ml20" onClick={showUser}>应征者名单公示 &gt;&gt;</a>}
{dataList.length > 0 && taskLimit && <a className="line_1 color-blue fr ml20" onClick={() => { setDownload(Math.random()) }}>一键导出应征者信息</a>}
{/* 一键导出应征者组件table */}
<ExportPaper id={id} download={download} taskName={detailData.name} />
{/* 若后台为“手动公示”,则显示按钮,是否公示由雇主与管理员是否点击“应征者名单公示”按钮决定,同时必须有成果,非关闭状态 */}
{!detailData.showUserStatus && !detailData.expertReview && taskLimit && detailData.showUserMode === 2 && <a className="fr color-orange ml20" onClick={showUser}>应征者名单公示 &gt;&gt;</a>}
{detailData.isProofBoolean && <a className="fr color-orange ml20" onClick={showProof}>评审结果公示</a>}
{detailData.isProofBoolean&& <a className="fr color-orange ml20" onClick={showProof}>评审结果公示</a>}
{/* [添加专家评审流程]按钮入口,仅管理员可见 */}
{taskLimit && !detailData.expertReview && detailData.status < 4 && <a className="fr color-orange ml20" onClick={addExpertReviewModal}>添加专家评审流程</a>}
</div>
{[5,6,7,8].includes(detailData.status)&&<StatusNav
{[5, 6, 7, 8].includes(detailData.status) && <StatusNav
key={'applyStatus'}
type={'applyStatus'}
options={applyStatusArr}
changeOptionId={changeOptionId}
/>}
{[3,4].includes(detailData.status)&& <StatusNav
{[3, 4].includes(detailData.status) && <StatusNav
key={'checkStatus'}
type={'checkStatus'}
options={paperCheckSearchArr}
changeOptionId={changeOptionId}
/> }
/>}
<ItemListPaper
current_user={current_user}
@ -638,6 +645,7 @@ export default Form.create()(
showNotification={showNotification}
reloadList={reloadDetail}
/>}
</div>
)