Merge remote-tracking branch 'origin/main' into refactor-matchRadar
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
} from '@/services/company/list';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import DictTag from '@/components/DictTag';
|
||||
import { getCmsIndustryTreeList } from '@/services/classify/industry';
|
||||
|
||||
// 详情查看组件
|
||||
const CompanyDetailModal = ({
|
||||
@@ -20,11 +21,13 @@ const CompanyDetailModal = ({
|
||||
onCancel,
|
||||
record,
|
||||
scaleEnum,
|
||||
industryEnum,
|
||||
}: {
|
||||
visible: boolean;
|
||||
onCancel: () => void;
|
||||
record?: API.CompanyList.Company;
|
||||
scaleEnum: Record<string, any>;
|
||||
industryEnum: Record<string, any>;
|
||||
}) => {
|
||||
return (
|
||||
<Modal
|
||||
@@ -40,7 +43,9 @@ const CompanyDetailModal = ({
|
||||
>
|
||||
<Descriptions column={1} bordered>
|
||||
<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="公司规模">
|
||||
<DictTag enums={scaleEnum} value={record?.scale} />
|
||||
</Descriptions.Item>
|
||||
@@ -60,6 +65,7 @@ function ManagementList() {
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
const [detailVisible, setDetailVisible] = useState<boolean>(false);
|
||||
const [scaleEnum, setScaleEnum] = useState<Record<string, any>>({});
|
||||
const [industryEnum, setIndustryEnum] = useState<Record<string, any>>({});
|
||||
|
||||
const handleRemoveOne = async (jobId: string) => {
|
||||
const hide = message.loading('正在删除');
|
||||
@@ -96,8 +102,28 @@ function ManagementList() {
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('scale', true, true).then((data) => {
|
||||
console.log(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>[] = [
|
||||
@@ -272,6 +298,7 @@ function ManagementList() {
|
||||
}}
|
||||
record={currentRow}
|
||||
scaleEnum={scaleEnum}
|
||||
industryEnum={industryEnum}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
ProFormRadio,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form } from 'antd';
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { useEffect ,useState} from 'react';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
import { getCmsCompanyList } from '@/services/company/list';
|
||||
import { cmsfileupload } from '@/services/Management/list';
|
||||
@@ -29,8 +29,52 @@ export type ListFormProps = {
|
||||
|
||||
const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
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 { 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(() => {
|
||||
if (props.open) {
|
||||
form.resetFields();
|
||||
@@ -39,7 +83,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
form.setFieldsValue({
|
||||
...props.values,
|
||||
jobLocationAreaCode: String(props.values.jobLocationAreaCode || ''),
|
||||
isExplain: Number(props.values.isExplain) || 0, // 确保是数字
|
||||
isExplain: Number(props.values.isExplain) || 0,
|
||||
});
|
||||
} else {
|
||||
form.setFieldsValue({ isExplain: 0 });
|
||||
@@ -47,7 +91,6 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
}, 0);
|
||||
}
|
||||
}, [form, props.values, props.open]);
|
||||
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
form.resetFields();
|
||||
@@ -188,12 +231,39 @@ 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 }));
|
||||
fieldProps={{
|
||||
onChange: (value, option) => {
|
||||
if (option && option.label) {
|
||||
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: '请输入公司名称选择公司!' }]}
|
||||
label="招聘会公司"
|
||||
/>
|
||||
|
||||
@@ -121,12 +121,14 @@ function ManagementList() {
|
||||
dataIndex: 'minSalary',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
render: (text, record) => (record.minSalary ? record.minSalary : '面议'),
|
||||
},
|
||||
{
|
||||
title: '最大薪资(元/月)',
|
||||
dataIndex: 'maxSalary',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
render: (text, record) => (record.maxSalary ? record.maxSalary : '面议'),
|
||||
},
|
||||
{
|
||||
title: '单位名称',
|
||||
@@ -180,6 +182,7 @@ function ManagementList() {
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
hideInSearch: true,
|
||||
render: (text, record) => (record.vacancies== -1 ? '若干' : record.vacancies),
|
||||
},
|
||||
{
|
||||
title: '浏览量',
|
||||
|
||||
Reference in New Issue
Block a user