@yeeyoon/library 3.0.6 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,14 +6,13 @@ import { Menu, Dropdown, Tooltip, Avatar, Drawer, Modal, Divider } from 'antd';
6
6
  import {
7
7
  UserOutlined,
8
8
  SettingOutlined,
9
- UsergroupAddOutlined,
10
9
  PoweroffOutlined,
11
10
  } from '@ant-design/icons';
12
11
  // import Notification from '../Notification/recent';
13
12
  import ProductListMenu from './components/ProductListMenu/';
14
13
  import PlatformModal from './components/PlatformModal/';
15
14
 
16
- import { IconTodo, IconConsole, IconMore } from '../Icons/';
15
+ import { IconTodo, IconConsole, IconMore, IconQunZuGuanLi } from '../Icons/';
17
16
 
18
17
  import {
19
18
  fetchSystemToken,
@@ -68,8 +67,9 @@ const Header = (props) => {
68
67
  const [systemUserInfo, setSystemUserInfo] = useState(null);
69
68
  const [tenants, setTenants] = useState([]);
70
69
  const [userId, setUserId] = useState([]);
71
- const [productListMenuDrawerShow, setProductListMenuDrawerShow] =
72
- useState(false);
70
+ const [productListMenuDrawerShow, setProductListMenuDrawerShow] = useState(
71
+ false
72
+ );
73
73
  const [platformsModalShow, setPlatformsModalShow] = useState(false);
74
74
  const [avatarProps, setAvatarProps] = useState({});
75
75
  const [redirectUrl, setRedirectUrl] = useState('');
@@ -93,7 +93,7 @@ const Header = (props) => {
93
93
  修改密码
94
94
  </Menu.Item>
95
95
  <Menu.Item
96
- icon={<UsergroupAddOutlined />}
96
+ icon={<IconQunZuGuanLi style={{ fontSize: '14px' }} />}
97
97
  onClick={() => {
98
98
  window.location.href = `${HOST_PROFILE_GROUP}?token=${token}`;
99
99
  }}
@@ -4,8 +4,9 @@ import { createFromIconfontCN } from '@ant-design/icons';
4
4
  const Icons = createFromIconfontCN({
5
5
  scriptUrl: [
6
6
  '//at.alicdn.com/t/font_2716486_dpnjwgvqpfn.js',
7
- '//at.alicdn.com/t/font_2832661_kmrn4o901g.js',
7
+ '//at.alicdn.com/t/font_2832661_kmrn4o901g.js', //宜云协同iconfont
8
8
  '//at.alicdn.com/t/font_2832313_vjeg45f5qof.js',
9
+ '//at.alicdn.com/t/font_2965204_9g0wekoduag.js', //租户管理
9
10
  ],
10
11
  });
11
12
 
@@ -30,6 +31,9 @@ const IconWodechanpin = (args) => {
30
31
  const IconTuijianchanpin = (args) => {
31
32
  return <Icons type="icon-icon_tuijianchanpin" {...args} />;
32
33
  };
34
+ const IconQunZuGuanLi = (args) => {
35
+ return <Icons type="icon-qunzuguanli" {...args} />;
36
+ };
33
37
 
34
38
  export {
35
39
  IconBell,
@@ -39,4 +43,5 @@ export {
39
43
  IconCircle,
40
44
  IconWodechanpin,
41
45
  IconTuijianchanpin,
46
+ IconQunZuGuanLi,
42
47
  };
@@ -7,7 +7,7 @@ import { fetchUserInfo } from './service';
7
7
  const { Option } = Select;
8
8
 
9
9
  const TenantSelector = (props) => {
10
- const { tenantId, tenantIdChangeCb } = props;
10
+ const { tenantId, tenantIdChangeCb, appId, handleException } = props;
11
11
  const [tenantList, setTenantList] = useState([]);
12
12
  const [currentTenantId, setCurrentTenantId] = useState('');
13
13
 
@@ -17,7 +17,17 @@ const TenantSelector = (props) => {
17
17
  let id;
18
18
  let name;
19
19
  if (success) {
20
- const { tenants } = data;
20
+ let { tenants } = data;
21
+ if (appId) {
22
+ tenants = tenants.filter((item) => {
23
+ const { applications } = item;
24
+ return applications.filter((item) => item.id === appId).length;
25
+ });
26
+ }
27
+ if (!tenants.length) {
28
+ handleException && handleException();
29
+ return;
30
+ }
21
31
  const result = tenants.filter((item) => item.id === tenantId);
22
32
  if (result.length) {
23
33
  id = tenantId;
@@ -28,7 +38,7 @@ const TenantSelector = (props) => {
28
38
  }
29
39
  setTenantList(tenants);
30
40
  setCurrentTenantId(id);
31
- tenantIdChangeCb(id, name, tenants);
41
+ tenantIdChangeCb && tenantIdChangeCb(id, name);
32
42
  }
33
43
  }, []);
34
44
 
@@ -43,9 +53,7 @@ const TenantSelector = (props) => {
43
53
  onChange={(value, option) => {
44
54
  const { children } = option;
45
55
  setCurrentTenantId(value);
46
- if (tenantIdChangeCb) {
47
- tenantIdChangeCb(value, children, tenantList);
48
- }
56
+ tenantIdChangeCb && tenantIdChangeCb(value, children);
49
57
  }}
50
58
  >
51
59
  {tenantList.map((item) => {
@@ -61,7 +69,9 @@ const TenantSelector = (props) => {
61
69
 
62
70
  TenantSelector.propTypes = {
63
71
  tenantId: PropTypes.string,
72
+ appId: PropTypes.string,
64
73
  tenantIdChangeCb: PropTypes.func,
74
+ handleException: PropTypes.func,
65
75
  };
66
76
 
67
77
  export default TenantSelector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -1,7 +1,17 @@
1
1
  import React from 'react';
2
2
  import Header from '../../lib/components/Header/';
3
+ import TenantSelector from '../../lib/components/TenantSelector';
3
4
 
4
5
  // eslint-disable-next-line react/display-name
5
6
  export default function () {
6
- return <Header productName="bpm" slot={<div>nasa</div>} />;
7
+ return (
8
+ <>
9
+ <Header productName="bpm" slot={<div>nasa</div>} />
10
+ <TenantSelector
11
+ tenantId="b7b0e19414927b878814094f33b43543"
12
+ appId="bbe5c8f0063711ecb0c00c42a1ff8370"
13
+ tenantIdChangeCb={() => {}}
14
+ />
15
+ </>
16
+ );
7
17
  }