Jelajahi Sumber

fix: merge next

fix: bug#9762、9754、9742、9702、9698、9636、7843
hear 3 tahun lalu
induk
melakukan
d58b1f4d06

+ 6 - 5
src/components/Metadata/JsonParam/index.tsx

@@ -203,11 +203,12 @@ const JsonParam = observer((props: Props) => {
                       required: true,
                       'x-decorator': 'FormItem',
                       'x-component': 'Select',
-                      enum: DataTypeList.filter((item) =>
-                        ['int', 'long', 'float', 'double', 'string', 'boolean', 'date'].includes(
-                          item.value,
-                        ),
-                      ),
+                      // enum: DataTypeList.filter((item) =>
+                      //   ['int', 'long', 'float', 'double', 'string', 'boolean', 'date'].includes(
+                      //     item.value,
+                      //   ),
+                      // ),
+                      enum: DataTypeList,
                       'x-validator': [
                         {
                           required: true,

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

@@ -778,7 +778,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
         }}
         type="primary"
         overlay={historyDom}
-        overlayStyle={{ height: 350, overflow: 'auto' }}
+        overlayStyle={{ maxHeight: 350, overflow: 'auto' }}
         htmlType={'submit'}
       >
         搜索

+ 2 - 2
src/pages/home/components/Guide.tsx

@@ -1,7 +1,7 @@
 import './index.less';
-import { message } from 'antd';
 import useHistory from '@/hooks/route/useHistory';
 import Title from './Title';
+import { onlyMessage } from '@/utils/util';
 
 const Image = {
   1: require('/public/images/home/1.png'),
@@ -31,7 +31,7 @@ const GuideItem = (props: GuideItemProps) => {
     if (props.url && props.auth) {
       history.push(`${props.url}`, props.param);
     } else {
-      message.warning('暂无权限,请联系管理员');
+      onlyMessage('暂无权限,请联系管理员', 'warning');
     }
   };
 

+ 12 - 0
src/pages/media/Device/Channel/Save.tsx

@@ -88,6 +88,12 @@ const Save = (props: SaveModalProps) => {
               gridSpan: 1,
               tooltip: '若不填写,系统将自动生成唯一ID',
             },
+            'x-validator': [
+              {
+                max: 64,
+                message: '最多可输入64个字符',
+              },
+            ],
           },
           name: {
             type: 'string',
@@ -198,6 +204,12 @@ const Save = (props: SaveModalProps) => {
             'x-decorator-props': {
               gridSpan: 1,
             },
+            'x-validator': [
+              {
+                max: 64,
+                message: '最多可输入64个字符',
+              },
+            ],
           },
           address: {
             type: 'string',

+ 6 - 5
src/pages/media/Home/index.tsx

@@ -1,5 +1,5 @@
 import { PageContainer } from '@ant-design/pro-layout';
-import { Col, message, Row, Tooltip } from 'antd';
+import { Col, Row, Tooltip } from 'antd';
 import { PermissionButton } from '@/components';
 import { getMenuPathByCode } from '@/utils/menu';
 import useHistory from '@/hooks/route/useHistory';
@@ -11,6 +11,7 @@ import DeviceModal from './deviceModal';
 import './index.less';
 import { Body, Guide, Statistics } from '@/pages/home/components';
 import Steps from '@/pages/home/components/Steps';
+import { onlyMessage } from '@/utils/util';
 
 const permissionTip = '暂无权限,请联系管理员';
 
@@ -44,7 +45,7 @@ export default () => {
         save: true,
       });
     } else {
-      message.warning(permissionTip);
+      onlyMessage(permissionTip, 'warning');
     }
   };
 
@@ -52,7 +53,7 @@ export default () => {
     if (splitScreenUrl) {
       history.push(splitScreenUrl);
     } else {
-      message.warning(permissionTip);
+      onlyMessage(permissionTip, 'warning');
     }
   };
 
@@ -60,7 +61,7 @@ export default () => {
     if (channelUrl) {
       setVisible(true);
     } else {
-      message.warning(permissionTip);
+      onlyMessage(permissionTip, 'warning');
     }
   };
 
@@ -124,7 +125,7 @@ export default () => {
                     if (!!dashBoardUrl) {
                       history.push(`${dashBoardUrl}`);
                     } else {
-                      message.warning('暂无权限,请联系管理员');
+                      onlyMessage('暂无权限,请联系管理员', 'warning');
                     }
                   }}
                 >

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

