From aa48790c24ad74bea5fe3606991e814f16d4844e Mon Sep 17 00:00:00 2001 From: francis-fh Date: Thu, 23 Jul 2026 19:20:32 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Management/List/edit.tsx | 113 ++++++++++++++++++++++- src/pages/Management/List/index.tsx | 8 ++ src/pages/Usermgmt/Companyuser/index.tsx | 28 +++--- src/types/Management/list.d.ts | 8 ++ src/types/cms/company.d.ts | 11 ++- 5 files changed, 153 insertions(+), 15 deletions(-) diff --git a/src/pages/Management/List/edit.tsx b/src/pages/Management/List/edit.tsx index ead7237..a16213a 100644 --- a/src/pages/Management/List/edit.tsx +++ b/src/pages/Management/List/edit.tsx @@ -32,7 +32,7 @@ const toManageFormValues = ( values: Partial, ): Partial => ({ ...values, - jobLocationAreaCode: String(values.jobLocationAreaCode || ''), + jobLocationAreaCode: values.jobLocationAreaCode != null ? String(values.jobLocationAreaCode) : undefined, salaryComposition: parseCommaSeparatedTags(values.salaryComposition), welfareBenefits: parseCommaSeparatedTags(values.welfareBenefits), workSchedule: parseCommaSeparatedTags(values.workSchedule), @@ -65,6 +65,7 @@ export type ListFormProps = { salaryCompositionEnum: DictValueEnumObj; welfareBenefitsEnum: DictValueEnumObj; workScheduleEnum: DictValueEnumObj; + keyPopulationsEnum: DictValueEnumObj; mode?: 'view' | 'edit' | 'create'; }; @@ -81,6 +82,8 @@ const listEdit: React.FC = (props) => { const isEnterprise = initialState?.currentUser?.userType === 'view'; const [form] = Form.useForm(); const companyNameMap = useRef>({}); + const [companyOptions, setCompanyOptions] = useState<{ label: string; value: number }[]>([]); + const [areaOptions, setAreaOptions] = useState<{ label: string; value: string }[]>([]); const [jobDetail, setJobDetail] = useState(null); const [loading, setLoading] = useState(false); const [jobCategoryTreeData, setJobCategoryTreeData] = useState([]); @@ -94,13 +97,36 @@ const listEdit: React.FC = (props) => { salaryCompositionEnum, welfareBenefitsEnum, workScheduleEnum, + keyPopulationsEnum, } = props; const { mode = props.values ? 'edit' : 'create' } = props; + const [showKeyPopulations, setShowKeyPopulations] = useState(false); useEffect(() => { if (props.open) { form.resetFields(); if (props.values) { form.setFieldsValue(toManageFormValues(props.values)); + // 预填充公司选项(编辑时回显公司名称) + if (props.values.companyId && props.values.companyName) { + companyNameMap.current[props.values.companyId] = props.values.companyName; + setCompanyOptions([ + { label: props.values.companyName, value: props.values.companyId }, + ]); + } else { + setCompanyOptions([]); + } + // 预填充区县选项(编辑时回显工作区县名称) + if (props.values.jobLocationAreaCode && areaEnum) { + const code = String(props.values.jobLocationAreaCode); + const areaItem = areaEnum[code]; + if (areaItem) { + setAreaOptions([{ label: areaItem.label ?? areaItem.text, value: code }]); + } else { + setAreaOptions([]); + } + } else { + setAreaOptions([]); + } // 初始化地图位置信息(编辑时回显) if (props.values.latitude || props.values.longitude) { setMapViewInfo({ @@ -111,8 +137,17 @@ const listEdit: React.FC = (props) => { } else { setMapViewInfo({}); } + // 初始化重点人群显示状态(编辑时回显) + if (props.values.isKeyPopulations === '0') { + setShowKeyPopulations(true); + } else { + setShowKeyPopulations(false); + } } else { setMapViewInfo({}); + setShowKeyPopulations(false); + setCompanyOptions([]); + setAreaOptions([]); } // 加载岗位标签树数据 getJobTitleTreeSelect() @@ -123,6 +158,22 @@ const listEdit: React.FC = (props) => { } }, [form, props.values?.jobId, props.open]); + // 区县字典加载完成后,回显工作区县名称 + useEffect(() => { + if ( + props.open && + props.values?.jobLocationAreaCode && + areaEnum && + Object.keys(areaEnum).length > 0 + ) { + const code = String(props.values.jobLocationAreaCode); + const areaItem = areaEnum[code]; + if (areaItem) { + setAreaOptions([{ label: areaItem.label ?? areaItem.text, value: code }]); + } + } + }, [areaEnum, props.open, props.values?.jobLocationAreaCode]); + // 在查看模式和编辑模式下调用API获取详情 useEffect(() => { if (props.open && (mode === 'view' || mode === 'edit') && props.values?.jobId) { @@ -141,6 +192,21 @@ const listEdit: React.FC = (props) => { // 如果是编辑模式,将获取到的详情数据设置到表单中 if (mode === 'edit') { form.setFieldsValue(toManageFormValues(response.data)); + // 预填充公司选项(从详情API获取的数据回显公司名称) + if (response.data.companyId && response.data.companyName) { + companyNameMap.current[response.data.companyId] = response.data.companyName; + setCompanyOptions([ + { label: response.data.companyName, value: response.data.companyId }, + ]); + } + // 预填充区县选项(从详情API获取的数据回显工作区县名称) + if (response.data.jobLocationAreaCode && areaEnum) { + const code = String(response.data.jobLocationAreaCode); + const areaItem = areaEnum[code]; + if (areaItem) { + setAreaOptions([{ label: areaItem.label ?? areaItem.text, value: code }]); + } + } } } } catch (error) { @@ -203,6 +269,8 @@ const listEdit: React.FC = (props) => { ), jobCategory: values.jobCategory, isUrgent: values.isUrgent ? 1 : 0, + isKeyPopulations: showKeyPopulations ? '0' : '1', + keyPopulations: showKeyPopulations ? values.keyPopulations : undefined, latitude: values.latitude, longitude: values.longitude, }; @@ -237,6 +305,16 @@ const listEdit: React.FC = (props) => { label="是否急聘" valueEnum={{ 0: '否', 1: '是' }} /> + + = (props) => { initialValue={0} fieldProps={{ defaultChecked: false }} /> + { + setShowKeyPopulations(checked); + if (!checked) { + form.setFieldValue('keyPopulations', undefined); + } + }, + }} + /> + {showKeyPopulations && ( + + )} {!isEnterprise && ( = (props) => { onChange: (companyId: number) => { form.setFieldValue('companyName', companyNameMap.current[companyId] ?? ''); }, + options: companyOptions.length > 0 ? companyOptions : undefined, }} placeholder="请输入公司名称选择公司" rules={[{ required: true, message: '请输入公司名称选择公司!' }]} @@ -543,6 +649,9 @@ const listEdit: React.FC = (props) => { label={'工作区县'} valueEnum={areaEnum} placeholder="请选择区县" + fieldProps={{ + options: areaOptions.length > 0 ? areaOptions : undefined, + }} rules={[{ required: true, message: '请选择区县!' }]} /> = (props) => { return title.toLowerCase().includes(inputValue.toLowerCase()); }} placeholder="请搜索或选择岗位标签" - style={{ width: '100%' }} + style={{ width: 328 }} /> diff --git a/src/pages/Management/List/index.tsx b/src/pages/Management/List/index.tsx index ec0f94b..c1da99f 100644 --- a/src/pages/Management/List/index.tsx +++ b/src/pages/Management/List/index.tsx @@ -97,6 +97,7 @@ function ManagementList() { const [salaryCompositionEnum, setSalaryCompositionEnum] = useState([]); const [welfareBenefitsEnum, setWelfareBenefitsEnum] = useState([]); const [workScheduleEnum, setWorkScheduleEnum] = useState([]); + const [keyPopulationsEnum, setKeyPopulationsEnum] = useState([]); const [currentRow, setCurrentRow] = useState(); const [modalVisible, setModalVisible] = useState(false); const [mode, setMode] = useState<'view' | 'edit' | 'create'>('create'); @@ -128,6 +129,9 @@ function ManagementList() { getDictValueEnum('work_schedule', false, true).then((data) => { setWorkScheduleEnum(data); }); + getDictValueEnum('kp_type', false, true).then((data) => { + setKeyPopulationsEnum(data); + }); }, []); async function changeRelease(record: API.ManagementList.Manage) { @@ -440,6 +444,9 @@ function ManagementList() { rowKey="jobId" key="index" columns={columns} + search={{ + defaultCollapsed: false, + }} request={(params) => getCmsJobList({ ...params } as API.ManagementList.ListParams).then((res) => { console.log(params); @@ -533,6 +540,7 @@ function ManagementList() { salaryCompositionEnum={salaryCompositionEnum} welfareBenefitsEnum={welfareBenefitsEnum} workScheduleEnum={workScheduleEnum} + keyPopulationsEnum={keyPopulationsEnum} > ); diff --git a/src/pages/Usermgmt/Companyuser/index.tsx b/src/pages/Usermgmt/Companyuser/index.tsx index bf3e9cd..583c487 100644 --- a/src/pages/Usermgmt/Companyuser/index.tsx +++ b/src/pages/Usermgmt/Companyuser/index.tsx @@ -68,20 +68,24 @@ function CompanyUserList() { width: 100, }, { - title: '联系人', - dataIndex: 'contactPerson', + title: '企业联系人', + dataIndex: 'companyContactList', valueType: 'text', align: 'center', - width: 100, - render: (_, record) => record.contactPerson || '-', - }, - { - title: '联系电话', - dataIndex: 'contactPersonPhone', - valueType: 'text', - align: 'center', - width: 130, - render: (_, record) => record.contactPersonPhone || '-', + width: 180, + render: (_, record) => { + const list = record.companyContactList; + if (!list || list.length === 0) return '-'; + return ( +
+ {list.map((item, index) => ( +
+ {item.contactPerson || '-'}:{item.contactPersonPhone || '-'} +
+ ))} +
+ ); + }, }, { title: '状态', diff --git a/src/types/Management/list.d.ts b/src/types/Management/list.d.ts index edcb68c..7035063 100644 --- a/src/types/Management/list.d.ts +++ b/src/types/Management/list.d.ts @@ -39,6 +39,10 @@ declare namespace API.ManagementList { createTime?: string; jobCategory?: string; description?: string; + /** 是否重点人群 0是,1否 */ + isKeyPopulations?: string; + /** 重点人群-1农民工、2团场职工、3失业人员、4零就业家庭、5零工人员、6退役军人 */ + keyPopulations?: string; } export interface AddParams { @@ -71,6 +75,10 @@ declare namespace API.ManagementList { jobContactList?: ContactPerson[]; jobCategory?: string; description?: string; + /** 是否重点人群 0是,1否 */ + isKeyPopulations?: string; + /** 重点人群-1农民工、2团场职工、3失业人员、4零就业家庭、5零工人员、6退役军人 */ + keyPopulations?: string; } export interface ListParams { diff --git a/src/types/cms/company.d.ts b/src/types/cms/company.d.ts index 55e38cb..74a52f2 100644 --- a/src/types/cms/company.d.ts +++ b/src/types/cms/company.d.ts @@ -7,6 +7,15 @@ declare namespace API.CmsCompany { data?: any; } + export interface CompanyContact { + createTime: string | null; + updateTime: string | null; + id: number | null; + companyId: number; + contactPerson: string; + contactPersonPhone: string; + } + export interface CompanyUser { createTime: string; updateTime: string; @@ -29,7 +38,7 @@ declare namespace API.CmsCompany { contactPersonPhone?: string | null; status: number; // 0 待审核, 1 通过, 2 驳回 notPassReason?: string | null; - companyContactList?: any; + companyContactList?: CompanyContact[]; registeredAddress: string; isAbnormal?: any; rejectTime?: string | null;