import { useState, useEffect } from "react"; import { ConfigProvider, Modal, Form, Input, Select, message, Button } from "antd"; import commonConfig from "@/utils/config"; import * as commonServices from "@/services/services"; const UserRegistrationEvent = () => { const [state, setState0] = useState({}); const setState = payload => { setState0({ ...state, ...payload }); }; // 初始化获取所属客户 useEffect(() => { const url = `${commonConfig.feedback_host}sysworkorder/getCustomerData`; commonServices.postValueService("", {}, url).then(({ data: result = {} }) => { const { code = -1, data, msg = "接口出错" } = result; if (code > -1) { setState({ customerData: data }); } else { message.error(msg); } }); }, []); return { ...state, setState, }; }; const UserRegistration = ({ _this }) => { const { userRegisterMode } = _this.state; if (!userRegisterMode) return ""; const props = UserRegistrationEvent(); const { customerData = [], successModalVisible } = props; const [form] = Form.useForm(); const handleCancel = () => { _this.setState({ userRegisterMode: false, }); }; const handleOk = () => { form.submit(); }; const onFinish = ({ username, phonenumber, sCustomerId }) => { const url = `${commonConfig.feedback_host}sftlogininfo/insertPasswordUserName/add`; const params = { sUserName: username, sLanguage: "sChinese", sBrandsId: "1111111111", sSubsidiaryId: "1111111111", sPhone: phonenumber, sCustomerId, }; commonServices.postValueService("", params, url).then(({ data: result = {} }) => { const { code = -1, msg = "接口出错" } = result; if (code > -1) { props.setState({ successModalVisible: true, phonenumber, }); } else { message.error(msg); } }); }; return (