safety-eval-website/src/pages/Container/RegisterMore/index.js

610 lines
22 KiB
JavaScript
Raw Normal View History

2026-07-09 16:54:59 +08:00
import React, { useEffect, useState } from "react";
2026-07-09 10:05:52 +08:00
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,
2026-07-09 16:54:59 +08:00
Modal,
2026-07-09 10:05:52 +08:00
} from "antd";
import { NS_REGISTER } from "~/enumerate/namespace";
import AttachmentUpload from "~/components/AttachmentUpload";
2026-07-09 16:54:59 +08:00
import { tools } from "@cqsjjb/jjb-common-lib";
2026-07-09 10:05:52 +08:00
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,
2026-07-09 16:54:59 +08:00
normalizeUrl,
2026-07-09 10:05:52 +08:00
} from "~/utils/validators";
import {
2026-07-09 16:54:59 +08:00
CHONGQING_DISTRICTS,
2026-07-09 10:05:52 +08:00
ENTERPRISE_SCALE_OPTIONS,
ENTERPRISE_STATUS_OPTIONS,
2026-07-09 16:54:59 +08:00
REGISTERED_ORG_FILING_TYPE_SEARCH_OPTIONS,
REGISTERED_ORG_FILING_RECORD_STATUS_OPTIONS,
2026-07-09 10:05:52 +08:00
} from "~/enumerate/enterpriseOptions";
import "./index.less";
2026-07-09 16:54:59 +08:00
const { router } = tools;
2026-07-09 10:05:52 +08:00
const RegisterMore = (props) => {
const { orgInfoSave, register, syncUserToGBS } = props;
const [current, setCurrent] = useState(0);
const [form] = Form.useForm();
const { registerLoading, syncUserToGBSLoading } = register;
2026-07-09 16:54:59 +08:00
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();
}, []);
2026-07-09 10:05:52 +08:00
const handleSave = async (type) => {
if (!hasRegisterContext) {
message.error("缺少注册信息,请从注册页重新进入");
return;
}
const formValues = await form.validateFields();
const values = {
...formValues,
2026-07-09 16:54:59 +08:00
registerUserId: router.query?.registerUserId,
2026-07-09 10:05:52 +08:00
productionDate: formValues.productionDate
? dayjs(formValues.productionDate).format("YYYY-MM-DD")
: undefined,
attachmentUrls: formValues.attachmentUrls
? JSON.stringify(formValues.attachmentUrls)
: null,
2026-07-09 16:54:59 +08:00
infoDisclosureUrl: formValues.infoDisclosureUrl
? normalizeUrl(formValues.infoDisclosureUrl)
: undefined,
2026-07-09 10:05:52 +08:00
authStatusCode: type === "draft" ? 0 : 1,
authStatusName: type === "draft" ? "草稿" : "已提交",
};
2026-07-09 16:54:59 +08:00
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 handleLogin = () => {
message.success("即将跳转到登录页面,请稍候...");
setTimeout(() => {
window.location.href =
"https://gbs-gateway.qhdsafety.com/login/client/ZQAQPJ";
}, 2000);
2026-07-09 10:05:52 +08:00
};
useEffect(() => {
if (current === 1) {
window.setTimeout(() => {
setCurrent(2);
}, 3000);
}
2026-07-09 16:54:59 +08:00
if (current === 2) {
handleLogin();
}
2026-07-09 10:05:52 +08:00
}, [current]);
return (
<div className="register-more">
<div className="register-more-header">
<img
src={headerImage}
alt=""
style={{ width: "100%", height: "100%" }}
/>
<div className="register-more-header-content">
<div className="register-more-header-title">认证信息</div>
</div>
</div>
<div className="register-more-content">
<Flex justify="center">
<Steps
style={{
width: "600px",
marginBottom: "20px",
}}
current={current}
//onChange={setCurrent}
items={[
{
title: "填写信息",
},
{
title: "认证审核中",
},
{
title: "认证通过",
},
]}
/>
</Flex>
{current === 0 && (
<div>
{!hasRegisterContext && (
<Empty
description="缺少注册信息,请从注册页重新进入"
style={{ marginBottom: 24 }}
/>
)}
2026-07-09 16:54:59 +08:00
<Form
form={form}
labelCol={{ span: 10 }}
disabled={!hasRegisterContext}
>
2026-07-09 10:05:52 +08:00
<Row gutter={[16, 16]}>
<Col span={12}>
2026-07-09 16:54:59 +08:00
<Form.Item noStyle name='id' />
2026-07-09 10:05:52 +08:00
<Form.Item
name="unitName"
label="生产经营单位名称"
rules={[
{ required: true, message: "请输入生产经营单位名称" },
]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入生产经营单位名称" allowClear maxLength={200} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="creditCode"
label="统一社会信用代码"
rules={[creditCodeRule(true)]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入统一社会信用代码" allowClear maxLength={18} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="safetyIndustryCategoryName"
label="安全生产监管行业类别"
rules={[
{ required: true, message: "请输入安全生产监管行业类别" },
]}
>
<Input
placeholder="请输入安全生产监管行业类别"
allowClear
2026-07-13 16:09:45 +08:00
maxLength={100}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
2026-07-10 17:11:35 +08:00
name="districtCode"
2026-07-09 10:05:52 +08:00
label="属地"
rules={[{ required: true, message: "请选择属地" }]}
>
<Select
2026-07-09 16:54:59 +08:00
options={CHONGQING_DISTRICTS}
2026-07-09 10:05:52 +08:00
placeholder="请选择属地"
allowClear
2026-07-10 17:11:35 +08:00
onChange={(value, option) => {
form.setFieldValue("districtName", option?.label || "");
}}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
2026-07-10 17:11:35 +08:00
<Form.Item name="districtName" noStyle />
2026-07-09 10:05:52 +08:00
</Col>
<Col span={12}>
<Form.Item
name="townStreet"
label="所属镇、街道"
rules={[{ required: true, message: "请输入所属镇街道" }]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入所属镇街道" allowClear maxLength={100} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="villageCommunity" label="属村(社区)">
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入属村(社区)" allowClear maxLength={100} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="longitude"
label="所在地坐标经度"
2026-07-09 16:54:59 +08:00
dependencies={["latitude"]}
rules={[
{
validator(_, value) {
const latitude = form.getFieldValue("latitude");
if (
value !== undefined &&
value !== null &&
value !== "" &&
(latitude === undefined ||
latitude === null ||
latitude === "")
) {
return Promise.reject(
new Error("填写经度后,纬度必填"),
);
}
return Promise.resolve();
},
},
]}
2026-07-09 10:05:52 +08:00
>
<InputNumber
style={{ width: "100%" }}
min={-180}
max={180}
precision={6}
placeholder="请输入经度"
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="latitude"
label="所在地坐标纬度"
2026-07-09 16:54:59 +08:00
dependencies={["longitude"]}
rules={[
{
validator(_, value) {
const longitude = form.getFieldValue("longitude");
if (
value !== undefined &&
value !== null &&
value !== "" &&
(longitude === undefined ||
longitude === null ||
longitude === "")
) {
return Promise.reject(
new Error("填写纬度后,经度必填"),
);
}
return Promise.resolve();
},
},
]}
2026-07-09 10:05:52 +08:00
>
<InputNumber
style={{ width: "100%" }}
min={-90}
max={90}
precision={6}
placeholder="请输入纬度"
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="registerAddress"
label="注册地址"
rules={[{ required: true, message: "请输入注册地址" }]}
>
2026-07-13 16:09:45 +08:00
<Input.TextArea rows={3} placeholder="请输入注册地址" maxLength={200} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="businessAddress"
label="经营地址"
rules={[{ required: true, message: "请输入经营地址" }]}
>
2026-07-13 16:09:45 +08:00
<Input.TextArea rows={3} placeholder="请输入经营地址" maxLength={200} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="ownershipTypeName" label="归属类型">
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入归属类型" allowClear maxLength={50} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="economyIndustryCode"
label="国民经济行业分类(GB/T4754-2017)"
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入国民经济行业分类" allowClear maxLength={50} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="legalRepresentative"
label="法定代表人"
rules={[{ required: true, message: "请输入法定代表人" }]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入法定代表人" allowClear maxLength={50} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="legalRepresentativePhone"
label="法定代表人联系电话"
rules={[phoneRule("法定代表人联系电话", false)]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入法定代表人联系电话" allowClear maxLength={11} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="principalName"
label="主要负责人"
rules={[{ required: true, message: "请输入主要负责人" }]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入主要负责人" allowClear maxLength={50} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="principalPhone"
label="主要负责人联系电话"
rules={[phoneRule("主要负责人联系电话", true)]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入主要负责人联系电话" allowClear maxLength={11} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="safetyDeptManager"
label="安全管理部门负责人"
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入安全管理部门负责人" allowClear maxLength={50} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="safetyDeptManagerPhone"
label="安全管理部门负责人联系电话"
rules={[phoneRule("安全管理部门负责人联系电话", false)]}
>
<Input
placeholder="请输入安全管理部门负责人联系电话"
allowClear
2026-07-13 16:09:45 +08:00
maxLength={11}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
</Col>
2026-07-09 16:54:59 +08:00
2026-07-09 10:05:52 +08:00
<Col span={12}>
<Form.Item
name="safetyDeputyPhone"
label="主管安全副总联系电话"
rules={[phoneRule("主管安全副总联系电话", false)]}
>
<Input
placeholder="请输入主管安全副总联系电话"
allowClear
2026-07-13 16:09:45 +08:00
maxLength={11}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="productionDate" label="投产日期">
<DatePicker
style={{ width: "100%" }}
placeholder="请选择投产日期"
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="businessStatusName" label="企业经营状态">
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入企业经营状态" allowClear maxLength={50} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="infoDisclosureUrl"
label="信息公开网址"
rules={[urlRule("信息公开网址", false)]}
>
2026-07-13 16:09:45 +08:00
<Input placeholder="请输入信息公开网址" allowClear maxLength={200} />
2026-07-09 10:05:52 +08:00
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="workplaceArea"
label="工作场所建筑面积"
rules={[positiveNumberRule("工作场所建筑面积", false)]}
>
<InputNumber
style={{ width: "100%" }}
min={0}
precision={2}
placeholder="请输入工作场所建筑面积"
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="archiveRoomArea"
label="档案室面积"
rules={[positiveNumberRule("档案室面积", false)]}
>
<InputNumber
style={{ width: "100%" }}
min={0}
precision={2}
placeholder="请输入档案室面积"
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="fulltimeEvaluatorCount"
label="专职安全评价师数量"
rules={[
nonNegativeIntegerRule("专职安全评价师数量", false),
]}
>
<InputNumber
style={{ width: "100%" }}
min={0}
precision={0}
placeholder="请输入专职安全评价师数量"
/>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name="registeredEngineerCount"
label="注册安全工程师数量"
rules={[
nonNegativeIntegerRule("注册安全工程师数量", false),
]}
>
<InputNumber
style={{ width: "100%" }}
min={0}
precision={0}
placeholder="请输入注册安全工程师数量"
/>
</Form.Item>
</Col>
<Col span={12}>
2026-07-10 17:11:35 +08:00
<Form.Item name="enterpriseStatusCode" label="企业状态">
2026-07-09 10:05:52 +08:00
<Select
options={ENTERPRISE_STATUS_OPTIONS}
placeholder="请选择企业状态"
allowClear
2026-07-10 17:11:35 +08:00
onChange={(value, option) => {
form.setFieldValue("enterpriseStatusName", option?.label || "");
}}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
2026-07-10 17:11:35 +08:00
<Form.Item name="enterpriseStatusName" noStyle />
2026-07-09 10:05:52 +08:00
</Col>
<Col span={12}>
2026-07-10 17:11:35 +08:00
<Form.Item name="enterpriseScaleCode" label="企业规模">
2026-07-09 10:05:52 +08:00
<Select
options={ENTERPRISE_SCALE_OPTIONS}
placeholder="请选择企业规模"
allowClear
2026-07-10 17:11:35 +08:00
onChange={(value, option) => {
form.setFieldValue("enterpriseScaleName", option?.label || "");
}}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
2026-07-10 17:11:35 +08:00
<Form.Item name="enterpriseScaleName" noStyle />
2026-07-09 10:05:52 +08:00
</Col>
<Col span={12}>
2026-07-09 16:54:59 +08:00
<Form.Item name="filingTypeCode" label="备案类型">
2026-07-09 10:05:52 +08:00
<Select
2026-07-09 16:54:59 +08:00
options={REGISTERED_ORG_FILING_TYPE_SEARCH_OPTIONS}
2026-07-09 10:05:52 +08:00
placeholder="请选择备案类型"
allowClear
2026-07-09 16:54:59 +08:00
onChange={(value, option) => {
form.setFieldValue("filingTypeName", option?.label);
}}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
2026-07-09 16:54:59 +08:00
<Form.Item name="filingTypeName" noStyle />
2026-07-09 10:05:52 +08:00
</Col>
<Col span={12}>
2026-07-09 16:54:59 +08:00
<Form.Item name="filingRecordStatusCode" label="备案状态">
2026-07-09 10:05:52 +08:00
<Select
2026-07-09 16:54:59 +08:00
options={REGISTERED_ORG_FILING_RECORD_STATUS_OPTIONS}
2026-07-09 10:05:52 +08:00
placeholder="请选择备案状态"
allowClear
2026-07-09 16:54:59 +08:00
onChange={(value, option) => {
form.setFieldValue(
"filingRecordStatusName",
option?.label || "",
);
}}
2026-07-09 10:05:52 +08:00
/>
</Form.Item>
2026-07-09 16:54:59 +08:00
<Form.Item name="filingRecordStatusName" noStyle />
2026-07-09 10:05:52 +08:00
</Col>
<Col span={12}>
<AttachmentUpload name="attachmentUrls" label="上传附件" />
</Col>
</Row>
</Form>
<Flex justify="center">
<Space size={16}>
{/* <Button
loading={registerLoading || syncUserToGBSLoading}
onClick={() => handleSave("draft")}
>
暂存
</Button> */}
<Button
loading={registerLoading || syncUserToGBSLoading}
type="primary"
disabled={!hasRegisterContext}
onClick={() => handleSave("submit")}
>
提交
</Button>
</Space>
</Flex>
</div>
)}
{current === 1 && (
<div>
<Flex justify="center" vertical align="center">
<div
className="audit-look"
style={{
backgroundImage: `url(${auditBkImage})`,
}}
>
<img src={auditLookImage} className="audit-look-img" />
</div>
<div>认证审核中请耐心等待···</div>
</Flex>
</div>
)}
{current === 2 && (
<div>
<Flex justify="center" vertical align="center">
<img src={successIcon} />
<div>审核通过</div>
</Flex>
</div>
)}
</div>
</div>
);
};
export default Connect([NS_REGISTER], true)(RegisterMore);