import React, { useEffect, useState } from "react"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import dayjs from "dayjs"; import { Button, Empty, Form, Input, message, Steps, Flex, Row, Col, Select, InputNumber, DatePicker, Space, } from "antd"; import { NS_REGISTER } from "~/enumerate/namespace"; import AttachmentUpload from "~/components/AttachmentUpload"; import { tools } from "@cqsjjb/jjb-common-lib"; import headerImage from "~/enumerate/img/header.png"; import auditLookImage from "~/enumerate/img/auditLook.png"; import auditBkImage from "~/enumerate/img/audit.png"; import successIcon from "~/enumerate/img/successIcon.png"; import { creditCodeRule, nonNegativeIntegerRule, phoneRule, positiveNumberRule, urlRule, normalizeUrl, } from "~/utils/validators"; import { CHONGQING_DISTRICTS, ECONOMY_INDUSTRY_OPTIONS, ENTERPRISE_SCALE_OPTIONS, ENTERPRISE_STATUS_OPTIONS, QUALIFICATION_INDUSTRY_OPTIONS, REGISTERED_ORG_FILING_TYPE_SEARCH_OPTIONS, REGISTERED_ORG_FILING_RECORD_STATUS_OPTIONS, } from "~/enumerate/enterpriseOptions"; import BaiduMapPicker from "~/components/BaiduMapPicker"; import "./index.less"; const { router } = tools; const RegisterMore = (props) => { const { orgInfoSave, register, syncUserToGBS } = props; const [current, setCurrent] = useState(0); const [mapPickerVisible, setMapPickerVisible] = useState(false); const [form] = Form.useForm(); const { registerLoading, syncUserToGBSLoading } = register; const hasRegisterContext = Boolean( router.query?.account && router.query?.registerUserId, ); const loadDetail = async () => { const res = await props.orgInfoGet({ data: router.query?.account, }); if (res?.data) { form.setFieldsValue({ ...res.data, productionDate: res.data.productionDate ? dayjs(res.data.productionDate) : undefined, attachmentUrls: res.data.attachmentUrls ? JSON.parse(res.data.attachmentUrls) : null, }); } }; useEffect(() => { loadDetail(); }, []); const handleSave = async (type) => { if (!hasRegisterContext) { message.error("缺少注册信息,请从注册页重新进入"); return; } const formValues = await form.validateFields(); const values = { ...formValues, registerUserId: router.query?.registerUserId, productionDate: formValues.productionDate ? dayjs(formValues.productionDate).format("YYYY-MM-DD") : undefined, attachmentUrls: formValues.attachmentUrls ? JSON.stringify(formValues.attachmentUrls) : null, infoDisclosureUrl: formValues.infoDisclosureUrl ? normalizeUrl(formValues.infoDisclosureUrl) : undefined, authStatusCode: type === "draft" ? 0 : 1, authStatusName: type === "draft" ? "草稿" : "已提交", }; const res1 = await orgInfoSave(values); if (res1.success) { const res2 = await syncUserToGBS({ account: router.query?.account, registerUserId: router.query?.registerUserId, }); if (res2.success) { message.success("保存成功"); setCurrent(1); } } }; const handleMapConfirm = ({ lng, lat }) => { form.setFieldsValue({ longitude: lng, latitude: lat }); setMapPickerVisible(false); }; const handleLogin = () => { message.success("即将跳转到登录页面,请稍候..."); setTimeout(() => { window.location.href = "https://gbs-gateway.qhdsafety.com/login/client/ZQAQPJ"; }, 2000); }; useEffect(() => { if (current === 1) { window.setTimeout(() => { setCurrent(2); }, 3000); } if (current === 2) { handleLogin(); } }, [current]); return (
认证信息
{current === 0 && (
{!hasRegisterContext && ( )}
{ form.setFieldValue("districtName", option?.label || ""); }} /> { form.setFieldValue( "enterpriseScaleName", option?.label || "", ); }} /> { form.setFieldValue( "filingRecordStatusName", option?.label || "", ); }} />
setMapPickerVisible(false)} onConfirm={handleMapConfirm} /> {/* */}
)} {current === 1 && (
认证审核中,请耐心等待···
)} {current === 2 && (
审核通过
)}
); }; export default Connect([NS_REGISTER], true)(RegisterMore);