Ver código fonte

fix: resolve syntax errors

Lind 4 anos atrás
pai
commit
fab6924030

+ 1 - 3
src/app.tsx

@@ -9,12 +9,10 @@ import { BookOutlined, LinkOutlined } from '@ant-design/icons';
 import Service from '@/pages/user/Login/service';
 import Token from '@/utils/token';
 import type { RequestOptionsInit } from 'umi-request';
-import { useIntl } from '@@/plugin-locale/localeExports';
 
 const isDev = process.env.NODE_ENV === 'development';
 const loginPath = '/user/login';
 
-
 /** 获取用户信息比较慢的时候会展示一个 loading */
 export const initialStateConfig = {
   loading: <PageLoading />,
@@ -150,7 +148,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
           <Link to="/umi/plugin/openapi" target="_blank">
             <LinkOutlined />
             <span>OpenAPI 文档</span>
-          {/* <span>
+            {/* <span>
           { intl.formatMessage({
                   id: 'pages.searchTable.new',
                   defaultMessage: '新建',

+ 4 - 3
src/hooks/websocket/useSendWebsocketMessage.ts

@@ -4,10 +4,11 @@ import { Observable } from 'rxjs';
 import Token from '@/utils/token';
 import type { WebsocketPayload } from '@/hooks/websocket/typings';
 import { notification } from 'antd';
+import SystemConst from '@/utils/const';
 
-const url = `${document.location.protocol.replace('http', 'ws')}//${
-  document.location.host
-}/jetlinks/messaging/${Token.get()}?:X_Access_Token=${Token.get()}`;
+const url = `${document.location.protocol.replace('http', 'ws')}//${document.location.host}/${
+  SystemConst.API_BASE
+}/messaging/${Token.get()}?:X_Access_Token=${Token.get()}`;
 
 enum MsgType {
   sub = 'sub',

+ 9 - 9
src/pages/Analysis/index.tsx

@@ -23,9 +23,9 @@ const Analysis = () => {
         <StatisticCard.Group direction={responsive ? 'column' : 'row'}>
           <StatisticCard
             statistic={{
-              title:intl.formatMessage({
-                id:'pages.analysis.cpu',
-                defaultMessage:'CPU使用率',
+              title: intl.formatMessage({
+                id: 'pages.analysis.cpu',
+                defaultMessage: 'CPU使用率',
               }),
             }}
             chart={<CPU />}
@@ -33,9 +33,9 @@ const Analysis = () => {
           <Divider type={responsive ? 'horizontal' : 'vertical'} />
           <StatisticCard
             statistic={{
-              title:intl.formatMessage({
-                id:'pages.analysis.jvm',
-                defaultMessage:'JVM内存',
+              title: intl.formatMessage({
+                id: 'pages.analysis.jvm',
+                defaultMessage: 'JVM内存',
               }),
             }}
             chart={<Jvm />}
@@ -43,9 +43,9 @@ const Analysis = () => {
           <Divider type={responsive ? 'horizontal' : 'vertical'} />
           <StatisticCard
             statistic={{
-              title:intl.formatMessage({
-                id:'pages.analysis.information',
-                defaultMessage:'信息完成度',
+              title: intl.formatMessage({
+                id: 'pages.analysis.information',
+                defaultMessage: '信息完成度',
               }),
               value: 5,
               suffix: '/ 100',

+ 14 - 14
src/pages/device/Command/index.tsx

@@ -16,7 +16,7 @@ const Command = () => {
 
   const columns: ProColumns<CommandItem>[] = [
     {
-      title:  intl.formatMessage({
+      title: intl.formatMessage({
         id: 'pages.device.command.deviceID',
         defaultMessage: '设备ID',
       }),
@@ -36,26 +36,26 @@ const Command = () => {
       }),
       dataIndex: 'messageType',
       filters: [
-        { 
+        {
           text: intl.formatMessage({
             id: 'pages.device.command.instructionType.readAttributes',
             defaultMessage: '读取属性',
           }),
-          value: 'READ_PROPERTY' 
+          value: 'READ_PROPERTY',
         },
-        { 
+        {
           text: intl.formatMessage({
             id: 'pages.device.command.instructionType.setProperties',
             defaultMessage: '设置属性',
           }),
-          value: 'WRITE_PROPERTY' 
+          value: 'WRITE_PROPERTY',
         },
-        { 
+        {
           text: intl.formatMessage({
             id: 'pages.device.command.instructionType.callAttribute',
             defaultMessage: '调用属性',
           }),
-          value: 'INVOKE_FUNCTION' 
+          value: 'INVOKE_FUNCTION',
         },
       ],
     },
@@ -66,26 +66,26 @@ const Command = () => {
       }),
       dataIndex: 'state',
       filters: [
-        { 
+        {
           text: intl.formatMessage({
             id: 'pages.device.command.status.waiting',
             defaultMessage: '等待中',
           }),
-          value: 'wait' 
+          value: 'wait',
         },
-        { 
+        {
           text: intl.formatMessage({
             id: 'pages.device.command.status.failed ',
             defaultMessage: '发送失败',
           }),
-          value: 'sendError' 
+          value: 'sendError',
         },
-        { 
+        {
           text: intl.formatMessage({
             id: 'pages.device.command.status.succeed',
             defaultMessage: '发送成功',
           }),
-          value: 'success' 
+          value: 'success',
         },
       ],
       render: (value: any) => value.text,
@@ -110,7 +110,7 @@ const Command = () => {
     {
       title: intl.formatMessage({
         id: 'pages.data.option',
-          defaultMessage: '操作',
+        defaultMessage: '操作',
       }),
       valueType: 'option',
       align: 'center',

+ 1 - 1
src/pages/device/Firmware/index.tsx

@@ -17,7 +17,7 @@ const Firmware = () => {
 
   const columns: ProColumns<FirmwareItem>[] = [
     {
-      title:  intl.formatMessage({
+      title: intl.formatMessage({
         id: 'pages.device.firmware.name',
         defaultMessage: '固件名称',
       }),

+ 16 - 16
src/pages/device/Product/index.tsx

@@ -38,10 +38,10 @@ const Product = observer(() => {
           toolBarRender={() => {
             return [
               <Button key="3" type="primary">
-                { intl.formatMessage({
+                {intl.formatMessage({
                   id: 'pages.searchTable.new',
                   defaultMessage: '新建',
-                 })}
+                })}
               </Button>,
             ];
           }}
@@ -70,8 +70,8 @@ const Product = observer(() => {
             title: {
               dataIndex: 'name',
               title: intl.formatMessage({
-                id:'pages.device.product.name',
-                defaultMessage:'名称',
+                id: 'pages.device.product.name',
+                defaultMessage: '名称',
               }),
             },
             avatar: {
@@ -207,30 +207,30 @@ const Product = observer(() => {
             },
             state: {
               // 自己扩展的字段,主要用于筛选,不在列表中显示
-             title: intl.formatMessage({
-                id:'pages.device.product.status',
-                defaultMessage:'状态',
+              title: intl.formatMessage({
+                id: 'pages.device.product.status',
+                defaultMessage: '状态',
               }),
               valueType: 'select',
               valueEnum: {
                 all: {
-                   text: intl.formatMessage({
-                    id:'pages.device.product.status.all',
-                    defaultMessage:'状态',
+                  text: intl.formatMessage({
+                    id: 'pages.device.product.status.all',
+                    defaultMessage: '状态',
                   }),
-                    status: 'Default' 
-                  },
+                  status: 'Default',
+                },
                 1: {
                   text: intl.formatMessage({
-                    id:'pages.device.product.status.published',
-                    defaultMessage:'已发布',
+                    id: 'pages.device.product.status.published',
+                    defaultMessage: '已发布',
                   }),
                   status: 'Error',
                 },
                 0: {
                   text: intl.formatMessage({
-                    id:'pages.device.product.status.unpublished',
-                    defaultMessage:'未发布',
+                    id: 'pages.device.product.status.unpublished',
+                    defaultMessage: '未发布',
                   }),
                   status: 'Success',
                 },

+ 16 - 16
src/pages/log/Access/index.tsx

@@ -26,17 +26,17 @@ const Access: React.FC = () => {
       // ellipsis: true
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.access.requestPath',
-        defaultMessage:'请求路径',
+      title: intl.formatMessage({
+        id: 'pages.log.access.requestPath',
+        defaultMessage: '请求路径',
       }),
       dataIndex: 'url',
-       // ellipsis: true,
+      // ellipsis: true,
     },
     {
-       title:intl.formatMessage({
-        id:'pages.log.access.explain',
-        defaultMessage:'说明',
+      title: intl.formatMessage({
+        id: 'pages.log.access.explain',
+        defaultMessage: '说明',
       }),
       dataIndex: 'describe',
       // ellipsis: true,
@@ -45,9 +45,9 @@ const Access: React.FC = () => {
       },
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.access.requestTime',
-        defaultMessage:'请求时间',
+      title: intl.formatMessage({
+        id: 'pages.log.access.requestTime',
+        defaultMessage: '请求时间',
       }),
       dataIndex: 'requestTime',
       sorter: true,
@@ -56,9 +56,9 @@ const Access: React.FC = () => {
       renderText: (text: string) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.access.requestTimeConsuming',
-        defaultMessage:'请求耗时',
+      title: intl.formatMessage({
+        id: 'pages.log.access.requestTimeConsuming',
+        defaultMessage: '请求耗时',
       }),
       // width: 100,
       renderText: (record: AccessLogItem) => (
@@ -66,9 +66,9 @@ const Access: React.FC = () => {
       ),
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.access.requestUser',
-        defaultMessage:'请求用户',
+      title: intl.formatMessage({
+        id: 'pages.log.access.requestUser',
+        defaultMessage: '请求用户',
       }),
       dataIndex: 'context.username',
       render: (text) => <Tag color="geekblue">{text}</Tag>,

+ 18 - 18
src/pages/log/System/index.tsx

@@ -22,51 +22,51 @@ const System = () => {
       width: 48,
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.system.thread',
-        defaultMessage:'线程',
+      title: intl.formatMessage({
+        id: 'pages.log.system.thread',
+        defaultMessage: '线程',
       }),
       dataIndex: 'threadName',
       ellipsis: true,
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.system.name',
-        defaultMessage:'名称',
+      title: intl.formatMessage({
+        id: 'pages.log.system.name',
+        defaultMessage: '名称',
       }),
       dataIndex: 'name',
       ellipsis: true,
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.system.level',
-        defaultMessage:'级别',
+      title: intl.formatMessage({
+        id: 'pages.log.system.level',
+        defaultMessage: '级别',
       }),
       dataIndex: 'level',
       width: 80,
       render: (text) => <Tag color={text === 'ERROR' ? 'red' : 'orange'}>{text}</Tag>,
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.system.logContent',
-        defaultMessage:'日志内容',
+      title: intl.formatMessage({
+        id: 'pages.log.system.logContent',
+        defaultMessage: '日志内容',
       }),
       dataIndex: 'exceptionStack',
       ellipsis: true,
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.system.serviceName',
-        defaultMessage:'服务名',
+      title: intl.formatMessage({
+        id: 'pages.log.system.serviceName',
+        defaultMessage: '服务名',
       }),
       dataIndex: 'context.server',
       width: 150,
       ellipsis: true,
     },
     {
-      title:intl.formatMessage({
-        id:'pages.log.system.creationTime',
-        defaultMessage:'创建时间',
+      title: intl.formatMessage({
+        id: 'pages.log.system.creationTime',
+        defaultMessage: '创建时间',
       }),
       dataIndex: 'createTime',
       width: 200,

+ 29 - 30
src/pages/system/OpenAPI/index.tsx

@@ -30,17 +30,16 @@ const OpenAPI: React.FC = () => {
       dataIndex: 'id',
     },
     {
-      title:intl.formatMessage({
-        id:'pages.system.open-api.Name',
-        defaultMessage:'名称',
+      title: intl.formatMessage({
+        id: 'pages.system.open-api.Name',
+        defaultMessage: '名称',
       }),
       dataIndex: 'Name',
-
     },
     {
-      title:intl.formatMessage({
-        id:'pages.system.open-api.userName',
-        defaultMessage:'用户名',
+      title: intl.formatMessage({
+        id: 'pages.system.open-api.userName',
+        defaultMessage: '用户名',
       }),
       dataIndex: 'username',
     },
@@ -59,23 +58,23 @@ const OpenAPI: React.FC = () => {
       valueEnum: [
         {
           text: intl.formatMessage({
-            id:'pages.searchTable.titleStatus.all',
+            id: 'pages.searchTable.titleStatus.all',
             defaultMessage: '全部',
-          }), 
+          }),
           status: 'Default',
         },
         {
-          text:intl.formatMessage({
-            id:'pages.searchTable.titleStatus.normal',
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.normal',
             defaultMessage: '正常',
-          }), 
+          }),
           status: '1',
         },
         {
-          text:intl.formatMessage({
-            id:'pages.searchTable.titleStatus.disable',
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.disable',
             defaultMessage: '禁用',
-          }), 
+          }),
           status: '0',
         },
       ],
@@ -158,9 +157,9 @@ const OpenAPI: React.FC = () => {
         name: 'oy139sts87c',
         properties: {
           clientName: {
-            title:intl.formatMessage({
-              id:'pages.system.open-api.Name',
-              defaultMessage:'名称',
+            title: intl.formatMessage({
+              id: 'pages.system.open-api.Name',
+              defaultMessage: '名称',
             }),
             type: 'string',
             'x-decorator': 'FormItem',
@@ -217,9 +216,9 @@ const OpenAPI: React.FC = () => {
             name: 'secureKey',
           },
           username: {
-            title:intl.formatMessage({
-              id:'pages.system.open-api.userName',
-              defaultMessage:'用户名',
+            title: intl.formatMessage({
+              id: 'pages.system.open-api.userName',
+              defaultMessage: '用户名',
             }),
             type: 'string',
             'x-decorator': 'FormItem',
@@ -236,9 +235,9 @@ const OpenAPI: React.FC = () => {
             name: 'username',
           },
           password: {
-            title:intl.formatMessage({
-              id:'pages.system.open-api.passWord',
-              defaultMessage:'密码',
+            title: intl.formatMessage({
+              id: 'pages.system.open-api.passWord',
+              defaultMessage: '密码',
             }),
             type: 'string',
             'x-decorator': 'FormItem',
@@ -288,9 +287,9 @@ const OpenAPI: React.FC = () => {
         },
       },
       ipWhiteList: {
-        title:intl.formatMessage({
-          id:'pages.system.open-api.ipWhileList',
-          defaultMessage:'IP白名单',
+        title: intl.formatMessage({
+          id: 'pages.system.open-api.ipWhileList',
+          defaultMessage: 'IP白名单',
         }),
         type: 'string',
         'x-decorator': 'FormItem',
@@ -305,9 +304,9 @@ const OpenAPI: React.FC = () => {
         'x-index': 1,
       },
       description: {
-        title:intl.formatMessage({
-          id:'pages.system.open-api.describe',
-          defaultMessage:'描述',
+        title: intl.formatMessage({
+          id: 'pages.system.open-api.describe',
+          defaultMessage: '描述',
         }),
         type: 'string',
         'x-decorator': 'FormItem',

+ 3 - 3
src/pages/system/Org/index.tsx

@@ -60,8 +60,8 @@ const Org = observer(() => {
     obs.data = {
       id: null,
       name: intl.formatMessage({
-        id:'pages.system.org',
-        defaultMessage:'机构管理',
+        id: 'pages.system.org',
+        defaultMessage: '机构管理',
       }),
       title: '组织架构',
       children: response.result,
@@ -155,4 +155,4 @@ const Org = observer(() => {
   );
 });
 
-export default Org;
+export default Org;

+ 33 - 33
src/pages/system/Permission/index.tsx

@@ -66,7 +66,7 @@ const Permission: React.FC = () => {
       copyable: true,
       ellipsis: true,
       align: 'center',
-      tip:intl.formatMessage({
+      tip: intl.formatMessage({
         id: 'pages.system.permission.name.tip',
         defaultMessage: '名称过长会自动收缩',
       }),
@@ -95,23 +95,23 @@ const Permission: React.FC = () => {
       valueEnum: {
         all: {
           text: intl.formatMessage({
-            id:'pages.searchTable.titleStatus.all',
+            id: 'pages.searchTable.titleStatus.all',
             defaultMessage: '全部',
-          }), 
-           status: 'Default' 
-          },
+          }),
+          status: 'Default',
+        },
         1: {
-          text:intl.formatMessage({
-            id:'pages.searchTable.titleStatus.normal',
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.normal',
             defaultMessage: '正常',
-          }), 
+          }),
           status: 1,
         },
         0: {
-          text:intl.formatMessage({
-            id:'pages.searchTable.titleStatus.disable',
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.disable',
             defaultMessage: '禁用',
-          }), 
+          }),
           status: 0,
         },
       },
@@ -271,8 +271,8 @@ const Permission: React.FC = () => {
                     column3: {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
-                      'x-component-props': { 
-                        width: 200, 
+                      'x-component-props': {
+                        width: 200,
                         title: intl.formatMessage({
                           id: 'pages.system.permission.operationConfiguration.type',
                           defaultMessage: '操作类型',
@@ -289,9 +289,9 @@ const Permission: React.FC = () => {
                     column4: {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
-                      'x-component-props': { 
-                        width: 200, 
-                        title:  intl.formatMessage({
+                      'x-component-props': {
+                        width: 200,
+                        title: intl.formatMessage({
                           id: 'pages.system.permission.operationConfiguration.name',
                           defaultMessage: '名称',
                         }),
@@ -307,12 +307,12 @@ const Permission: React.FC = () => {
                     column5: {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
-                      'x-component-props': { 
-                        width: 200, 
-                        title:  intl.formatMessage({
+                      'x-component-props': {
+                        width: 200,
+                        title: intl.formatMessage({
                           id: 'pages.system.permission.operationConfiguration.describe',
                           defaultMessage: '描述',
-                        }), 
+                        }),
                       },
                       properties: {
                         a3: {
@@ -326,7 +326,7 @@ const Permission: React.FC = () => {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
                       'x-component-props': {
-                        title:  intl.formatMessage({
+                        title: intl.formatMessage({
                           id: 'pages.data.option',
                           defaultMessage: '操作',
                         }),
@@ -362,9 +362,9 @@ const Permission: React.FC = () => {
                     type: 'void',
                     'x-component': 'ArrayTable.Addition',
                     title: intl.formatMessage({
-                      id:'pages.system.permission.add',
-                      defaultMessage:'添加条目'
-                    })
+                      id: 'pages.system.permission.add',
+                      defaultMessage: '添加条目',
+                    }),
                   },
                 },
               },
@@ -374,7 +374,7 @@ const Permission: React.FC = () => {
             type: 'void',
             'x-component': 'FormTab.TabPane',
             'x-component-props': {
-              tab:intl.formatMessage({
+              tab: intl.formatMessage({
                 id: 'pages.system.permission.associatedPermissions',
                 defaultMessage: '关联权限',
               }),
@@ -402,8 +402,8 @@ const Permission: React.FC = () => {
                     column3: {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
-                      'x-component-props': { 
-                        width: 200, 
+                      'x-component-props': {
+                        width: 200,
                         title: intl.formatMessage({
                           id: 'pages.system.permission.associatedPermissions.preOperation',
                           defaultMessage: '前置操作',
@@ -420,8 +420,8 @@ const Permission: React.FC = () => {
                     column4: {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
-                      'x-component-props': { 
-                        width: 200, 
+                      'x-component-props': {
+                        width: 200,
                         title: intl.formatMessage({
                           id: 'pages.system.permission.associatedPermissions.associatedPermissions',
                           defaultMessage: '关联权限',
@@ -438,8 +438,8 @@ const Permission: React.FC = () => {
                     column5: {
                       type: 'void',
                       'x-component': 'ArrayTable.Column',
-                      'x-component-props': { 
-                        width: 200, 
+                      'x-component-props': {
+                        width: 200,
                         title: intl.formatMessage({
                           id: 'pages.system.permission.associatedPermissions.associatedOperation',
                           defaultMessage: '关联操作',
@@ -493,8 +493,8 @@ const Permission: React.FC = () => {
                     type: 'void',
                     'x-component': 'ArrayTable.Addition',
                     title: intl.formatMessage({
-                      id:'pages.system.permission.add',
-                      defaultMessage:'添加条目'
+                      id: 'pages.system.permission.add',
+                      defaultMessage: '添加条目',
                     }),
                   },
                 },

+ 20 - 20
src/pages/system/Tenant/index.tsx

@@ -34,9 +34,9 @@ const Tenant = () => {
     },
     {
       dataIndex: 'tenant',
-      title:intl.formatMessage({
-        id:'pages.system.tenant.avatar',
-        defaultMessage:'头像',
+      title: intl.formatMessage({
+        id: 'pages.system.tenant.avatar',
+        defaultMessage: '头像',
       }),
       align: 'center',
       search: false,
@@ -44,26 +44,26 @@ const Tenant = () => {
     },
     {
       dataIndex: 'tenant',
-      title:intl.formatMessage({
-        id:'pages.system.tenant.name',
-        defaultMessage:'名称',
+      title: intl.formatMessage({
+        id: 'pages.system.tenant.name',
+        defaultMessage: '名称',
       }),
       align: 'center',
       renderText: (text: TenantDetail) => text.name,
     },
     {
       dataIndex: 'members',
-      title:intl.formatMessage({
-        id:'pages.system.tenant.members',
-        defaultMessage:'成员数',
+      title: intl.formatMessage({
+        id: 'pages.system.tenant.members',
+        defaultMessage: '成员数',
       }),
       align: 'center',
     },
     {
       dataIndex: 'tenant',
-      title:intl.formatMessage({
-        id:'pages.searchTable.titleStatus',
-        defaultMessage:'状态',
+      title: intl.formatMessage({
+        id: 'pages.searchTable.titleStatus',
+        defaultMessage: '状态',
       }),
       align: 'center',
       renderText: (text: TenantDetail) => text.state.text,
@@ -73,23 +73,23 @@ const Tenant = () => {
       valueEnum: [
         {
           text: intl.formatMessage({
-            id:'pages.searchTable.titleStatus.all',
+            id: 'pages.searchTable.titleStatus.all',
             defaultMessage: '全部',
-          }), 
+          }),
           status: 'Default',
         },
         {
-          text:intl.formatMessage({
-            id:'pages.searchTable.titleStatus.normal',
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.normal',
             defaultMessage: '正常',
-          }), 
+          }),
           status: '1',
         },
         {
-          text:intl.formatMessage({
-            id:'pages.searchTable.titleStatus.disable',
+          text: intl.formatMessage({
+            id: 'pages.searchTable.titleStatus.disable',
             defaultMessage: '禁用',
-          }), 
+          }),
           status: '0',
         },
       ],