import { useRef, useState, useEffect } from 'react';
import { connect } from '@umijs/max';
import type { ProFormInstance } from '@ant-design/pro-components';
import {
    StepsForm, ProCard,
    ProFormDatePicker,
    ProFormDependency,
    ProFormText,
    ProFormCascader,
    ProFormRadio,
    FormControlRender,
    ProFormSelect,
    ProFormSegmented,
    ProFormDigit,
    ProFormTreeSelect,
    ProFormDigitRange
} from '@ant-design/pro-components';
import { Row, Col, Image, ConfigProvider, Modal, Space, Form, message, } from 'antd';
import { getCompanyList, GetCompanyDepartmentList, PostCompanyJobAdd, PostCompanyJobEdit, PostCompanyJobInfo, GetCompanyInfo, GetCompanyDepartmentInfo } from '@/apis/api';
import { Imageprefix } from '@/constants';
import { verifyPhone } from '@/utils/VerifyHelper';
import { disFrontData } from '@/utils/format'
import MapComponent from '@/components/Common/map';
import RichComponent from '@/components/Common/rich';
import UploadModel from '@/components/Common/upload';

import dayjs from "dayjs";

const selectfieldCompanyNames = { label: 'full_name', value: 'id' };
const selectfieldNames = { label: 'name', value: 'id' };
const cascaderfieldNames = { label: 'name', value: 'id', children: 'children' };

