Explorar el Código

Merge xyh

Next xyh
XieYongHong hace 3 años
padre
commit
954b9c07ac
Se han modificado 28 ficheros con 300 adiciones y 108 borrados
  1. 1 1
      src/components/Ellipsis/index.tsx
  2. 3 3
      src/components/ProTableCard/CardItems/Stream/index.less
  3. 9 3
      src/components/ProTableCard/CardItems/Stream/index.tsx
  4. 15 5
      src/components/ProTableCard/index.tsx
  5. 48 21
      src/components/SearchComponent/index.tsx
  6. 2 0
      src/pages/device/Instance/Detail/ChildDevice/index.tsx
  7. 4 4
      src/pages/device/Instance/index.tsx
  8. 1 1
      src/pages/media/Cascade/index.tsx
  9. 1 1
      src/pages/media/Home/index.tsx
  10. 1 1
      src/pages/media/Home/service.tsx
  11. 56 7
      src/pages/notice/Config/Debug/index.tsx
  12. 25 19
      src/pages/notice/Template/Debug/index.tsx
  13. 1 0
      src/pages/notice/Template/index.tsx
  14. 1 1
      src/pages/rule-engine/Alarm/Configuration/index.tsx
  15. 9 5
      src/pages/rule-engine/Alarm/Log/TabComponent/index.tsx
  16. 1 1
      src/pages/rule-engine/Instance/index.tsx
  17. 23 2
      src/pages/rule-engine/Scene/Save/action/VariableItems/builtIn.tsx
  18. 29 11
      src/pages/rule-engine/Scene/Save/action/action.tsx
  19. 5 1
      src/pages/rule-engine/Scene/Save/action/device/ConditionalFiltering.tsx
  20. 43 9
      src/pages/rule-engine/Scene/Save/action/device/WriteProperty/index.tsx
  21. 3 2
      src/pages/rule-engine/Scene/Save/action/device/deviceModal.tsx
  22. 3 1
      src/pages/rule-engine/Scene/Save/action/device/index.tsx
  23. 2 0
      src/pages/rule-engine/Scene/Save/action/messageContent.tsx
  24. 1 0
      src/pages/rule-engine/Scene/Save/index.tsx
  25. 4 3
      src/pages/system/Department/Assets/deivce/index.tsx
  26. 1 1
      src/pages/system/Department/Assets/product/index.tsx
  27. 3 0
      src/pages/system/Relationship/index.tsx
  28. 5 5
      src/utils/menu/index.ts

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

@@ -93,7 +93,7 @@ export default (props: EllipsisProps) => {
       )}
       <div
         className={classnames(props.titleClassName?.replace('ellipsis', ''), Style['ellipsis-max'])}
-        style={{ ...props.titleStyle, width: 'max-content !important' }}
+        style={props.titleStyle ? { ...props.titleStyle, width: 'max-content !important' } : {width: 'max-content !important'}}
         ref={extraNode}
       >
         {props.title}

+ 3 - 3
src/components/ProTableCard/CardItems/Stream/index.less

@@ -18,14 +18,14 @@
 
       .header {
         .stream-title {
-          width: 100%;
+          //width: 100%;
           font-weight: 700;
           font-size: 18px;
         }
       }
       .container {
-        display: flex;
-        justify-content: space-between;
+        display: grid;
+        grid-template-columns: 1fr 1fr 1fr;
         width: 100%;
         margin-bottom: 20px;
         padding-right: 20px;

+ 9 - 3
src/components/ProTableCard/CardItems/Stream/index.tsx

@@ -37,18 +37,24 @@ export default (props: StreamCardProps) => {
               {/*<div className={'ellipsis'}>*/}
               {/*  <Tooltip title={props?.provider}>{props?.provider}</Tooltip>*/}
               {/*</div>*/}
-              <Ellipsis title={props?.provider} titleClassName={'stream-title'} />
+              <div style={{width: '100%'}}>
+                <Ellipsis title={props?.provider} titleClassName={'stream-title'} />
+              </div>
             </div>
             <div>
               <label>RTP IP</label>
-              <Ellipsis title={props?.configuration?.rtpIp} />
+              <div style={{width: '100%'}}>
+                <Ellipsis title={props?.configuration?.rtpIp} />
+              </div>
               {/*<div className={'ellipsis'}>*/}
               {/*  <Tooltip title={props?.configuration?.rtpIp}>{props?.configuration?.rtpIp}</Tooltip>*/}
               {/*</div>*/}
             </div>
             <div>
               <label>API HOST</label>
-              <Ellipsis title={props?.configuration?.apiHost} />
+              <div style={{width: '100%'}}>
+                <Ellipsis title={props?.configuration?.apiHost} />
+              </div>
               {/*<div className={'ellipsis'}>*/}
               {/*  <Tooltip title={props?.configuration?.apiHost}>*/}
               {/*    {props?.configuration?.apiHost}*/}

+ 15 - 5
src/components/ProTableCard/index.tsx

@@ -22,6 +22,13 @@ type ModelType = keyof typeof ModelEnum;
 interface ProTableCardProps<T> {
   cardRender?: (data: T) => JSX.Element | React.ReactNode;
   gridColumn?: number;
+  /**
+   * 用于不同分辨率
+   * gridColumns[0] 1366 ~ 1440 分辨率;
+   * gridColumns[1] 1440 ~  1600 分辨率;
+   * gridColumns[2] > 1600 分辨率;
+   */
+  gridColumns?: [number, number, number]
   height?: 'none';
 }
 
@@ -69,7 +76,7 @@ const ProTableCard = <
             'item-active': selectedRowKeys && selectedRowKeys.includes(id),
           }),
           key: id,
