import { useState, useEffect, useRef } from 'react'; import { Link, history, connect } from '@umijs/max'; import type { CaptFieldRef, FormInstance } from '@ant-design/pro-components'; import { HomeOutlined, FormOutlined, CameraOutlined } from '@ant-design/icons' import { LoginForm, ProConfigProvider, ProFormDatePicker, ProFormCheckbox, ProFormText, ProFormSelect, ProForm, ProFormCascader, ProFormDigit, ProFormRadio } from '@ant-design/pro-components'; import { Space, Tabs, Button, Avatar, Row, Col, Image, Flex, Card, Modal, ConfigProvider } from 'antd'; import { selectfieldNames, cascaderfieldNames } from '@/constants' import { verifyPhone } from '@/utils/VerifyHelper' import { findAncestors } from '@/utils/dataHelper' import { PostJobapplicantAddDesireindustry, PostJobapplicantUpdateDesireindustry } from '@/services/apis/resume' interface ManageJobseekerResumeIntentionIndustryCreateProps { detail: any, closeModel: (value: boolean) => void } const ManageJobseekerResumeIntentionIndustryCreate: React.FC = ({ dispatch, dictModel, detail, closeModel }: any) => { const formRef = useRef(); useEffect(() => { dispatch({ type: 'dictModel/getList', payload: { code: 2028, type: 'setIndustryPostList' } }) }, []) return ( <> formRef={formRef} request={async () => { if (detail && detail.id){ let level0 = findAncestors(dictModel.industryPostList,detail.industry) detail.industry_array = [ level0[0] ? level0[0] : 0, detail.industry ? detail.industry : '' ] return detail } else { return {} } }} submitter={{ searchConfig: { resetText: '退出编辑', submitText: '保存', }, render: (_, dom) => { return {dom} }, onReset: () => { Modal.confirm({ title: '退出编辑', content: '未完成编辑,此时退出当前编辑内容不会保存,是否确定退出?', centered: true, okText: '退出', cancelText: '取消', onOk() { closeModel(false); }, onCancel() { return; }, }); } }} onFinish={async (values) => { values.customer_id = Number(localStorage.getItem('customerid')); values.industry = values.industry_array && values.industry_array.length > 0 && values.industry_array[1] ? values.industry_array[1] : 0 delete values.industry_array; if (detail && detail.id) { debugger values.id = detail.id; let res = await PostJobapplicantUpdateDesireindustry(values); closeModel(false); } else { let res = await PostJobapplicantAddDesireindustry(values); closeModel(false); } }} > { } }} /> ); }; export default connect(({ dictModel }: any) => ({ dictModel }))(ManageJobseekerResumeIntentionIndustryCreate);