@@ -557,7 +557,7 @@ const Detail = observer(() => {
 
   registerValidateRules({
     batchCheckEmail(value) {
-      const regEmail = /^([A-Za-z0-9_\-\.])+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
+      const regEmail = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
       let error;
       if (value) {
         value.some((item: string) => {

+ 35 - 15
src/pages/rule-engine/Alarm/Config/Save/output.tsx

@@ -1,7 +1,7 @@
 import { Modal } from 'antd';
 import { createSchemaField } from '@formily/react';
 import { Form, FormGrid, FormItem, Input, Switch } from '@formily/antd';
-import { createForm, onFormInit } from '@formily/core';
+import { createForm, Field, onFieldChange, onFormInit } from '@formily/core';
 import type { ISchema } from '@formily/json-schema';
 import { service } from '@/pages/rule-engine/Alarm/Config';
 import { onlyMessage } from '@/utils/util';
@@ -21,6 +21,7 @@ const OutputSave = (props: Props) => {
     effects() {
       onFormInit(async (f) => {
         if (data) {
+          console.log(data);
           f.setInitialValues({
             // ...data?.data?.config?.config,
             address: data?.data?.config?.config?.address,
@@ -29,6 +30,25 @@ const OutputSave = (props: Props) => {
           });
         }
       });
+      onFieldChange('state', (field, form1) => {
+        const value = (field as Field).value;
+        console.log(value);
+        if (value) {
+          form1.setFieldState('address', (state) => {
+            state.visible = true;
+          });
+          form1.setFieldState('topic', (state) => {
+            state.visible = true;
+          });
+        } else {
+          form1.setFieldState('address', (state) => {
+            state.visible = false;
+          });
+          form1.setFieldState('topic', (state) => {
+            state.visible = false;
+          });
+        }
+      });
     },
   });
 
@@ -68,10 +88,22 @@ const OutputSave = (props: Props) => {
   const outputSchema: ISchema = {
     type: 'object',
     properties: {
+      state: {
+        title: '状态',
+        type: 'string',
+        // required: true,
+        'x-decorator': 'FormItem',
+        'x-component': 'Switch',
+        default: false,
+        'x-component-props': {
+          checkedChildren: '禁用',
+          unCheckedChildren: '启用',
+        },
+      },
       address: {
         title: 'kafka地址',
         type: 'string',
-        // required: true,
+        required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-component-props': {
@@ -87,7 +119,7 @@ const OutputSave = (props: Props) => {
       topic: {
         title: 'topic',
         type: 'string',
-        // required: true,
+        required: true,
         'x-decorator': 'FormItem',
         'x-component': 'Input',
         'x-component-props': {
@@ -100,18 +132,6 @@ const OutputSave = (props: Props) => {
           },
         ],
       },
-      state: {
-        title: '状态',
-        type: 'string',
-        // required: true,
-        'x-decorator': 'FormItem',
-        'x-component': 'Switch',
-        default: false,
-        'x-component-props': {
-          checkedChildren: '禁用',
-          unCheckedChildren: '启用',
-        },
-      },
       // layout2: {
       //   type: 'void',
       //   'x-decorator': 'FormGrid',

+ 11 - 11
src/pages/system/Department/Assets/product/bind.tsx

@@ -126,8 +126,8 @@ const Bind = observer((props: Props) => {
     AssetsModel.params = {};
   };
 
-  const getSelectedRowsKey = (selectedRows) => {
-    return selectedRows.map((item) => item?.id).filter((item2) => !!item2 !== false);
+  const getSelectedRowsKey = (selectedRows: any) => {
+    return selectedRows.map((item: any) => item?.id).filter((item2: any) => !!item2 !== false);
   };
 
   useEffect(() => {
@@ -308,15 +308,15 @@ const Bind = observer((props: Props) => {
                   resp.result.data.map((item: any) => item.id),
                 );
                 if (assetsResp.status === 200) {
-                  newData = newData.map((item: any) => {
-                    const assetsItem = assetsResp.result.find(
-                      (aItem: any) => (aItem.assetId = item.id),
-                    );
-                    return {
-                      ...item,
-                      ...assetsItem,
-                    };
-                  });
+                  newData = newData?.reduce((x: any, y: any) => {
+                    const id = assetsResp.result.find((item: any) => item.assetId === y.id);
+                    if (id) {
+                      Object.assign(id, y);
+                    } else {
+                      x.push(y);
+                    }
+                    return x;
+                  }, assetsResp.result);
                 }
               }
 

+ 2 - 2
src/pages/system/Department/Assets/product/index.tsx

@@ -241,8 +241,8 @@ export default observer((props: { parentId: string }) => {
     Models.bindKeys = [];
     Models.unBindKeys = [];
   };
-  const getSelectedRowsKey = (selectedRows) => {
-    return selectedRows.map((item) => item?.id).filter((item2) => !!item2 !== false);
+  const getSelectedRowsKey = (selectedRows: any) => {
+    return selectedRows.map((item: any) => item?.id).filter((item2: any) => !!item2 !== false);
   };
 
   useEffect(() => {