Bläddra i källkod

Merge pull request #613 from jetlinks/next-wzy

Next wzy
孙超 3 år sedan
förälder
incheckning
3e5d9c520b

+ 14 - 8
src/app.tsx

@@ -373,6 +373,12 @@ export function render(oldRender: any) {
                 termType: 'eq',
                 termType: 'eq',
                 value: 'iot',
                 value: 'iot',
               },
               },
+              {
+                column: 'owner',
+                termType: 'isnull',
+                value: '1',
+                type: 'or',
+              },
             ],
             ],
           },
           },
         ],
         ],
@@ -385,14 +391,14 @@ export function render(oldRender: any) {
     });
     });
     MenuService.queryOwnThree({ paging: false, terms: params }).then((res) => {
     MenuService.queryOwnThree({ paging: false, terms: params }).then((res) => {
       if (res && res.status === 200) {
       if (res && res.status === 200) {
-        if (isDev) {
-          res.result.push({
-            code: 'iframe',
-            id: 'iframe',
-            name: '例子',
-            url: '/iframe',
-          });
-        }
+        // if (isDev) {
+        //   res.result.push({
+        //     code: 'iframe',
+        //     id: 'iframe',
+        //     name: '例子',
+        //     url: '/iframe',
+        //   });
+        // }
         extraRoutes = handleRoutes([...res.result, ...extraRouteArr]);
         extraRoutes = handleRoutes([...res.result, ...extraRouteArr]);
         saveMenusCache(extraRoutes);
         saveMenusCache(extraRoutes);
       }
       }

+ 8 - 0
src/pages/media/Stream/service.ts

@@ -7,6 +7,14 @@ class Service extends BaseService<StreamItem> {
     request(`/${SystemConst.API_BASE}/media/server/providers`, {
     request(`/${SystemConst.API_BASE}/media/server/providers`, {
       method: 'GET',
       method: 'GET',
     });
     });
+  enalbe = (id: string) =>
+    request(`/${SystemConst.API_BASE}/media/server/${id}/_enable`, {
+      method: 'POST',
+    });
+  disable = (id: string) =>
+    request(`/${SystemConst.API_BASE}/media/server/${id}/_disable`, {
+      method: 'POST',
+    });
 }
 }
 
 
 export default Service;
 export default Service;

+ 1 - 1
src/pages/notice/index.tsx

@@ -99,7 +99,7 @@ const Type = observer(() => {
     {
     {
       type: 'webhook',
       type: 'webhook',
       name: 'webhook',
       name: 'webhook',
-      describe: '支持websocket消息通知',
+      describe: '支持Http消息通知',
     },
     },
   ];
   ];
 
 

+ 68 - 23
src/pages/system/Apply/Menu/index.tsx

@@ -1,42 +1,73 @@
-import { Modal, Tree } from 'antd';
+import { onlyMessage } from '@/utils/util';
+import { Modal, Tree, Select } from 'antd';
 import { useEffect, useState } from 'react';
 import { useEffect, useState } from 'react';
 import { service } from '../index';
 import { service } from '../index';
 
 
 interface Props {
 interface Props {
   close: Function;
   close: Function;
-  data: string;
+  data: any;
 }
 }
 
 
 const MenuPage = (props: Props) => {
 const MenuPage = (props: Props) => {
-  const [treeData, setTreeData] = useState<undefined | any[]>(undefined);
+  const { data } = props;
+  const { Option } = Select;
+  const [treeData, setTreeData] = useState<any[]>([]);
   const [keys, setKeys] = useState<any>([]);
   const [keys, setKeys] = useState<any>([]);
   const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
   const [expandedKeys, setExpandedKeys] = useState<string[]>([]);
+  const [half, setHalf] = useState<string[]>([]);
+  // const [owner, setOwner] = useState<string>('iot');
+  const [ownerList, setOwenrList] = useState<any>([]);
+  // const [menu,setMenu] = useState<string>('')
 
 
   const getTree = async () => {
   const getTree = async () => {
     const res = await service.queryOwner(['iot']);
     const res = await service.queryOwner(['iot']);
     if (res.status === 200) {
     if (res.status === 200) {
+      setOwenrList(res.result);
+      console.log(res.result);
+      // if (data.provider !== 'internal-standalone') {
+      //   setOwner(res.result?.[0])
+      // }
       const resp = await service.queryOwnerTree(res.result?.[0]);
       const resp = await service.queryOwnerTree(res.result?.[0]);
       if (resp.status === 200) {
       if (resp.status === 200) {
         setTreeData(resp.result);
         setTreeData(resp.result);
-        // console.log(resp.result)
+        const pid = resp.result.map((item: any) => item.id);
+        setExpandedKeys(pid);
       }
       }
     }
     }
   };
   };
 
 
-  // const filterTree = (tree:any[],parms: any[]) => {
-  //     return tree.filter(item=>{
-  //         console.log(item)
-  //         return parms?.indexOf(item.id) > -1
-  //     }).map(i=>{
-  //         i = Object.assign({},i)
-  //         if(i.children){
-  //             i.children = filterTree(i.children,parms)
-  //         }
-  //         return i
-  //     })
+  // const getMenu = async ()=>{
+  //   const res = await service.queryOwner(['iot']);
+  //   if(res.status === 200){
+  //     setOwenrList(res.result)
+  //   }
   // }
   // }
 
 
+  const save = async (datalist: any) => {
+    const res = await service.saveOwnerTree('iot', data.id, datalist);
+    if (res?.status === 200) {
+      onlyMessage('操作成功');
+    }
+  };
+
+  //过滤节点-默认带上父节点
+  const filterTree = (nodes: any[], list: any[]) => {
+    if (!nodes?.length) {
+      return nodes;
+    }
+    return nodes.filter((it) => {
+      // 不符合条件的直接砍掉
+      if (list.indexOf(it.id) <= -1) {
+        return false;
+      }
+      // 符合条件的保留,并且需要递归处理其子节点
+      it.children = filterTree(it.children, list);
+      return true;
+    });
+  };
+
   useEffect(() => {
   useEffect(() => {
+    // console.log(data);
     getTree();
     getTree();
   }, []);
   }, []);
 
 
@@ -45,31 +76,45 @@ const MenuPage = (props: Props) => {
       visible
       visible
       maskClosable={false}
       maskClosable={false}
       title="集成菜单"
       title="集成菜单"
-      width={800}
+      width={600}
       onCancel={() => {
       onCancel={() => {
         props.close();
         props.close();
       }}
       }}
       onOk={() => {
       onOk={() => {
-        // if(treeData && treeData.length!==0){
-        //     const item = filterTree(treeData,keys.checked)
-        //     console.log(item)
-        // }
-        // console.log(keys)
+        const items = filterTree(treeData, [...keys, ...half]);
+        if (items && items.length !== 0) {
+          save(items);
+        } else {
+          onlyMessage('请勾选配置菜单', 'warning');
+        }
       }}
       }}
     >
     >
+      <Select
+        style={{ width: 200, marginBottom: 20 }}
+        placeholder="请选择集成系统"
+        onChange={(value) => {
+          console.log(value);
+        }}
+      >
+        {ownerList.map((item: any) => (
+          <Option value={item} key={item}>
+            {item}
+          </Option>
+        ))}
+      </Select>
       <Tree
       <Tree
         fieldNames={{
         fieldNames={{
           title: 'name',
           title: 'name',
           key: 'id',
           key: 'id',
         }}
         }}
         checkable
         checkable
-        // checkStrictly={true}
         treeData={treeData}
         treeData={treeData}
         checkedKeys={keys}
         checkedKeys={keys}
         autoExpandParent={true}
         autoExpandParent={true}
-        onCheck={(_keys: any, e) => {
+        onCheck={(_keys: any, e: any) => {
           console.log(e);
           console.log(e);
           setKeys(_keys);
           setKeys(_keys);
+          setHalf(e.halfCheckedKeys);
         }}
         }}
         expandedKeys={expandedKeys}
         expandedKeys={expandedKeys}
         onExpand={(_keys: any[]) => {
         onExpand={(_keys: any[]) => {

+ 2 - 10
src/pages/system/Apply/Save/index.tsx

@@ -68,7 +68,7 @@ const Save = () => {
       value: 'apiServer',
       value: 'apiServer',
     },
     },
     {
     {
-      label: '单点登',
+      label: '单点登',
       value: 'ssoClient',
       value: 'ssoClient',
     },
     },
   ];
   ];
@@ -146,6 +146,7 @@ const Save = () => {
         formInit.setInitialValues({
         formInit.setInitialValues({
           ...resp.result,
           ...resp.result,
           integrationModes,
           integrationModes,
+          'apiServer.appId': id,
         });
         });
       });
       });
       onFieldValueChange('provider', (field, form1) => {
       onFieldValueChange('provider', (field, form1) => {
@@ -206,15 +207,6 @@ const Save = () => {
             state.visible = true;
             state.visible = true;
           });
           });
         });
         });
-        // const array = ['apiClient', 'apiServer'];
-        // const isSome = array.length ===value.length&& array.filter(t=>!value.includes(t))
-        // if(isSome){
-        //   // console.log(isSome,value)
-        //   console.log(11111)
-        //   form2.setFieldState('config.apiServer.appId',(state)=>{
-        //     state.visible=true
-        //   })
-        // }
       });
       });
       onFieldReact('apiClient.authConfig.oauth2.clientId', (filed) => {
       onFieldReact('apiClient.authConfig.oauth2.clientId', (filed) => {
         const parms = filed.query('provider').get('value');
         const parms = filed.query('provider').get('value');

+ 15 - 0
src/pages/system/Apply/service.ts

@@ -31,6 +31,21 @@ class Service extends BaseService<any> {
       method: 'POST',
       method: 'POST',
       data: {},
       data: {},
     });
     });
+  saveOwnerTree = (owner: string, appId: string, data: any) =>
+    request(`${SystemConst.API_BASE}/menu/owner/${owner}/${appId}/_all`, {
+      method: 'PATCH',
+      data,
+    });
+  queryOwnerStandalone = (api: string, data: any) =>
+    request(`${api}/menu/owner`, {
+      method: 'POST',
+      data,
+    });
+  queryOwnerTreeStandalone = (api: string, owner: string) =>
+    request(`${api}/menu/owner/tree/${owner}`, {
+      method: 'POST',
+      data: {},
+    });
 }
 }
 
 
 export default Service;
 export default Service;