-          onClick: (e) => {
+          onClick: (e: any) => {
             e.stopPropagation();
             if (onChange) {
               const isSelect = selectedRowKeys.includes(id);
@@ -123,11 +130,14 @@ const ProTableCard = <
 
   const windowChange = () => {
     if (window.innerWidth <= 1440) {
-      setColumn(props.gridColumn && props.gridColumn < 2 ? props.gridColumn : 2);
+      const _column = props.gridColumn && props.gridColumn < 2 ? props.gridColumn : 2
+      setColumn(props.gridColumns ? props.gridColumns[0] : _column);
     } else if (window.innerWidth > 1440 && window.innerWidth <= 1600) {
-      setColumn(props.gridColumn && props.gridColumn < 3 ? props.gridColumn : 3);
+      const _column = props.gridColumn && props.gridColumn < 3 ? props.gridColumn : 3
+      setColumn(props.gridColumns ? props.gridColumns[1] : _column);
     } else if (window.innerWidth > 1600) {
-      setColumn(props.gridColumn && props.gridColumn < 4 ? props.gridColumn : 4);
+      const _column = props.gridColumn && props.gridColumn < 4 ? props.gridColumn : 4
+      setColumn(props.gridColumns ? props.gridColumns[2] : _column);
     }
   };
 
@@ -137,7 +147,7 @@ const ProTableCard = <
     return () => {
       window.removeEventListener('resize', windowChange);
     };
-  }, []);
+  }, [props.gridColumns]);
 
   const pageSizeOptions = [Default_Size * 2, Default_Size * 4, Default_Size * 8, Default_Size * 16];
 

+ 48 - 21
src/components/SearchComponent/index.tsx

@@ -200,13 +200,17 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
         initialValues: initParams,
         effects() {
           onFieldReact('*.*.column', async (typeFiled, f) => {
-            if ((typeFiled as Field).modified) {
+            // if ((typeFiled as Field).modified) {
+              const isModified = (typeFiled as Field).modified
               const _column = (typeFiled as Field).value;
               const _field = field.find((item) => item.dataIndex === _column);
               if (_column === 'id') {
-                f.setFieldState(typeFiled.query('.termType'), async (state) => {
-                  state.value = 'eq';
-                });
+                if (isModified) {
+                  f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                    state.value = 'eq';
+                  });
+
+                }
                 f.setFieldState(typeFiled.query('.value'), async (state) => {
                   state.componentType = 'Input';
                   state.componentProps = { allowClear: true };
@@ -223,14 +227,22 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                     } else if (_field?.request) {
                       __option = await _field.request();
                     }
-                    f.setFieldState(typeFiled.query('.termType'), async (state) => {
-                      state.value = 'eq';
-                    });
+                    if (isModified) {
+                      f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                        state.value = 'eq';
+                      });
+                    }
+
                     f.setFieldState(typeFiled.query('.value'), async (state) => {
                       console.log(state.value);
                       state.componentType = 'Select';
                       state.dataSource = __option;
-                      state.componentProps = { allowClear: true };
+                      state.componentProps = {
+                        allowClear: true,
+                        showSearch: true,
+                        filterOption: (input: string, option: any) =>
+                          option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
+                      };
                     });
                     break;
                   case 'treeSelect':
@@ -243,16 +255,22 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                     } else if (_field?.request) {
                       _option = await _field.request();
                     }
-                    f.setFieldState(typeFiled.query('.termType'), (_state) => {
-                      _state.value = 'eq';
-                    });
+                    if (isModified) {
+                      f.setFieldState(typeFiled.query('.termType'), (_state) => {
+                        _state.value = 'eq';
+                      });
+                    }
+
                     f.setFieldState(typeFiled.query('.value'), (state) => {
                       state.componentType = 'TreeSelect';
                       state.dataSource = _option;
                       state.componentProps = {
                         ..._field.fieldProps,
                         allowClear: true,
+                        showSearch: true,
                         treeNodeFilterProp: 'name',
+                        filterOption: (input: string, option: any) =>
+                          option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
                       };
                     });
                     break;
@@ -261,23 +279,32 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                       state.componentType = 'NumberPicker';
                       state.componentProps = { allowClear: true };
                     });
