Merge remote-tracking branch 'origin/main' into refactor-matchRadar
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
|||||||
} from '@/services/company/list';
|
} from '@/services/company/list';
|
||||||
import { getDictValueEnum } from '@/services/system/dict';
|
import { getDictValueEnum } from '@/services/system/dict';
|
||||||
import DictTag from '@/components/DictTag';
|
import DictTag from '@/components/DictTag';
|
||||||
|
import { getCmsIndustryTreeList } from '@/services/classify/industry';
|
||||||
|
|
||||||
// 详情查看组件
|
// 详情查看组件
|
||||||
const CompanyDetailModal = ({
|
const CompanyDetailModal = ({
|
||||||
@@ -20,11 +21,13 @@ const CompanyDetailModal = ({
|
|||||||
onCancel,
|
onCancel,
|
||||||
record,
|
record,
|
||||||
scaleEnum,
|
scaleEnum,
|
||||||
|
industryEnum,
|
||||||
}: {
|
}: {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
record?: API.CompanyList.Company;
|
record?: API.CompanyList.Company;
|
||||||
scaleEnum: Record<string, any>;
|
scaleEnum: Record<string, any>;
|
||||||
|
industryEnum: Record<string, any>;
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@@ -40,7 +43,9 @@ const CompanyDetailModal = ({
|
|||||||
>
|
>
|
||||||
<Descriptions column={1} bordered>
|
<Descriptions column={1} bordered>
|
||||||
<Descriptions.Item label="公司名称">{record?.name}</Descriptions.Item>
|
<Descriptions.Item label="公司名称">{record?.name}</Descriptions.Item>
|
||||||
<Descriptions.Item label="公司行业">{record?.industry}</Descriptions.Item>
|
<Descriptions.Item label="公司行业">
|
||||||
|
<DictTag enums={industryEnum} value={record?.industry} />
|
||||||
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="公司规模">
|
<Descriptions.Item label="公司规模">
|
||||||
<DictTag enums={scaleEnum} value={record?.scale} />
|
<DictTag enums={scaleEnum} value={record?.scale} />
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
@@ -60,6 +65,7 @@ function ManagementList() {
|
|||||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||||
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
||||||
const [scaleEnum, setScaleEnum] = useState<Record<string, any>>({});
|
const [scaleEnum, setScaleEnum] = useState<Record<string, any>>({});
|
||||||
|
const [industryEnum, setIndustryEnum] = useState<Record<string, any>>({});
|
||||||
|
|
||||||
const handleRemoveOne = async (jobId: string) => {
|
const handleRemoveOne = async (jobId: string) => {
|
||||||
const hide = message.loading('正在删除');
|
const hide = message.loading('正在删除');
|
||||||
@@ -96,8 +102,28 @@ function ManagementList() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDictValueEnum('scale', true, true).then((data) => {
|
getDictValueEnum('scale', true, true).then((data) => {
|
||||||
|
console.log(data,'______')
|
||||||
setScaleEnum(data);
|
setScaleEnum(data);
|
||||||
});
|
});
|
||||||
|
getCmsIndustryTreeList().then((res) => {
|
||||||
|
|
||||||
|
let dict = []
|
||||||
|
try {
|
||||||
|
res.data.forEach(item => {
|
||||||
|
dict[item.id] = {
|
||||||
|
label: item.label,
|
||||||
|
text: item.label,
|
||||||
|
value: item.id,
|
||||||
|
listClass: "default",
|
||||||
|
status: "default",
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
dict = []
|
||||||
|
}
|
||||||
|
console.log(dict,'+++++')
|
||||||
|
setIndustryEnum(dict);
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const columns: ProColumns<API.CompanyList.Company>[] = [
|
const columns: ProColumns<API.CompanyList.Company>[] = [
|
||||||
@@ -272,6 +298,7 @@ function ManagementList() {
|
|||||||
}}
|
}}
|
||||||
record={currentRow}
|
record={currentRow}
|
||||||
scaleEnum={scaleEnum}
|
scaleEnum={scaleEnum}
|
||||||
|
industryEnum={industryEnum}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
ProFormRadio,
|
ProFormRadio,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Form } from 'antd';
|
import { Form } from 'antd';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect ,useState} from 'react';
|
||||||
import { DictValueEnumObj } from '@/components/DictTag';
|
import { DictValueEnumObj } from '@/components/DictTag';
|
||||||
import { getCmsCompanyList } from '@/services/company/list';
|
import { getCmsCompanyList } from '@/services/company/list';
|
||||||
import { cmsfileupload } from '@/services/Management/list';
|
import { cmsfileupload } from '@/services/Management/list';
|
||||||
@@ -29,8 +29,52 @@ export type ListFormProps = {
|
|||||||
|
|
||||||
const listEdit: React.FC<ListFormProps> = (props) => {
|
const listEdit: React.FC<ListFormProps> = (props) => {
|
||||||
const [form] = Form.useForm<API.ManagementList.Manage>();
|
const [form] = Form.useForm<API.ManagementList.Manage>();
|
||||||
|
const [initialCompanyOptions, setInitialCompanyOptions] = useState<Array<{label: string, value: string | number}>>([]);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const { educationEnum, experienceEnum, areaEnum, isExplainOptions } = props;
|
const { educationEnum, experienceEnum, areaEnum, isExplainOptions } = props;
|
||||||
const { mode = props.values ? 'edit' : 'create' } = props;
|
const { mode = props.values ? 'edit' : 'create' } = props;
|
||||||
|
// 预加载公司数据
|
||||||
|
useEffect(() => {
|
||||||
|
const preloadCompanyData = async () => {
|
||||||
|
if (props.open && props.values?.companyId && props.values?.companyName) {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
// 1. 先搜索当前公司名称
|
||||||
|
const resData = await getCmsCompanyList({
|
||||||
|
name: props.values.companyName,
|
||||||
|
});
|
||||||
|
|
||||||
|
let options = resData.rows.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.companyId
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 2. 如果当前公司不在搜索结果中,手动添加
|
||||||
|
const exists = options.some(opt => opt.value === props.values!.companyId);
|
||||||
|
if (!exists) {
|
||||||
|
options = [
|
||||||
|
{ label: props.values.companyName, value: props.values.companyId },
|
||||||
|
...options
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
setInitialCompanyOptions(options);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('预加载公司失败:', error);
|
||||||
|
// 如果请求失败,至少添加当前公司
|
||||||
|
setInitialCompanyOptions([
|
||||||
|
{ label: props.values.companyName, value: props.values.companyId }
|
||||||
|
]);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
preloadCompanyData();
|
||||||
|
}, [props.open, props.values?.companyId, props.values?.companyName]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.open) {
|
if (props.open) {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
@@ -39,7 +83,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
...props.values,
|
...props.values,
|
||||||
jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''),
|
jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''),
|
||||||
isExplain: Number(props.values.isExplain) || 0, // 确保是数字
|
isExplain: Number(props.values.isExplain) || 0,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
form.setFieldsValue({ isExplain: 0 });
|
form.setFieldsValue({ isExplain: 0 });
|
||||||
@@ -47,7 +91,6 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
}, [form, props.values, props.open]);
|
}, [form, props.values, props.open]);
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
props.onCancel();
|
props.onCancel();
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
@@ -188,12 +231,39 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
|||||||
showSearch
|
showSearch
|
||||||
width="md"
|
width="md"
|
||||||
name="companyId"
|
name="companyId"
|
||||||
onChange={handleChange}
|
fieldProps={{
|
||||||
request={async ({ keyWords }) => {
|
onChange: (value, option) => {
|
||||||
let resData = await getCmsCompanyList({ name: keyWords });
|
if (option && option.label) {
|
||||||
return resData.rows.map((item) => ({ label: item.name, value: item.companyId }));
|
form.setFieldValue('companyName', option.label);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loading: loading,
|
||||||
|
options: initialCompanyOptions,
|
||||||
|
defaultActiveFirstOption: false,
|
||||||
}}
|
}}
|
||||||
placeholder="请输入公司名称选择公司"
|
request={async ({ keyWords }) => {
|
||||||
|
const resData = await getCmsCompanyList({
|
||||||
|
name: keyWords,
|
||||||
|
});
|
||||||
|
const options = resData.rows.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.companyId
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 如果是编辑模式,确保当前公司被包含
|
||||||
|
if (props.values?.companyId && props.values?.companyName && keyWords) {
|
||||||
|
const exists = options.some(opt => opt.value === props.values!.companyId);
|
||||||
|
if (!exists && props.values.companyName.toLowerCase().includes(keyWords.toLowerCase())) {
|
||||||
|
options.unshift({
|
||||||
|
label: props.values.companyName,
|
||||||
|
value: props.values.companyId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}}
|
||||||
|
placeholder={loading ? "加载中..." : "请输入公司名称选择公司"}
|
||||||
rules={[{ required: true, message: '请输入公司名称选择公司!' }]}
|
rules={[{ required: true, message: '请输入公司名称选择公司!' }]}
|
||||||
label="招聘会公司"
|
label="招聘会公司"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -121,12 +121,14 @@ function ManagementList() {
|
|||||||
dataIndex: 'minSalary',
|
dataIndex: 'minSalary',
|
||||||
valueType: 'text',
|
valueType: 'text',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
render: (text, record) => (record.minSalary ? record.minSalary : '面议'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '最大薪资(元/月)',
|
title: '最大薪资(元/月)',
|
||||||
dataIndex: 'maxSalary',
|
dataIndex: 'maxSalary',
|
||||||
valueType: 'text',
|
valueType: 'text',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
render: (text, record) => (record.maxSalary ? record.maxSalary : '面议'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '单位名称',
|
title: '单位名称',
|
||||||
@@ -180,6 +182,7 @@ function ManagementList() {
|
|||||||
valueType: 'text',
|
valueType: 'text',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
|
render: (text, record) => (record.vacancies== -1 ? '若干' : record.vacancies),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '浏览量',
|
title: '浏览量',
|
||||||
|
|||||||
Reference in New Issue
Block a user