فهرست منبع

Merge pull request #610 from jetlinks/next-wzy

feat: 应用管理集成
孙超 3 سال پیش
والد
کامیت
97a5fc1649

+ 3 - 3
src/app.tsx

@@ -376,10 +376,10 @@ export function render(oldRender: any) {
       if (res && res.status === 200) {
         if (isDev) {
           res.result.push({
-            code: 'demo',
-            id: 'demo',
+            code: 'iframe',
+            id: 'iframe',
             name: '例子',
-            url: '/demo',
+            url: '/iframe',
           });
         }
         extraRoutes = handleRoutes([...res.result, ...extraRouteArr]);

+ 1 - 1
src/components/RightContent/index.tsx

@@ -57,7 +57,7 @@ const GlobalHeaderRight: React.FC = () => {
       <span
         className={styles.action}
         onClick={() => {
-          window.open('http://doc.jetlinks.cn');
+          window.open('http://doc.v2.jetlinks.cn');
         }}
       >
         <QuestionCircleOutlined />

+ 14 - 0
src/pages/iframe/index.tsx

@@ -0,0 +1,14 @@
+import { PageContainer } from '@ant-design/pro-layout';
+
+const Iframe = () => {
+  return (
+    <PageContainer>
+      <iframe
+        style={{ width: '100%', height: '800px' }}
+        src={'http://47.108.170.157:9010/#/login'}
+        frameBorder="0"
+      ></iframe>
+    </PageContainer>
+  );
+};
+export default Iframe;

+ 9 - 3
src/pages/system/Apply/Save/index.tsx

@@ -27,10 +27,12 @@ import { PlusOutlined } from '@ant-design/icons';
 import { action } from '@formily/reactive';
 import type { Response } from '@/utils/typings';
 import usePermissions from '@/hooks/permission';
-import { useLocation } from '@/hooks';
+import { useHistory, useLocation } from '@/hooks';
+import { getMenuPathByCode } from '@/utils/menu';
 
 const Save = () => {
   const location = useLocation();
+  const history = useHistory();
   const { permission: rolePermission } = usePermissions('system/Role');
   const { permission: deptPermission } = usePermissions('system/Department');
   const { permission } = PermissionButton.usePermission('system/Apply');
@@ -217,14 +219,18 @@ const Save = () => {
       const resp: any = await service.modify(id, data);
       if (resp.status === 200) {
         onlyMessage('保存成功');
+        const url = getMenuPathByCode('system/Apply');
+        history.push(url);
       }
     } else {
       const res: any = await service.save(data);
       if (res.status === 200) {
         onlyMessage('保存成功');
+        const url = getMenuPathByCode('system/Apply');
+        history.push(url);
       }
     }
-    console.log(data);
+    // console.log(data);
   };
 
   //单点登录
@@ -755,7 +761,7 @@ const Save = () => {
                 },
               },
             },
-            oAuth2: {
+            oauth2: {
               type: 'object',
               'x-reactions': {
                 dependencies: ['.type'],

+ 22 - 0
src/pages/system/Menu/Setting/baseMenu.ts

@@ -968,6 +968,28 @@ export default [
                 permissions: [{ permission: 'rule-scene', actions: ['query', 'delete'] }],
               },
               {
+                id: 'tigger',
+                name: '手动触发',
+                description: null,
+                permissions: [
+                  {
+                    permission: 'rule-scene',
+                    actions: ['execute'],
+                  },
+                ],
+              },
+              {
+                id: 'view',
+                name: '查看',
+                description: null,
+                permissions: [
+                  {
+                    permission: 'rule-scene',
+                    actions: ['query'],
+                  },
+                ],
+              },
+              {
                 id: 'action',
                 name: '启用/禁用',
                 permissions: [{ permission: 'rule-scene', actions: ['query', 'save', 'execute'] }],

+ 32 - 1
src/pages/system/Menu/index.tsx

@@ -41,7 +41,7 @@ export default observer(() => {
   const actionRef = useRef<ActionType>();
   const intl = useIntl();
   const { minHeight } = useDomFullHeight(`.menu`, 24);
-  const [param, setParam] = useState({});
+  const [param, setParam] = useState<any>({});
   const history = useHistory();
   const { permission } = PermissionButton.usePermission('system/Menu');
 
@@ -265,8 +265,39 @@ export default observer(() => {
         search={false}
         params={param}
         request={async (params) => {
+          console.log(params);
           const response = await service.queryMenuThree({
             ...params,
+            // terms: [
+            //   ...param?.terms,
+            //   {
+            //     "terms": [
+            //       {
+            //         "terms": [
+            //           {
+            //             "column": "owner",
+            //             "termType": "eq",
+            //             "value": "iot"
+            //           }
+            //         ]
+            //       },
+            //       {
+            //         "terms": [
+            //           {
+            //             "column": "owner",
+            //             "termType": "notnull"
+            //           },
+            //           {
+            //             "column": "appId",
+            //             "termType": "notnull",
+            //             "type": "and"
+            //           }
+            //         ],
+            //         "type": "or"
+            //       }
+            //     ]
+            //   },
+            // ],
             sorts: [{ name: 'sortIndex', order: 'asc' }],
             paging: false,
           });

+ 7 - 1
src/pages/user/Login/index.tsx

@@ -26,6 +26,8 @@ const Login: React.FC = () => {
   iconMap.set('dingtalk-ent-app', require('/public/images/bind/dingtalk.png'));
   iconMap.set('wechat-webapp', require('/public/images/bind/wechat-webapp.png'));
 
+  const defaultImg = require('/public/images/apply/provider1.png');
+
   const fetchUserInfo = async () => {
     const userInfo = (await initialState?.fetchUserInfo?.()) as UserInfo;
     if (userInfo) {
@@ -276,7 +278,11 @@ const Login: React.FC = () => {
                             };
                           }}
                         >
-                          <img src={iconMap.get(item.provider)} />
+                          <img
+                            style={{ width: 32, height: 33 }}
+                            alt={item.name}
+                            src={iconMap.get(item.provider) || defaultImg}
+                          />
                         </Button>
                       ))}
                     </div>