const PagesMainCompanyListCreate: React.FC = ({ dispatch, dictModel, openModel, id }: any) => {
    const formRef = useRef<ProFormInstance>();
    const formMapRef = useRef<
        React.MutableRefObject<ProFormInstance<any> | undefined>[]
    >([]); // 编辑模式
    const [openPreview, setOpenPreview] = useState(false);
    const [detail, setDetail] = useState<CompanyType.Job | null>(null)

    const [richTxt, setRichTxt] = useState<string | number>(''); // 企业简介
    const [mapSwitch, setMapSwitch] = useState<boolean>(false); // 选择地图
    const [lat, setLat] = useState<string | number>('');
    const [lng, setLng] = useState<string | number>('');



    useEffect(() => {
        dispatch({ type: 'dictModel/getList', payload: { code: 2004, type: 'setPositionList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2009, type: 'setAreaList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2005, type: 'setPayList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2016, type: 'setAccommodationRequirementList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2017, type: 'setHolidayRestList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2018, type: 'setLicenseList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2021, type: 'setWorkExperienceList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2006, type: 'setEducationList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2014, type: 'setTitleList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2015, type: 'setSkillCertificationeList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2007, type: 'setOtherLanguageList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2008, type: 'setDegreeList' } })
        dispatch({ type: 'dictModel/getList', payload: { code: 2027, type: 'setIndustryPostList' } })

    }, [])

    useEffect(() => {
        setOpenPreview(openModel.openModal)
    }, [openModel.openModal])


    return (
        <>
            <ConfigProvider
                theme={{
                    token: {
                        colorPrimary: '#4FBE70',
                    }, components: {
                        Segmented: {
                            itemSelectedBg: '#19be6e',
                            itemSelectedColor: '#ffffff'
                        },
                    },
                }}
            >
                <Modal
                    open={openPreview}
                    title={id ? '编辑职位' : '添加职位'}
                    centered
                    maskClosable={false}
                    footer={null}
                    destroyOnClose
                    width={1000}
                    onCancel={() => {
                        dispatch({ type: 'openModel/getOpenModal', payload: false })
                    }}
                    afterOpenChange={async (open) => {
                        if (open && id) {
                            let res = await PostCompanyJobInfo({ id: id })
                            let res1 = await GetCompanyInfo({ id: res.data.company_id })
                            sessionStorage.setItem('post_company_info', JSON.stringify(res1.data))
                            formMapRef?.current?.forEach((formInstanceRef) => {
                                res.data.age_arr = [res.data.age_min, res.data.age_max];
                                res.data.household_arr = [
                                    res.data.household_province ? res.data.household_province : null,
                                    res.data.household_city ? res.data.household_city : null
                                ];
                                res.data.location_arr = [
                                    res.data.location_province ? res.data.location_province : null,
                                    res.data.location_city ? res.data.location_city : null,
                                    res.data.location_town ? res.data.location_town : null
                                ];
                                const gangweizhizeStartIndex = res.data.describe_text.indexOf('<div>岗位职责</div>') + '<div>岗位职责</div>'.length;
                                const gangweizhizeEndIndex = res.data.describe_text.indexOf('<div>任职要求</div>');
                                const gangweizhizeContent = res.data.describe_text.substring(gangweizhizeStartIndex, gangweizhizeEndIndex);
                                const renzhiyaoqiuStartIndex = res.data.describe_text.indexOf('<div>任职要求</div>') + '<div>任职要求</div>'.length;
                                const renzhiyaoqiuContent = res.data.describe_text.substring(renzhiyaoqiuStartIndex);
                                res.data.gangweizhize = gangweizhizeContent.trim();
                                res.data.renzhiyaoqiu = renzhiyaoqiuContent.trim();
                                formInstanceRef?.current?.setFieldsValue(res.data);
                            });
                            setDetail(res.data)


                        } else {
                            formMapRef?.current?.forEach((formInstanceRef) => {
                                formInstanceRef?.current?.setFieldsValue({
                                    company_id: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).id : null,
                                    contact: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).contact : '',
                                    phone: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).phone : '',
                                    mobile: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).mobile : '',
                                    email: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).email : '',
                                    fax: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).email : '',
                                    longitude: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).longitude : 0,
                                    latitude: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).latitude : 0,
                                    other_address: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).address : '',
                                    interview_address: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).address : '',
                                    phone_public: 1,
                                    mobile_public: 1,
                                    email_public: 1,
                                    fax_public: 1,
                                    status: 1
                                });
                            });
                        }
                    }}
                >
                    <StepsForm<CompanyType.Job>
                        formMapRef={formMapRef}
                        formRef={formRef}
                        onFinish={async (values: CompanyType.Job) => {
                            values.job_type = values.job_type.slice(0, 3);
                            values.job_location = values.job_location.slice(0, 4);
                            // 年龄
                            if (values.age_arr && values.age_arr.length > 0) {
                                values.age_min = values.age_arr[0] ? values.age_arr[0] : 0;
                                values.age_max = values.age_arr[1] ? values.age_arr[1] : 0;
                                delete values.age_arr;
                            }


                            // 所在地
                            if (values.household_arr && values.household_arr.length > 0) {
                                values.household_province = values.household_arr[0] ? values.household_arr[0] : 0;
                                values.household_city = values.household_arr[1] ? values.household_arr[1] : 0;
                                delete values.household_arr;
                            }


                            // 籍贯
                            if (values.location_arr && values.location_arr.length > 0) {
                                values.location_province = values.location_arr[0] ? values.location_arr[0] : 0;
                                values.location_city = values.location_arr[1] ? values.location_arr[1] : 0;
                                values.location_town = values.location_arr[2] ? values.location_arr[2] : 0;
                                delete values.location_arr;
                            }

                            values.describe_text = '<div>岗位职责</div>' + values.gangweizhize + '<div>任职要求</div>' + values.renzhiyaoqiu;
                            delete values.gangweizhize;
                            delete values.renzhiyaoqiu;
                            values.status = values.status ? values.status : 1;

                            if (detail) {
                                values.id = detail.id;

                                let res = await PostCompanyJobEdit(values)
                                message.success('提交成功')
                                dispatch({ type: 'openModel/getOpenModal', payload: false })
                            } else {
                                let res = await PostCompanyJobAdd(values)
                                message.success('提交成功')
                                dispatch({ type: 'openModel/getOpenModal', payload: false })
                            }
                            return true;
                        }}
                    >
                        <StepsForm.StepForm
                            title="基本信息"
                            onFinish={async (values) => {
                                return true;
                            }}
                        >
                            <ProCard
                                ghost
                                style={{
                                    minWidth: 800,
                                    maxWidth: '100%',
                                }}
                            >
                                <Row gutter={[16, 16]}>
                                    <Col span={24}>
                                        <ProFormRadio.Group
                                            name="urgent"
                                            label="是否紧急"
                                            options={[
                                                { label: '是', value: 1 },
                                                { label: '否', value: 2 }
                                            ]}
                                        />

                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            showSearch
                                            name="company_id"
                                            label="选择企业"
                                            placeholder="请选择企业"
                                            fieldProps={{
                                                fieldNames: selectfieldCompanyNames,
                                                disabled: sessionStorage.getItem('post_company_info') ? true : false
                                            }}
                                            rules={[{ required: true, message: '请选择企业' }]}
                                            onChange={(value) => {
                                                GetCompanyInfo({ id: value }).then(res => {
                                                    formMapRef?.current?.forEach((formInstanceRef) => {
                                                        formInstanceRef?.current?.setFieldsValue({
                                                            contact: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).contact : res.data.contact,
                                                            department_id: null,
                                                            phone: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).phone : res.data.phone,
                                                            mobile: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).mobile : res.data.mobile,
                                                            email: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).email : res.data.email,
                                                            fax: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).email : res.data.fax,
                                                            longitude: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).longitude : res.data.longitude,
                                                            latitude: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).latitude : res.data.latitude,
                                                            other_address: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).address : res.data.address,
                                                            interview_address: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).address : res.data.address,
                                                            phone_public: 2,
                                                            mobile_public: 2,
                                                            email_public: 2,
                                                            fax_public: 2,
                                                        });
                                                    });

                                                })
                                            }}
                                            request={(keyword) =>
                                                getCompanyList({ page: 1, pagesize: 999, keyword: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).full_name : keyword.keyWords }).then(res => {
                                                    return res.data.list;
                                                })
                                            }
                                        />
                                    </Col>
                                    <ProFormDependency name={['company_id']}>
                                        {({ company_id }) => {
                                            {
                                                return (
                                                    company_id && <Col span={8}>
                                                        <ProFormSelect
                                                            showSearch
                                                            name="department_id"
                                                            label="选择部门"
                                                            placeholder="请选择部门"
                                                            fieldProps={{
                                                                fieldNames: selectfieldNames,
                                                            }}
                                                            onChange={(value) => {
                                                                GetCompanyDepartmentInfo({ id: value }).then(res => {
                                                                    formMapRef?.current?.forEach((formInstanceRef) => {
                                                                        formInstanceRef?.current?.setFieldsValue({
                                                                            contact: res.data.contact ? res.data.contact : JSON.parse(sessionStorage.getItem('post_company_info')).contact,
                                                                            phone: res.data.phone ? res.data.phone : JSON.parse(sessionStorage.getItem('post_company_info')).phone,
                                                                            mobile: res.data.mobile ? res.data.mobile : JSON.parse(sessionStorage.getItem('post_company_info')).mobile,
                                                                            email: res.data.email ? res.data.email : JSON.parse(sessionStorage.getItem('post_company_info')).email,
                                                                        });
                                                                    });

                                                                })
                                                            }}
                                                            request={async (params) =>
                                                                GetCompanyDepartmentList({ page: 1, pagesize: 100, keyword: params.keyWords, company_id: sessionStorage.getItem('post_company_info') ? JSON.parse(sessionStorage.getItem('post_company_info')).id : company_id }).then(res => {
                                                                    return res.data.rows;
                                                                })
                                                            }
                                                        />
                                                    </Col>
                                                );
                                            }

                                        }}
                                    </ProFormDependency>
                                    <Col span={8}>
                                        <ProFormDigit
                                            label="有效天数"
                                            placeholder="请输入有效天数"
                                            rules={[{ required: true, message: '请输入有效天数' }]}
                                            name="useful_life"
                                            min={0}
                                            max={300}
                                            onChange={(value) => {
                                                const currentDate = dayjs(); // 获取当前日期
                                                const futureDate = currentDate.add(value, 'day'); // 加上有效天数
                                                const formattedDate = futureDate.format('YYYY-MM-DD'); // 格式化日期
                                                formRef.current.setFieldsValue({
                                                    disabled_date: formattedDate
                                                })
                                            }}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormDatePicker
                                            width='xl'
                                            name="disabled_date" 
                                            label="到期日期"
                                            placeholder='请选择到期日期'
                                            fieldProps={{
                                                disabledDate: disFrontData
                                            }}
                                            rules={[{ required: true, message: '请选择到期日期' }]}
                                            onChange={(value) => {
                                                if (value) {
                                                    const currentDate = dayjs(); // 获取当前日期
                                                    const selectedDate = dayjs(value); // 将选择的日期转换为 dayjs 对象
                                                    const diffDays = currentDate.diff(selectedDate, 'day'); // 计算天数差，注意这里是反向的，会得到负数
                                                    const daysUntilExpiration = -diffDays;
                                                    formRef.current.setFieldsValue({
                                                        useful_life: daysUntilExpiration + 1
                                                    })
                                                } else {
                                                    formRef.current.setFieldsValue({
                                                        useful_life: 0
                                                    })
                                                }

                                            }}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormText
                                            label="职位名称"
                                            name="name"
                                            placeholder="请输入职位名称"
                                            rules={[{ required: true, message: '请输入职位名称' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormText
                                            label="招聘人数"
                                            name="invite_count"
                                            placeholder="请输入招聘人数"
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormTreeSelect
                                            label="职位类别"
                                            name="job_type"
                                            fieldProps={{
                                                fieldNames: cascaderfieldNames,
                                                treeData: dictModel.industryPostList,
                                                multiple: true,
                                                treeCheckable: true,
                                            }}
                                            placeholder="请选择职位类别(最多三个,多选只取前三)"
                                            rules={[{ required: true, message: '请选择职位类别' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormTreeSelect
                                            label="工作区域"
                                            name="job_location"
                                            fieldProps={{
                                                fieldNames: cascaderfieldNames,
                                                treeData: dictModel.areaList,
                                                multiple: true,
                                                treeCheckable: true,
                                            }}
                                            placeholder="请选择工作区域(最多四个,多选只取前四)"
                                            rules={[{ required: true, message: '请选择工作区域' }]}
                                        />
                                    </Col>
                                </Row>
                            </ProCard>
                        </StepsForm.StepForm>
                        <StepsForm.StepForm
                            title="职位描述"
                            onFinish={async (values) => {
                                return true;
                            }}
                        >
                            <ProCard
                                ghost
                                style={{
                                    minWidth: 800,
                                    maxWidth: '100%',
                                }}
                            >
                                <Row gutter={[16, 16]}>
                                    <Col span={12}>
                                        <Form.Item
                                            name='gangweizhize'
                                            label="岗位职责"
                                            rules={[{ required: true, message: '请输入岗位职责' }]}

                                        >
                                            <FormControlRender>
                                                {() => {
                                                    return (
                                                        <ProFormDependency name={['gangweizhize']} >
                                                            {({ gangweizhize }, form) => {
                                                                return (
                                                                    <RichComponent placeholder="请输入岗位职责" defaultValue={gangweizhize}
                                                                        onChange={(value) => {
                                                                            form.formRef.current.setFieldsValue({
                                                                                gangweizhize: value
                                                                            })
                                                                        }}></RichComponent>
                                                                );
                                                            }}
                                                        </ProFormDependency>
                                                    );
                                                }}
                                            </FormControlRender>
                                        </Form.Item>
                                    </Col>
                                    <Col span={12}>
                                        <Form.Item
                                            name='renzhiyaoqiu'
                                            label="任职要求"
                                            rules={[{ required: true, message: '请输入任职要求' }]}

                                        >
                                            <FormControlRender>
                                                {() => {
                                                    return (
                                                        <ProFormDependency name={['renzhiyaoqiu']} >
                                                            {({ renzhiyaoqiu }, form) => {
                                                                return (
                                                                    <RichComponent placeholder="请输入任职要求" defaultValue={renzhiyaoqiu}
                                                                        onChange={(value) => {
                                                                            form.formRef.current.setFieldsValue({
                                                                                renzhiyaoqiu: value
                                                                            })
                                                                        }}></RichComponent>
                                                                );
                                                            }}
                                                        </ProFormDependency>
                                                    );
                                                }}
                                            </FormControlRender>
                                        </Form.Item>
                                    </Col>
                                    <Col span={5}>
                                        <ProFormRadio.Group
                                            name="fulltime"
                                            label="是否全职"
                                            options={[
                                                { label: '是', value: 1 },
                                                { label: '否', value: 2 }
                                            ]}
                                        />
                                    </Col>
                                    <Col span={5}>
                                        <ProFormRadio.Group
                                            name="parttime"
                                            label="是否兼职"
                                            request={async () => [
                                                { label: '是', value: 1 },
                                                { label: '否', value: 2 }
                                            ]}
                                        />
                                    </Col>
                                    <Col span={5}>
                                        <ProFormRadio.Group
                                            name="casual"
                                            label="是否临时"
                                            request={async () => [
                                                { label: '是', value: 1 },
                                                { label: '否', value: 2 }
                                            ]}
                                        />
                                    </Col>
                                    <Col span={5}>
                                        <ProFormRadio.Group
                                            name="practical"
                                            label="是否实习"
                                            request={async () => [
                                                { label: '是', value: 1 },
                                                { label: '否', value: 2 }
                                            ]}
                                        />
                                    </Col>
                                    <Col span={4}>
                                        <ProFormRadio.Group
                                            name="campus"
                                            label="校园招聘"
                                            request={async () => [
                                                { label: '是', value: 1 },
                                                { label: '否', value: 2 }
                                            ]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="薪资范围"
                                            name="pay_range"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.payList}
                                            placeholder="请选择薪资范围"
                                            rules={[{ required: true, message: '请选择薪资范围' }]}

                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="食宿要求"
                                            name="shisu"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.accommodationRequirementList}
                                            placeholder="请选择食宿要求"
                                            rules={[{ required: true, message: '请选择食宿要求' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="节假日休息情况"
                                            name="holidays"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.holidayRestList}
                                            placeholder="请选择节假日休息情况"
                                            rules={[{ required: true, message: '请选择节假日休息情况' }]}
                                        />
                                    </Col>
                                </Row>
                            </ProCard>
                        </StepsForm.StepForm>
                        <StepsForm.StepForm
                            title="面试地址"
                            onFinish={async (values) => {
                                return true;
                            }}
                        >
                            <ProCard
                                ghost
                                style={{
                                    minWidth: 800,
                                    maxWidth: '100%',
                                }}
                            >
                                <Row gutter={[16, 16]}>
                                    {/* <Col span={24}>
                                        <Switch checked={mapSwitch} checkedChildren='地图已显示' unCheckedChildren="地图已关闭" onChange={(val) => {
                                            setMapSwitch(val)
                                        }} />
                                    </Col>
                                    <Col span={6}>
                                        <ProFormText
                                            label="经度"
                                            name="longitude"
                                            placeholder="请选择打开地图并选择经度"
                                            disabled
                                            rules={[{
                                                required: true, message: '请选择打开地图并选择经度',
                                            }]}
                                        />
                                    </Col>
                                    <Col span={6}>
                                        <ProFormText
                                            label="纬度"
                                            name="latitude"
                                            disabled
                                            placeholder="请选择打开地图并选择纬度"
                                            rules={[{
                                                required: true, message: '请选择打开地图并选择纬度',
                                            }]}
                                        />
                                    </Col> */}
                                    <Col span={6}>
                                        <ProFormText
                                            label="面试地址"
                                            name="interview_address"
                                            placeholder="请输入面试地址"
                                        />
                                    </Col>
                                    <Col span={6}>
                                        <ProFormText
                                            label="其他地址"
                                            name="other_address"
                                            placeholder="请输入其他地址"
                                        />
                                    </Col>
                                    {/* {
                                        mapSwitch && <Col span={24}>
                                            <MapComponent lat={lat} lng={lng} getLoc={(values) => {
                                                formRef.current.setFieldsValue({
                                                    latitude: values.latlng.lat,
                                                    longitude: values.latlng.lng,
                                                    interview_address: values.poiaddress
                                                })
                                                setLat(values.latlng.lat)
                                                setLng(values.latlng.lng)
                                                setMapSwitch(false)
                                            }}></MapComponent>
                                        </Col>
                                    } */}
                                </Row>
                            </ProCard>
                        </StepsForm.StepForm>
                        <StepsForm.StepForm
                            title="职位要求"
                            onFinish={async (values) => {
                                return true;
                            }}
                        >
                            <ProCard
                                ghost
                                style={{
                                    minWidth: 800,
                                    maxWidth: '100%',
                                }}
                            >
                                <Row gutter={[16, 16]}>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="工作经验"
                                            name="experience"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.workExperienceList}
                                            placeholder="请选择工作经验"
                                            rules={[{ required: true, message: '请选择工作经验' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="学历"
                                            name="school_degree"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.educationList}
                                            placeholder="请选择学历"
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormRadio.Group
                                            name="degree_better"
                                            label="是否是最高学历"

                                            options={[
                                                {
                                                    label: '是',
                                                    value: 1,
                                                },
                                                {
                                                    label: '否',
                                                    value: 2,
                                                }
                                            ]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="职称要求"
                                            name="profelevel"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.titleList}
                                            placeholder="请选择职称要求"
                                            rules={[{ required: true, message: '请选择职称要求' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="技能认证"
                                            name="certification"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.skillCertificationeList}
                                            placeholder="请选择技能认证"
                                            rules={[{ required: true, message: '请选择技能认证' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="语言要求"
                                            name="language"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.otherLanguageList}
                                            placeholder="请选择语言要求"
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="掌握程度"
                                            name="language_degree"
                                            fieldProps={{
                                                fieldNames: selectfieldNames
                                            }}
                                            options={dictModel.degreeList}
                                            placeholder="请选择掌握程度"
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormRadio.Group
                                            name="sex"
                                            label="性别要求"

                                            options={[
                                                {
                                                    label: '男',
                                                    value: 1,
                                                },
                                                {
                                                    label: '女',
                                                    value: 2,
                                                },
                                                {
                                                    label: '不限',
                                                    value: 3,
                                                }
                                            ]}

                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormDigitRange
                                            label="年龄"
                                            name="age_arr"
                                            separator="-"
                                            placeholder={['请输入最小年龄', '请输入最大年龄']}
                                            fieldProps={{
                                                min: 10,
                                                max: 100
                                            }}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormRadio.Group
                                            name="marital_status"
                                            label="婚姻状况"
                                            options={[
                                                {
                                                    label: '已婚',
                                                    value: 1,
                                                },
                                                {
                                                    label: '未婚',
                                                    value: 2,
                                                },
                                                {
                                                    label: '不限',
                                                    value: 3,
                                                }
                                            ]}
                                            rules={[{ required: true, message: '请选择婚姻状况' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormText
                                            label="专业"
                                            name="major"
                                            placeholder="请输入专业"
                                            rules={[{ required: true, message: '请输入专业' }]}
                                        />
                                    </Col>
                                    <Col span={8}>
                                        <ProFormSelect
                                            label="证书要求"
                                            name="license"
                                            fieldProps={{
                                                fieldNames: selectfieldNames,
                                                options: dictModel.licenseList,
                                                mode: 'multiple',
                                            }}
                                            placeholder="请选择证书要求"
                                        />
                                    </Col>
                                    <Col span={12}>
                                        <ProFormCascader
                                            label="所在地要求"
                                            name="location_arr"
                                            fieldProps={{
                                                fieldNames: cascaderfieldNames,
                                                options: dictModel.areaList
                                            }}
                                            placeholder="请选择所在地要求"
                                        />
                                    </Col>
                                    <Col span={12}>
                                        <ProFormCascader
                                            label="籍贯要求"
                                            name="household_arr"
                                            fieldProps={{
                                                fieldNames: cascaderfieldNames,
                                                options: dictModel.areaList
                                            }}
                                            placeholder="请选择籍贯要求"

                                        />

                                    </Col>

                                </Row>
                            </ProCard>
                        </StepsForm.StepForm>
                        <StepsForm.StepForm
                            title="联系信息"
                            onFinish={async (values) => {
                                return true;
                            }}
                        >
                            <ProCard
                                ghost
                                style={{
                                    minWidth: 800,
                                    maxWidth: '100%',
                                }}
                            >
                                <Row gutter={[16, 16]}>
                                    <Col span={12}>
                                        <ProFormText
                                            label="联系人"
                                            name="contact"
                                            placeholder="请输入联系人"
                                            rules={[{ required: true, message: '请输入联系人' }]}
                                        />
                                    </Col>
                                    <Col span={12}>
                                        <ProFormText
                                            label="担任职位"
                                            name="possession"
                                            placeholder="请输入担任职位"
                                        />
                                    </Col>

                                    <Col span={12}>
                                        <Space>
                                            <ProFormText
                                                width={'md'}
                                                label="联系电话"
                                                name="phone"
                                                placeholder="请输入联系电话"
                                                rules={[{ required: true, message: '请输入联系电话' }]}
                                            />
                                            <ProFormRadio.Group
                                                name="phone_public"
                                                label="是否公开联系电话"
                                                options={[
                                                    {
                                                        label: '是',
                                                        value: 1,
                                                    },
                                                    {
                                                        label: '否',
                                                        value: 2,
                                                    }
                                                ]}

                                            />
                                        </Space>
                                    </Col>
                                    <Col span={12}>
                                        <Space >
                                            <ProFormText
                                                width={'md'}

                                                label="手机"
                                                name="mobile"
                                                placeholder="请输入手机"
                                                rules={[{ required: true, message: '请输入手机' }]}
                                            />
                                            <ProFormRadio.Group
                                                name="mobile_public"
                                                label="是否公开手机"

                                                options={[
                                                    {
                                                        label: '是',
                                                        value: 1,
                                                    },
                                                    {
                                                        label: '否',
                                                        value: 2,
                                                    }
                                                ]}

                                            />
                                        </Space>

                                    </Col>
                                    <Col span={12}>
                                        <Space >
                                            <ProFormText
                                                width={'md'}

                                                label="邮箱"
                                                name="email"
                                                placeholder="请输入邮箱"
                                            />
                                            <ProFormRadio.Group
                                                name="email_public"
                                                label="是否公开邮箱"

                                                options={[
                                                    {
                                                        label: '是',
                                                        value: 1,
                                                    },
                                                    {
                                                        label: '否',
                                                        value: 2,
                                                    }
                                                ]}

                                            />
                                        </Space>
                                    </Col>

                                    <Col span={12}>
                                        <Space>
                                            <ProFormText
                                                width={'md'}

                                                label="传真"
                                                name="fax"
                                                placeholder="请输入传真"

                                            />
                                            <ProFormRadio.Group
                                                name="fax_public"
                                                label="是否公开传真"

                                                options={[
                                                    {
                                                        label: '是',
                                                        value: 1,
                                                    },
                                                    {
                                                        label: '否',
                                                        value: 2,
                                                    }
                                                ]}

                                            />
                                        </Space>

                                    </Col>
                                    <Col span={16}>
                                        <ProFormRadio.Group
                                            name="status"
                                            label="职位状态"
                                            request={async () => [
                                                { label: '发布中', value: 1 },
                                                { label: '未发布', value: 2 },
                                                { label: '暂停', value: 3 },
                                                { label: '锁定', value: 4 },
                                                { label: '回收站', value: 5 },
                                                { label: '已过期', value: 6 },
                                            ]}
                                        />
                                    </Col>

                                </Row>
                            </ProCard>
                        </StepsForm.StepForm>
                    </StepsForm>

                </Modal>

            </ConfigProvider>

        </>
    );
};


export default connect(({ dictModel, openModel }: any) => ({
    dictModel, openModel
}))(PagesMainCompanyListCreate);