111
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:
@@ -7,9 +7,9 @@ import {
|
||||
ProFormTextArea,
|
||||
ProDescriptions,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form, Button, Space } from 'antd';
|
||||
import { Form, Button, Input } from 'antd';
|
||||
import { PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
import { getCmsCompanyList } from '@/services/company/list';
|
||||
import { getCmsJobDetail } from '@/services/Management/list';
|
||||
@@ -36,6 +36,7 @@ const waitTime = (time: number = 100) => {
|
||||
|
||||
const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
const [form] = Form.useForm<API.ManagementList.Manage>();
|
||||
const companyNameMap = useRef<Record<number, string>>({});
|
||||
const [jobDetail, setJobDetail] = useState<API.ManagementList.Manage | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { educationEnum, experienceEnum, areaEnum, jobTypeEnum } = props;
|
||||
@@ -88,11 +89,33 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
};
|
||||
|
||||
const handleFinish = async (values: Record<string, any>) => {
|
||||
props.onSubmit(values as API.ManagementList.Manage);
|
||||
};
|
||||
|
||||
const handleChange = (_: string, value: any) => {
|
||||
form.setFieldValue('companyName', value.label);
|
||||
const payload: API.ManagementList.Manage = {
|
||||
jobTitle: values.jobTitle,
|
||||
companyId: values.companyId,
|
||||
companyName:
|
||||
typeof values.companyName === 'string'
|
||||
? values.companyName
|
||||
: companyNameMap.current[values.companyId] ?? '',
|
||||
minSalary: values.minSalary,
|
||||
maxSalary: values.maxSalary,
|
||||
education: values.education,
|
||||
experience: values.experience,
|
||||
jobLocationAreaCode: values.jobLocationAreaCode,
|
||||
vacancies: values.vacancies,
|
||||
jobType: values.jobType,
|
||||
jobLocation: values.jobLocation,
|
||||
description: values.description,
|
||||
jobContactList: (values.jobContactList ?? []).map((item: API.ManagementList.ContactPerson) => ({
|
||||
contactPerson: item.contactPerson,
|
||||
contactPersonPhone: item.contactPersonPhone,
|
||||
position: item.position,
|
||||
})),
|
||||
};
|
||||
if (mode === 'edit' && values.jobId) {
|
||||
payload.jobId = values.jobId;
|
||||
}
|
||||
await props.onSubmit(payload);
|
||||
return true;
|
||||
};
|
||||
if (mode === 'view') {
|
||||
return (
|
||||
@@ -280,11 +303,13 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
destroyOnClose: true,
|
||||
onCancel: () => handleCancel(),
|
||||
style: { height: '80vh' },
|
||||
bodyStyle: {
|
||||
height: 'calc(80vh - 120px)',
|
||||
overflowY: 'auto',
|
||||
padding: '16px 24px'
|
||||
}
|
||||
styles: {
|
||||
body: {
|
||||
height: 'calc(80vh - 120px)',
|
||||
overflowY: 'auto',
|
||||
padding: '16px 24px',
|
||||
},
|
||||
},
|
||||
}}
|
||||
submitTimeout={2000}
|
||||
onFinish={handleFinish}
|
||||
@@ -296,10 +321,17 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
showSearch
|
||||
width="md"
|
||||
name="companyId"
|
||||
onChange={handleChange}
|
||||
request={async ({ keyWords }) => {
|
||||
let resData = await getCmsCompanyList({ name: keyWords });
|
||||
return resData.rows.map((item) => ({ label: item.name, value: item.companyId }));
|
||||
const resData = await getCmsCompanyList({ name: keyWords });
|
||||
return resData.rows.map((item) => {
|
||||
companyNameMap.current[item.companyId] = item.name;
|
||||
return { label: item.name, value: item.companyId };
|
||||
});
|
||||
}}
|
||||
fieldProps={{
|
||||
onChange: (companyId: number) => {
|
||||
form.setFieldValue('companyName', companyNameMap.current[companyId] ?? '');
|
||||
},
|
||||
}}
|
||||
placeholder="请输入公司名称选择公司"
|
||||
rules={[{ required: true, message: '请输入公司名称选择公司!' }]}
|
||||
@@ -383,7 +415,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
rules={[{ required: true, message: '请输入联系人姓名' }]}
|
||||
style={{ marginBottom: 0, flex: 1 }}
|
||||
>
|
||||
<ProFormText placeholder="请输入联系人姓名" />
|
||||
<Input placeholder="请输入联系人姓名" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
{...restField}
|
||||
@@ -395,7 +427,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
]}
|
||||
style={{ marginBottom: 0, flex: 1 }}
|
||||
>
|
||||
<ProFormText placeholder="请输入联系电话" />
|
||||
<Input placeholder="请输入联系电话" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
{...restField}
|
||||
@@ -404,7 +436,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
rules={[{ required: true, message: '请输入职务' }]}
|
||||
style={{ marginBottom: 0, flex: 1 }}
|
||||
>
|
||||
<ProFormText placeholder="请输入职务" />
|
||||
<Input placeholder="请输入职务" />
|
||||
</Form.Item>
|
||||
<Button
|
||||
type="text"
|
||||
|
||||
Reference in New Issue
Block a user