Commit f93fa131 authored by Maofei94's avatar Maofei94

perf: a perf

parent 9d4878eb
......@@ -44,7 +44,7 @@ const ListCard = props => {
useEffect(() => {
setValueList(checkList);
}, [dataList, loading]);
}, [dataList, loading, checkList]);
const updateValueList = (checkedKeys, childrenKeys, sourceItem) => {
// eslint-disable-next-line no-console
......
......@@ -139,7 +139,7 @@ const MongDBTable = props => {
title: '类型',
dataIndex: 'type',
key: 'type',
width: 100,
// width: 200,
ellipsis: true,
},
{
......
......@@ -2,16 +2,18 @@ import React, { useState, useEffect } from 'react';
import { Card, Tabs } from 'antd';
import ProCard from '@ant-design/pro-card';
import PageContainer from '@/components/BasePageContainer';
import { miniAppSiteTree } from '@/services/mobileConfig/api';
import {
miniAppSiteTree,
getMiniAppModuleTree,
} from '@/services/mobileConfig/api';
import SiteConfig from './SiteConfig';
import MenuConfig from './menuconfig/MenuConfig';
const { TabPane } = Tabs;
const MobileConfigPage = props => {
const [activeKey, setActiveKey] = useState('0'); // tabs活动页
const [activeKey, setActiveKey] = useState('1'); // tabs活动页
const [miniTitle, setMiniTitle] = useState('');
const [flag, setFlag] = useState(1);
useEffect(() => {
console.log(33, '33');
miniAppSiteTree({
userMode: 'admin',
select: '',
......@@ -26,6 +28,13 @@ const MobileConfigPage = props => {
console.log(res);
});
}, [flag]);
useEffect(() => {
getMiniAppModuleTree({
userMode: 'super',
}).then(res => {
console.log(res);
});
}, []);
// 修改选中的tab
const handleChange = key => {
setActiveKey(key);
......
......@@ -15,7 +15,8 @@ import PageContainer from '@/components/BasePageContainer';
import {
DoubleLeftOutlined,
DoubleRightOutlined,
UnorderedListOutlined,
TeamOutlined,
UserOutlined,
} from '@ant-design/icons';
import {
setMenuToRole,
......@@ -69,6 +70,7 @@ const SiteManage = () => {
if (id) {
setSaveTreeId(id);
setRoleID(id);
setValueList([...valueList]);
} else {
setRoleID(saveTreeId);
}
......@@ -197,18 +199,20 @@ const SiteManage = () => {
let arr3 = arr2.map(item => {
item.title = item.visibleTitle || '';
item.key = item.visibleValue || '';
item.icon = <TeamOutlined />;
if (item.roleList && item.roleList.length > 0) {
item.roleList.map((itemRole, index) => {
if (itemRole.roleList) {
itemRole.title = itemRole.visibleTitle || '';
itemRole.key = itemRole.visibleTitle + itemRole.visibleValue || '';
itemRole.groupflag = itemRole.visibleTitle;
// itemRole.icon = mulu ? <UnorderedListOutlined /> : '';
itemRole.icon = <TeamOutlined />;
itemRole.roleList.map(i => {
i.title = i.roleName;
i.key = i.roleID;
i.subSystemValue = item.visibleValue;
i.group = itemRole.visibleTitle;
i.icon = <UserOutlined />;
if (roleID && roleID === i.roleID) {
setItemObj(i);
}
......@@ -219,6 +223,7 @@ const SiteManage = () => {
itemRole.title = itemRole.roleName;
itemRole.key = itemRole.roleID;
itemRole.subSystemValue = item.visibleValue;
itemRole.icon = <UserOutlined />;
if (roleID && roleID === itemRole.roleID) {
setItemObj(itemRole);
}
......@@ -271,12 +276,12 @@ const SiteManage = () => {
const handleHide = () => {
setMulu(!mulu);
};
const handleCommit = rusults => {
const handleCommit = results => {
setBtnLoading(true);
setMenuToRole(
qs.stringify({
roleID,
menuNameList: String(rusults.flat()),
menuNameList: String(results.flat()),
}),
{
headers: {
......@@ -287,6 +292,7 @@ const SiteManage = () => {
.then(res => {
setBtnLoading(false);
if (res.success) {
setValueList([...results.flat()]);
notification.success({
message: '提示',
duration: 3,
......@@ -320,7 +326,7 @@ const SiteManage = () => {
</div>
{treeData && treeData.length > 0 && (
<Tree
showLine={{ showLeafIcon: false }}
// showLine={{ showLeafIcon: false }}
showIcon
onSelect={handleTreeSelect}
autoExpandParent
......
......@@ -2,7 +2,15 @@
min-height: calc(100vh - 74px);
max-height: calc(100vh - 74px);
overflow-y: scroll;
margin-right: 10px;
margin-right: 20px;
.ant-tree-node-content-wrapper{
display: flex;
align-items: center;
.ant-tree-iconEle{
display: flex;
align-items: center;
}
}
}
.ant-tree-node-content-wrapper-open{
display: flex;
......
import { get, post } from '@/services/index';
import { get, post, PUBLISH_SERVICE } from '@/services/index';
import qs from 'qs';
/**
......@@ -40,4 +40,9 @@ export const editWebsite = (params, options) => {
/**
* @获取菜单配置
* {
* userMode:''
* } 必填 super 或 admin 或common
*/
export const getMiniAppModuleTree = params =>
get(`${PUBLISH_SERVICE}/PlatformCenter/MiniAppModuleTree`, params);
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