|  |  |  | 
|---|
|  |  |  | ProFormDateTimePicker, | 
|---|
|  |  |  | ProFormTreeSelect | 
|---|
|  |  |  | } from '@ant-design/pro-components'; | 
|---|
|  |  |  | import { FormattedMessage, useIntl } from '@umijs/max'; | 
|---|
|  |  |  | import { Form, Modal, Col } from 'antd'; | 
|---|
|  |  |  | import moment from 'moment'; | 
|---|
|  |  |  | import Http from '@/utils/http'; | 
|---|
|  |  |  | 
|---|
|  |  |  | import IconSelector from '@/components/IconSelector'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const Edit = (props) => { | 
|---|
|  |  |  | const intl = useIntl(); | 
|---|
|  |  |  | const [menuType, setMenuType] = useState(0); | 
|---|
|  |  |  | const [menuIconName, setMenuIconName] = useState(); | 
|---|
|  |  |  | const [iconSelectorOpen, setIconSelectorOpen] = useState(false); | 
|---|
|  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <Modal | 
|---|
|  |  |  | title="Edit" | 
|---|
|  |  |  | title={ | 
|---|
|  |  |  | Object.keys(props.values).length > 0 | 
|---|
|  |  |  | ? intl.formatMessage({ id: 'page.edit', defaultMessage: '编辑' }) | 
|---|
|  |  |  | : intl.formatMessage({ id: 'page.add', defaultMessage: '添加' }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | width={640} | 
|---|
|  |  |  | forceRender | 
|---|
|  |  |  | destroyOnClose | 
|---|
|  |  |  | 
|---|
|  |  |  | return props.treeData; | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请选择" | 
|---|
|  |  |  | rules={[{ required: true, message: "上级菜单不能为空" }]} | 
|---|
|  |  |  | fieldProps={{ | 
|---|
|  |  |  | treeDefaultExpandedKeys: [0] | 
|---|
|  |  |  | 
|---|
|  |  |  | name="name" | 
|---|
|  |  |  | label="菜单名称" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | rules={[{ required: true, message: "菜单名称不能为空!" }]} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ProForm.Group> | 
|---|
|  |  |  | 
|---|
|  |  |  | name="route" | 
|---|
|  |  |  | label="路由地址" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <ProFormText | 
|---|
|  |  |  | name="component" | 
|---|
|  |  |  | label="页面组件" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | </ProForm.Group> | 
|---|
|  |  |  | <ProForm.Group> | 
|---|
|  |  |  | 
|---|
|  |  |  | name="type" | 
|---|
|  |  |  | label="类型" | 
|---|
|  |  |  | colProps={{ md: 10, xl: 610 }} | 
|---|
|  |  |  | placeholder="请选择" | 
|---|
|  |  |  | options={[ | 
|---|
|  |  |  | { label: '菜单', value: 0 }, | 
|---|
|  |  |  | { label: '按钮', value: 1 }, | 
|---|
|  |  |  | 
|---|
|  |  |  | label="权限标识" | 
|---|
|  |  |  | hidden={menuType !== 1} | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <ProFormSelect | 
|---|
|  |  |  | name="icon" | 
|---|
|  |  |  | label="菜单图标" | 
|---|
|  |  |  | hidden={menuType !== 0} | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | valueEnum={{}} | 
|---|
|  |  |  | addonBefore={createIcon(menuIconName)} | 
|---|
|  |  |  | fieldProps={{ | 
|---|
|  |  |  | 
|---|
|  |  |  | label="排序" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | fieldProps={{ precision: 0 }} | 
|---|
|  |  |  | placeholder="请输入" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | <ProFormSelect | 
|---|
|  |  |  | name="status" | 
|---|
|  |  |  | label="状态" | 
|---|
|  |  |  | colProps={{ md: 12, xl: 12 }} | 
|---|
|  |  |  | placeholder="请选择" | 
|---|
|  |  |  | options={[ | 
|---|
|  |  |  | { label: '正常', value: 1 }, | 
|---|
|  |  |  | { label: '禁用', value: 0 }, | 
|---|