Commit 587e1833 authored by 张烨's avatar 张烨
parents 2106012f dd52e920
...@@ -21,8 +21,8 @@ const SiteConfig = props => { ...@@ -21,8 +21,8 @@ const SiteConfig = props => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
labelCol: { span: 3 }, labelCol: { span: 7 },
wrapperCol: { span: 14 }, wrapperCol: { span: 6 },
}; };
useEffect(() => { useEffect(() => {
console.log(miniTitle, 'miniTitle'); console.log(miniTitle, 'miniTitle');
...@@ -88,6 +88,7 @@ const SiteConfig = props => { ...@@ -88,6 +88,7 @@ const SiteConfig = props => {
}; };
return ( return (
<Spin spinning={loading} tip="loading..."> <Spin spinning={loading} tip="loading...">
<div style={{ minHeight: 'calc(100vh - 172px)', marginTop: '20px' }}>
<Form form={form} {...layout}> <Form form={form} {...layout}>
<Item <Item
label="应用名称:" label="应用名称:"
...@@ -181,12 +182,13 @@ const SiteConfig = props => { ...@@ -181,12 +182,13 @@ const SiteConfig = props => {
<Radio value={false}></Radio> <Radio value={false}></Radio>
</Radio.Group> </Radio.Group>
</Item> </Item>
<Item style={{ textAlign: 'center' }}> <Item wrapperCol={{ span: 6, offset: 7 }}>
<Button type="primary" onClick={submit}> <Button type="primary" onClick={submit}>
提交 提交
</Button> </Button>
</Item> </Item>
</Form> </Form>
</div>
</Spin> </Spin>
); );
}; };
......
...@@ -31,7 +31,7 @@ import ListCardItem from '@/pages/orgnazation/listCardItem'; ...@@ -31,7 +31,7 @@ import ListCardItem from '@/pages/orgnazation/listCardItem';
import styles from './LeftPart.less'; import styles from './LeftPart.less';
import PicturesWall from '@/components/Upload/index'; import PicturesWall from '@/components/Upload/index';
const LeftPart = () => { const AppMenu = () => {
const [treeLoading, setTreeLoading] = useState(true); const [treeLoading, setTreeLoading] = useState(true);
const [treeData, setTreeData] = useState([]); // 菜单树 const [treeData, setTreeData] = useState([]); // 菜单树
...@@ -47,6 +47,7 @@ const LeftPart = () => { ...@@ -47,6 +47,7 @@ const LeftPart = () => {
const [addMenuVisible, setAddMenuVisible] = useState(false); const [addMenuVisible, setAddMenuVisible] = useState(false);
const [addMenuGroupVisible, setAddMenuGroupVisible] = useState(false); const [addMenuGroupVisible, setAddMenuGroupVisible] = useState(false);
const [tipVisible, setTipVisible] = useState(false); const [tipVisible, setTipVisible] = useState(false);
const [deleteMenuVisible, setDeleteMenuVisible] = useState(false); const [deleteMenuVisible, setDeleteMenuVisible] = useState(false);
const [addMenuForm] = Form.useForm(); const [addMenuForm] = Form.useForm();
...@@ -57,11 +58,13 @@ const LeftPart = () => { ...@@ -57,11 +58,13 @@ const LeftPart = () => {
roleValueList[index] = value; roleValueList[index] = value;
setRoleValueList({ ...roleValueList }); setRoleValueList({ ...roleValueList });
}, []); }, []);
const [flag, setFlag] = useState(1); // 刷新标记
const [saveid, setSaveid] = useState(''); // 保存选择的ID
const [submitLoading, setSubmitLoading] = useState(false);
// 获取菜单树 // 获取菜单树
useEffect(() => { useEffect(() => {
updateTrees(); updateTrees();
}, []); }, [flag]);
const updateTrees = () => { const updateTrees = () => {
setTreeLoading(true); setTreeLoading(true);
...@@ -119,11 +122,6 @@ const LeftPart = () => { ...@@ -119,11 +122,6 @@ const LeftPart = () => {
onClick={() => addMenuGroup(menu, '分组图标')} onClick={() => addMenuGroup(menu, '分组图标')}
/> />
</Tooltip> </Tooltip>
{/* <Tooltip title="添加菜单组">
<EditTwoTone
onClick={() => editMenuGroup(menu, '在线图标')}
/>
</Tooltip> */}
</> </>
)} )}
{menu.menuType === 'MiniAppMenuGroupTwo' && ( {menu.menuType === 'MiniAppMenuGroupTwo' && (
...@@ -131,20 +129,9 @@ const LeftPart = () => { ...@@ -131,20 +129,9 @@ const LeftPart = () => {
<Tooltip title="添加菜单"> <Tooltip title="添加菜单">
<FileAddTwoTone onClick={() => addMenu(menu)} /> <FileAddTwoTone onClick={() => addMenu(menu)} />
</Tooltip> </Tooltip>
{/* <Tooltip title="编辑菜单组">
<EditTwoTone
onClick={() => editMenuGroup(menu, '分组图标')}
/>
</Tooltip> */}
</> </>
)} )}
{/* {menu.menuType === 'MiniAppMenuThree' && (
<>
<Tooltip title="编辑菜单">
<EditTwoTone onClick={() => editMenu(menu)} />
</Tooltip>
</>
)} */}
<Tooltip title="删除菜单"> <Tooltip title="删除菜单">
<DeleteTwoTone onClick={() => deleteMenu(menu)} /> <DeleteTwoTone onClick={() => deleteMenu(menu)} />
</Tooltip> </Tooltip>
...@@ -152,7 +139,7 @@ const LeftPart = () => { ...@@ -152,7 +139,7 @@ const LeftPart = () => {
</> </>
), ),
key: menu.menuID, key: menu.menuID,
icon: menu.leaf ? <FileOutlined /> : <FolderOpenOutlined />, // icon: menu.leaf ? <FileOutlined /> : <FolderOpenOutlined />,
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作 // 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children: haveChildren ? menu.children.map(i => mapTree(i)) : [], children: haveChildren ? menu.children.map(i => mapTree(i)) : [],
}; };
...@@ -161,6 +148,7 @@ const LeftPart = () => { ...@@ -161,6 +148,7 @@ const LeftPart = () => {
// 获取当前菜单详细 // 获取当前菜单详细
const onSelect = (props, e) => { const onSelect = (props, e) => {
// e.node.pos节点类型,根据这个渲染不同的编辑表单item,0-x一级菜单,0-0-x二级,0-0-0-x三级 // e.node.pos节点类型,根据这个渲染不同的编辑表单item,0-x一级菜单,0-0-x二级,0-0-0-x三级
console.log(props, e);
if (e) { if (e) {
if (e.node.pos.lastIndexOf('-') === 1) { if (e.node.pos.lastIndexOf('-') === 1) {
setNodeType(1); setNodeType(1);
...@@ -170,7 +158,13 @@ const LeftPart = () => { ...@@ -170,7 +158,13 @@ const LeftPart = () => {
setNodeType(3); setNodeType(3);
} }
} }
if (props[0]) {
setMenuID(props[0]); setMenuID(props[0]);
setSaveid(props[0]);
} else {
setMenuID(saveid);
}
// setMenuID(props[0]);
getMenuInfo(props[0]) getMenuInfo(props[0])
.then(res => { .then(res => {
if (res.success) { if (res.success) {
...@@ -193,7 +187,8 @@ const LeftPart = () => { ...@@ -193,7 +187,8 @@ const LeftPart = () => {
// 左侧目录树相关操作 // 左侧目录树相关操作
const addMenu = menu => { const addMenu = menu => {
setAddMenuVisible(true); setAddMenuVisible(true);
setMenuTitle(`在${menu.text}下添加菜单`); setMenuTitle(`在${menu.text}下添加功能菜单`);
console.log(menu, 'enu');
setMenuID(menu.menuID); setMenuID(menu.menuID);
addMenuForm.setFieldsValue({ addMenuForm.setFieldsValue({
menuName: '', menuName: '',
...@@ -384,9 +379,13 @@ const LeftPart = () => { ...@@ -384,9 +379,13 @@ const LeftPart = () => {
} }
}; };
const submitMenu = params => { const submitMenu = params => {
setSubmitLoading(true);
submitMenuInfo(params) submitMenuInfo(params)
.then(res => { .then(res => {
setSubmitLoading(false);
if (res.success) { if (res.success) {
setFlag(flag + 1);
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
}); });
...@@ -398,6 +397,7 @@ const LeftPart = () => { ...@@ -398,6 +397,7 @@ const LeftPart = () => {
} }
}) })
.catch(err => { .catch(err => {
setSubmitLoading(false);
message.error(err); message.error(err);
}); });
}; };
...@@ -430,7 +430,7 @@ const LeftPart = () => { ...@@ -430,7 +430,7 @@ const LeftPart = () => {
<div className={styles.menuContainer}> <div className={styles.menuContainer}>
<div style={{ padding: '10px 10px 0 16px' }}> <div style={{ padding: '10px 10px 0 16px' }}>
菜单列表 菜单列表
<Tooltip title="添加菜单"> <Tooltip title="添加功能菜单">
<FileAddTwoTone <FileAddTwoTone
style={{ style={{
fontSize: '18px', fontSize: '18px',
...@@ -460,8 +460,10 @@ const LeftPart = () => { ...@@ -460,8 +460,10 @@ const LeftPart = () => {
showIcon="true" showIcon="true"
showLine={{ showLeafIcon: false }} showLine={{ showLeafIcon: false }}
defaultExpandAll="true" defaultExpandAll="true"
// selectedKeys={[currentSelectMenu]} selectedKeys={[menuID]}
onSelect={onSelect} onSelect={onSelect}
autoExpandParent
expandedKeys={[menuID]}
treeData={treeData.map(t => mapTree(t))} treeData={treeData.map(t => mapTree(t))}
/> />
</Spin> </Spin>
...@@ -526,7 +528,12 @@ const LeftPart = () => { ...@@ -526,7 +528,12 @@ const LeftPart = () => {
<Input placeholder="请输入功能参数" /> <Input placeholder="请输入功能参数" />
</Form.Item> </Form.Item>
<Form.Item wrapperCol={{ offset: 12 }}> <Form.Item wrapperCol={{ offset: 12 }}>
<Button key="back" type="primary" onClick={() => submitEditMenu()}> <Button
key="back"
type="primary"
onClick={() => submitEditMenu()}
loading={submitLoading}
>
提交 提交
</Button> </Button>
</Form.Item> </Form.Item>
...@@ -534,8 +541,141 @@ const LeftPart = () => { ...@@ -534,8 +541,141 @@ const LeftPart = () => {
</div> </div>
<div className={styles.previewContainer}>关联角色</div> <div className={styles.previewContainer}>关联角色</div>
{/* 必填项提示 */} {/* 必填项提示 */}
<Modal
title="提示"
visible={tipVisible}
onCancel={() => setTipVisible(false)}
width="300px"
styles={{ zIndex: 999999 }}
centered
footer={[
<Button
key="back"
type="primary"
onClick={() => setTipVisible(false)}
>
关闭
</Button>,
]}
>
<p>
标记<span className={styles.redText}>*</span>的为必填项
</p>
</Modal>
{/* 添加菜单 */}
<Modal
title={menuTitle}
visible={addMenuVisible}
onOk={submitAddMenu}
onCancel={() => setAddMenuVisible(false)}
okText="确认"
cancelText="取消"
centered
>
<Form form={addMenuForm} labelCol={{ span: 4 }}>
<Form.Item
name="menuName"
label="菜单名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入菜单名称" />
</Form.Item>
<Form.Item
name="shortName"
label="菜单别名"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入菜单别名" />
</Form.Item>
<Form.Item
name="imageUrl"
label="菜单图标"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入菜单图标" />
</Form.Item>
<Form.Item
name="pageUrl"
label="功能路径"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入菜单图标" />
</Form.Item>
<Form.Item label="图标预览">
<PicturesWall maxLen={1} />
</Form.Item>
<Form.Item name="funParam" label="功能参数">
<Input placeholder="请输入功能参数" />
</Form.Item>
</Form>
</Modal>
{/* 添加菜单组 */}
<Modal
title={menuTitle}
visible={addMenuGroupVisible}
onOk={submitAddMenuGroup}
onCancel={() => setAddMenuGroupVisible(false)}
okText="确认"
cancelText="取消"
centered
>
<Form form={addMenuGroupForm} labelCol={{ span: 4 }}>
<Form.Item
name="menuName"
label="分组名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入分组名称" />
</Form.Item>
<Form.Item
name="shortName"
label="分组别名"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入分组别名" />
</Form.Item>
<Form.Item
name="imageUrl"
label={menuLabel}
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入菜单图标" />
</Form.Item>
<Form.Item label="图标预览">
<PicturesWall maxLen={1} />
</Form.Item>
{/* 添加菜单组,label名称为在线图标才有离线图标 */}
{menuLabel === '在线图标' && (
<Form.Item
name="offlineImgUrl"
label="离线图标"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入离线图标" />
</Form.Item>
)}
<Form.Item label="图标预览">
<PicturesWall maxLen={1} />
</Form.Item>
<Form.Item name="funParam" label="功能参数">
<Input placeholder="请输入功能参数" />
</Form.Item>
</Form>
</Modal>
{/* 删除菜单 */}
<Modal
title={menuTitle}
visible={deleteMenuVisible}
onOk={submitDeleteMenu}
onCancel={() => setDeleteMenuVisible(false)}
okText="确认"
cancelText="取消"
centered
>
<span>确定删除?</span>
</Modal>
</div> </div>
); );
}; };
export default LeftPart; export default AppMenu;
.contentContainer{ .contentContainer{
max-height: calc(100vh - 300px); // min-height: calc(100vh - 48px);
overflow-x: auto; overflow-x: auto;
display: flex; display: flex;
.menuContainer{ .menuContainer{
min-width: 300px; min-width: 300px;
border:1px solid #abaeb1; border:2px solid #eee;
// min-height:calc(100vh - 300px); min-height:calc(100vh - 172px);
overflow-y:auto; overflow-y:auto;
.ant-tree-list{ .ant-tree-list{
padding: 10px; padding: 10px;
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
padding: 16px; padding: 16px;
float: left; float: left;
min-width: 500px; min-width: 500px;
border:1px solid #abaeb1; border:2px solid #eee;
.ant-table-pagination-right{ .ant-table-pagination-right{
padding-right: 12px; padding-right: 12px;
} }
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
margin-left: 12px; margin-left: 12px;
// flex: 1; // flex: 1;
float: left; float: left;
min-width: 400px; min-width: 700px;
border:1px solid #abaeb1; border:2px solid #eee;
.ant-table-pagination-right{ .ant-table-pagination-right{
padding-right: 12px; padding-right: 12px;
} }
......
...@@ -6,10 +6,10 @@ import LeftPart from './LeftPart'; ...@@ -6,10 +6,10 @@ import LeftPart from './LeftPart';
const MenuConfig = props => { const MenuConfig = props => {
const [flag, setFlag] = useState(1); const [flag, setFlag] = useState(1);
return ( return (
<ProCard split="vertical"> <div split="vertical">
<LeftPart /> <LeftPart />
{/* <ProCard><AddForm /></ProCard> */} {/* <ProCard><AddForm /></ProCard> */}
</ProCard> </div>
); );
}; };
export default MenuConfig; export default MenuConfig;
...@@ -130,6 +130,7 @@ const SiteManage = () => { ...@@ -130,6 +130,7 @@ const SiteManage = () => {
let arr = list.map(item => { let arr = list.map(item => {
item.id = item.OUID * 10000; item.id = item.OUID * 10000;
item.text = item.OUName; item.text = item.OUName;
item.isChecked = false;
item.type = 'widgetGroup'; item.type = 'widgetGroup';
item.children = item.userList.map(u => ({ item.children = item.userList.map(u => ({
...u, ...u,
......
...@@ -37,3 +37,7 @@ export const editWebsite = (params, options) => { ...@@ -37,3 +37,7 @@ export const editWebsite = (params, options) => {
options, options,
); );
}; };
/**
* @获取菜单配置
*/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment