预约面试功能开发
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:
@@ -298,7 +298,7 @@ function ManagementList() {
|
||||
<ResumeView
|
||||
values={currentRow}
|
||||
open={resumeVisible}
|
||||
matching={{ jobId, companyId: (jobInfo as any)?.companyId, applyId: currentRow?.applyId }}
|
||||
matching={{ jobId, companyId: (jobInfo as any)?.companyId, applyId: currentRow?.applyId, jobName: (jobInfo as any)?.jobTitle }}
|
||||
onClose={() => {
|
||||
setResumeVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ProDescriptions} from '@ant-design/pro-components';
|
||||
import {
|
||||
addCmsUserWorkExperiencesList,
|
||||
addCmsInterview,
|
||||
getCmsInterviewList,
|
||||
} from '@/services/Management/list';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
@@ -27,17 +28,43 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
const [interviewForm] = Form.useForm();
|
||||
const [interviewMethod, setInterviewMethod] = useState<string>('online');
|
||||
const [submitting, setSubmitting] = useState<boolean>(false);
|
||||
const [alreadyInvited, setAlreadyInvited] = useState<boolean>(false);
|
||||
const [checkingInvitation, setCheckingInvitation] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (props.open && props.values) {
|
||||
console.log(props.values);
|
||||
fetchResumeDetail();
|
||||
checkExistingInvitation();
|
||||
// 重置面试邀约表单
|
||||
interviewForm.resetFields();
|
||||
setInterviewMethod('online');
|
||||
}
|
||||
}, [props.values,props.open]);
|
||||
|
||||
// 检查是否已存在有效邀约
|
||||
const checkExistingInvitation = async () => {
|
||||
if (!props.matching?.jobId || !props.values?.userId) return;
|
||||
setCheckingInvitation(true);
|
||||
try {
|
||||
const res = await getCmsInterviewList({
|
||||
jobId: Number(props.matching.jobId),
|
||||
userId: props.values.userId,
|
||||
});
|
||||
if (res?.code === 200 && res?.rows?.length > 0) {
|
||||
// 存在非 rejected 的邀约即为已邀约
|
||||
const hasActive = res.rows.some(
|
||||
(item: API.Management.InterviewInvitation) => item.status !== 'rejected'
|
||||
);
|
||||
setAlreadyInvited(hasActive);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('检查邀约状态失败:', error);
|
||||
} finally {
|
||||
setCheckingInvitation(false);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchResumeDetail = async () => {
|
||||
if (!props.values?.userId) return;
|
||||
|
||||
@@ -66,6 +93,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
jobId: Number(props.matching?.jobId),
|
||||
userId: props.values?.userId,
|
||||
applyId: props.values?.applyId ? Number(props.values.applyId) : undefined,
|
||||
jobName: props.matching?.jobName,
|
||||
interviewTime: values.interviewTime
|
||||
? dayjs(values.interviewTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
: undefined,
|
||||
@@ -81,12 +109,15 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
const response = await addCmsInterview(payload);
|
||||
if (response.code === 200) {
|
||||
message.success('面试邀约已发送');
|
||||
setAlreadyInvited(true);
|
||||
interviewForm.resetFields();
|
||||
setInterviewMethod('online');
|
||||
} else {
|
||||
message.error(response.msg || '发送失败');
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
const errMsg = error?.response?.data?.msg || error?.message || '发送面试邀约失败';
|
||||
message.error(errMsg);
|
||||
console.error('发送面试邀约失败:', error);
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -156,7 +187,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
<Form
|
||||
form={interviewForm}
|
||||
layout="vertical"
|
||||
initialValues={{ interviewMethod: 'online' }}
|
||||
initialValues={{ interviewMethod: 'online', meetingLink: 'https://mc.repohub.cn/pro.html' }}
|
||||
>
|
||||
<Form.Item
|
||||
name="interviewMethod"
|
||||
@@ -188,18 +219,17 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
<>
|
||||
<Form.Item
|
||||
name="meetingLink"
|
||||
label="腾讯会议链接"
|
||||
rules={[{ required: true, message: '请输入腾讯会议链接' }]}
|
||||
label="在线会议链接"
|
||||
>
|
||||
<Input placeholder="请输入腾讯会议链接" />
|
||||
<Input placeholder="https://mc.repohub.cn/pro.html" disabled />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
{/* <Form.Item
|
||||
name="meetingPassword"
|
||||
label="会议密码"
|
||||
rules={[{ required: true, message: '请输入会议密码' }]}
|
||||
>
|
||||
<Input placeholder="请输入会议密码" />
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -229,8 +259,13 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<Button type="primary" loading={submitting} onClick={handleInterviewSubmit}>
|
||||
发送面试邀约
|
||||
<Button
|
||||
type="primary"
|
||||
loading={submitting || checkingInvitation}
|
||||
disabled={alreadyInvited}
|
||||
onClick={handleInterviewSubmit}
|
||||
>
|
||||
{alreadyInvited ? '已邀约' : '发送面试邀约'}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user