-                    f.setFieldState(typeFiled.query('.termType'), async (state) => {
-                      state.value = 'eq';
-                    });
+                    if (isModified) {
+                      f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                        state.value = 'eq';
+                      });
+                    }
+
                     break;
                   case 'dateTime':
                     f.setFieldState(typeFiled.query('.value'), async (state) => {
                       state.componentType = 'DatePicker';
                       state.componentProps = { showTime: true, allowClear: true };
                     });
-                    f.setFieldState(typeFiled.query('.termType'), async (state) => {
-                      state.value = 'gte';
-                    });
+                    if (isModified) {
+                      f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                        state.value = 'gte';
+                      });
+                    }
+
                     break;
                   default:
-                    f.setFieldState(typeFiled.query('.termType'), async (state) => {
-                      state.value = 'like';
-                    });
+                    if (isModified) {
+                      f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                        state.value = 'like';
+                      });
+                    }
+
                     f.setFieldState(typeFiled.query('.value'), async (state) => {
                       state.componentType = 'Input';
                       state.componentProps = { allowClear: true };
@@ -285,7 +312,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                     break;
                 }
               }
-            }
+            // }
           });
           onFieldValueChange('*.*.column', (field1, form1) => {
             form1.setFieldState(field1.query('.value'), (state1) => {

+ 2 - 0
src/pages/device/Instance/Detail/ChildDevice/index.tsx

@@ -127,7 +127,9 @@ const ChildDevice = () => {
             }}
             title={'确认解绑吗?'}
           >
+            <Tooltip title={'解绑'}>
             <DisconnectOutlined />
+            </Tooltip>
           </Popconfirm>
         </a>,
       ],

+ 4 - 4
src/pages/device/Instance/index.tsx

@@ -36,12 +36,12 @@ import { service as categoryService } from '@/pages/device/Category';
 import { onlyMessage } from '@/utils/util';
 
 export const statusMap = new Map();
-statusMap.set('在线', 'success');
+statusMap.set('在线', 'processing');
 statusMap.set('离线', 'error');
-statusMap.set('未激活', 'processing');
-statusMap.set('online', 'success');
+statusMap.set('未激活', 'warning');
+statusMap.set('online', 'processing');
 statusMap.set('offline', 'error');
-statusMap.set('notActive', 'processing');
+statusMap.set('notActive', 'warning');
 
 export const InstanceModel = model<{
   current: Partial<DeviceInstance>;

+ 1 - 1
src/pages/media/Cascade/index.tsx

@@ -288,7 +288,7 @@ const Cascade = () => {
           isPermission={permission.delete}
           disabled={record.status.value !== 'disabled'}
           tooltip={{
-            title: record.status.value !== 'disabled' ? '请先禁用,再删除' : '',
+            title: record.status.value !== 'disabled' ? '请先禁用,再删除' : '删除',
           }}
           popConfirm={{
             title: '确认删除',

+ 1 - 1
src/pages/media/Home/index.tsx

@@ -14,7 +14,7 @@ import Steps from '@/pages/home/components/Steps';
 
 const permissionTip = '暂无权限,请联系管理员';
 
-export const service = new Service('media/device');
+export const service = new Service('media');
 
 export default () => {
   const dashBoardUrl = getMenuPathByCode('media/DashBoard');

+ 1 - 1
src/pages/media/Home/service.tsx

@@ -3,7 +3,7 @@ import { request } from 'umi';
 import type { DeviceItem } from '@/pages/media/Device/typings';
 
 class Service extends BaseService<DeviceItem> {
-  deviceCount = (data?: any) => request(`${this.uri}/_count`, { methods: 'GET', params: data });
+  deviceCount = (data?: any) => request(`${this.uri}/device/_count`, { methods: 'GET', params: data });
 
   channelCount = (data: any = {}) =>
     request(`${this.uri}/channel/_count`, { method: 'POST', data: data });

+ 56 - 7
src/pages/notice/Config/Debug/index.tsx

@@ -1,5 +1,5 @@
 import { Modal } from 'antd';
-import { useMemo } from 'react';
+import {useMemo, useRef} from 'react';
 import { createForm, Field, onFieldReact, onFieldValueChange } from '@formily/core';
 import { createSchemaField, observer } from '@formily/react';
 import {
@@ -14,6 +14,7 @@ import {
 } from '@formily/antd';
 import { ISchema } from '@formily/json-schema';
 import { service, state } from '@/pages/notice/Config';
+import { service as TemplateService } from '@/pages/notice/Template';
 import { useLocation } from 'umi';
 import { onlyMessage, useAsyncDataSource } from '@/utils/util';
 import { Store } from 'jetlinks-store';
@@ -22,6 +23,7 @@ import FUpload from '@/components/Upload';
 const Debug = observer(() => {
   const location = useLocation<{ id: string }>();
   const id = (location as any).query?.id;
+  const variableRef = useRef<any>([]);
 
   const form = useMemo(
     () =>
@@ -31,17 +33,30 @@ const Debug = observer(() => {
           onFieldValueChange('templateId', (field, form1) => {
             const value = field.value;
             // 找到模版详情;
-            const list = Store.get('notice-template-list');
+            // const list = Store.get('notice-template-list');
 
-            const _template = list.find((item: any) => item.id === value);
-            form1.setFieldState('variableDefinitions', (_state) => {
-              _state.visible = _template?.variableDefinitions?.length > 0;
-              _state.value = _template.variableDefinitions;
+            TemplateService.getVariableDefinitions(value).then((resp) => {
+              const _template = resp.result;
+              if (_template?.variableDefinitions?.length > 0) {
+                variableRef.current = _template?.variableDefinitions;
+                form1.setFieldState('variableDefinitions', (state1) => {
+                  state1.visible = true;
+                  state1.value = _template?.variableDefinitions;
+                });
+              }
             });
+
+            // const _template = list.find((item: any) => item.id === value);
+            // console.log(_template)
+            // form1.setFieldState('variableDefinitions', (_state) => {
+            //   _state.visible = _template?.variableDefinitions?.length > 0;
+            //   _state.value = _template.variableDefinitions;
+            // });
           });
-          onFieldReact('variableDefinitions.*.type', (field) => {
+          onFieldReact('variableDefinitions.*.type', async (field) => {
             const value = (field as Field).value;
             const format = field.query('.value').take() as any;
+            const _id = field.query('.id').take() as Field;
             switch (value) {
               case 'date':
                 format.setComponent(DatePicker);
@@ -61,6 +76,33 @@ const Debug = observer(() => {
                 format.setComponent(Input);
                 break;
             }
+            console.log(variableRef.current)
+            if (variableRef.current) {
+              const a = variableRef.current?.find((i: any) => i.id === _id.value);
+              const businessType = a?.expands?.businessType;
+              if (id === 'dingTalk' || id === 'weixin') {
+                switch (businessType) {
+                  case 'org':
+                    // 获取org
+                    const orgList = await TemplateService[id].getDepartments(state.current?.id);
+                    format.setComponent(Select);
+                    format.setDataSource(orgList);
+                    break;
+                  case 'user':
+                    // 获取user
+                    const userList = await TemplateService[id].getUser(state.current?.id);
+                    format.setComponent(Select);
+                    format.setDataSource(userList);
+                    break;
+                  case 'tag':
+                    // 获取user
+                    const tagList = await TemplateService[id].getTags(state.current?.id);
+                    format.setComponent(Select);
+                    format.setDataSource(tagList);
+                    break;
+                }
+              }
+            }
           });
         },
       }),
@@ -148,6 +190,13 @@ const Debug = observer(() => {
               'x-component-props': { title: '值', width: '120px' },
               properties: {
                 value: {
+                  required: true,
+                  type: 'string',
+                  'x-decorator': 'FormItem',
+                  'x-component': 'Input',
+                },
+                type: {
+                  'x-hidden': true,
                   type: 'string',
                   'x-decorator': 'FormItem',
                   'x-component': 'Input',

+ 25 - 19
src/pages/notice/Template/Debug/index.tsx

@@ -1,7 +1,7 @@
-import { Modal, Spin } from 'antd';
-import { useEffect, useMemo, useRef, useState } from 'react';
-import { createForm, Field, onFieldReact, onFieldValueChange } from '@formily/core';
-import { createSchemaField, observer } from '@formily/react';
+import {Modal, Spin} from 'antd';
+import {useEffect, useMemo, useRef, useState} from 'react';
+import {createForm, Field, onFieldReact, onFieldValueChange} from '@formily/core';
+import {createSchemaField, observer} from '@formily/react';
 import {
   ArrayTable,
   DatePicker,
@@ -12,11 +12,11 @@ import {
   PreviewText,
   Select,
 } from '@formily/antd';
-import { ISchema } from '@formily/json-schema';
-import { configService, service, state } from '@/pages/notice/Template';
-import { useLocation } from 'umi';
-import { onlyMessage, useAsyncDataSource } from '@/utils/util';
-import { Store } from 'jetlinks-store';
+import {ISchema} from '@formily/json-schema';
+import {configService, service, state} from '@/pages/notice/Template';
+import {useLocation} from 'umi';
+import {onlyMessage, useAsyncDataSource} from '@/utils/util';
+import {Store} from 'jetlinks-store';
 import FUpload from '@/components/Upload';
 
 const Debug = observer(() => {
@@ -89,8 +89,14 @@ const Debug = observer(() => {
                       format.setComponent(Select);
                       format.setDataSource(userList);
                       break;
+                    case 'tag':
+                      // 获取user
+                      const tagList = await service[id].getTags(_configId);
+                      format.setComponent(Select);
+                      format.setDataSource(tagList);
+                      break;
                   }
-                } else if (businessType === 'org' || businessType === 'user') {
+                } else if (['tag', 'org', 'user'].includes(businessType)) {
                   format.setComponent(Select);
                   format.setDataSource([]);
                 }
@@ -136,8 +142,8 @@ const Debug = observer(() => {
     configService
       .queryNoPagingPost({
         terms: [
-          { column: 'type$IN', value: id },
-          { column: 'provider', value: state.current?.provider },
+          {column: 'type$IN', value: id},
+          {column: 'provider', value: state.current?.provider},
         ],
       })
       .then((resp: any) => {
@@ -168,8 +174,8 @@ const Debug = observer(() => {
         'x-decorator': 'FormItem',
         'x-component': 'ArrayTable',
         'x-component-props': {
-          pagination: { pageSize: 9999 },
-          scroll: { x: '100%' },
+          pagination: {pageSize: 9999},
+          scroll: {x: '100%'},
         },
         'x-visible': false,
         items: {
@@ -178,7 +184,7 @@ const Debug = observer(() => {
             column0: {
               type: 'void',
               'x-component': 'ArrayTable.Column',
-              'x-component-props': { title: '类型', width: '120px' },
+              'x-component-props': {title: '类型', width: '120px'},
               'x-hidden': true,
               properties: {
                 type: {
@@ -192,7 +198,7 @@ const Debug = observer(() => {
             column1: {
               type: 'void',
               'x-component': 'ArrayTable.Column',
-              'x-component-props': { title: '变量', width: '120px' },
+              'x-component-props': {title: '变量', width: '120px'},
               properties: {
                 id: {
                   type: 'string',
@@ -205,7 +211,7 @@ const Debug = observer(() => {
             column2: {
               type: 'void',
               'x-component': 'ArrayTable.Column',
-              'x-component-props': { title: '名称', width: '120px' },
+              'x-component-props': {title: '名称', width: '120px'},
               properties: {
                 name: {
                   type: 'string',
@@ -218,7 +224,7 @@ const Debug = observer(() => {
             column3: {
               type: 'void',
               'x-component': 'ArrayTable.Column',
-              'x-component-props': { title: '值', width: '120px' },
+              'x-component-props': {title: '值', width: '120px'},
               properties: {
                 value: {
                   required: true,
@@ -286,7 +292,7 @@ const Debug = observer(() => {
     >
       <Spin spinning={spinning}>
         <Form form={form} layout={'vertical'}>
-          <SchemaField schema={schema} scope={{ getConfig, useAsyncDataSource }} />
+          <SchemaField schema={schema} scope={{getConfig, useAsyncDataSource}}/>
         </Form>
       </Spin>
     </Modal>

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

@@ -230,6 +230,7 @@ const Template = observer(() => {
         params={param}
         columns={columns}
         columnEmptyText={''}
+        gridColumns={[2,2,3]}
         headerTitle={
           <Space>
             <PermissionButton

+ 1 - 1
src/pages/rule-engine/Alarm/Configuration/index.tsx

@@ -183,7 +183,7 @@ const Configuration = () => {
             style={{ padding: 0 }}
             isPermission={permission.tigger}
             tooltip={{
-              title: record.state?.value === 'disabled' ? '未启用,不能手动触发' : '',
+              title: record.state?.value === 'disabled' ? '未启用,不能手动触发' : '手动触发',
             }}
             disabled={record.state?.value === 'disabled'}
             popConfirm={{

+ 9 - 5
src/pages/rule-engine/Alarm/Log/TabComponent/index.tsx

@@ -15,6 +15,7 @@ import { useHistory } from 'umi';
 import classNames from 'classnames';
 import { useDomFullHeight } from '@/hooks';
 import PermissionButton from '@/components/PermissionButton';
+import {Ellipsis} from "@/components";
 
 interface Props {
   type: string;
@@ -203,12 +204,15 @@ const TabComponent = observer((props: Props) => {
                       <div className={'card-warp'}>
                         <div className={classNames('card-content')}>
                           <div
-                            style={{ fontSize: 20, fontWeight: 700, marginBottom: 20 }}
-                            className="ellipsis"
+                            style={{ width: 'calc(100% - 90px)' }}
                           >
-                            <Tooltip title={item.alarmName}>
-                              <a style={{ cursor: 'default' }}>{item.alarmName}</a>
-                            </Tooltip>
+                            <Ellipsis
+                              title={item.alarmName}
+                              titleStyle={{color: '#2F54EB'}}
+                            />
+                            {/*<Tooltip title={item.alarmName}>*/}
+                            {/*  <a style={{ cursor: 'default' }}>{item.alarmName}</a>*/}
+                            {/*</Tooltip>*/}
                           </div>
                           <div className="alarm-log-context">
                             <div className="context-left">

+ 1 - 1
src/pages/rule-engine/Instance/index.tsx

@@ -86,7 +86,7 @@ const Instance = () => {
       isPermission={permission.delete}
       disabled={record.state.value !== 'disable'}
       tooltip={{
-        title: record.state.value !== 'disable' ? '请先禁用,再删除' : '',
+        title: record.state.value !== 'disable' ? '请先禁用,再删除' : '删除',
       }}
       popConfirm={{
         title: '确认删除',

+ 23 - 2
src/pages/rule-engine/Scene/Save/action/VariableItems/builtIn.tsx

@@ -23,6 +23,7 @@ interface BuiltInProps {
   parallel?: boolean;
   form: FormInstance;
   name: number;
+  isEdit?: boolean
 }
 
 export default (props: BuiltInProps) => {
@@ -32,6 +33,8 @@ export default (props: BuiltInProps) => {
 
   const [builtInList, setBuiltInList] = useState<any[]>([]);
 
+  const [isEdit, setIsEdit] = useState(false)
+
   const onChange = (_source: string = 'fixed', _value?: any, _upperKey?: string) => {
     const obj: ChangeType = {
       source: _source,
@@ -61,13 +64,31 @@ export default (props: BuiltInProps) => {
   };
 
   useEffect(() => {
-    if (source === 'upper') {
+    if (props.isEdit) {
+      setIsEdit(false)
+      const data = props.form.getFieldsValue();
+      const params = props.name - 1 >= 0 ? { action: props.name - 1 } : undefined;
+      queryBuiltInParams(data, params).then((res: any) => {
+        if (res.status === 200) {
+          const actionParams = res.result.filter((item: any) => item.id === `action_${props.name}`);
+          const _data = BuiltInParamsHandleTreeData(props.name === 0 ? res.result : actionParams);
+          setBuiltInList(_data);
+        }
+      });
+    }
+    setTimeout(() => {
+      setIsEdit(true)
+    }, 300)
+  }, [ props.isEdit ])
+
+  useEffect(() => {
+    if (source === 'upper' && isEdit) {
       sourceChangeEvent();
     }
   }, [source, props.trigger, props.parallel, props.type]);
 
   useEffect(() => {
-    if (props.trigger?.trigger?.device?.productId && source === 'upper') {
+    if (props.trigger?.trigger?.device?.productId && source === 'upper' && isEdit) {
       sourceChangeEvent();
     }
   }, [props.trigger?.trigger?.device?.productId, source]);

+ 29 - 11
src/pages/rule-engine/Scene/Save/action/action.tsx

@@ -30,6 +30,7 @@ interface ActionProps {
   actionItemData?: any;
   trigger?: any;
   parallel?: boolean;
+  isEdit?: boolean;
 }
 
 export default observer((props: ActionProps) => {
@@ -127,7 +128,7 @@ export default observer((props: ActionProps) => {
         setType1(data.executor);
       }
 
-      if (data.terms) {
+      if (data.terms && data.terms.length) {
         // 显示过滤条件
         setIsFiltering(true);
       }
@@ -155,15 +156,15 @@ export default observer((props: ActionProps) => {
     }
   }, [props.parallel]);
 
-  useEffect(() => {
-    if (productId) {
-      const actions = props.form.getFieldValue('actions');
-      if (actions[name].device?.message?.properties) {
-        actions[name].device.message.properties = undefined;
-        props.form.setFieldsValue({ actions });
-      }
-    }
-  }, [productId]);
+  // useEffect(() => {
+  //   if (productId) {
+  //     const actions = props.form.getFieldValue('actions');
+  //     if (actions[name].device?.message?.properties) {
+  //       actions[name].device.message.properties = undefined;
+  //       props.form.setFieldsValue({ actions });
+  //     }
+  //   }
+  // }, [productId]);
 
   const MessageNodes = (
     <>
@@ -237,6 +238,13 @@ export default observer((props: ActionProps) => {
           checked={isFiltering}
           onChange={(e) => {
             setIsFiltering(e.target.checked);
+            if (!e.target.checked) {
+              const actions = props.form?.getFieldValue('actions');
+              delete actions[name].terms
+              props.form?.setFieldsValue({
+                actions,
+              });
+            }
           }}
         >
           条件过滤
@@ -292,7 +300,15 @@ export default observer((props: ActionProps) => {
             onFunctionChange={setFunctionList}
             restField={props.restField}
             parallel={props.parallel}
-            onProductIdChange={setProductId}
+            onProductIdChange={(_id) => {
+              setProductId(_id)
+              const actions = props.form.getFieldValue('actions');
+              if (actions[name].device?.message?.properties) {
+                actions[name].device.message.properties = undefined;
+                props.form.setFieldsValue({ actions });
+              }
+            }}
+            isEdit={props.isEdit}
           />
         )}
         {type1 === 'delay' && (
@@ -314,6 +330,7 @@ export default observer((props: ActionProps) => {
           triggerType={props.triggerType}
           configId={configId}
           parallel={props.parallel}
+          isEdit={props.isEdit}
         />
       ) : null}
       {type1 === 'device' &&
@@ -347,6 +364,7 @@ export default observer((props: ActionProps) => {
                   form={props.form}
                   parallel={props.parallel}
                   productId={productId}
+                  isEdit={props.isEdit}
                 />
               </Form.Item>
             </Col>

+ 5 - 1
src/pages/rule-engine/Scene/Save/action/device/ConditionalFiltering.tsx

@@ -260,7 +260,11 @@ export default (props: ConditionalFilteringProps) => {
           </ItemGroup>
         </Form.Item>
       </Col>
-      <Col>执行后续动作</Col>
+      <Col>
+        <div style={{ height: '100%', display: 'flex', alignItems: 'center', paddingBottom: 24}}>
+          执行后续动作
+        </div>
+      </Col>
     </>
   );
 };

+ 43 - 9
src/pages/rule-engine/Scene/Save/action/device/WriteProperty/index.tsx

@@ -17,6 +17,7 @@ interface WritePropertyProps {
   name: number;
   trigger?: any;
   productId: string;
+  isEdit?: boolean;
 }
 
 export default (props: WritePropertyProps) => {
@@ -25,6 +26,7 @@ export default (props: WritePropertyProps) => {
   const [propertiesKey, setPropertiesKey] = useState<string | undefined>(undefined);
   const [propertiesValue, setPropertiesValue] = useState(undefined);
   const [propertiesType, setPropertiesType] = useState('');
+  const [isEdit, setIsEdit] = useState(false)
   const paramsListRef = useRef<any[]>();
 
   const handleName = (data: any) => {
@@ -105,25 +107,57 @@ export default (props: WritePropertyProps) => {
   }, [props.properties, propertiesKey, source]);
 
   useEffect(() => {
-    if (source === 'upper') {
+    if (source === 'upper' && isEdit) {
       sourceChangeEvent();
     }
   }, [source, props.type, props.parallel]);
 
   useEffect(() => {
-    if (props.trigger?.trigger?.device?.productId && source === 'upper') {
-      sourceChangeEvent();
+    if (props.isEdit) {
+      setIsEdit(false)
+      const params = props.name - 1 >= 0 ? { action: props.name - 1 } : undefined;
+      const data = props.form.getFieldsValue();
+      queryBuiltInParams(data, params).then((res: any) => {
+        if (res.status === 200) {
+          const actionParams = res.result.filter((item: any) => item.id === `action_${props.name}`);
+          // 获取当前属性类型,过滤不同类型的数据
+          const propertiesItem = props.properties
+            .filter((item) => {
+              if (item.expands && item.expands.type) {
+                return item.expands.type.includes('write');
+              }
+              return false;
+            })
+            .find((item) => item.id === propertiesKey);
+          const type = propertiesItem?.valueType?.type;
+          const _params = props.name === 0 ? res.result : actionParams;
+          paramsListRef.current = cloneDeep(_params);
+          const _filterData = filterParamsData(type, _params);
+          const _data = handleTreeData(_filterData);
+          setBuiltInList(_data);
+        }
+      });
     }
-  }, [props.trigger?.trigger?.device?.productId, source]);
+    setTimeout(() => {
+      setIsEdit(true)
+    }, 300)
+  }, [props.isEdit])
 
   useEffect(() => {
-    if (props.productId) {
-      setPropertiesKey(undefined);
-      onChange('undefined', undefined, source);
+    if (props.trigger?.trigger?.device?.productId && source === 'upper' && isEdit) {
+      sourceChangeEvent();
     }
-  }, [props.productId]);
+  }, [props.trigger?.trigger?.device?.productId, source]);
+
+  // useEffect(() => {
+  //   if (props.productId) {
+  //     setPropertiesKey(undefined);
+  //     onChange('undefined', undefined, source);
+  //   }
+  // }, [props.productId]);
 
   useEffect(() => {
+    console.log(props.value)
     if (props.value) {
       if (props.properties && props.properties.length) {
         if (0 in props.value) {
@@ -246,7 +280,7 @@ export default (props: WritePropertyProps) => {
             style={{ width: 120 }}
             onChange={(key) => {
               setSource(key);
-              onChange(propertiesKey, propertiesValue, key);
+              onChange(propertiesKey, undefined, key);
             }}
           />
           {source === 'upper' ? (

+ 3 - 2
src/pages/rule-engine/Scene/Save/action/device/deviceModal.tsx

@@ -25,9 +25,9 @@ type ChangeValueType = {
 
 const DeviceBadge = (props: DeviceBadgeProps) => {
   const STATUS = {
-    notActive: 'processing',
+    notActive: 'warning',
     offline: 'error',
-    online: 'success',
+    online: 'processing',
   };
   return <Badge status={STATUS[props.type]} text={props.text} />;
 };
@@ -43,6 +43,7 @@ export default (props: DeviceModelProps) => {
   useEffect(() => {
     setValue(props.value || []);
     setSelectKeys(props.value || []);
+    console.log(props.value)
   }, [props.value]);
 
   const columns: ProColumns<DeviceItem>[] = [

+ 3 - 1
src/pages/rule-engine/Scene/Save/action/device/index.tsx

@@ -18,6 +18,7 @@ interface DeviceProps {
   onFunctionChange: (functionItem: any) => void;
   parallel?: boolean;
   onProductIdChange: (id: string) => void;
+  isEdit?: boolean
 }
 
 enum SourceEnum {
@@ -90,11 +91,12 @@ export default (props: DeviceProps) => {
     }
     const actions = props.form?.getFieldValue('actions');
 
-    if (actions[name] && actions[name].device) {
+    if (actions[name] && actions[name].device && !props.isEdit) {
       if (actions[name].device.selector) {
         actions[name].device.selector = SourceEnum.fixed;
       }
       if (actions[name].device.selectorValues) {
+        console.log('useEffect')
         actions[name].device.selectorValues = undefined;
       }
     }

+ 2 - 0
src/pages/rule-engine/Scene/Save/action/messageContent.tsx

@@ -18,6 +18,7 @@ interface MessageContentProps {
   configId: string;
   trigger?: any;
   parallel?: boolean;
+  isEdit?: boolean;
 }
 
 const rowGutter = 12;
@@ -155,6 +156,7 @@ export default (props: MessageContentProps) => {
                           type={props.triggerType}
                           trigger={props.trigger}
                           data={item}
+                          isEdit={props.isEdit}
                         />
                       )}
                     </Form.Item>

+ 1 - 0
src/pages/rule-engine/Scene/Save/index.tsx

@@ -374,6 +374,7 @@ export default () => {
                             actionItemData={actionsData[name]}
                             isLast={!actionDataCount || actionDataCount - 1 === name}
                             parallel={parallel}
+                            isEdit={isEdit}
                           />
                         ))}
                         <Form.Item noStyle>

+ 4 - 3
src/pages/system/Department/Assets/deivce/index.tsx

@@ -24,10 +24,11 @@ type DeviceBadgeProps = {
 };
 export const DeviceBadge = (props: DeviceBadgeProps) => {
   const STATUS = {
-    notActive: 'processing',
+    notActive: 'warning',
     offline: 'error',
-    online: 'success',
+    online: 'processing',
   };
+  console.log(STATUS[props.type], props)
   return <Badge status={STATUS[props.type]} text={props.text} />;
 };
 
@@ -217,7 +218,7 @@ export default observer((props: { parentId: string }) => {
             <Tooltip
               title={intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
-                defaultMessage: '解除绑定',
+                defaultMessage: '删除',
               })}
             >
               <DisconnectOutlined />

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

@@ -149,7 +149,7 @@ export default observer((props: { parentId: string }) => {
             <Tooltip
               title={intl.formatMessage({
                 id: 'pages.system.role.option.unBindUser',
-                defaultMessage: '解除绑定',
+                defaultMessage: '删除',
               })}
             >
               <DisconnectOutlined />

+ 3 - 0
src/pages/system/Relationship/index.tsx

@@ -74,6 +74,9 @@ const Relationship = () => {
         <PermissionButton
           isPermission={permission.delete}
           style={{ padding: 0 }}
+          tooltip={{
+            title: '删除'
+          }}
           popConfirm={{
             title: '确认删除',
             onConfirm: async () => {

+ 5 - 5
src/utils/menu/index.ts

@@ -194,11 +194,11 @@ export const handleRoutes = (routes?: MenuItem[], level = 1): MenuItem[] => {
             const eRoutes = findExtraRoutes(item.code, extraRoutes.children, item.url);
             item.children = item.children ? [...eRoutes, ...item.children] : eRoutes;
           }
-        } else {
-          const detailComponent = findDetailRoute(item.code, item.url);
-          if (detailComponent) {
-            item.children = item.children ? [detailComponent, ...item.children] : [detailComponent];
-          }
+        }
+
+        const detailComponent = findDetailRoute(item.code, item.url);
+        if (detailComponent) {
+          item.children = item.children ? [detailComponent, ...item.children] : [detailComponent];
         }
 
         // eslint-disable-next-line @typescript-eslint/no-unused-vars