feat: add recruitment fair participant export
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled
This commit is contained in:
@@ -22,6 +22,8 @@ import {
|
||||
} from '@/services/jobfair/publicJobFair';
|
||||
import EditModal from './components/EditModal';
|
||||
import CompanyJobManageModal from './components/CompanyJobManageModal';
|
||||
import FairExportModal from '../components/FairExportModal';
|
||||
import type { RecruitmentFairExportParams } from '@/services/jobfair/recruitmentFairExport';
|
||||
|
||||
const PublicJobFairList: React.FC = () => {
|
||||
const access = useAccess();
|
||||
@@ -36,6 +38,7 @@ const PublicJobFairList: React.FC = () => {
|
||||
const [jobFairRegionTypeEnum, setJobFairRegionTypeEnum] = useState<any>({});
|
||||
const [yesNoEnum, setYesNoEnum] = useState<any>({});
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
const [exportModalOpen, setExportModalOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('job_fair_type', true).then(setJobFairTypeEnum);
|
||||
@@ -76,27 +79,23 @@ const PublicJobFairList: React.FC = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const buildListSearchParams = (values: Record<string, any>): API.PublicJobFair.ListParams => {
|
||||
const { dateRange, current, pageSize, ...rest } = values || {};
|
||||
const params = { ...rest } as API.PublicJobFair.ListParams;
|
||||
if (dateRange?.[0] && dateRange?.[1]) {
|
||||
params.startDate = dateRange[0];
|
||||
params.endDate = dateRange[1];
|
||||
}
|
||||
return params;
|
||||
};
|
||||
|
||||
const handleExport = async () => {
|
||||
const handleExport = async (params: RecruitmentFairExportParams) => {
|
||||
message.loading('正在导出...');
|
||||
try {
|
||||
const searchVal = formRef.current?.getFieldsValue();
|
||||
await exportPublicJobFair(buildListSearchParams(searchVal || {}));
|
||||
await exportPublicJobFair(params);
|
||||
message.success('导出成功');
|
||||
setExportModalOpen(false);
|
||||
} catch {
|
||||
message.error('导出失败');
|
||||
}
|
||||
};
|
||||
|
||||
const dictOptions = (valueEnum: Record<string, any>) =>
|
||||
Object.entries(valueEnum).map(([value, item]) => ({
|
||||
value,
|
||||
label: item?.text || item?.label || value,
|
||||
}));
|
||||
|
||||
const columns: ProColumns<API.PublicJobFair.JobFairItem>[] = [
|
||||
{
|
||||
title: '时间范围',
|
||||
@@ -336,7 +335,12 @@ const PublicJobFairList: React.FC = () => {
|
||||
批量删除
|
||||
</Button>
|
||||
),
|
||||
<Button key="export" icon={<ExportOutlined />} onClick={handleExport}>
|
||||
<Button
|
||||
key="export"
|
||||
icon={<ExportOutlined />}
|
||||
hidden={!access.hasPerms('cms:publicJobFair:export')}
|
||||
onClick={() => setExportModalOpen(true)}
|
||||
>
|
||||
导出
|
||||
</Button>,
|
||||
]}
|
||||
@@ -373,6 +377,14 @@ const PublicJobFairList: React.FC = () => {
|
||||
setCurrentJobFair(undefined);
|
||||
}}
|
||||
/>
|
||||
<FairExportModal
|
||||
open={exportModalOpen}
|
||||
channel="online"
|
||||
fairTypeOptions={dictOptions(jobFairTypeEnum)}
|
||||
regionOptions={dictOptions(jobFairRegionTypeEnum)}
|
||||
onCancel={() => setExportModalOpen(false)}
|
||||
onExport={handleExport}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user