+ 141 - 2
src/pages/system/Menu/Setting/baseMenu.ts

@@ -3,6 +3,7 @@ export default [
   {
   {
     code: 'iot',
     code: 'iot',
     name: '物联网',
     name: '物联网',
+    owner: 'iot',
     id: '1',
     id: '1',
     url: '/iot',
     url: '/iot',
     icon: 'icon-wulianwang',
     icon: 'icon-wulianwang',
@@ -17,6 +18,7 @@ export default [
       {
       {
         code: 'home',
         code: 'home',
         name: '首页',
         name: '首页',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-1',
         id: '1-1',
         url: '/iot/home',
         url: '/iot/home',
@@ -31,6 +33,7 @@ export default [
       {
       {
         code: 'notice',
         code: 'notice',
         name: '通知管理',
         name: '通知管理',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-2',
         id: '1-2',
         url: '/iot/notice/Type',
         url: '/iot/notice/Type',
@@ -57,6 +60,7 @@ export default [
       {
       {
         code: 'device',
         code: 'device',
         name: '设备管理',
         name: '设备管理',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-3',
         id: '1-3',
         url: '/iot/device',
         url: '/iot/device',
@@ -67,6 +71,7 @@ export default [
           {
           {
             code: 'device/DashBoard',
             code: 'device/DashBoard',
             name: '仪表盘',
             name: '仪表盘',
+            owner: 'iot',
             parentId: '1-3',
             parentId: '1-3',
             id: '1-3-1',
             id: '1-3-1',
             url: '/iot/device/DashBoard',
             url: '/iot/device/DashBoard',
@@ -82,6 +87,7 @@ export default [
           {
           {
             code: 'device/Product',
             code: 'device/Product',
             name: '产品',
             name: '产品',
+            owner: 'iot',
             parentId: '1-3',
             parentId: '1-3',
             id: '1-3-2',
             id: '1-3-2',
             url: '/iot/device/Product',
             url: '/iot/device/Product',
@@ -157,6 +163,7 @@ export default [
           {
           {
             code: 'device/Instance',
             code: 'device/Instance',
             name: '设备',
             name: '设备',
+            owner: 'iot',
             parentId: '1-3',
             parentId: '1-3',
             id: '1-3-3',
             id: '1-3-3',
             url: '/iot/device/Instance',
             url: '/iot/device/Instance',
@@ -234,6 +241,7 @@ export default [
           {
           {
             code: 'device/Category',
             code: 'device/Category',
             name: '产品分类',
             name: '产品分类',
+            owner: 'iot',
             parentId: '1-3',
             parentId: '1-3',
             id: '1-3-4',
             id: '1-3-4',
             sortIndex: 4,
             sortIndex: 4,
@@ -271,6 +279,7 @@ export default [
       {
       {
         code: 'link',
         code: 'link',
         name: '运维管理',
         name: '运维管理',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-4',
         id: '1-4',
         url: '/iot/link',
         url: '/iot/link',
@@ -693,6 +702,7 @@ export default [
       {
       {
         code: 'rule-engine/Alarm',
         code: 'rule-engine/Alarm',
         name: '告警中心',
         name: '告警中心',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-5',
         id: '1-5',
         sortIndex: 1,
         sortIndex: 1,
@@ -812,6 +822,7 @@ export default [
       {
       {
         code: 'Northbound',
         code: 'Northbound',
         name: '北向输出',
         name: '北向输出',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-6',
         id: '1-6',
         sortIndex: 6,
         sortIndex: 6,
@@ -892,6 +903,7 @@ export default [
       {
       {
         code: 'rule-engine',
         code: 'rule-engine',
         name: '规则引擎',
         name: '规则引擎',
+        owner: 'iot',
         parentId: '1',
         parentId: '1',
         id: '1-7',
         id: '1-7',
         sortIndex: 7,
         sortIndex: 7,
@@ -1015,6 +1027,7 @@ export default [
   {
   {
     code: 'media',
     code: 'media',
     name: '视频中心',
     name: '视频中心',
+    owner: 'iot',
     id: '2',
     id: '2',
     url: '/media',
     url: '/media',
     icon: 'icon-shipinwangguan',
     icon: 'icon-shipinwangguan',
@@ -1027,6 +1040,7 @@ export default [
       {
       {
         code: 'media/Home',
         code: 'media/Home',
         name: '首页',
         name: '首页',
+        owner: 'iot',
         parentId: '2',
         parentId: '2',
         id: '2-1',
         id: '2-1',
         sortIndex: 1,
         sortIndex: 1,
@@ -1038,6 +1052,7 @@ export default [
       {
       {
         code: 'media/DashBoard',
         code: 'media/DashBoard',
         name: '仪表盘',
         name: '仪表盘',
+        owner: 'iot',
         parentId: '2',
         parentId: '2',
         id: '2-2',
         id: '2-2',
         sortIndex: 2,
         sortIndex: 2,
@@ -1049,6 +1064,7 @@ export default [
       {
       {
         code: 'media/Device',
         code: 'media/Device',
         name: '视频设备',
         name: '视频设备',
+        owner: 'iot',
         parentId: '2',
         parentId: '2',
         id: '2-3',
         id: '2-3',
         sortIndex: 3,
         sortIndex: 3,
@@ -1114,6 +1130,7 @@ export default [
       {
       {
         code: 'media/SplitScreen',
         code: 'media/SplitScreen',
         name: '分屏展示',
         name: '分屏展示',
+        owner: 'iot',
         parentId: '2',
         parentId: '2',
         id: '2-4',
         id: '2-4',
         sortIndex: 4,
         sortIndex: 4,
@@ -1137,6 +1154,7 @@ export default [
       {
       {
         code: 'media/Cascade',
         code: 'media/Cascade',
         name: '国标级联',
         name: '国标级联',
+        owner: 'iot',
         parentId: '2',
         parentId: '2',
         id: '2-5',
         id: '2-5',
         sortIndex: 5,
         sortIndex: 5,
@@ -1208,6 +1226,7 @@ export default [
   {
   {
     code: 'system',
     code: 'system',
     name: '系统管理',
     name: '系统管理',
+    owner: 'iot',
     id: '3',
     id: '3',
     url: '/system',
     url: '/system',
     icon: 'icon-xitongguanli1',
     icon: 'icon-xitongguanli1',
@@ -1218,6 +1237,7 @@ export default [
       {
       {
         code: 'system/Basis',
         code: 'system/Basis',
         name: '基础配置',
         name: '基础配置',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-1',
         id: '3-1',
         sortIndex: 1,
         sortIndex: 1,
@@ -1238,6 +1258,7 @@ export default [
       {
       {
         code: 'system/User',
         code: 'system/User',
         name: '用户管理',
         name: '用户管理',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-2',
         id: '3-2',
         sortIndex: 2,
         sortIndex: 2,
@@ -1295,6 +1316,7 @@ export default [
       {
       {
         code: 'system/Department',
         code: 'system/Department',
         name: '部门管理',
         name: '部门管理',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-3',
         id: '3-3',
         sortIndex: 3,
         sortIndex: 3,
@@ -1318,6 +1340,16 @@ export default [
             permissions: [{ permission: 'organization', actions: ['query'] }],
             permissions: [{ permission: 'organization', actions: ['query'] }],
           },
           },
           {
           {
+            id: 'bind',
+            name: '资产编辑',
+            permissions: [{ permission: 'assets-bind', actions: ['permission'] }],
+          },
+          {
+            id: 'bind',
+            name: '资产解绑',
+            permissions: [{ permission: 'assets-bind', actions: ['bind', 'unbind'] }],
+          },
+          {
             id: 'bind-user',
             id: 'bind-user',
             name: '绑定用户',
             name: '绑定用户',
             permissions: [
             permissions: [
@@ -1355,6 +1387,7 @@ export default [
       {
       {
         code: 'system/Role',
         code: 'system/Role',
         name: '角色管理',
         name: '角色管理',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-4',
         id: '3-4',
         sortIndex: 4,
         sortIndex: 4,
@@ -1398,6 +1431,7 @@ export default [
       {
       {
         code: 'system/Menu',
         code: 'system/Menu',
         name: '菜单管理',
         name: '菜单管理',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-5',
         id: '3-5',
         sortIndex: 5,
         sortIndex: 5,
@@ -1451,6 +1485,7 @@ export default [
       {
       {
         code: 'system/Permission',
         code: 'system/Permission',
         name: '权限管理',
         name: '权限管理',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-6',
         id: '3-6',
         sortIndex: 6,
         sortIndex: 6,
@@ -1506,6 +1541,7 @@ export default [
       {
       {
         code: 'system/Platforms',
         code: 'system/Platforms',
         name: '第三方平台',
         name: '第三方平台',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-7',
         id: '3-7',
         sortIndex: 7,
         sortIndex: 7,
@@ -1516,10 +1552,13 @@ export default [
           {
           {
             id: 'empowerment',
             id: 'empowerment',
             name: '赋权',
             name: '赋权',
-            permissions: [{ permission: 'user-third-party-manager', actions: ['save'] }],
+            permissions: [
+              { permission: 'user-third-party-manager', actions: ['save'] },
+              { permission: 'open-api', actions: ['save'] },
+            ],
           },
           },
           {
           {
-            id: 'action',
+            id: 'password',
             name: '重置密码',
             name: '重置密码',
             permissions: [{ permission: 'open-api', actions: ['save'] }],
             permissions: [{ permission: 'open-api', actions: ['save'] }],
           },
           },
@@ -1539,6 +1578,7 @@ export default [
       {
       {
         code: 'system/Relationship',
         code: 'system/Relationship',
         name: '关系配置',
         name: '关系配置',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-8',
         id: '3-8',
         sortIndex: 8,
         sortIndex: 8,
@@ -1567,6 +1607,7 @@ export default [
       {
       {
         code: 'system/DataSource',
         code: 'system/DataSource',
         name: '数据源管理',
         name: '数据源管理',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-9',
         id: '3-9',
         sortIndex: 9,
         sortIndex: 9,
@@ -1604,6 +1645,7 @@ export default [
       {
       {
         code: 'system/Platforms/Setting',
         code: 'system/Platforms/Setting',
         name: 'API配置',
         name: 'API配置',
+        owner: 'iot',
         parentId: '3',
         parentId: '3',
         id: '3-10',
         id: '3-10',
         sortIndex: 10,
         sortIndex: 10,
@@ -1612,6 +1654,103 @@ export default [
         permissions: [{ permission: 'open-api', actions: ['query'] }],
         permissions: [{ permission: 'open-api', actions: ['query'] }],
         buttons: [],
         buttons: [],
       },
       },
+      {
+        code: 'system/Apply',
+        name: '应用管理',
+        owner: 'iot',
+        parentId: '3',
+        id: '3-11',
+        sortIndex: 11,
+        url: '/system/Apply',
+        icon: 'icon-wangguanzishebei',
+        permissions: [],
+        buttons: [
+          {
+            id: 'delete',
+            name: '删除',
+            description: null,
+            permissions: [
+              {
+                permission: 'application',
+                actions: ['delete'],
+              },
+            ],
+            options: null,
+          },
+          {
+            id: 'add',
+            name: '新增',
+            description: null,
+            permissions: [
+              {
+                permission: 'application',
+                actions: ['query', 'save'],
+              },
+            ],
+            options: null,
+          },
+          {
+            id: 'update',
+            name: '编辑',
+            description: null,
+            permissions: [
+              {
+                permission: 'application',
+                actions: ['query', 'save'],
+              },
+            ],
+            options: null,
+          },
+          {
+            id: 'empowerment',
+            name: '赋权',
+            description: null,
+            permissions: [
+              {
+                permission: 'open-api',
+                actions: ['query', 'save', 'delete'],
+              },
+            ],
+            options: null,
+          },
+          {
+            id: 'api',
+            name: '查看api',
+            description: null,
+            permissions: [
+              {
+                permission: 'open-api',
+                actions: ['query', 'save'],
+              },
+            ],
+            options: null,
+          },
+          {
+            id: 'view',
+            name: '查看',
+            description: null,
+            permissions: [
+              {
+                permission: 'application',
+                actions: ['query'],
+              },
+            ],
+            options: null,
+          },
+          {
+            id: 'action',
+            name: '启/禁用',
+            description: null,
+            permissions: [
+              {
+                permission: 'application',
+                actions: ['save'],
+              },
+            ],
+            options: null,
+          },
+        ],
+      },
     ],
     ],
   },
   },
 ];
 ];

+ 6 - 0
src/pages/system/Menu/Setting/index.tsx

@@ -161,6 +161,12 @@ export default observer(() => {
                 termType: 'eq',
                 termType: 'eq',
                 value: 'iot',
                 value: 'iot',
               },
               },
+              {
+                column: 'owner',
+                termType: 'isnull',
+                value: '1',
+                type: 'or',
+              },
             ],
             ],
           },
           },
         ],
         ],

+ 6 - 0
src/pages/system/Menu/index.tsx

@@ -276,6 +276,12 @@ export default observer(() => {
                     termType: 'eq',
                     termType: 'eq',
                     value: 'iot',
                     value: 'iot',
                   },
                   },
+                  {
+                    column: 'owner',
+                    termType: 'isnull',
+                    value: '1',
+                    type: 'or',
+                  },
                 ],
                 ],
               },
               },
             ],
             ],

+ 1 - 0
src/pages/system/Menu/typing.d.ts

@@ -60,6 +60,7 @@ export type MenuItem = {
   redirect?: string;
   redirect?: string;
   children?: MenuItem[];
   children?: MenuItem[];
   accessSupport?: { text: string; value: string };
   accessSupport?: { text: string; value: string };
+  appId?: string; //应用id
 };
 };
 
 
 /**
 /**

+ 19 - 9
src/utils/menu/index.ts

@@ -225,16 +225,27 @@ export const handleRoutes = (routes?: MenuItem[], level = 1): MenuItem[] => {
  * @param level 路由层级
  * @param level 路由层级
  */
  */
 const getRoutes = (extraRoutes: MenuItem[], level = 1): IRouteProps[] => {
 const getRoutes = (extraRoutes: MenuItem[], level = 1): IRouteProps[] => {
-  // console.log(extraRoutes, 1111111111);
   const allComponents = findComponents(require.context('@/pages', true, /index(\.tsx)$/));
   const allComponents = findComponents(require.context('@/pages', true, /index(\.tsx)$/));
   return extraRoutes.map((route) => {
   return extraRoutes.map((route) => {
-    const component = allComponents[route.code] || null;
-    const _route: IRouteProps = {
-      key: route.url,
-      name: route.name,
-      path: route.url,
-    };
+    let component;
+    let _route: IRouteProps;
+    if (route.appId) {
+      component = allComponents['iframe'];
+      _route = {
+        key: `${route.url}`,
+        name: route.name,
+        path: `${route.url}`,
+      };
+    } else {
+      component = allComponents[route.code] || null;
+      _route = {
+        key: route.url,
+        name: route.name,
+        path: route.url,
+      };
+    }
 
 
+    // console.log(_route)
     if (route.children && route.children.length) {
     if (route.children && route.children.length) {
       const flatRoutes = getRoutes(flatRoute(route.children || []), level + 1);
       const flatRoutes = getRoutes(flatRoute(route.children || []), level + 1);
       const redirect = flatRoutes.filter((r) => r.component)[0]?.path;
       const redirect = flatRoutes.filter((r) => r.component)[0]?.path;
@@ -250,13 +261,12 @@ const getRoutes = (extraRoutes: MenuItem[], level = 1): IRouteProps[] => {
         : flatRoutes;
         : flatRoutes;
     } else if (component) {
     } else if (component) {
       _route.component = component;
       _route.component = component;
-      // console.log(component)
     }
     }
 
 
     if (level !== 1) {
     if (level !== 1) {
       _route.exact = true;
       _route.exact = true;
     }
     }
-
+    // console.log(_route);
     return _route;
     return _route;
   });
   });
 };
 };