wzyyy 3 лет назад
Родитель
Сommit
0b4b186ee0

+ 33 - 6
src/app.tsx

@@ -362,17 +362,44 @@ export function patchRoutes(routes: any) {
 
 export function render(oldRender: any) {
   if (![loginPath, bindPath].includes(history.location.pathname)) {
-    // SystemConfigService.getAMapKey().then((res) => {
-    //   if (res && res.status === 200 && res.result) {
-    //     localStorage.setItem(SystemConst.AMAP_KEY, res.result.apiKey);
-    //   }
-    // });
+    //过滤非集成的菜单
+    const params = [
+      {
+        terms: [
+          {
+            terms: [
+              {
+                column: 'owner',
+                termType: 'eq',
+                value: 'iot',
+              },
+            ],
+          },
+          {
+            terms: [
+              {
+                column: 'owner',
+                termType: 'notnull',
+                value: '1',
+              },
+              {
+                column: 'appId',
+                termType: 'notnull',
+                value: '1',
+                type: 'and',
+              },
+            ],
+            type: 'or',
+          },
+        ],
+      },
+    ];
     Service.settingDetail('api').then((res) => {
       if (res && res.status === 200 && res.result) {
         localStorage.setItem(SystemConst.AMAP_KEY, res.result.api);
       }
     });
-    MenuService.queryOwnThree({ paging: false }).then((res) => {
+    MenuService.queryOwnThree({ paging: false, terms: params }).then((res) => {
       if (res && res.status === 200) {
         if (isDev) {
           res.result.push({

+ 1 - 1
src/pages/account/Center/index.tsx

@@ -293,7 +293,7 @@ const Center = () => {
                         type="primary"
                         onClick={() => {
                           window.open(
-                            `/${SystemConst.API_BASE}/application/sso/${item.id}/login?autoCreateUser=false&redirect=/account/center/bind`,
+                            `/${SystemConst.API_BASE}/application/sso/${item.id}/login?autoCreateUser=false`,
                           );
                           // window.open(`/#/account/center/bind`);
                           localStorage.setItem('onBind', 'false');

+ 24 - 0
src/pages/system/Apply/Save/index.tsx

@@ -120,6 +120,7 @@ const Save = () => {
   };
   const getRole = () => service.queryRoleList();
   const getOrg = () => service.queryOrgList();
+  const getOwner = (data: any) => service.queryOwner(data);
 
   const useAsyncData = (api: any) => (fields: Field) => {
     fields.loading = true;
@@ -1203,6 +1204,28 @@ const Save = () => {
               header: '页面集成',
             },
             properties: {
+              'page.owner': {
+                type: 'string',
+                title: '所属系统',
+                'x-decorator': 'FormItem',
+                'x-decorator-props': {
+                  gridSpan: 2,
+                  layout: 'vertical',
+                  labelAlign: 'left',
+                },
+                required: true,
+                'x-component': 'Select',
+                'x-component-props': {
+                  placeholder: '请输入接入地址',
+                },
+                // 'x-reactions': '{{useAsyncDataSource(getOwner(["iot"]))}}',
+                // 'x-reactions': {
+                //   dependencies: ['configId'],
+                //   fulfill: {
+                //     run: '{{useAsyncDataSource(getAliyunSigns($deps[0]))}}',
+                //   },
+                // },
+              },
               'page.baseUrl': {
                 type: 'string',
                 title: '接入地址',
@@ -1549,6 +1572,7 @@ const Save = () => {
                   getProvidersAll,
                   getRole,
                   getOrg,
+                  getOwner,
                 }}
               />
               <FormButtonGroup.Sticky>

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

@@ -21,6 +21,11 @@ class Service extends BaseService<any> {
       method: 'GET',
       params,
     });
+  queryOwner = (data: any) =>
+    request(`${SystemConst.API_BASE}/menu/owner`, {
+      method: 'POST',
+      data,
+    });
 }
 
 export default Service;

+ 64 - 44
src/pages/system/Menu/index.tsx

@@ -266,51 +266,71 @@ export default observer(() => {
         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,
-          });
-          return {
-            code: response.message,
-            result: {
-              data: response.result,
-              pageIndex: 0,
-              pageSize: 0,
-              total: 0,
-            },
-            status: response.status,
+          //过滤非集成的菜单
+          const item = {
+            terms: [
+              {
+                terms: [
+                  {
+                    column: 'owner',
+                    termType: 'eq',
+                    value: 'iot',
+                  },
+                ],
+              },
+              {
+                terms: [
+                  {
+                    column: 'owner',
+                    termType: 'notnull',
+                    value: '1',
+                  },
+                  {
+                    column: 'appId',
+                    termType: 'notnull',
+                    value: '1',
+                    type: 'and',
+                  },
+                ],
+                type: 'or',
+              },
+            ],
           };
+          if (params.terms && params.length !== 0) {
+            const response = await service.queryMenuThree({
+              ...params,
+              terms: [...param.terms, item],
+              sorts: [{ name: 'sortIndex', order: 'asc' }],
+              paging: false,
+            });
+            return {
+              code: response.message,
+              result: {
+                data: response.result,
+                pageIndex: 0,
+                pageSize: 0,
+                total: 0,
+              },
+              status: response.status,
+            };
+          } else {
+            const response = await service.queryMenuThree({
+              ...params,
+              terms: [item],
+              sorts: [{ name: 'sortIndex', order: 'asc' }],
+              paging: false,
+            });
+            return {
+              code: response.message,
+              result: {
+                data: response.result,
+                pageIndex: 0,
+                pageSize: 0,
+                total: 0,
+              },
+              status: response.status,
+            };
+          }
         }}
         headerTitle={[
           <PermissionButton

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

@@ -269,7 +269,7 @@ const Login: React.FC = () => {
                             localStorage.setItem('onLogin', 'no');
                             //  window.open(`/#/account/center/bind`);
                             window.open(
-                              `/${SystemConst.API_BASE}/application/sso/${item.id}/login?redirect=/account/center/bind`,
+                              `/${SystemConst.API_BASE}/application/sso/${item.id}/login`,
                             );
                             window.onstorage = (e) => {
                               if (e.newValue) {