flat:招聘会添加
This commit is contained in:
@@ -20,28 +20,7 @@ body,
|
||||
.ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed {
|
||||
left: unset;
|
||||
}
|
||||
.ant-table-cell .ant-table-row-expand-icon {
|
||||
vertical-align: middle;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.ant-table-row {
|
||||
&-level-0 .ant-table-cell:first-child {
|
||||
padding-left: 16px !important;
|
||||
}
|
||||
&-level-1 .ant-table-cell:first-child {
|
||||
padding-left: 40px !important;
|
||||
}
|
||||
&-level-2 .ant-table-cell:first-child {
|
||||
padding-left: 64px !important;
|
||||
}
|
||||
}
|
||||
.ant-table-row .ant-table-cell:first-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.ant-table-row-level-2 .ant-table-row-expand-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -48,11 +48,14 @@ const buildTree = (
|
||||
): API.ClassifyJobs.Jobs[] => {
|
||||
const children = data
|
||||
.filter((item) => item.parentId === parentId)
|
||||
.map((item) => ({
|
||||
.map((item) => {
|
||||
const child = buildTree(data, item.jobId, depth + 1);
|
||||
return {
|
||||
...item,
|
||||
depth,
|
||||
children: buildTree(data, item.jobId, depth + 1),
|
||||
}));
|
||||
children: child.length ? child : undefined,
|
||||
};
|
||||
});
|
||||
return children || [];
|
||||
};
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import {useEffect, useCallback, useState} from 'react'
|
||||
import { useEffect, useState } from 'react';
|
||||
import {
|
||||
ModalForm,
|
||||
ProForm,
|
||||
ProFormTextArea,
|
||||
ProFormText,
|
||||
ProFormDateTimeRangePicker,
|
||||
ProFormDigit,
|
||||
ProFormRadio,
|
||||
ProFormDateRangePicker,
|
||||
ProFormList,
|
||||
ProFormRadio,
|
||||
ProFormSelect,
|
||||
ProFormText,
|
||||
ProFormTextArea,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Button, Form, message } from 'antd';
|
||||
import {DictOptionType, DictValueEnumObj} from "@/components/DictTag";
|
||||
import { useIntl, FormattedMessage } from '@umijs/max';
|
||||
import {getCmsCompanyList} from "@/services/company/list";
|
||||
import { Button, Form } from 'antd';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
import { FormattedMessage, useIntl } from '@umijs/max';
|
||||
import { getCmsCompanyList } from '@/services/company/list';
|
||||
import ProFromMap from '@/components/ProFromMap';
|
||||
|
||||
export type ListFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: unknown) => void;
|
||||
@@ -35,34 +36,35 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
const intl = useIntl();
|
||||
const { jobFairType } = props;
|
||||
|
||||
const [companyOptions, setCompanyOptions] = useState([])
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const [viewInfo, setViewInfo] = useState<any>({});
|
||||
const [companyOptions, setCompanyOptions] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
if(props.values) {
|
||||
console.log(props.values)
|
||||
if (props.values) {
|
||||
console.log(props.values);
|
||||
form.setFieldsValue({
|
||||
...props.values,
|
||||
createTimeRanger: [props.values.startTime, props.values.endTime],
|
||||
});
|
||||
setViewInfo(props.values);
|
||||
}
|
||||
}, [form, props]);
|
||||
|
||||
|
||||
const handleChange =(_: string, value: any) => {
|
||||
const handleChange = (_: string, value: any) => {
|
||||
const ls = form.getFieldsValue().companyList.map((item: any) => {
|
||||
if(value.value === item.companyId) {
|
||||
if (value.value === item.companyId) {
|
||||
return {
|
||||
...item,
|
||||
companyName: value.title
|
||||
}
|
||||
companyName: value.title,
|
||||
};
|
||||
}
|
||||
return item;
|
||||
})
|
||||
form.setFieldValue('companyList', ls)
|
||||
console.log(ls)
|
||||
}
|
||||
|
||||
});
|
||||
form.setFieldValue('companyList', ls);
|
||||
console.log(ls);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
@@ -73,6 +75,25 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
props.onSubmit(values as API.JobFairList.JobFairListRows);
|
||||
};
|
||||
|
||||
const select = (result) => {
|
||||
if (result.location) {
|
||||
const { lat, lng } = result.location;
|
||||
form.setFieldValue('latitude', lat);
|
||||
form.setFieldValue('longitude', lng);
|
||||
form.setFieldValue('address', result.address);
|
||||
const obj = {
|
||||
latitude: lat,
|
||||
longitude: lng,
|
||||
address: result.address,
|
||||
};
|
||||
setViewInfo(obj);
|
||||
setOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
return (
|
||||
<ModalForm<{
|
||||
name: string;
|
||||
@@ -89,19 +110,9 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
submitTimeout={2000}
|
||||
onFinish={handleFinish}
|
||||
>
|
||||
<ProFormDigit
|
||||
label="InputNumber"
|
||||
name="jobFairId"
|
||||
disabled
|
||||
hidden={true}
|
||||
/>
|
||||
<ProFormDigit label="InputNumber" name="jobFairId" disabled hidden={true} />
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="name"
|
||||
label="招聘会名称"
|
||||
placeholder="请输入招聘会名称"
|
||||
/>
|
||||
<ProFormText width="md" name="name" label="招聘会名称" placeholder="请输入招聘会名称" />
|
||||
<ProFormRadio.Group
|
||||
valueEnum={jobFairType}
|
||||
name="jobFairType"
|
||||
@@ -111,27 +122,48 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请选择招聘会类型!" defaultMessage="请选择招聘会类型!" />,
|
||||
message: (
|
||||
<FormattedMessage id="请选择招聘会类型!" defaultMessage="请选择招聘会类型!" />
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormDateRangePicker
|
||||
<ProFormDateTimeRangePicker
|
||||
transform={(values) => {
|
||||
return {
|
||||
startTime: values ? values[0] : undefined,
|
||||
endTime: values ? values[1] : undefined,
|
||||
};
|
||||
}}
|
||||
width="md"
|
||||
width="xl"
|
||||
name="createTimeRanger"
|
||||
label="招聘会时间"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<div>
|
||||
<Button onClick={() => setOpen(true)}>选择位置信息</Button>
|
||||
<div style={{ margin: '10px 0 0 0' }}>
|
||||
{viewInfo.address ? (
|
||||
<span style={{ padding: '0 0 0 16px' }}>地址:{viewInfo.address}</span>
|
||||
) : null}
|
||||
{viewInfo.latitude ? (
|
||||
<span style={{ padding: '0 0 0 16px' }}>
|
||||
经纬度:{viewInfo.latitude},{viewInfo.longitude}
|
||||
</span>
|
||||
) : (
|
||||
<span style={{ padding: '0 0 0 16px', color: 'red' }}>请选择位置!</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormText width="xl" name="location" label="招聘会地点" placeholder="请输入招聘会地点" />
|
||||
<ProFormTextArea
|
||||
width="xl"
|
||||
name="location"
|
||||
label="招聘会地点"
|
||||
name="description"
|
||||
label="招聘会描述"
|
||||
placeholder="请输入招聘会地点"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
@@ -155,24 +187,61 @@ const listEdit: React.FC<ListFormProps> = (props) => {
|
||||
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}))
|
||||
request={async ({ keyWords }) => {
|
||||
let resData = await getCmsCompanyList({ name: keyWords });
|
||||
return resData.rows.map((item) => ({ label: item.name, value: item.companyId }));
|
||||
}}
|
||||
placeholder="请输入公司名称选择公司"
|
||||
rules={[{ required: true, message: '请输入公司名称选择公司!' }]}
|
||||
label="招聘会公司列表"
|
||||
/>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="companyName"
|
||||
label=" "
|
||||
hidden={true}
|
||||
/>
|
||||
<ProFormText width="md" name="companyName" label=" " hidden={true} />
|
||||
</ProForm.Group>
|
||||
</ProFormList>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
width="md"
|
||||
name="address"
|
||||
label="地理位置"
|
||||
hidden={true}
|
||||
placeholder="请输入地理位置"
|
||||
/>
|
||||
<ProFormDigit
|
||||
label="纬度"
|
||||
placeholder="请输入纬度"
|
||||
name="latitude"
|
||||
width="md"
|
||||
hidden={true}
|
||||
min={-90}
|
||||
max={90}
|
||||
fieldProps={{ controls: false }}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入纬度!',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormDigit
|
||||
label="经度"
|
||||
placeholder="请输入经度"
|
||||
name="longitude"
|
||||
width="md"
|
||||
min={-180}
|
||||
hidden={true}
|
||||
max={180}
|
||||
fieldProps={{ controls: false }}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入经度!',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProFromMap open={open} onSelect={select} onCancel={cancel}></ProFromMap>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default listEdit
|
||||
export default listEdit;
|
||||
|
||||
Reference in New Issue
Block a user