feat: implement job management for companies in public job fairs
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:
@@ -1,26 +1,37 @@
|
||||
import React, { useRef, useState, useEffect } from 'react';
|
||||
import { useAccess, history } from '@umijs/max';
|
||||
import { Button, FormInstance, message, Modal } from 'antd';
|
||||
import { Button, FormInstance, message, Modal, Tag } from 'antd';
|
||||
import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined, ExportOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
FormOutlined,
|
||||
ExportOutlined,
|
||||
EyeOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import DictTag from '@/components/DictTag';
|
||||
import {
|
||||
getPublicJobFairList,
|
||||
getPublicJobFairDetail,
|
||||
signupPublicJobFair,
|
||||
addPublicJobFair,
|
||||
updatePublicJobFair,
|
||||
deletePublicJobFair,
|
||||
exportPublicJobFair,
|
||||
} from '@/services/jobfair/publicJobFair';
|
||||
import EditModal from './components/EditModal';
|
||||
import CompanyJobManageModal from './components/CompanyJobManageModal';
|
||||
|
||||
const PublicJobFairList: React.FC = () => {
|
||||
const access = useAccess();
|
||||
const isEnterprise = Boolean(access.isEnterprise);
|
||||
const formRef = useRef<FormInstance>();
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [currentRow, setCurrentRow] = useState<API.PublicJobFair.JobFairItem>();
|
||||
const [companyJobModalOpen, setCompanyJobModalOpen] = useState(false);
|
||||
const [currentJobFair, setCurrentJobFair] = useState<API.PublicJobFair.JobFairItem>();
|
||||
const [jobFairTypeEnum, setJobFairTypeEnum] = useState<any>({});
|
||||
const [yesNoEnum, setYesNoEnum] = useState<any>({});
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
@@ -47,6 +58,22 @@ const PublicJobFairList: React.FC = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleSignup = (record: API.PublicJobFair.JobFairItem) => {
|
||||
Modal.confirm({
|
||||
title: '报名线上招聘会',
|
||||
content: `确定报名「${record.jobFairTitle}」吗?报名后需要等待管理员审核。`,
|
||||
onOk: async () => {
|
||||
const res = await signupPublicJobFair(record.jobFairId);
|
||||
if (res.code === 200) {
|
||||
message.success('报名成功,请等待管理员审核');
|
||||
actionRef.current?.reload();
|
||||
} else {
|
||||
message.error(res.msg || '报名失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const buildListSearchParams = (values: Record<string, any>): API.PublicJobFair.ListParams => {
|
||||
const { dateRange, current, pageSize, ...rest } = values || {};
|
||||
const params = { ...rest } as API.PublicJobFair.ListParams;
|
||||
@@ -102,6 +129,32 @@ const PublicJobFairList: React.FC = () => {
|
||||
valueEnum: jobFairTypeEnum,
|
||||
render: (_, record) => <DictTag enums={jobFairTypeEnum} value={record.jobFairType} />,
|
||||
},
|
||||
{
|
||||
title: '报名审核状态',
|
||||
dataIndex: 'enterpriseReviewStatus',
|
||||
hideInSearch: true,
|
||||
hideInTable: !isEnterprise,
|
||||
render: (_, record) => {
|
||||
if (record.isSignUp === undefined) return '-';
|
||||
if (record.isSignUp !== '1') return <Tag>未报名</Tag>;
|
||||
const statusMap: Record<string, { text: string; color: string }> = {
|
||||
'0': { text: '待审核', color: 'gold' },
|
||||
'1': { text: '已通过', color: 'green' },
|
||||
'2': { text: '已驳回', color: 'red' },
|
||||
};
|
||||
const status = statusMap[record.enterpriseReviewStatus || '0'] || statusMap['0'];
|
||||
return (
|
||||
<span>
|
||||
<Tag color={status.color}>{status.text}</Tag>
|
||||
{record.enterpriseReviewComments && (
|
||||
<span title={record.enterpriseReviewComments} style={{ color: '#999' }}>
|
||||
(有意见)
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '是否跨域',
|
||||
dataIndex: 'isCrossDomain',
|
||||
@@ -130,46 +183,85 @@ const PublicJobFairList: React.FC = () => {
|
||||
{
|
||||
title: '操作',
|
||||
valueType: 'option',
|
||||
width: 200,
|
||||
width: 360,
|
||||
fixed: 'right',
|
||||
render: (_, record) => [
|
||||
<Button
|
||||
key="detail"
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<EyeOutlined />}
|
||||
onClick={() => history.push(`/jobfair/public-job-fair/detail?id=${record.jobFairId}`)}
|
||||
>
|
||||
详情
|
||||
</Button>,
|
||||
<Button
|
||||
key="edit"
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<FormOutlined />}
|
||||
hidden={!access.hasPerms('cms:publicJobFair:edit')}
|
||||
onClick={async () => {
|
||||
const res = await getPublicJobFairDetail(record.jobFairId);
|
||||
if (res.code === 200) {
|
||||
setCurrentRow(res.data);
|
||||
setModalVisible(true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>,
|
||||
<Button
|
||||
key="delete"
|
||||
type="link"
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
hidden={!access.hasPerms('cms:publicJobFair:remove')}
|
||||
onClick={() => handleDelete(record.jobFairId)}
|
||||
>
|
||||
删除
|
||||
</Button>,
|
||||
],
|
||||
render: (_, record) => {
|
||||
const canViewDetail = !isEnterprise && access.hasPerms('cms:publicJobFair:query');
|
||||
const canSignUp =
|
||||
isEnterprise &&
|
||||
access.hasPerms('cms:publicJobFair:signup') &&
|
||||
(record.canSignUp ?? (record.isSignUp !== '1' || record.enterpriseReviewStatus === '2'));
|
||||
const canEditCompanyJobs =
|
||||
isEnterprise &&
|
||||
access.hasPerms('cms:publicJobFair:job:edit') &&
|
||||
(record.canEditJobs ?? record.enterpriseReviewStatus === '1');
|
||||
|
||||
return [
|
||||
canViewDetail && (
|
||||
<Button
|
||||
key="detail"
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<EyeOutlined />}
|
||||
onClick={() => history.push(`/jobfair/public-job-fair/detail?id=${record.jobFairId}`)}
|
||||
>
|
||||
详情
|
||||
</Button>
|
||||
),
|
||||
canSignUp && (
|
||||
<Button
|
||||
key="signup"
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<PlusOutlined />}
|
||||
onClick={() => handleSignup(record)}
|
||||
>
|
||||
报名
|
||||
</Button>
|
||||
),
|
||||
canEditCompanyJobs && (
|
||||
<Button
|
||||
key="companyJobs"
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<FormOutlined />}
|
||||
onClick={() => {
|
||||
setCurrentJobFair(record);
|
||||
setCompanyJobModalOpen(true);
|
||||
}}
|
||||
>
|
||||
编辑报名岗位
|
||||
</Button>
|
||||
),
|
||||
<Button
|
||||
key="edit"
|
||||
type="link"
|
||||
size="small"
|
||||
icon={<FormOutlined />}
|
||||
hidden={!access.hasPerms('cms:publicJobFair:edit')}
|
||||
onClick={async () => {
|
||||
const res = await getPublicJobFairDetail(record.jobFairId);
|
||||
if (res.code === 200) {
|
||||
setCurrentRow(res.data);
|
||||
setModalVisible(true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>,
|
||||
<Button
|
||||
key="delete"
|
||||
type="link"
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
hidden={!access.hasPerms('cms:publicJobFair:remove')}
|
||||
onClick={() => handleDelete(record.jobFairId)}
|
||||
>
|
||||
删除
|
||||
</Button>,
|
||||
];
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -248,6 +340,15 @@ const PublicJobFairList: React.FC = () => {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<CompanyJobManageModal
|
||||
open={companyJobModalOpen}
|
||||
jobFairId={currentJobFair?.jobFairId || ''}
|
||||
jobFairTitle={currentJobFair?.jobFairTitle}
|
||||
onCancel={() => {
|
||||
setCompanyJobModalOpen(false);
|
||||
setCurrentJobFair(undefined);
|
||||
}}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user