|  |  |  | 
|---|
|  |  |  | ProFormDateTimePicker, | 
|---|
|  |  |  | ProFormTreeSelect | 
|---|
|  |  |  | } from '@ant-design/pro-components'; | 
|---|
|  |  |  | import { Form, Modal } from 'antd'; | 
|---|
|  |  |  | import { Form, Modal, Col } from 'antd'; | 
|---|
|  |  |  | import moment from 'moment'; | 
|---|
|  |  |  | import Http from '@/utils/http'; | 
|---|
|  |  |  | import { createIcon } from '@/utils/icon-util' | 
|---|
|  |  |  | import IconSelector from '@/components/IconSelector'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const Edit = (props) => { | 
|---|
|  |  |  | const [menuType, setMenuType] = useState(0); | 
|---|
|  |  |  | const [menuIconName, setMenuIconName] = useState(); | 
|---|
|  |  |  | const [iconSelectorOpen, setIconSelectorOpen] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [form] = Form.useForm(); | 
|---|
|  |  |  | const { } = props; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <ProFormText | 
|---|
|  |  |  | name="name" | 
|---|
|  |  |  | label="名称" | 
|---|
|  |  |  | label="菜单名称" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | rules={[{ required: true, message: "名称不能为空!" }]} | 
|---|
|  |  |  | rules={[{ required: true, message: "菜单名称不能为空!" }]} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ProForm.Group> | 
|---|
|  |  |  | <ProForm.Group> | 
|---|
|  |  |  | 
|---|
|  |  |  | <ProFormSelect | 
|---|
|  |  |  | name="type" | 
|---|
|  |  |  | label="类型" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | colProps={{ md: 10, xl: 610 }} | 
|---|
|  |  |  | placeholder="请选择" | 
|---|
|  |  |  | options={[ | 
|---|
|  |  |  | { label: '菜单', value: 0 }, | 
|---|
|  |  |  | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <ProFormText | 
|---|
|  |  |  | <ProFormSelect | 
|---|
|  |  |  | name="icon" | 
|---|
|  |  |  | label="菜单图标" | 
|---|
|  |  |  | hidden={menuType !== 0} | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | valueEnum={{}} | 
|---|
|  |  |  | addonBefore={createIcon(menuIconName)} | 
|---|
|  |  |  | fieldProps={{ | 
|---|
|  |  |  | onClick: () => { | 
|---|
|  |  |  | setIconSelectorOpen(true); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ProForm.Group> | 
|---|
|  |  |  | <ProForm.Group> | 
|---|
|  |  |  | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ProForm.Group> | 
|---|
|  |  |  | </ProForm> | 
|---|
|  |  |  | </Modal> | 
|---|
|  |  |  | <Modal | 
|---|
|  |  |  | width={800} | 
|---|
|  |  |  | open={iconSelectorOpen} | 
|---|
|  |  |  | onCancel={() => { | 
|---|
|  |  |  | setIconSelectorOpen(false); | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | footer={null} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <IconSelector | 
|---|
|  |  |  | onSelect={(name) => { | 
|---|
|  |  |  | form.setFieldsValue({ icon: name }); | 
|---|
|  |  |  | setMenuIconName(name); | 
|---|
|  |  |  | setIconSelectorOpen(false); | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </Modal> | 
|---|
|  |  |  | </Modal > | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|