You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import { useState, useEffect, useRef } from 'react';
  2. import { Link, history, connect } from '@umijs/max';
  3. import type { CaptFieldRef, FormInstance } from '@ant-design/pro-components';
  4. import { HomeOutlined, FormOutlined, CameraOutlined } from '@ant-design/icons'
  5. import { LoginForm, ProConfigProvider, ProFormDatePicker, ProFormCheckbox, ProFormText, ProFormSelect, ProForm, ProFormCascader, ProFormDigit, ProFormRadio } from '@ant-design/pro-components';
  6. import { Space, Tabs, Button, Avatar, Row, Col, Image, Flex, Card, Modal, ConfigProvider } from 'antd';
  7. import { selectfieldNames, cascaderfieldNames } from '@/constants'
  8. import { verifyPhone } from '@/utils/VerifyHelper'
  9. import { findAncestors } from '@/utils/dataHelper'
  10. import { PostJobapplicantAddDesireindustry, PostJobapplicantUpdateDesireindustry } from '@/services/apis/resume'
  11. interface ManageJobseekerResumeIntentionIndustryCreateProps {
  12. detail: any,
  13. closeModel: (value: boolean) => void
  14. }
  15. const ManageJobseekerResumeIntentionIndustryCreate: React.FC<ManageJobseekerResumeIntentionIndustryCreateProps> = ({ dispatch, dictModel, detail, closeModel }: any) => {
  16. const formRef = useRef<FormInstance | null>();
  17. useEffect(() => {
  18. dispatch({ type: 'dictModel/getList', payload: { code: 2028, type: 'setIndustryPostList' } })
  19. }, [])
  20. return (
  21. <>
  22. <ConfigProvider
  23. theme={{
  24. token: {
  25. colorPrimary: '#19be6e',
  26. }, components: {
  27. },
  28. }}
  29. >
  30. <ProForm
  31. <Resume.IntentionPosition>
  32. formRef={formRef}
  33. request={async () => {
  34. if (detail && detail.id){
  35. let level0 = findAncestors(dictModel.industryPostList,detail.industry)
  36. detail.industry_array = [
  37. level0[0] ? level0[0] : 0,
  38. detail.industry ? detail.industry : ''
  39. ]
  40. return detail
  41. } else {
  42. return {}
  43. }
  44. }}
  45. submitter={{
  46. searchConfig: {
  47. resetText: '退出编辑',
  48. submitText: '保存',
  49. },
  50. render: (_, dom) => { return <Flex justify='flex-end'> <Space>{dom}</Space></Flex> },
  51. onReset: () => {
  52. Modal.confirm({
  53. title: '退出编辑',
  54. content: '未完成编辑,此时退出当前编辑内容不会保存,是否确定退出?',
  55. centered: true,
  56. okText: '退出',
  57. cancelText: '取消',
  58. onOk() {
  59. closeModel(false);
  60. },
  61. onCancel() {
  62. return;
  63. },
  64. });
  65. }
  66. }}
  67. onFinish={async (values) => {
  68. values.customer_id = Number(localStorage.getItem('customerid'));
  69. values.industry = values.industry_array && values.industry_array.length > 0 && values.industry_array[1] ? values.industry_array[1] : 0
  70. delete values.industry_array;
  71. if (detail && detail.id) {
  72. debugger
  73. values.id = detail.id;
  74. let res = await PostJobapplicantUpdateDesireindustry(values);
  75. closeModel(false);
  76. } else {
  77. let res = await PostJobapplicantAddDesireindustry(values);
  78. closeModel(false);
  79. }
  80. }}
  81. >
  82. <Row gutter={20}>
  83. <Col span={8}>
  84. <ProFormCascader
  85. name="industry_array"
  86. label="期望行业(请选择到第二项)"
  87. fieldProps={{
  88. fieldNames: cascaderfieldNames,
  89. options: dictModel.industryPostList,
  90. changeOnSelect: true,
  91. onChange: (value) => {
  92. }
  93. }}
  94. />
  95. </Col>
  96. </Row>
  97. </ProForm>
  98. </ConfigProvider>
  99. </>
  100. );
  101. };
  102. export default connect(({ dictModel }: any) => ({
  103. dictModel
  104. }))(ManageJobseekerResumeIntentionIndustryCreate);