Browse Source

fix: task#1420-1412

wzyyy 3 years atrás
parent
commit
e0c8271168

+ 4 - 4
config/proxy.ts

@@ -15,10 +15,10 @@ export default {
       // target: 'http://120.79.18.123:8844/',
       // ws: 'ws://120.79.18.123:8844/',
       // 测试环境
-      target: 'http://192.168.32.65:8844/',
-      ws: 'ws://192.168.32.65:8844/',
-      // target: 'http://192.168.66.5:8844/',
-      // ws: 'ws://192.168.66.5:8844/',
+      target: 'http://120.77.179.54:8844/',
+      ws: 'ws://120.77.179.54:8844/',
+      // target: 'http://192.168.32.65:8844/',
+      // ws: 'ws://192.168.32.65:8844/',
       //v2环境
       // ws: 'ws://47.109.52.230:8844',
       // target: 'http://47.109.52.230:8844',

+ 37 - 21
src/app.tsx

@@ -198,30 +198,46 @@ export const request: RequestConfig = {
               message: JSON.parse(resp || '{}').message || '服务器内部错误!',
             });
             if (JSON.parse(resp || '{}').code === 'license required') {
-              //判按钮权限
+              //判按钮权限
               let buttons = {};
               const buttonString = localStorage.getItem('MENUS_BUTTONS_CACHE');
               buttons = JSON.parse(buttonString || '{}');
-              // console.log(buttons['system/License'].includes('update'))
-              Modal.error({
-                title: 'License已到期或者错误',
-                content: (
-                  <>
-                    {buttons['system/License'].includes('update') ? (
-                      <a
-                        onClick={() => {
-                          Modal.destroyAll();
-                          window.location.href = '/#/init-license';
-                        }}
-                      >
-                        请更新License
-                      </a>
-                    ) : (
-                      '请联系管理员更新license'
-                    )}
-                  </>
-                ),
-              });
+              //判读是否是退出登录状态
+              if (Object.keys(buttons) && Object.keys(buttons).length !== 0) {
+                Modal.error({
+                  title: 'License已到期或者错误',
+                  content: (
+                    <>
+                      {buttons['system/License']?.includes('update') ? (
+                        <a
+                          onClick={() => {
+                            Modal.destroyAll();
+                            window.location.href = '/#/init-license';
+                          }}
+                        >
+                          请更新License
+                        </a>
+                      ) : (
+                        '请联系管理员更新license'
+                      )}
+                    </>
+                  ),
+                });
+              } else {
+                Modal.error({
+                  title: 'License已到期或者错误',
+                  content: (
+                    <a
+                      onClick={() => {
+                        Modal.destroyAll();
+                        window.location.href = '/#/init-license';
+                      }}
+                    >
+                      请更新License
+                    </a>
+                  ),
+                });
+              }
             }
           } else {
             response

+ 1 - 1
src/pages/init-home/components/menu.tsx

@@ -42,7 +42,7 @@ const Menu = forwardRef((props: { onChange?: (menu: any) => void }, ref) => {
   const getSystemPermissions = async () => {
     const resp = await service.getSystemPermission();
     if (resp.status === 200) {
-      // console.log(resp.result.map((item: any) => JSON.parse(item).id))
+      console.log(resp.result.map((item: any) => JSON.parse(item).id));
       const newTree = filterMenu(
         resp.result.map((item: any) => JSON.parse(item).id),
         BaseMenu,

+ 5 - 1
src/pages/system/Apply/Api/base.tsx

@@ -93,6 +93,10 @@ export default observer((props: ApiPageProps) => {
     getApiGrant();
   }, []);
 
+  useEffect(() => {
+    console.log(ApiModel.data);
+  }, [ApiModel.data]);
+
   return (
     <div className={'platforms-api'} style={{ minHeight }}>
       <div className={'platforms-api-tree'}>
@@ -111,7 +115,7 @@ export default observer((props: ApiPageProps) => {
       </div>
       {ApiModel.showTable ? (
         <>
-          {ApiModel.data ? (
+          {ApiModel.data && ApiModel.data.length !== 0 ? (
             <Table
               data={ApiModel.data}
               operations={operations}

+ 68 - 12
src/pages/system/Apply/Save/index.tsx

@@ -94,6 +94,29 @@ const Save = () => {
     );
   };
 
+  const providerList = [
+    {
+      label: createImageLabel(providerType.get('internal-standalone'), '内部独立应用'),
+      value: 'internal-standalone',
+    },
+    {
+      label: createImageLabel(providerType.get('internal-integrated'), '内部集成应用'),
+      value: 'internal-integrated',
+    },
+    {
+      label: createImageLabel(providerType.get('wechat-webapp'), '微信网站应用'),
+      value: 'wechat-webapp',
+    },
+    {
+      label: createImageLabel(providerType.get('dingtalk-ent-app'), '钉钉企业内部应用'),
+      value: 'dingtalk-ent-app',
+    },
+    {
+      label: createImageLabel(providerType.get('third-party'), '第三方应用'),
+      value: 'third-party',
+    },
+  ];
+
   const SchemaField = createSchemaField({
     components: {
       FormItem,
@@ -111,16 +134,16 @@ const Save = () => {
     },
   });
 
-  const getProvidersAll = () => {
-    return service.getProvidersAll().then((res) => {
-      if (res.status === 200) {
-        return res.result.map((item: any) => ({
-          label: createImageLabel(providerType.get(item.provider), item.name),
-          value: item.provider,
-        }));
-      }
-    });
-  };
+  // const getProvidersAll = () => {
+  //   return service.getProvidersAll().then((res) => {
+  //     if (res.status === 200) {
+  //       return res.result.map((item: any) => ({
+  //         label: createImageLabel(providerType.get(item.provider), item.name),
+  //         value: item.provider,
+  //       }));
+  //     }
+  //   });
+  // };
   const getRole = () => service.queryRoleList();
   const getOrg = () => service.queryOrgList();
 
@@ -293,6 +316,14 @@ const Save = () => {
       'x-component-props': {
         placeholder: '请输入授权地址',
       },
+      'x-reactions': {
+        dependencies: ['integrationModes'],
+        fulfill: {
+          state: {
+            visible: '{{$deps[0] && !$deps[0].includes("apiClient")}}',
+          },
+        },
+      },
     },
     'sso.configuration.oAuth2.redirectUri': {
       type: 'string',
@@ -308,6 +339,14 @@ const Save = () => {
       'x-component-props': {
         placeholder: '请输入回调地址',
       },
+      'x-reactions': {
+        dependencies: ['integrationModes'],
+        fulfill: {
+          state: {
+            visible: '{{$deps[0] && !$deps[0].includes("apiClient")}}',
+          },
+        },
+      },
     },
     'sso.configuration.oAuth2.clientId': {
       type: 'string',
@@ -323,6 +362,14 @@ const Save = () => {
       'x-component-props': {
         placeholder: '请输入appId',
       },
+      'x-reactions': {
+        dependencies: ['integrationModes'],
+        fulfill: {
+          state: {
+            visible: '{{$deps[0] && !$deps[0].includes("apiClient")}}',
+          },
+        },
+      },
     },
     'sso.configuration.oAuth2.clientSecret': {
       type: 'string',
@@ -338,6 +385,14 @@ const Save = () => {
       'x-component-props': {
         placeholder: '请输入appKey',
       },
+      'x-reactions': {
+        dependencies: ['integrationModes'],
+        fulfill: {
+          state: {
+            visible: '{{$deps[0] && !$deps[0].includes("apiClient")}}',
+          },
+        },
+      },
     },
     'sso.autoCreateUser': {
       type: 'string',
@@ -931,11 +986,12 @@ const Save = () => {
           placeholder: '请选择应用',
         },
         required: true,
-        'x-reactions': '{{useAsyncDataSource(getProvidersAll)}}',
+        // 'x-reactions': '{{useAsyncDataSource(getProvidersAll)}}',
         'x-decorator-props': {
           gridSpan: 1,
         },
         default: 'internal-standalone',
+        enum: providerList,
         'x-validator': [
           {
             required: true,
@@ -1678,7 +1734,7 @@ const Save = () => {
                   formCollapse,
                   useAsyncDataSource,
                   useAsyncData,
-                  getProvidersAll,
+                  // getProvidersAll,
                   getRole,
                   getOrg,
                 }}

+ 1 - 1
src/pages/system/Apply/service.ts

@@ -42,7 +42,7 @@ class Service extends BaseService<any> {
       data,
     });
   queryOwnerTreeStandalone = (appId: string, owner: string) =>
-    request(`{/${SystemConst.API_BASE}/application/${appId}/_/api/menu/owner/${owner}`, {
+    request(`{/${SystemConst.API_BASE}/application/${appId}/_/api/menu/owner/tree/${owner}`, {
       method: 'POST',
       data: {},
     });

+ 4 - 3
src/pages/system/License/index.tsx

@@ -12,7 +12,7 @@ import Service from './service';
 const License = () => {
     const { minHeight } = useDomFullHeight(`.license`);
     const service = new Service('license');
-    const [info, setInfo] = useState<any>([])
+    const [info, setInfo] = useState<any>()
     const [license, setLicens] = useState<any>()
     const [value, setValue] = useState<any>()
     const { permission: userPermission } = usePermissions('system/License');
@@ -51,10 +51,11 @@ const License = () => {
                 <TitleComponent data={'基础信息'} />
                 <div >
                     <Descriptions bordered column={4}>
-                        {info.map((item: any) => (
+                        <Descriptions.Item label="Host" span={4}>{info?.host}</Descriptions.Item>
+                        {info?.modules.map((item: any) => (
                             <>
                                 <Descriptions.Item label="IP" span={2}>{item.ip}</Descriptions.Item>
-                                <Descriptions.Item label="mac" span={2}>{item.mac}</Descriptions.Item>
+                                <Descriptions.Item label="Mac" span={2}>{item.mac}</Descriptions.Item>
                             </>)
                         )}
                     </Descriptions>

+ 46 - 45
src/pages/system/License/init/index.tsx

@@ -10,7 +10,7 @@ import Service from '../service';
 const Init = () => {
     const { minHeight } = useDomFullHeight(`.license`);
     const service = new Service('license');
-    const [info, setInfo] = useState<any>([])
+    const [info, setInfo] = useState<any>()
     const [value, setValue] = useState<any>()
 
     const getInfo = async () => {
@@ -27,9 +27,9 @@ const Init = () => {
             const resp = await service.initPage()
             if (resp.status === 200 && !resp.result.length) {
                 window.location.href = '/#/init-home';
-              }else{
-                window.location.href='/'
-              }
+            } else {
+                window.location.href = '/'
+            }
         }
     }
 
@@ -39,49 +39,50 @@ const Init = () => {
     }, [])
 
     return (
-            <Card className="license" style={{ minHeight }}>
-                <TitleComponent data={'基础信息'} />
-                <div >
-                    <Descriptions bordered column={4}>
-                        {info.map((item: any) => (
-                            <>
-                                <Descriptions.Item label="IP" span={2}>{item.ip}</Descriptions.Item>
-                                <Descriptions.Item label="mac" span={2}>{item.mac}</Descriptions.Item>
-                            </>)
-                        )}
-                    </Descriptions>
+        <Card className="license" style={{ minHeight }}>
+            <TitleComponent data={'基础信息'} />
+            <div >
+                <Descriptions bordered column={4}>
+                    <Descriptions.Item label="Host" span={4}>{info?.host}</Descriptions.Item>
+                    {info?.modules.map((item: any) => (
+                        <>
+                            <Descriptions.Item label="IP" span={2}>{item.ip}</Descriptions.Item>
+                            <Descriptions.Item label="Mac" span={2}>{item.mac}</Descriptions.Item>
+                        </>)
+                    )}
+                </Descriptions>
 
-                </div>
-                <div style={{ display: 'flex', marginTop: 10, alignItems: 'center' }}>
-                    <TitleComponent data={'License'} style={{ marginTop: 10 }} />
-                </div>
+            </div>
+            <div style={{ display: 'flex', marginTop: 10, alignItems: 'center' }}>
+                <TitleComponent data={'License'} style={{ marginTop: 10 }} />
+            </div>
 
-                <Input.TextArea
-                    placeholder="请输入License"
-                    rows={10}
-                    // style={{ width: 900 }}
-                    value={value}
-                    onChange={(e) => {
-                        setValue(e.target.value)
-                    }}
-                />
-                <PermissionButton
-                    type="primary"
-                    key="save"
-                    style={{ marginTop: 20 }}
-                    onClick={() => {
-                        // save();
-                        if (value) {
-                            save(value)
-                        } else {
-                            onlyMessage('请配置License', 'warning')
-                        }
-                    }}
-                    isPermission={true}
-                >
-                    保存
-                </PermissionButton>
-            </Card>
+            <Input.TextArea
+                placeholder="请输入License"
+                rows={10}
+                // style={{ width: 900 }}
+                value={value}
+                onChange={(e) => {
+                    setValue(e.target.value)
+                }}
+            />
+            <PermissionButton
+                type="primary"
+                key="save"
+                style={{ marginTop: 20 }}
+                onClick={() => {
+                    // save();
+                    if (value) {
+                        save(value)
+                    } else {
+                        onlyMessage('请配置License', 'warning')
+                    }
+                }}
+                isPermission={true}
+            >
+                保存
+            </PermissionButton>
+        </Card>
     )
 }
 export default Init;

+ 59 - 43
src/pages/system/Menu/Setting/baseMenu.ts

@@ -1350,7 +1350,7 @@ export default [
             permissions: [{ permission: 'organization', actions: ['query'] }],
           },
           {
-            id: 'bind',
+            id: 'edit',
             name: '资产编辑',
             permissions: [{ permission: 'assets-bind', actions: ['permission'] }],
           },
@@ -1548,43 +1548,43 @@ export default [
           },
         ],
       },
-      {
-        code: 'system/Platforms',
-        name: '第三方平台',
-        owner: 'iot',
-        parentId: '3',
-        id: '3-7',
-        sortIndex: 7,
-        url: '/system/platforms',
-        icon: 'icon-xitongguanli1',
-        permissions: [{ permission: 'open-api', actions: ['query', 'save', 'delete'] }],
-        buttons: [
-          {
-            id: 'empowerment',
-            name: '赋权',
-            permissions: [
-              { permission: 'user-third-party-manager', actions: ['save'] },
-              { permission: 'open-api', actions: ['save'] },
-            ],
-          },
-          {
-            id: 'password',
-            name: '重置密码',
-            permissions: [{ permission: 'open-api', actions: ['save'] }],
-          },
-          {
-            id: 'delete',
-            name: '删除',
-            permissions: [{ permission: 'open-api', actions: ['delete'] }],
-          },
-          {
-            id: 'update',
-            name: '编辑',
-            permissions: [{ permission: 'open-api', actions: ['save'] }],
-          },
-          { id: 'add', name: '新增', permissions: [{ permission: 'open-api', actions: ['save'] }] },
-        ],
-      },
+      // {
+      //   code: 'system/Platforms',
+      //   name: '第三方平台',
+      //   owner: 'iot',
+      //   parentId: '3',
+      //   id: '3-7',
+      //   sortIndex: 7,
+      //   url: '/system/platforms',
+      //   icon: 'icon-xitongguanli1',
+      //   permissions: [{ permission: 'open-api', actions: ['query', 'save', 'delete'] }],
+      //   buttons: [
+      //     {
+      //       id: 'empowerment',
+      //       name: '赋权',
+      //       permissions: [
+      //         { permission: 'user-third-party-manager', actions: ['save'] },
+      //         { permission: 'open-api', actions: ['save'] },
+      //       ],
+      //     },
+      //     {
+      //       id: 'password',
+      //       name: '重置密码',
+      //       permissions: [{ permission: 'open-api', actions: ['save'] }],
+      //     },
+      //     {
+      //       id: 'delete',
+      //       name: '删除',
+      //       permissions: [{ permission: 'open-api', actions: ['delete'] }],
+      //     },
+      //     {
+      //       id: 'update',
+      //       name: '编辑',
+      //       permissions: [{ permission: 'open-api', actions: ['save'] }],
+      //     },
+      //     { id: 'add', name: '新增', permissions: [{ permission: 'open-api', actions: ['save'] }] },
+      //   ],
+      // },
       {
         code: 'system/Relationship',
         name: '关系配置',
@@ -1623,7 +1623,9 @@ export default [
         sortIndex: 9,
         url: '/system/DataSource',
         icon: 'icon-shebei',
-        permissions: [],
+        permissions: [
+          { permission: 'datasource-config', actions: ['query', 'save', 'rdb-ddl', 'delete'] },
+        ],
         buttons: [
           {
             id: 'manage',
@@ -1673,7 +1675,16 @@ export default [
         sortIndex: 11,
         url: '/system/Apply',
         icon: 'icon-wangguanzishebei',
-        permissions: [],
+        permissions: [
+          {
+            permission: 'application',
+            actions: ['query', 'save', 'delete'],
+          },
+          {
+            permission: 'open-api',
+            actions: ['query', 'save', 'delete'],
+          },
+        ],
         buttons: [
           {
             id: 'delete',
@@ -1766,11 +1777,16 @@ export default [
         name: 'License管理',
         owner: 'iot',
         parentId: '3',
-        id: '3-11',
-        sortIndex: 11,
+        id: '3-12',
+        sortIndex: 12,
         url: '/system/License',
         icon: 'icon-zidingyiguize',
-        permissions: [],
+        permissions: [
+          {
+            permission: 'license',
+            actions: ['query', 'save'],
+          },
+        ],
         buttons: [
           {
             id: 'update',