bug修复
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
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
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:
@@ -32,7 +32,7 @@ const toManageFormValues = (
|
||||
values: Partial<API.ManagementList.Manage>,
|
||||
): Partial<ManageFormValues> => ({
|
||||
...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<ListFormProps> = (props) => {
|
||||
const isEnterprise = initialState?.currentUser?.userType === 'view';
|
||||
const [form] = Form.useForm<ManageFormValues>();
|
||||
const companyNameMap = useRef<Record<number, string>>({});
|
||||
const [companyOptions, setCompanyOptions] = useState<{ label: string; value: number }[]>([]);
|
||||
const [areaOptions, setAreaOptions] = useState<{ label: string; value: string }[]>([]);
|
||||
const [jobDetail, setJobDetail] = useState<API.ManagementList.Manage | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [jobCategoryTreeData, setJobCategoryTreeData] = useState<any[]>([]);
|
||||
@@ -94,13 +97,36 @@ const listEdit: React.FC<ListFormProps> = (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<ListFormProps> = (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<ListFormProps> = (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<ListFormProps> = (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<ListFormProps> = (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<ListFormProps> = (props) => {
|
||||
label="是否急聘"
|
||||
valueEnum={{ 0: '否', 1: '是' }}
|
||||
/>
|
||||
<ProDescriptions.Item
|
||||
dataIndex="isKeyPopulations"
|
||||
label="是否重点服务人群"
|
||||
valueEnum={{ 0: '是', 1: '否' }}
|
||||
/>
|
||||
<ProDescriptions.Item
|
||||
dataIndex="keyPopulations"
|
||||
label="重点人群"
|
||||
valueEnum={keyPopulationsEnum}
|
||||
/>
|
||||
<ProDescriptions.Item dataIndex="minSalary" label="最低薪资(元/月)" />
|
||||
<ProDescriptions.Item dataIndex="maxSalary" label="最高薪资(元/月)" />
|
||||
<ProDescriptions.Item
|
||||
@@ -458,6 +536,33 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
initialValue={0}
|
||||
fieldProps={{ defaultChecked: false }}
|
||||
/>
|
||||
<ProFormSwitch
|
||||
width="md"
|
||||
name="isKeyPopulations"
|
||||
label="是否重点服务人群"
|
||||
checkedChildren="是"
|
||||
unCheckedChildren="否"
|
||||
initialValue="1"
|
||||
fieldProps={{
|
||||
defaultChecked: false,
|
||||
onChange: (checked) => {
|
||||
setShowKeyPopulations(checked);
|
||||
if (!checked) {
|
||||
form.setFieldValue('keyPopulations', undefined);
|
||||
}
|
||||
},
|
||||
}}
|
||||
/>
|
||||
{showKeyPopulations && (
|
||||
<ProFormSelect
|
||||
width="md"
|
||||
name="keyPopulations"
|
||||
label="重点人群"
|
||||
valueEnum={keyPopulationsEnum}
|
||||
placeholder="请选择重点人群"
|
||||
rules={[{ required: true, message: '请选择重点人群!' }]}
|
||||
/>
|
||||
)}
|
||||
{!isEnterprise && (
|
||||
<ProFormSelect
|
||||
showSearch
|
||||
@@ -474,6 +579,7 @@ const listEdit: React.FC<ListFormProps> = (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<ListFormProps> = (props) => {
|
||||
label={'工作区县'}
|
||||
valueEnum={areaEnum}
|
||||
placeholder="请选择区县"
|
||||
fieldProps={{
|
||||
options: areaOptions.length > 0 ? areaOptions : undefined,
|
||||
}}
|
||||
rules={[{ required: true, message: '请选择区县!' }]}
|
||||
/>
|
||||
<ProFormDigit
|
||||
@@ -576,7 +685,7 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
return title.toLowerCase().includes(inputValue.toLowerCase());
|
||||
}}
|
||||
placeholder="请搜索或选择岗位标签"
|
||||
style={{ width: '100%' }}
|
||||
style={{ width: 328 }}
|
||||
/>
|
||||
</ProForm.Item>
|
||||
<ProFormText width="md" name="jobLocation" label="工作地点" placeholder="请输入工作地点" />
|
||||
|
||||
@@ -97,6 +97,7 @@ function ManagementList() {
|
||||
const [salaryCompositionEnum, setSalaryCompositionEnum] = useState<any>([]);
|
||||
const [welfareBenefitsEnum, setWelfareBenefitsEnum] = useState<any>([]);
|
||||
const [workScheduleEnum, setWorkScheduleEnum] = useState<any>([]);
|
||||
const [keyPopulationsEnum, setKeyPopulationsEnum] = useState<any>([]);
|
||||
const [currentRow, setCurrentRow] = useState<API.ManagementList.Manage>();
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(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}
|
||||
></EditManageRow>
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
@@ -68,20 +68,24 @@ function CompanyUserList() {
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '联系人',
|
||||
dataIndex: 'contactPerson',
|
||||
title: '企业联系人',
|
||||
dataIndex: 'companyContactList',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
render: (_, record) => record.contactPerson || '-',
|
||||
width: 180,
|
||||
render: (_, record) => {
|
||||
const list = record.companyContactList;
|
||||
if (!list || list.length === 0) return '-';
|
||||
return (
|
||||
<div>
|
||||
{list.map((item, index) => (
|
||||
<div key={index}>
|
||||
{item.contactPerson || '-'}:{item.contactPersonPhone || '-'}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
{
|
||||
title: '联系电话',
|
||||
dataIndex: 'contactPersonPhone',
|
||||
valueType: 'text',
|
||||
align: 'center',
|
||||
width: 130,
|
||||
render: (_, record) => record.contactPersonPhone || '-',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
|
||||
8
src/types/Management/list.d.ts
vendored
8
src/types/Management/list.d.ts
vendored
@@ -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 {
|
||||
|
||||
11
src/types/cms/company.d.ts
vendored
11
src/types/cms/company.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user