diff --git a/src/components/UserRegistration/index.jsx b/src/components/UserRegistration/index.jsx index 3d56621..184300d 100644 --- a/src/components/UserRegistration/index.jsx +++ b/src/components/UserRegistration/index.jsx @@ -1,9 +1,40 @@ -import { ConfigProvider, Modal, Form, Input, Select } from "antd"; +import { useState, useEffect } from "react"; +import { ConfigProvider, Modal, Form, Input, Select, message } 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 = [] } = props; + const [form] = Form.useForm(); const handleCancel = () => { @@ -22,15 +53,7 @@ const UserRegistration = ({ _this }) => { return ( - +
{