xieyonghong 3 gadi atpakaļ
vecāks
revīzija
e6e2549b53
50 mainītis faili ar 914 papildinājumiem un 1072 dzēšanām
  1. 20 8
      src/components/ProTableCard/CardItems/AccessConfig/index.tsx
  2. 1 1
      src/components/ProTableCard/CardItems/aliyun.tsx
  3. 1 1
      src/components/ProTableCard/CardItems/cascade.tsx
  4. 9 8
      src/components/ProTableCard/CardItems/duerOs.tsx
  5. 10 6
      src/components/ProTableCard/CardItems/networkCard.tsx
  6. 4 0
      src/global.less
  7. 1 1
      src/locales/zh-CN/pages.ts
  8. 1 2
      src/pages/Northbound/AliCloud/Detail/index.tsx
  9. 1 1
      src/pages/Northbound/AliCloud/index.tsx
  10. 43 3
      src/pages/Northbound/DuerOS/Detail/index.tsx
  11. 23 2
      src/pages/account/NotificationRecord/index.tsx
  12. 3 0
      src/pages/account/NotificationRecord/mark_chat_read.svg
  13. 4 0
      src/pages/cloud/DuerOS/typings.d.ts
  14. 2 2
      src/pages/device/Alarm/index.tsx
  15. 2 2
      src/pages/device/Command/index.tsx
  16. 2 2
      src/pages/device/Firmware/index.tsx
  17. 29 28
      src/pages/device/Instance/Detail/Config/index.tsx
  18. 6 2
      src/pages/device/Instance/Detail/MetadataMap/index.tsx
  19. 1 0
      src/pages/device/Instance/Detail/Running/Property/EditProperty.tsx
  20. 2 2
      src/pages/device/Instance/Detail/Running/Property/Indicators.tsx
  21. 59 21
      src/pages/device/Instance/Detail/Running/Property/index.tsx
  22. 1 1
      src/pages/device/Instance/index.tsx
  23. 1 0
      src/pages/device/Product/Detail/Access/AccessConfig/index.tsx
  24. 80 64
      src/pages/device/Product/Detail/index.tsx
  25. 30 16
      src/pages/link/AccessConfig/Detail/Access/index.tsx
  26. 142 126
      src/pages/link/AccessConfig/index.tsx
  27. 1 1
      src/pages/link/Channel/Opcua/Save/index.tsx
  28. 3 3
      src/pages/link/Protocol/index.tsx
  29. 4 6
      src/pages/link/Protocol/save/index.tsx
  30. 1 1
      src/pages/link/Type/Detail/index.tsx
  31. 11 6
      src/pages/link/Type/index.tsx
  32. 2 2
      src/pages/media/Cascade/Save/index.tsx
  33. 2 2
      src/pages/media/Cascade/index.tsx
  34. 1 1
      src/pages/media/Device/Channel/index.tsx
  35. 119 102
      src/pages/media/Stream/index.tsx
  36. 49 0
      src/pages/notice/Config/index.tsx
  37. 31 22
      src/pages/notice/Template/Debug/index.tsx
  38. 4 4
      src/pages/notice/Template/index.tsx
  39. 3 9
      src/pages/rule-engine/Alarm/Configuration/Save/index.tsx
  40. 17 0
      src/pages/rule-engine/Alarm/Configuration/index.tsx
  41. 0 181
      src/pages/rule-engine/Alarm/Log/TabComponent/index copy.less
  42. 0 307
      src/pages/rule-engine/Alarm/Log/TabComponent/index copy.tsx
  43. 8 0
      src/pages/rule-engine/Alarm/Log/TabComponent/index.less
  44. 126 100
      src/pages/rule-engine/Alarm/Log/TabComponent/index.tsx
  45. 1 1
      src/pages/rule-engine/Scene/Save/action/VariableItems/user.tsx
  46. 35 19
      src/pages/system/DataSource/Management/EditTable.tsx
  47. 13 1
      src/pages/system/DataSource/Save/index.tsx
  48. 2 2
      src/pages/system/Permission/index.tsx
  49. 1 1
      src/pages/system/Tenant/Detail/Member/Bind.tsx
  50. 2 2
      src/pages/system/User/index.tsx

+ 20 - 8
src/components/ProTableCard/CardItems/AccessConfig/index.tsx

@@ -50,16 +50,28 @@ export default (props: AccessConfigCardProps) => {
               {props?.channelInfo?.name && (
                 <div className="server">
                   <div className="subTitle">{props?.channelInfo?.name}</div>
-                  <div className="serverItem">
-                    {props.channelInfo?.addresses.slice(0, 1).map((i: any, index: number) => (
-                      <div className="subItem" key={i.address + `_address${index}`}>
-                        <Tooltip placement="topLeft" title={i.address}>
+                  <Tooltip
+                    placement="topLeft"
+                    title={
+                      <div>
+                        {[...props.channelInfo?.addresses].map((i: any, index: number) => (
+                          <div key={i.address + `_address${index}`}>
+                            <Badge color={i.health === -1 ? 'red' : 'green'} />
+                            {i.address}
+                          </div>
+                        ))}
+                      </div>
+                    }
+                  >
+                    <div className="serverItem">
+                      {props.channelInfo?.addresses.slice(0, 1).map((i: any, index: number) => (
+                        <div className="subItem" key={i.address + `_address${index}`}>
                           <Badge color={i.health === -1 ? 'red' : 'green'} />
                           {i.address}
-                        </Tooltip>
-                      </div>
-                    ))}
-                  </div>
+                        </div>
+                      ))}
+                    </div>
+                  </Tooltip>
                 </div>
               )}
               {props.protocolDetail?.name && (

+ 1 - 1
src/components/ProTableCard/CardItems/aliyun.tsx

@@ -20,7 +20,7 @@ export default (props: AliyunCardProps) => {
       status={props?.state?.value}
       statusText={props?.state?.text}
       statusNames={{
-        enabled: StatusColorEnum.processing,
+        enabled: StatusColorEnum.success,
         disabled: StatusColorEnum.error,
       }}
       showMask={false}

+ 1 - 1
src/components/ProTableCard/CardItems/cascade.tsx

@@ -22,7 +22,7 @@ export default (props: CascadeCardProps) => {
       status={props.status.value}
       statusText={props.status.text}
       statusNames={{
-        enabled: StatusColorEnum.processing,
+        enabled: StatusColorEnum.success,
         disabled: StatusColorEnum.error,
       }}
     >

+ 9 - 8
src/components/ProTableCard/CardItems/duerOs.tsx

@@ -4,6 +4,7 @@ import '@/style/common.less';
 import '../index.less';
 import { Tooltip } from 'antd';
 import { DuerOSItem } from '@/pages/cloud/DuerOS/typings';
+import { StatusColorEnum } from '@/components/BadgeStatus';
 
 export interface DuerOSProps extends DuerOSItem {
   detail?: React.ReactNode;
@@ -17,14 +18,14 @@ export default (props: DuerOSProps) => {
   return (
     <TableCard
       actions={props.action}
-      // detail={props.detail}
-      showStatus={false}
-      // status={props.state?.value}
-      // statusText={props.state?.text}
-      // statusNames={{
-      //   enabled: StatusColorEnum.success,
-      //   disabled: StatusColorEnum.error,
-      // }}
+      detail={props.detail}
+      // showStatus={false}
+      status={props?.state?.value}
+      statusText={props?.state?.text}
+      statusNames={{
+        enabled: StatusColorEnum.success,
+        disabled: StatusColorEnum.error,
+      }}
       showMask={false}
     >
       <div className={'pro-table-card-item'}>

+ 10 - 6
src/components/ProTableCard/CardItems/networkCard.tsx

@@ -19,23 +19,27 @@ export default (props: NoticeCardProps) => {
   const createDetail = () => {
     const record = props;
     if (record.shareCluster) {
-      const publicHost = record.configuration.publicHost;
-      const publicPort = record.configuration.publicPort;
-      return publicHost ? (
+      const host = record.configuration.publicHost || record.configuration.remoteHost;
+      const port = record.configuration.publicPort || record.configuration.remotePort;
+      return host ? (
         <>
           {networkMap[record.type]}
-          {publicHost}:{publicPort}
+          {host}:{port}
         </>
       ) : null;
     } else {
       const log = record.cluster?.map(
-        (item) => `${item.configuration.publicHost}:${item.configuration.publicPort}`,
+        (item) =>
+          `${item.configuration.publicHost || record.configuration.remoteHost}:${
+            item.configuration.publicPort || record.configuration.remotePort
+          }`,
       );
       return (
         <>
           {log.map((item) => (
             <div key={item}>
-              `${networkMap[record.type]}${item}`
+              {networkMap[record.type]}
+              {item}
             </div>
           ))}
         </>

+ 4 - 0
src/global.less

@@ -126,4 +126,8 @@ ol {
 
 .ellipsis-70 {
   width: 70%;
+  overflow: hidden;
+  white-space: nowrap;
+  text-align: left;
+  text-overflow: ellipsis;
 }

+ 1 - 1
src/locales/zh-CN/pages.ts

@@ -257,7 +257,7 @@ export default {
   // 设备管理-设备
   'pages.device.instance': '设备',
   'pages.device.instance.registrationTime': '注册时间',
-  'pages.device.instance.status.notActive': '未启用',
+  'pages.device.instance.status.notActive': '用',
   'pages.device.instance.status.offLine': '离线',
   'pages.device.instance.status.onLine': '在线',
   'pages.device.instance.deleteTip': '已启用的设备无法删除',

+ 1 - 2
src/pages/Northbound/AliCloud/Detail/index.tsx

@@ -11,8 +11,7 @@ import {
   Select,
 } from '@formily/antd';
 import type { Field } from '@formily/core';
-import { onFormInit } from '@formily/core';
-import { createForm, FormPath, onFieldChange, onFieldValueChange } from '@formily/core';
+import { createForm, FormPath, onFieldChange, onFieldValueChange, onFormInit } from '@formily/core';
 import { createSchemaField, observer } from '@formily/react';
 import { Card, Col, Image, Row } from 'antd';
 import { useMemo } from 'react';

+ 1 - 1
src/pages/Northbound/AliCloud/index.tsx

@@ -156,7 +156,7 @@ const AliCloud = () => {
       valueType: 'select',
       valueEnum: {
         disabled: {
-          text: '用',
+          text: '用',
           status: 'disabled',
         },
         enabled: {

+ 43 - 3
src/pages/Northbound/DuerOS/Detail/index.tsx

@@ -5,11 +5,13 @@ import { Card, Col, Row } from 'antd';
 import {
   ArrayCollapse,
   ArrayTable,
+  DatePicker,
   Form,
   FormButtonGroup,
   FormGrid,
   FormItem,
   Input,
+  NumberPicker,
   PreviewText,
   Select,
 } from '@formily/antd';
@@ -29,6 +31,7 @@ import { Store } from 'jetlinks-store';
 import { useParams } from 'umi';
 import Doc from '@/pages/Northbound/DuerOS/Detail/Doc';
 import _ from 'lodash';
+import FUpload from '@/components/Upload';
 
 const Save = () => {
   const SchemaField = createSchemaField({
@@ -99,7 +102,7 @@ const Save = () => {
             );
             const value = (field as Field).value;
 
-            const title = actions.find((item: any) => item.id === value)?.name;
+            const title = actions?.find((item: any) => item.id === value)?.name;
             f.setFieldState(actionPath, (state) => {
               state.componentProps = {
                 header: title || '动作映射',
@@ -122,7 +125,7 @@ const Save = () => {
               const product = field.query('id').value();
               const _functionList = findProductMetadata(product)?.functions;
               const _function =
-                _functionList && _functionList.find((item: any) => item.id === functionId);
+                _functionList && _functionList?.find((item: any) => item.id === functionId);
               form1.setFieldState(field.query('.inputs'), (state) => {
                 state.value = _function?.inputs.map((item: any) => ({
                   ...item,
@@ -141,7 +144,7 @@ const Save = () => {
               (index) => `propertyMappings.${index}`,
             );
             const value = (field as Field).value;
-            const title = propertiesList.find((item: any) => item.id === value)?.name;
+            const title = propertiesList?.find((item: any) => item.id === value)?.name;
             f.setFieldState(propertyMappingPath, (state) => {
               state.componentProps = {
                 header: title || '属性映射',
@@ -152,6 +155,39 @@ const Save = () => {
             const product = field.query('id').value();
             (field as Field).setDataSource(findProductMetadata(product)?.properties);
           });
+          onFieldReact('actionMappings.*.layout.command.message.inputs.*.valueType', (field) => {
+            const value = (field as Field).value;
+            const format = field.query('.value').take() as any;
+            if (!format) return;
+            switch (value) {
+              case 'date':
+                format.setComponent(DatePicker);
+                break;
+              case 'string':
+                format.setComponent(Input);
+                break;
+              case 'number':
+              case 'int':
+                format.setComponent(NumberPicker);
+                break;
+              case 'boolean':
+                format.setComponent(Select);
+                format.setDataSource([
+                  { label: '是', value: true },
+                  { label: '否', value: false },
+                ]);
+                break;
+              case 'file':
+                format.setComponent(FUpload, {
+                  type: 'file',
+                });
+                break;
+
+              case 'other':
+                format.setComponent(Input);
+                break;
+            }
+          });
         },
       }),
     [],
@@ -246,6 +282,10 @@ const Save = () => {
                 label: 'name',
                 value: 'id',
               },
+              showSearch: true,
+              showArrow: true,
+              filterOption: (input: string, option: any) =>
+                option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0,
             },
             'x-reactions': '{{useAsyncDataSource(getTypes)}}',
             required: true,

+ 23 - 2
src/pages/account/NotificationRecord/index.tsx

@@ -1,7 +1,7 @@
 import { useIntl } from '@/.umi/plugin-locale/localeExports';
 import PermissionButton from '@/components/PermissionButton';
 import SearchComponent from '@/components/SearchComponent';
-import { ReadOutlined, SearchOutlined } from '@ant-design/icons';
+import Icon, { SearchOutlined } from '@ant-design/icons';
 import { PageContainer } from '@ant-design/pro-layout';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
@@ -12,6 +12,7 @@ import Service from './service';
 import encodeQuery from '@/utils/encodeQuery';
 import { useDomFullHeight } from '@/hooks';
 import { onlyMessage } from '@/utils/util';
+import type { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon';
 
 export const service = new Service('notifications');
 
@@ -34,6 +35,25 @@ const NotificationRecord = () => {
     });
   }, []);
 
+  const ReadSvg = () => (
+    <svg
+      width="1em"
+      height="1em"
+      viewBox="0 0 24 24"
+      fill="none"
+      xmlns="http://www.w3.org/2000/svg"
+    >
+      <path
+        d="M12 18H6L2 22V2C2 2 2.9 2 4 2H20C21.1 2 22 2 22 2V11H20V4H4V16H12V18ZM23 14.34L21.59 12.93L17.35 17.17L15.23 15.05L13.82 16.46L17.34 20L23 14.34Z"
+        fill="currentColor"
+      />
+    </svg>
+  );
+
+  const ReadIcon = (props: Partial<CustomIconComponentProps>) => (
+    <Icon component={ReadSvg} {...props} />
+  );
+
   const columns: ProColumns<NotifitionRecord>[] = [
     {
       dataIndex: 'topicProvider',
@@ -112,7 +132,8 @@ const NotificationRecord = () => {
             },
           }}
         >
-          <ReadOutlined />
+          {/* <ReadOutlined /> */}
+          <ReadIcon />
         </PermissionButton>,
         <PermissionButton
           key={'action'}

+ 3 - 0
src/pages/account/NotificationRecord/mark_chat_read.svg

@@ -0,0 +1,3 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M12 18H6L2 22V2C2 2 2.9 2 4 2H20C21.1 2 22 2 22 2V11H20V4H4V16H12V18ZM23 14.34L21.59 12.93L17.35 17.17L15.23 15.05L13.82 16.46L17.34 20L23 14.34Z" fill="#323232"/>
+</svg>

+ 4 - 0
src/pages/cloud/DuerOS/typings.d.ts

@@ -36,6 +36,10 @@ type DuerOSItem = {
     text: string;
     value: string;
   };
+  state?: {
+    text: string;
+    value: string;
+  };
   actionMappings: ActionMapping[];
   propertyMappings: PropertyMapping[];
 } & BaseItem;

+ 2 - 2
src/pages/device/Alarm/index.tsx

@@ -1,12 +1,12 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import BaseService from '@/utils/BaseService';
 import { useRef } from 'react';
-import type { ProColumns, ActionType } from '@jetlinks/pro-table';
+import type { ActionType, ProColumns } from '@jetlinks/pro-table';
+import ProTable from '@jetlinks/pro-table';
 import moment from 'moment';
 import { Form, Input, Modal, Tag, Tooltip } from 'antd';
 import { CheckOutlined, EyeOutlined } from '@ant-design/icons';
 import { useIntl } from '@@/plugin-locale/localeExports';
-import ProTable from '@jetlinks/pro-table';
 import { request } from 'umi';
 import SystemConst from '@/utils/const';
 import { onlyMessage } from '@/utils/util';

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

@@ -1,13 +1,13 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import { useRef } from 'react';
-import type { ProColumns, ActionType } from '@jetlinks/pro-table';
+import type { ActionType, ProColumns } from '@jetlinks/pro-table';
+import ProTable from '@jetlinks/pro-table';
 import type { CommandItem } from '@/pages/device/Command/typings';
 import { Button, Tooltip } from 'antd';
 import moment from 'moment';
 import { EyeOutlined, PlusOutlined, SyncOutlined } from '@ant-design/icons';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import Service from '@/pages/device/Command/service';
-import ProTable from '@jetlinks/pro-table';
 import Create from '@/pages/device/Command/create';
 import encodeQuery from '@/utils/encodeQuery';
 import { model } from '@formily/reactive';

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

@@ -1,5 +1,6 @@
 import { PageContainer } from '@ant-design/pro-layout';
-import type { ProColumns, ActionType } from '@jetlinks/pro-table';
+import type { ActionType, ProColumns } from '@jetlinks/pro-table';
+import ProTable from '@jetlinks/pro-table';
 import { Button, Popconfirm, Tooltip } from 'antd';
 import moment from 'moment';
 import { useRef } from 'react';
@@ -7,7 +8,6 @@ import { useIntl } from '@@/plugin-locale/localeExports';
 import { EditOutlined, EyeOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons';
 import { Link } from 'umi';
 import { model } from '@formily/reactive';
-import ProTable from '@jetlinks/pro-table';
 import { observer } from '@formily/react';
 import type { FirmwareItem, TaskItem } from '@/pages/device/Firmware/typings';
 import Service from '@/pages/device/Firmware/service';

+ 29 - 28
src/pages/device/Instance/Detail/Config/index.tsx

@@ -143,34 +143,35 @@ const Config = () => {
       </div>
       <div>
         {(metadata || []).map((i) => (
-          <Descriptions
-            size="small"
-            column={3}
-            key={i.name}
-            bordered
-            title={<h4 style={{ fontSize: 15 }}>{i.name}</h4>}
-          >
-            {(i?.properties || []).map((item: any) => (
-              <Descriptions.Item
-                span={1}
-                label={
-                  item?.description ? (
-                    <div>
-                      <span style={{ marginRight: '10px' }}>{item.name}</span>
-                      <Tooltip title={item.description}>
-                        <QuestionCircleOutlined />
-                      </Tooltip>
-                    </div>
-                  ) : (
-                    item.name
-                  )
-                }
-                key={item.property}
-              >
-                {renderComponent(item)}
-              </Descriptions.Item>
-            ))}
-          </Descriptions>
+          <div key={i.name} style={{ marginBottom: 20 }}>
+            <Descriptions
+              size="small"
+              column={3}
+              bordered
+              title={<h4 style={{ fontSize: 15 }}>{i.name}</h4>}
+            >
+              {(i?.properties || []).map((item: any) => (
+                <Descriptions.Item
+                  span={1}
+                  label={
+                    item?.description ? (
+                      <div>
+                        <span style={{ marginRight: '10px' }}>{item.name}</span>
+                        <Tooltip title={item.description}>
+                          <QuestionCircleOutlined />
+                        </Tooltip>
+                      </div>
+                    ) : (
+                      item.name
+                    )
+                  }
+                  key={item.property}
+                >
+                  {renderComponent(item)}
+                </Descriptions.Item>
+              ))}
+            </Descriptions>
+          </div>
         ))}
       </div>
       {visible && (

+ 6 - 2
src/pages/device/Instance/Detail/MetadataMap/index.tsx

@@ -134,7 +134,6 @@ const MetadataMap = (props: Props) => {
           </span>
         );
       }
-
       if (!description) {
         return <EditableTable data={data} type={type} />;
       } else {
@@ -157,7 +156,12 @@ const MetadataMap = (props: Props) => {
   }, [props.type]);
 
   return (
-    <Card bordered={false} className="device-detail-metadataMap" style={{ minHeight }}>
+    <Card
+      bordered={false}
+      bodyStyle={{ padding: type === 'device' ? 24 : 0 }}
+      className="device-detail-metadataMap"
+      style={{ minHeight }}
+    >
       {renderComponent()}
     </Card>
   );

+ 1 - 0
src/pages/device/Instance/Detail/Running/Property/EditProperty.tsx

@@ -5,6 +5,7 @@ import { createSchemaField, FormProvider } from '@formily/react';
 import { service } from '@/pages/device/Instance';
 import { useParams } from 'umi';
 import type { PropertyMetadata } from '@/pages/device/Product/typings';
+import { onlyMessage } from '@/utils/util';
 
 interface Props {
   data: Partial<PropertyMetadata>;

+ 2 - 2
src/pages/device/Instance/Detail/Running/Property/Indicators.tsx

@@ -180,10 +180,10 @@ const Indicators = (props: Props) => {
       service.queryMetric(InstanceModel.detail.id || '', data.id || '').then((resp) => {
         if (resp.status === 200) {
           if ((resp?.result || []).length > 0) {
-            const list = resp.result.map((item: any) => {
+            const list = resp?.result.map((item: any) => {
               return {
                 ...item,
-                value: item.value.split(','),
+                value: Array.isArray(item?.value) ? item?.value : item?.value?.split(','),
               };
             });
             setMetrics(list);

+ 59 - 21
src/pages/device/Instance/Detail/Running/Property/index.tsx

@@ -1,9 +1,14 @@
-import { Col, Empty, Input, Pagination, Row, Space, Spin, Table } from 'antd';
+import { Col, Empty, Input, Pagination, Row, Space, Spin, Table, Tooltip } from 'antd';
 import CheckButton from '@/components/CheckButton';
 import { useCallback, useEffect, useRef, useState } from 'react';
 import type { PropertyMetadata } from '@/pages/device/Product/typings';
 import PropertyCard from './PropertyCard';
-import { EditOutlined, SyncOutlined, UnorderedListOutlined } from '@ant-design/icons';
+import {
+  ClockCircleOutlined,
+  EditOutlined,
+  SyncOutlined,
+  UnorderedListOutlined,
+} from '@ant-design/icons';
 import { InstanceModel, service } from '@/pages/device/Instance';
 import useSendWebsocketMessage from '@/hooks/websocket/useSendWebsocketMessage';
 import { map } from 'rxjs/operators';
@@ -14,6 +19,7 @@ import styles from './index.less';
 import { groupBy, throttle, toArray } from 'lodash';
 import PropertyTable from './PropertyTable';
 import { onlyMessage } from '@/utils/util';
+import Indicators from './Indicators';
 
 interface Props {
   data: Partial<PropertyMetadata>[];
@@ -44,6 +50,7 @@ const Property = (props: Props) => {
     pageSize: 8,
     currentPage: 0,
   });
+  const [indicatorVisible, setIndicatorVisible] = useState<boolean>(false);
   const [loading, setLoading] = useState<boolean>(true);
 
   const [check, setCheck] = useState<boolean>(true);
@@ -83,30 +90,53 @@ const Property = (props: Props) => {
       key: 'action',
       render: (text: any, record: any) => (
         <Space size="middle">
-          {(record.expands?.readOnly === false || record.expands?.readOnly === 'false') && (
+          {record.expands?.type?.includes('write') && (
+            <Tooltip placement="top" title="设置属性至设备">
+              <a
+                onClick={() => {
+                  setVisible(true);
+                }}
+              >
+                <EditOutlined />
+              </a>
+            </Tooltip>
+          )}
+          {(record.expands?.metrics || []).length > 0 &&
+            ['int', 'long', 'float', 'double', 'string', 'boolean', 'date'].includes(
+              record.valueType?.type || '',
+            ) && (
+              <Tooltip placement="top" title="指标">
+                <a
+                  onClick={() => {
+                    setIndicatorVisible(true);
+                    setCurrentInfo(record);
+                  }}
+                >
+                  <ClockCircleOutlined />
+                </a>
+              </Tooltip>
+            )}
+          {record.expands?.type?.includes('read') && (
+            <Tooltip placement="top" title="获取最新属性值">
+              <a
+                onClick={() => {
+                  refreshProperty(record?.id);
+                }}
+              >
+                <SyncOutlined />
+              </a>
+            </Tooltip>
+          )}
+          <Tooltip placement="top" title="详情">
             <a
               onClick={() => {
-                setVisible(true);
+                setCurrentInfo(record);
+                setInfoVisible(true);
               }}
             >
-              <EditOutlined />
+              <UnorderedListOutlined />
             </a>
-          )}
-          <a
-            onClick={() => {
-              refreshProperty(record?.id);
-            }}
-          >
-            <SyncOutlined />
-          </a>
-          <a
-            onClick={() => {
-              setCurrentInfo(record);
-              setInfoVisible(true);
-            }}
-          >
-            <UnorderedListOutlined />
-          </a>
+          </Tooltip>
         </Space>
       ),
     },
@@ -318,6 +348,14 @@ const Property = (props: Props) => {
         />
       )}
       {infoVisible && <PropertyLog data={currentInfo} close={() => setInfoVisible(false)} />}
+      {indicatorVisible && (
+        <Indicators
+          data={currentInfo}
+          onCancel={() => {
+            setIndicatorVisible(false);
+          }}
+        />
+      )}
     </div>
   );
 };

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

@@ -269,7 +269,7 @@ const Instance = () => {
         notActive: {
           text: intl.formatMessage({
             id: 'pages.device.instance.status.notActive',
-            defaultMessage: '未启用',
+            defaultMessage: '用',
           }),
           status: 'notActive',
         },

+ 1 - 0
src/pages/device/Product/Detail/Access/AccessConfig/index.tsx

@@ -129,6 +129,7 @@ const AccessConfig = (props: Props) => {
         <SearchComponent
           field={columns}
           enableSave={false}
+          model="simple"
           onSearch={(data: any) => {
             const dt = {
               pageSize: 4,

+ 80 - 64
src/pages/device/Product/Detail/index.tsx

@@ -33,6 +33,76 @@ const ProductDetail = observer(() => {
   const location = useLocation();
   const history = useHistory();
 
+  const initList = [
+    {
+      key: 'base',
+      tab: intl.formatMessage({
+        id: 'pages.device.productDetail.base',
+        defaultMessage: '配置信息',
+      }),
+      component: (
+        <BaseInfo
+          onJump={(type) => {
+            if (type) {
+              setMode(type);
+            }
+          }}
+        />
+      ),
+    },
+    {
+      key: 'metadata',
+      tab: (
+        <>
+          {intl.formatMessage({
+            id: 'pages.device.instanceDetail.metadata',
+            defaultMessage: '物模型',
+          })}
+          <Tooltip
+            title={
+              <>
+                属性:
+                <br />
+                用于描述设备运行时具体信息和状态。
+                <br />
+                功能:
+                <br />
+                指设备可供外部调用的指令或方法。
+                <br />
+                事件:
+                <br />
+                设备运行时,主动上报给云端的信息。
+                <br />
+                标签:
+                <br />
+                统一为设备添加拓展字段,添加后将在设备信息页显示。
+              </>
+            }
+          >
+            <QuestionCircleOutlined style={{ marginLeft: 5 }} />
+          </Tooltip>
+        </>
+      ),
+      component: <Metadata type="product" />,
+    },
+    {
+      key: 'access',
+      tab: '设备接入',
+      component: <Access />,
+    },
+  ];
+
+  const pList = [
+    'websocket-server',
+    'http-server-gateway',
+    'udp-device-gateway',
+    'coap-server-gateway',
+    'mqtt-client-gateway',
+    'mqtt-server-gateway',
+    'tcp-server-gateway',
+  ];
+  const [list, setList] = useState<any[]>([...initList]);
+
   const { minHeight } = useDomFullHeight('.product-detail-body');
 
   const { permission } = PermissionButton.usePermission('device/Product');
@@ -74,6 +144,16 @@ const ProductDetail = observer(() => {
         const metadata: DeviceMetadata = JSON.parse(data.metadata);
         MetadataAction.insert(metadata);
       }
+      if (data?.accessProvider && pList.includes(data?.accessProvider)) {
+        setList([
+          ...initList,
+          {
+            key: 'metadata-map',
+            tab: '物模型映射',
+            component: <MetadataMap type="product" />,
+          },
+        ]);
+      }
       service.instanceCount(encodeQuery({ terms: { productId: param?.id } })).then((res: any) => {
         if (res.status === 200) {
           productModel.current = { ...data, count: res.result };
@@ -146,70 +226,6 @@ const ProductDetail = observer(() => {
     return subscription.unsubscribe;
   }, [changeDeploy, param.id]);
 
-  const list = [
-    {
-      key: 'base',
-      tab: intl.formatMessage({
-        id: 'pages.device.productDetail.base',
-        defaultMessage: '配置信息',
-      }),
-      component: (
-        <BaseInfo
-          onJump={(type) => {
-            if (type) {
-              setMode(type);
-            }
-          }}
-        />
-      ),
-    },
-    {
-      key: 'metadata',
-      tab: (
-        <>
-          {intl.formatMessage({
-            id: 'pages.device.instanceDetail.metadata',
-            defaultMessage: '物模型',
-          })}
-          <Tooltip
-            title={
-              <>
-                属性:
-                <br />
-                用于描述设备运行时具体信息和状态。
-                <br />
-                功能:
-                <br />
-                指设备可供外部调用的指令或方法。
-                <br />
-                事件:
-                <br />
-                设备运行时,主动上报给云端的信息。
-                <br />
-                标签:
-                <br />
-                统一为设备添加拓展字段,添加后将在设备信息页显示。
-              </>
-            }
-          >
-            <QuestionCircleOutlined style={{ marginLeft: 5 }} />
-          </Tooltip>
-        </>
-      ),
-      component: <Metadata type="product" />,
-    },
-    {
-      key: 'access',
-      tab: '设备接入',
-      component: <Access />,
-    },
-    {
-      key: 'metadata-map',
-      tab: '物模型映射',
-      component: <MetadataMap type="product" />,
-    },
-  ];
-
   useEffect(() => {
     const { state } = location;
     if (state && state?.tab) {

+ 30 - 16
src/pages/link/AccessConfig/Detail/Access/index.tsx

@@ -11,7 +11,7 @@ import TitleComponent from '@/components/TitleComponent';
 import { PermissionButton } from '@/components';
 import { useDomFullHeight } from '@/hooks';
 import { onlyMessage } from '@/utils/util';
-import { MetworkTypeMapping, ProcotoleMapping, descriptionList } from './data';
+import { descriptionList, MetworkTypeMapping, ProcotoleMapping } from './data';
 
 interface Props {
   change: () => void;
@@ -307,22 +307,36 @@ const Access = (props: Props) => {
                         </Tooltip>
                       </div>
                       <div className={styles.cardContent}>
-                        <div
-                          style={{
-                            width: '100%',
-                            height: '20px',
-                            display: 'flex',
-                            flexDirection: 'column',
-                            alignItems: 'center',
-                            justifyContent: 'center',
-                          }}
-                        >
-                          {item.addresses.slice(0, 1).map((i: any) => (
-                            <div className={styles.item} key={i.address}>
-                              <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
+                        <Tooltip
+                          placement="topLeft"
+                          title={
+                            <div>
+                              {[...item.addresses].map((i: any) => (
+                                <div key={i.address}>
+                                  <Badge color={i.health === -1 ? 'red' : 'green'} />
+                                  {i.address}
+                                </div>
+                              ))}
                             </div>
-                          ))}
-                        </div>
+                          }
+                        >
+                          <div
+                            style={{
+                              width: '100%',
+                              height: '20px',
+                              display: 'flex',
+                              flexDirection: 'column',
+                              alignItems: 'center',
+                              justifyContent: 'center',
+                            }}
+                          >
+                            {item.addresses.slice(0, 1).map((i: any) => (
+                              <div className={styles.item} key={i.address}>
+                                <Badge color={i.health === -1 ? 'red' : 'green'} text={i.address} />
+                              </div>
+                            ))}
+                          </div>
+                        </Tooltip>
                         <div className={styles.desc}>
                           <Tooltip
                             placement="topLeft"

+ 142 - 126
src/pages/link/AccessConfig/index.tsx

@@ -8,7 +8,7 @@ import { useHistory } from 'umi';
 import Service from './service';
 import { DeleteOutlined, EditOutlined, PlayCircleOutlined, StopOutlined } from '@ant-design/icons';
 import AccessConfigCard from '@/components/ProTableCard/CardItems/AccessConfig';
-import { PermissionButton, Empty } from '@/components';
+import { Empty, PermissionButton } from '@/components';
 import { useDomFullHeight } from '@/hooks';
 import { Store } from 'jetlinks-store';
 import { onlyMessage } from '@/utils/util';
@@ -20,7 +20,7 @@ const AccessConfig = () => {
   const [param, setParam] = useState<any>({ pageSize: 10, terms: [] });
   const { permission } = PermissionButton.usePermission('link/AccessConfig');
 
-  const { minHeight } = useDomFullHeight(`.link-accessConfig`);
+  const { minHeight } = useDomFullHeight(`.link-accessConfig`, 36);
 
   const columns: ProColumns<any>[] = [
     {
@@ -102,133 +102,149 @@ const AccessConfig = () => {
           handleSearch(dt);
         }}
       />
-      <Card className={'link-accessConfig'} style={{ minHeight }}>
-        <div style={{ width: '100%', display: 'flex', justifyContent: 'flex-start' }}>
-          <PermissionButton
-            isPermission={permission.add}
-            onClick={() => {
-              history.push(`${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}`);
-            }}
-            key="button"
-            type="primary"
-          >
-            新增
-          </PermissionButton>
-        </div>
-        {dataSource?.data.length > 0 ? (
-          <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
-            {(dataSource?.data || []).map((item: any) => (
-              <Col key={item.id} span={12}>
-                <AccessConfigCard
-                  {...item}
-                  actions={[
-                    <PermissionButton
-                      isPermission={permission.update}
-                      onClick={() => {
-                        history.push(
-                          `${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}?id=${
-                            item.id
-                          }`,
-                        );
-                      }}
-                      key="button"
-                      type="link"
-                    >
-                      <EditOutlined />
-                      编辑
-                    </PermissionButton>,
-                    <PermissionButton
-                      type={'link'}
-                      key={'state'}
-                      style={{ padding: 0 }}
-                      popConfirm={{
-                        title: `确认${item.state.value !== 'disabled' ? '禁用' : '启用'}`,
-                        onConfirm: () => {
-                          if (item.state.value !== 'disabled') {
-                            service.shutDown(item.id).then((resp) => {
-                              if (resp.status === 200) {
-                                onlyMessage('操作成功!');
-                                handleSearch(param);
-                              }
-                            });
-                          } else {
-                            service.startUp(item.id).then((resp) => {
-                              if (resp.status === 200) {
-                                onlyMessage('操作成功!');
-                                handleSearch(param);
+      <Card>
+        <div style={{ position: 'relative', minHeight }} className={'link-accessConfig'}>
+          <div style={{ height: '100%', paddingBottom: 48 }}>
+            <div style={{ width: '100%', display: 'flex', justifyContent: 'flex-start' }}>
+              <PermissionButton
+                isPermission={permission.add}
+                onClick={() => {
+                  history.push(`${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}`);
+                }}
+                key="button"
+                type="primary"
+              >
+                新增
+              </PermissionButton>
+            </div>
+            {dataSource?.data.length > 0 ? (
+              <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
+                {(dataSource?.data || []).map((item: any) => (
+                  <Col key={item.id} span={12}>
+                    <AccessConfigCard
+                      {...item}
+                      actions={[
+                        <PermissionButton
+                          isPermission={permission.update}
+                          onClick={() => {
+                            history.push(
+                              `${getMenuPathByCode(MENUS_CODE['link/AccessConfig/Detail'])}?id=${
+                                item.id
+                              }`,
+                            );
+                          }}
+                          key="button"
+                          type="link"
+                        >
+                          <EditOutlined />
+                          编辑
+                        </PermissionButton>,
+                        <PermissionButton
+                          type={'link'}
+                          key={'state'}
+                          style={{ padding: 0 }}
+                          popConfirm={{
+                            title: `确认${item.state.value !== 'disabled' ? '禁用' : '启用'}`,
+                            onConfirm: () => {
+                              if (item.state.value !== 'disabled') {
+                                service.shutDown(item.id).then((resp) => {
+                                  if (resp.status === 200) {
+                                    onlyMessage('操作成功!');
+                                    handleSearch(param);
+                                  }
+                                });
+                              } else {
+                                service.startUp(item.id).then((resp) => {
+                                  if (resp.status === 200) {
+                                    onlyMessage('操作成功!');
+                                    handleSearch(param);
+                                  }
+                                });
                               }
-                            });
-                          }
-                        },
-                      }}
-                      isPermission={permission.action}
-                      tooltip={{
-                        title: item.state.value !== 'disabled' ? '禁用' : '启用',
-                      }}
-                    >
-                      {item.state.value !== 'disabled' ? <StopOutlined /> : <PlayCircleOutlined />}
-                      {item.state.value !== 'disabled' ? '禁用' : '启用'}
-                    </PermissionButton>,
-                    <PermissionButton
-                      isPermission={permission.delete}
-                      disabled={item.state.value !== 'disabled'}
-                      tooltip={{
-                        title: item.state.value !== 'disabled' ? '请先禁用,再删除' : '',
-                      }}
-                      popConfirm={{
-                        title: '确认删除',
-                        disabled: item.state.value !== 'disabled',
-                        onConfirm: () => {
-                          service.remove(item.id).then((resp: any) => {
-                            if (resp.status === 200) {
-                              onlyMessage('操作成功!');
-                              handleSearch(param);
-                            } else {
-                              onlyMessage(resp?.message || '操作失败', 'error');
-                            }
-                          });
-                        },
-                      }}
-                      key="delete"
-                      type="link"
-                    >
-                      <DeleteOutlined />
-                    </PermissionButton>,
-                  ]}
-                />
-              </Col>
-            ))}
-          </Row>
-        ) : (
-          <div style={{ height: minHeight - 150 }}>
-            <Empty />
+                            },
+                          }}
+                          isPermission={permission.action}
+                          tooltip={{
+                            title: item.state.value !== 'disabled' ? '禁用' : '启用',
+                          }}
+                        >
+                          {item.state.value !== 'disabled' ? (
+                            <StopOutlined />
+                          ) : (
+                            <PlayCircleOutlined />
+                          )}
+                          {item.state.value !== 'disabled' ? '禁用' : '启用'}
+                        </PermissionButton>,
+                        <PermissionButton
+                          isPermission={permission.delete}
+                          disabled={item.state.value !== 'disabled'}
+                          tooltip={{
+                            title: item.state.value !== 'disabled' ? '请先禁用,再删除' : '',
+                          }}
+                          popConfirm={{
+                            title: '确认删除',
+                            disabled: item.state.value !== 'disabled',
+                            onConfirm: () => {
+                              service.remove(item.id).then((resp: any) => {
+                                if (resp.status === 200) {
+                                  onlyMessage('操作成功!');
+                                  handleSearch(param);
+                                } else {
+                                  onlyMessage(resp?.message || '操作失败', 'error');
+                                }
+                              });
+                            },
+                          }}
+                          key="delete"
+                          type="link"
+                        >
+                          <DeleteOutlined />
+                        </PermissionButton>,
+                      ]}
+                    />
+                  </Col>
+                ))}
+              </Row>
+            ) : (
+              <div style={{ height: minHeight - 150 }}>
+                <Empty />
+              </div>
+            )}
           </div>
-        )}
-        {dataSource.data.length > 0 && (
-          <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-            <Pagination
-              showSizeChanger
-              size="small"
-              className={'pro-table-card-pagination'}
-              total={dataSource?.total || 0}
-              current={dataSource?.pageIndex + 1}
-              onChange={(page, size) => {
-                handleSearch({
-                  ...param,
-                  pageIndex: page - 1,
-                  pageSize: size,
-                });
-              }}
-              pageSizeOptions={[10, 20, 50, 100]}
-              pageSize={dataSource?.pageSize}
-              showTotal={(num) => {
-                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+          {dataSource.data.length > 0 && (
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'flex-end',
+                position: 'absolute',
+                width: '100%',
+                bottom: 0,
               }}
-            />
-          </div>
-        )}
+            >
+              <Pagination
+                showSizeChanger
+                size="small"
+                className={'pro-table-card-pagination'}
+                total={dataSource?.total || 0}
+                current={dataSource?.pageIndex + 1}
+                onChange={(page, size) => {
+                  handleSearch({
+                    ...param,
+                    pageIndex: page - 1,
+                    pageSize: size,
+                  });
+                }}
+                pageSizeOptions={[10, 20, 50, 100]}
+                pageSize={dataSource?.pageSize}
+                showTotal={(num) => {
+                  const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
+                  const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
+                  return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+                }}
+              />
+            </div>
+          )}
+        </div>
       </Card>
     </PageContainer>
   );

+ 1 - 1
src/pages/link/Channel/Opcua/Save/index.tsx

@@ -1,4 +1,5 @@
 import { useIntl } from 'umi';
+import type { Field } from '@formily/core';
 import { createForm } from '@formily/core';
 import { createSchemaField } from '@formily/react';
 import { Form, FormGrid, FormItem, Input, Select } from '@formily/antd';
@@ -8,7 +9,6 @@ import { Modal } from '@/components';
 import { useMemo } from 'react';
 import { action } from '@formily/reactive';
 import type { Response } from '@/utils/typings';
-import type { Field } from '@formily/core';
 import { onlyMessage } from '@/utils/util';
 
 interface Props {

+ 3 - 3
src/pages/link/Protocol/index.tsx

@@ -261,10 +261,10 @@ const Protocol = () => {
                 type={'link'}
                 style={{ padding: 0 }}
                 tooltip={{
-                  title: record.state === 1 ? '撤销' : '发布',
+                  title: record.state === 1 ? '禁用' : '启用',
                 }}
                 popConfirm={{
-                  title: `确认${record.state === 1 ? '撤销' : '发布'}`,
+                  title: `确认${record.state === 1 ? '禁用' : '启用'}`,
                   onConfirm: () => {
                     if (record.state === 1) {
                       modifyState(record.id, 'un-deploy');
@@ -275,7 +275,7 @@ const Protocol = () => {
                 }}
               >
                 {record.state === 1 ? <StopOutlined /> : <PlayCircleOutlined />}
-                {record.state === 1 ? '撤销' : '发布'}
+                {record.state === 1 ? '禁用' : '启用'}
               </PermissionButton>,
               <PermissionButton
                 isPermission={permission.delete}

+ 4 - 6
src/pages/link/Protocol/save/index.tsx

@@ -8,9 +8,9 @@ import type { ISchema } from '@formily/json-schema';
 import { service } from '@/pages/link/Protocol';
 import FileUpload from '../FileUpload';
 import type { ProtocolItem } from '@/pages/link/Protocol/typings';
-import { PermissionButton } from '@/components';
-import { RadioCard } from '@/components';
+import { PermissionButton, RadioCard } from '@/components';
 import { onlyMessage } from '@/utils/util';
+
 interface Props {
   data: ProtocolItem | undefined;
   close: () => void;
@@ -138,7 +138,6 @@ const Save = (props: Props) => {
             'x-disabled': !!props.data?.id,
             'x-decorator-props': {
               gridSpan: 2,
-              tooltip: <div>jar:上传协议jar包,文件格式支持.jar或.zip</div>,
             },
             'x-component-props': {
               model: 'singular',
@@ -179,9 +178,6 @@ const Save = (props: Props) => {
                 'x-visible': false,
                 'x-decorator-props': {
                   gridSpan: 2,
-                  tooltip: (
-                    <div>local:填写本地协议编译目录绝对地址,如:d:/protocol/target/classes</div>
-                  ),
                 },
                 'x-validator': [
                   {
@@ -197,6 +193,8 @@ const Save = (props: Props) => {
                       componentType: '{{$deps[0]==="jar"?"FileUpload":"Input"}}',
                       componentProps:
                         '{{$deps[0]==="jar"?{type:"file", accept: ".jar, .zip"}:{placeholder: "请输入文件地址"}}}',
+                      decoratorProps:
+                        '{{$deps[0]!=="jar"?{gridSpan:"2",tooltip:"local:填写本地协议编译目录绝对地址,如:d:/protocol/target/classes"}:{gridSpan:"2",tooltip:"jar:上传协议jar包,文件格式支持.jar或.zip"}}}',
                     },
                   },
                 },

+ 1 - 1
src/pages/link/Type/Detail/index.tsx

@@ -282,7 +282,7 @@ const Save = observer(() => {
         'x-decorator': 'FormItem',
         'x-component': 'Select',
         'x-component-props': {
-          placeholder: '请输入本地端口',
+          placeholder: '请选择本地端口',
         },
         'x-reactions': {
           dependencies: ['type'],

+ 11 - 6
src/pages/link/Type/index.tsx

@@ -92,25 +92,30 @@ const Network = () => {
       dataIndex: 'configuration',
       title: '详情',
       ellipsis: true,
+      hideInSearch: true,
       renderText: (text, record) => {
         if (record.shareCluster) {
-          const publicHost = record.configuration.publicHost;
-          const publicPort = record.configuration.publicPort;
-          return publicHost ? (
+          const host = record.configuration.publicHost || record.configuration.remoteHost;
+          const port = record.configuration.publicPort || record.configuration.remotePort;
+          return host ? (
             <>
               {networkMap[record.type]}
-              {publicHost}:{publicPort}
+              {host}:{port}
             </>
           ) : null;
         } else {
           const log = record.cluster?.map(
-            (item) => `${item.configuration.publicHost}:${item.configuration.publicPort}`,
+            (item) =>
+              `${item.configuration.publicHost || record.configuration.remoteHost}:${
+                item.configuration.publicPort || record.configuration.remotePort
+              }`,
           );
           return (
             <>
               {log.map((item) => (
                 <div key={item}>
-                  `${networkMap[record.type]}${item}`
+                  {networkMap[record.type]}
+                  {item}
                 </div>
               ))}
             </>

+ 2 - 2
src/pages/media/Cascade/Save/index.tsx

@@ -2,10 +2,12 @@ import TitleComponent from '@/components/TitleComponent';
 import { InfoCircleFilled, QuestionCircleOutlined } from '@ant-design/icons';
 import { PageContainer } from '@ant-design/pro-layout';
 import {
+  Alert,
   Button,
   Card,
   Col,
   Form,
+  Image,
   Input,
   InputNumber,
   message,
@@ -13,8 +15,6 @@ import {
   Row,
   Select,
   Tooltip,
-  Image,
-  Alert,
 } from 'antd';
 import SipComponent from '@/components/SipComponent';
 import SipSelectComponent from '@/components/SipSelectComponent';

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

@@ -169,11 +169,11 @@ const Cascade = () => {
       valueType: 'select',
       valueEnum: {
         disabled: {
-          text: '已停止',
+          text: '禁用',
           status: 'disabled',
         },
         enabled: {
-          text: '已启动',
+          text: '正常',
           status: 'enabled',
         },
       },

+ 1 - 1
src/pages/media/Device/Channel/index.tsx

@@ -12,8 +12,8 @@ import { Button, message, Popconfirm, Tooltip } from 'antd';
 import {
   DeleteOutlined,
   EditOutlined,
-  PlusOutlined,
   LeftOutlined,
+  PlusOutlined,
   VideoCameraAddOutlined,
   VideoCameraOutlined,
 } from '@ant-design/icons';

+ 119 - 102
src/pages/media/Stream/index.tsx

@@ -26,7 +26,7 @@ const Stream = () => {
   const [param, setParam] = useState<any>({ pageSize: 10, terms: [] });
   const permissionCode = 'media/Stream';
   const { permission } = PermissionButton.usePermission(permissionCode);
-  const { minHeight } = useDomFullHeight(`.stream`);
+  const { minHeight } = useDomFullHeight(`.stream`, 36);
 
   const columns: ProColumns<StreamItem>[] = [
     {
@@ -77,108 +77,125 @@ const Stream = () => {
           });
         }}
       />
-      <Card className="stream" style={{ minHeight }}>
-        {dataSource.data.length > 0 ? (
-          <>
-            <PermissionButton
-              isPermission={permission.add}
-              onClick={() => {
-                history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
-                StreamModel.current = {};
-              }}
-              key="button"
-              icon={<PlusOutlined />}
-              type="primary"
-            >
-              新增
-            </PermissionButton>
-            <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
-              {(dataSource?.data || []).map((item: any) => (
-                <Col key={item.id} span={12}>
-                  <StreamCard
-                    {...item}
-                    actions={[
-                      <PermissionButton
-                        isPermission={permission.update}
-                        onClick={() => {
-                          history.push(
-                            `${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'], item.id)}`,
-                          );
-                          StreamModel.current = { ...item };
-                        }}
-                        key="button"
-                        type="link"
-                      >
-                        <EditOutlined />
-                        编辑
-                      </PermissionButton>,
-                      <PermissionButton
-                        isPermission={permission.delete}
-                        popConfirm={{
-                          title: '确认删除',
-                          onConfirm: () => {
-                            service.remove(item.id).then((resp: any) => {
-                              if (resp.status === 200) {
-                                onlyMessage('操作成功!');
-                                handleSearch({ pageSize: 10, terms: [] });
-                              }
-                            });
-                          },
-                        }}
-                        key="delete"
-                        type="link"
-                      >
-                        <DeleteOutlined />
-                      </PermissionButton>,
-                    ]}
-                  />
-                </Col>
-              ))}
-            </Row>
-            <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-              <Pagination
-                showSizeChanger
-                size="small"
-                className={'pro-table-card-pagination'}
-                total={dataSource?.total || 0}
-                current={dataSource?.pageIndex + 1}
-                onChange={(page, size) => {
-                  handleSearch({
-                    ...param,
-                    pageIndex: page - 1,
-                    pageSize: size,
-                  });
-                }}
-                pageSizeOptions={[10, 20, 50, 100]}
-                pageSize={dataSource?.pageSize}
-                showTotal={(num) => {
-                  const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                  const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                  return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
-                }}
+      <Card>
+        <div className="stream" style={{ position: 'relative', minHeight }}>
+          <div style={{ height: '100%', paddingBottom: 48 }}>
+            {dataSource.data.length > 0 ? (
+              <div>
+                <div>
+                  <PermissionButton
+                    isPermission={permission.add}
+                    onClick={() => {
+                      history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
+                      StreamModel.current = {};
+                    }}
+                    key="button"
+                    icon={<PlusOutlined />}
+                    type="primary"
+                  >
+                    新增
+                  </PermissionButton>
+                  <Row gutter={[16, 16]} style={{ marginTop: 10 }}>
+                    {(dataSource?.data || []).map((item: any) => (
+                      <Col key={item.id} span={12}>
+                        <StreamCard
+                          {...item}
+                          actions={[
+                            <PermissionButton
+                              isPermission={permission.update}
+                              onClick={() => {
+                                history.push(
+                                  `${getMenuPathByParams(
+                                    MENUS_CODE['media/Stream/Detail'],
+                                    item.id,
+                                  )}`,
+                                );
+                                StreamModel.current = { ...item };
+                              }}
+                              key="button"
+                              type="link"
+                            >
+                              <EditOutlined />
+                              编辑
+                            </PermissionButton>,
+                            <PermissionButton
+                              isPermission={permission.delete}
+                              popConfirm={{
+                                title: '确认删除',
+                                onConfirm: () => {
+                                  service.remove(item.id).then((resp: any) => {
+                                    if (resp.status === 200) {
+                                      onlyMessage('操作成功!');
+                                      handleSearch({ pageSize: 10, terms: [] });
+                                    }
+                                  });
+                                },
+                              }}
+                              key="delete"
+                              type="link"
+                            >
+                              <DeleteOutlined />
+                            </PermissionButton>,
+                          ]}
+                        />
+                      </Col>
+                    ))}
+                  </Row>
+                </div>
+              </div>
+            ) : (
+              <Empty
+                style={{ marginTop: '10%' }}
+                description={
+                  <span>
+                    暂无数据,请先
+                    <Button
+                      type="link"
+                      disabled={getButtonPermission('media/Stream', ['add'])}
+                      onClick={() => {
+                        history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
+                        StreamModel.current = {};
+                      }}
+                    >
+                      新增流媒体服务
+                    </Button>
+                  </span>
+                }
               />
-            </div>
-          </>
-        ) : (
-          <Empty
-            style={{ marginTop: '10%' }}
-            description={
-              <span>
-                暂无数据,请先
-                <Button
-                  type="link"
-                  disabled={getButtonPermission('media/Stream', ['add'])}
-                  onClick={() => {
-                    history.push(`${getMenuPathByParams(MENUS_CODE['media/Stream/Detail'])}`);
-                    StreamModel.current = {};
-                  }}
-                >
-                  新增流媒体服务
-                </Button>
-              </span>
-            }
-          />
-        )}
+            )}
+          </div>
+          <div
+            style={{
+              display: 'flex',
+              justifyContent: 'flex-end',
+              position: 'absolute',
+              bottom: 0,
+              width: '100%',
+            }}
+          >
+            <Pagination
+              showSizeChanger
+              size="small"
+              className={'pro-table-card-pagination'}
+              total={dataSource?.total || 0}
+              current={dataSource?.pageIndex + 1}
+              onChange={(page, size) => {
+                handleSearch({
+                  ...param,
+                  pageIndex: page - 1,
+                  pageSize: size,
+                });
+              }}
+              pageSizeOptions={[10, 20, 50, 100]}
+              pageSize={dataSource?.pageSize}
+              showTotal={(num) => {
+                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
+                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
+                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+              }}
+            />
+          </div>
+        </div>
       </Card>
     </PageContainer>
   );

+ 49 - 0
src/pages/notice/Config/index.tsx

@@ -42,6 +42,53 @@ export const state = model<{
   log: false,
   syncUser: false,
 });
+const list = {
+  weixin: {
+    corpMessage: {
+      text: '企业消息',
+      status: 'corpMessage',
+    },
+    // officialMessage: {
+    //   text: '服务号消息',
+    //   status: 'officialMessage',
+    // },
+  },
+  dingTalk: {
+    dingTalkMessage: {
+      text: '钉钉消息',
+      status: 'dingTalkMessage',
+    },
+    dingTalkRobotWebHook: {
+      text: '群机器人消息',
+      status: 'dingTalkRobotWebHook',
+    },
+  },
+  voice: {
+    aliyun: {
+      text: '阿里云语音',
+      status: 'aliyun',
+    },
+  },
+  sms: {
+    aliyunSms: {
+      text: '阿里云短信',
+      status: 'aliyunSms',
+    },
+  },
+  email: {
+    embedded: {
+      text: '默认',
+      status: 'embedded',
+    },
+  },
+  webhook: {
+    http: {
+      text: 'Webhook',
+      status: 'http',
+    },
+  },
+};
+
 const Config = observer(() => {
   const intl = useIntl();
   const actionRef = useRef<ActionType>();
@@ -62,6 +109,8 @@ const Config = observer(() => {
       dataIndex: 'provider',
       title: '通知方式',
       renderText: (text, record) => typeList[record.type][record.provider],
+      valueType: 'select',
+      valueEnum: list[id],
     },
     {
       dataIndex: 'description',

+ 31 - 22
src/pages/notice/Template/Debug/index.tsx

@@ -102,7 +102,6 @@ const Debug = observer(() => {
     // 从后端接口来获取变量参数
     service.getVariableDefinitions(state.current?.id || '').then((resp) => {
       const _template = resp.result;
-      console.log(resp, 'userEfffect', state.current);
       if (_template?.variableDefinitions?.length > 0) {
         variableRef.current = _template?.variableDefinitions;
         form.setFieldState('variableDefinitions', (state1) => {
@@ -215,6 +214,7 @@ const Debug = observer(() => {
               'x-component-props': { title: '值', width: '120px' },
               properties: {
                 value: {
+                  required: true,
                   type: 'string',
                   'x-decorator': 'FormItem',
                   'x-component': 'Input',
@@ -236,27 +236,36 @@ const Debug = observer(() => {
   const [spinning, setSpinning] = useState<boolean>(false);
   const start = async () => {
     setSpinning(true);
-    const data: { configId: string; variableDefinitions: any } = await form.submit();
-    // 应该取选择的配置信息
-    if (!state.current) return;
-    const resp = await service.debug(
-      data.configId,
-      state?.current.id,
-      data.variableDefinitions?.reduce(
-        (previousValue: any, currentValue: { id: any; value: any }) => {
-          return {
-            ...previousValue,
-            [currentValue.id]: currentValue.value,
-          };
-        },
-        {},
-      ),
-    );
-    if (resp.status === 200) {
-      onlyMessage('操作成功!');
-      setSpinning(false);
-      state.debug = false;
-    }
+    // const data: { configId: string; variableDefinitions: any } = await form.submit();
+    form
+      .submit()
+      .then(async (data: any) => {
+        // 应该取选择的配置信息
+        if (!state.current) return;
+        const resp = await service.debug(
+          data.configId,
+          state?.current.id,
+          data.variableDefinitions?.reduce(
+            (previousValue: any, currentValue: { id: any; value: any }) => {
+              return {
+                ...previousValue,
+                [currentValue.id]: currentValue.value,
+              };
+            },
+            {},
+          ),
+        );
+        if (resp.status === 200) {
+          onlyMessage('操作成功!');
+          setSpinning(false);
+          state.debug = false;
+        } else {
+          setSpinning(false);
+        }
+      })
+      .catch(() => {
+        setSpinning(false);
+      });
   };
   return (
     <Modal

+ 4 - 4
src/pages/notice/Template/index.tsx

@@ -45,10 +45,10 @@ const list = {
       text: '企业消息',
       status: 'corpMessage',
     },
-    officialMessage: {
-      text: '服务号消息',
-      status: 'officialMessage',
-    },
+    // officialMessage: {
+    //   text: '服务号消息',
+    //   status: 'officialMessage',
+    // },
   },
   dingTalk: {
     dingTalkMessage: {

+ 3 - 9
src/pages/rule-engine/Alarm/Configuration/Save/index.tsx

@@ -140,6 +140,8 @@ const Save = (props: Props) => {
     }
   };
 
+  const { permission } = PermissionButton.usePermission('rule-engine/Scene');
+
   const schema: ISchema = {
     type: 'object',
     properties: {
@@ -234,20 +236,12 @@ const Save = (props: Props) => {
             <PermissionButton
               type="link"
               style={{ padding: 0 }}
-              isPermission={true}
+              isPermission={permission.add}
               onClick={() => {
                 const tab: any = window.open(`${origin}/#/iot/rule-engine/scene/Save`);
                 tab!.onTabSaveSuccess = (value: any) => {
                   form.setFieldState('sceneId', async (state) => {
                     state.dataSource = await getScene();
-                    // .then((resp) =>
-                    //   resp.result?.map((item: Record<string, unknown>) => ({
-                    //     ...item,
-                    //     label: item.name,
-                    //     value: item.id,
-                    //   })),
-                    // );
-                    console.log(value, 'value');
                     state.value = value?.result?.id;
                   });
                 };

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

@@ -105,9 +105,26 @@ const Configuration = () => {
     {
       title: '状态',
       dataIndex: 'state',
+      valueType: 'select',
       renderText: (state) => (
         <Badge text={state?.text} status={state?.value === 'disabled' ? 'error' : 'success'} />
       ),
+      valueEnum: {
+        disabled: {
+          text: intl.formatMessage({
+            id: 'pages.device.product.status.disabled',
+            defaultMessage: '禁用',
+          }),
+          status: 'disabled',
+        },
+        enabled: {
+          text: intl.formatMessage({
+            id: 'pages.device.product.status.enabled',
+            defaultMessage: '正常',
+          }),
+          status: 'enabled',
+        },
+      },
     },
     {
       title: '说明',

+ 0 - 181
src/pages/rule-engine/Alarm/Log/TabComponent/index copy.less

@@ -1,181 +0,0 @@
-@import '~antd/es/style/themes/default.less';
-
-@alarm-log-padding-left: 60px;
-
-.ellipsis {
-  width: 100%;
-  overflow: hidden;
-  white-space: nowrap;
-  text-overflow: ellipsis;
-}
-
-.alarm-log-card {
-  .alarm-log-item {
-    display: flex;
-    margin-bottom: 20px;
-
-    .alarm-log-title {
-      position: relative;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      width: 15%;
-      padding: 10px;
-      overflow: hidden;
-      color: @primary-color;
-      background-color: #f0f2f3;
-      .alarm-log-level {
-        position: absolute;
-        top: 10px;
-        right: -12px;
-        display: flex;
-        justify-content: center;
-        width: 100px;
-        padding: 2px 0;
-        color: white;
-        background-color: red;
-        transform: skewX(45deg);
-        .alarm-log-text {
-          transform: skewX(-45deg);
-        }
-      }
-      .alarm-log-title-text {
-        margin: 0 10px;
-        .ellipsis();
-      }
-    }
-    .alarm-log-content {
-      display: flex;
-      align-items: center;
-      justify-content: space-between;
-      width: 87%;
-      padding: 20px;
-      background: url('/images/alarm/background.png') no-repeat;
-      background-size: 100% 100%;
-
-      .alarm-log-data {
-        display: flex;
-        align-items: center;
-        min-width: 60%;
-        max-width: 100%;
-
-        .alarm-log-image {
-          display: flex;
-          align-items: center;
-          padding-right: @alarm-log-padding-left;
-          border-right: 1px solid rgba(0, 0, 0, 0.09);
-
-          .alarm-type {
-            width: 40px;
-
-            .name {
-              color: #000;
-              font-size: 18px;
-            }
-
-            .text {
-              margin-top: 8px;
-              color: #666;
-              font-size: 14px;
-              .ellipsis();
-            }
-          }
-        }
-        .alarm-log-right {
-          display: flex;
-          justify-content: space-between;
-          width: 50%;
-          padding-left: @alarm-log-padding-left;
-
-          .alarm-log-time {
-            max-width: 165px;
-
-            .log-title {
-              margin-top: 8px;
-              color: #666;
-              font-size: 12px;
-            }
-
-            .context {
-              margin-top: 8px;
-              color: rgba(#000, 0.85);
-              font-size: 14px;
-              .ellipsis();
-            }
-          }
-
-          .alarm-log-status {
-            margin-left: @alarm-log-padding-left;
-          }
-        }
-      }
-      .alarm-log-actions {
-        .alarm-log-action {
-          display: flex;
-          justify-content: center;
-          width: 72px;
-          height: 72px;
-          background-color: #fff;
-          border: 1px solid @primary-color;
-
-          .btn {
-            display: flex;
-            flex-direction: column;
-            align-items: center;
-            justify-content: center;
-            width: 72px;
-            height: 72px;
-            .icon {
-              margin-bottom: 5px;
-              color: @primary-color;
-              font-size: 25px;
-            }
-
-            div {
-              color: @primary-color;
-              font-size: 12px;
-            }
-          }
-        }
-
-        .alarm-log-action:hover {
-          background-color: @primary-color;
-
-          .icon,
-          div {
-            color: #fff;
-          }
-        }
-        .alarm-log-disabled {
-          display: flex;
-          justify-content: center;
-          width: 72px;
-          height: 72px;
-          border: 1px solid rgba(0, 0, 0, 0.25);
-          .btn {
-            display: flex;
-            flex-direction: column;
-            align-items: center;
-            justify-content: center;
-            width: 72px;
-            height: 72px;
-            .icon {
-              margin-bottom: 5px;
-              color: rgba(0, 0, 0, 0.25);
-              font-size: 25px;
-            }
-
-            div {
-              color: rgba(0, 0, 0, 0.25);
-              font-size: 12px;
-            }
-          }
-        }
-      }
-    }
-  }
-
-  .alarm-log-item:hover {
-    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
-  }
-}

+ 0 - 307
src/pages/rule-engine/Alarm/Log/TabComponent/index copy.tsx

@@ -1,307 +0,0 @@
-import SearchComponent from '@/components/SearchComponent';
-import { FileFilled, FileTextFilled, ToolFilled } from '@ant-design/icons';
-import type { ProColumns } from '@jetlinks/pro-table';
-import { Badge, Button, Card, Col, Empty, Pagination, Row, Space, Tooltip } from 'antd';
-import { useEffect, useState } from 'react';
-import './index.less';
-import SolveComponent from '../SolveComponent';
-import SolveLog from '../SolveLog';
-import { AlarmLogModel } from '../model';
-import moment from 'moment';
-import { observer } from '@formily/reactive-react';
-import { service } from '@/pages/rule-engine/Alarm/Log';
-import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
-import { useHistory } from 'umi';
-import PermissionButton from '@/components/PermissionButton';
-import classNames from 'classnames';
-
-interface Props {
-  type: string;
-}
-
-const imgMap = new Map();
-imgMap.set('product', require('/public/images/alarm/product.png'));
-imgMap.set('device', require('/public/images/alarm/device.png'));
-imgMap.set('other', require('/public/images/alarm/other.png'));
-imgMap.set('org', require('/public/images/alarm/org.png'));
-
-const titleMap = new Map();
-titleMap.set('product', '产品');
-titleMap.set('device', '设备');
-titleMap.set('other', '其他');
-titleMap.set('org', '部门');
-
-const colorMap = new Map();
-colorMap.set(1, '#E50012');
-colorMap.set(2, '#FF9457');
-colorMap.set(3, '#FABD47');
-colorMap.set(4, '#999999');
-colorMap.set(5, '#C4C4C4');
-
-const TabComponent = observer((props: Props) => {
-  const { permission } = PermissionButton.usePermission('rule-engine/Alarm/Log');
-  const columns: ProColumns<any>[] = [
-    {
-      title: '名称',
-      dataIndex: 'alarmName',
-    },
-    {
-      title: '最近告警时间',
-      dataIndex: 'alarmTime',
-      valueType: 'dateTime',
-    },
-    {
-      title: '状态',
-      dataIndex: 'state',
-      valueType: 'select',
-      valueEnum: {
-        warning: {
-          text: '告警中',
-          status: 'warning',
-        },
-        normal: {
-          text: '无告警',
-          status: 'normal',
-        },
-      },
-    },
-  ];
-
-  const [param, setParam] = useState<any>({ pageSize: 10, terms: [] });
-  const history = useHistory<Record<string, string>>();
-
-  const [dataSource, setDataSource] = useState<any>({
-    data: [],
-    pageSize: 10,
-    pageIndex: 0,
-    total: 0,
-  });
-
-  const handleSearch = (params: any) => {
-    setParam(params);
-    const terms = [...params.terms];
-    if (props.type !== 'all') {
-      terms.push({
-        termType: 'eq',
-        column: 'targetType',
-        value: props.type,
-        type: 'and',
-      });
-    }
-    service
-      .query({
-        ...params,
-        terms: [...terms],
-        sorts: [{ name: 'alarmTime', order: 'desc' }],
-      })
-      .then((resp) => {
-        if (resp.status === 200) {
-          setDataSource(resp.result);
-        }
-      });
-  };
-
-  useEffect(() => {
-    handleSearch(param);
-  }, [props.type]);
-
-  return (
-    <div className="alarm-log-card">
-      <SearchComponent<any>
-        field={columns}
-        target="alarm-log"
-        onSearch={(data) => {
-          const dt = {
-            pageSize: 10,
-            terms: [...data?.terms],
-          };
-          handleSearch(dt);
-        }}
-      />
-      <Card>
-        {dataSource?.data.length > 0 ? (
-          <Row gutter={24} style={{ marginTop: 10 }}>
-            {(dataSource?.data || []).map((item: any) => (
-              <Col key={item.id} span={24}>
-                <div className="alarm-log-item">
-                  <div className="alarm-log-title">
-                    <div
-                      className="alarm-log-level"
-                      style={{ backgroundColor: colorMap.get(item.level) }}
-                    >
-                      <div className="alarm-log-text">
-                        {AlarmLogModel.defaultLevel.find((i) => i.level === item.level)?.title ||
-                          item.level}
-                      </div>
-                    </div>
-                    <div className="alarm-log-title-text">
-                      <Tooltip placement="topLeft" title={item.alarmName}>
-                        {item.alarmName}
-                      </Tooltip>
-                    </div>
-                  </div>
-                  <div className="alarm-log-content">
-                    <div className="alarm-log-data">
-                      <div className="alarm-log-image">
-                        <img
-                          width={88}
-                          height={88}
-                          src={imgMap.get(props.type)}
-                          alt={''}
-                          style={{ marginRight: 20 }}
-                        />
-                        <div className="alarm-type">
-                          <div className="name">{titleMap.get(item.targetType)}</div>
-                          <div className="text">
-                            <Tooltip placement="topLeft" title={item.targetName}>
-                              {item.targetName}
-                            </Tooltip>
-                          </div>
-                        </div>
-                      </div>
-                      <div className="alarm-log-right">
-                        <div className="alarm-log-time">
-                          <div className="log-title">最近告警时间</div>
-                          <div className="context">
-                            {moment(item.alarmTime).format('YYYY-MM-DD HH:mm:ss')}
-                          </div>
-                        </div>
-                        <div
-                          className="alarm-log-time alarm-log-status"
-                          style={{ paddingLeft: 10 }}
-                        >
-                          <div className="log-title">状态</div>
-                          <div className="context">
-                            <Badge status={item.state.value === 'warning' ? 'error' : 'default'} />
-                            <span
-                              style={{
-                                color: item.state.value === 'warning' ? '#E50012' : 'black',
-                              }}
-                            >
-                              {item.state.text}
-                            </span>
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                    <div className="alarm-log-actions">
-                      <Space>
-                        {item.state.value === 'warning' && (
-                          <div
-                            className={classNames(
-                              permission.action ? 'alarm-log-action' : 'alarm-log-disabled',
-                            )}
-                          >
-                            <Tooltip title={permission.action ? '' : '暂无权限,请联系管理员'}>
-                              <Button
-                                type={'link'}
-                                disabled={!permission.action}
-                                onClick={() => {
-                                  AlarmLogModel.solveVisible = true;
-                                  AlarmLogModel.current = item;
-                                }}
-                              >
-                                <div className="btn">
-                                  <ToolFilled className="icon" />
-                                  <div>告警处理</div>
-                                </div>
-                              </Button>
-                            </Tooltip>
-                          </div>
-                        )}
-                        <div className="alarm-log-action">
-                          <Button
-                            type={'link'}
-                            onClick={() => {
-                              AlarmLogModel.current = item;
-                              const url = getMenuPathByParams(
-                                MENUS_CODE['rule-engine/Alarm/Log/Detail'],
-                                item.id,
-                              );
-                              history.push(url);
-                            }}
-                          >
-                            <div className="btn">
-                              <FileFilled className="icon" />
-                              <div>告警日志</div>
-                            </div>
-                          </Button>
-                        </div>
-                        <div className="alarm-log-action">
-                          <Button
-                            type={'link'}
-                            onClick={() => {
-                              AlarmLogModel.logVisible = true;
-                              AlarmLogModel.current = item;
-                            }}
-                          >
-                            <div className="btn">
-                              <FileTextFilled className="icon" />
-                              <div>处理记录</div>
-                            </div>
-                          </Button>
-                        </div>
-                      </Space>
-                    </div>
-                  </div>
-                </div>
-              </Col>
-            ))}
-          </Row>
-        ) : (
-          <Empty />
-        )}
-        {dataSource.data.length > 0 && (
-          <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-            <Pagination
-              showSizeChanger
-              size="small"
-              className={'pro-table-card-pagination'}
-              total={dataSource?.total || 0}
-              current={dataSource?.pageIndex + 1}
-              onChange={(page, size) => {
-                handleSearch({
-                  ...param,
-                  pageIndex: page - 1,
-                  pageSize: size,
-                });
-              }}
-              pageSizeOptions={[10, 20, 50, 100]}
-              pageSize={dataSource?.pageSize}
-              showTotal={(num) => {
-                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
-              }}
-            />
-          </div>
-        )}
-      </Card>
-      {AlarmLogModel.solveVisible && (
-        <SolveComponent
-          close={() => {
-            AlarmLogModel.solveVisible = false;
-            AlarmLogModel.current = {};
-          }}
-          reload={() => {
-            AlarmLogModel.solveVisible = false;
-            AlarmLogModel.current = {};
-            handleSearch(param);
-          }}
-          data={AlarmLogModel.current}
-        />
-      )}
-      {AlarmLogModel.logVisible && (
-        <SolveLog
-          close={() => {
-            AlarmLogModel.logVisible = false;
-            AlarmLogModel.current = {};
-          }}
-          data={AlarmLogModel.current}
-        />
-      )}
-    </div>
-  );
-});
-
-export default TabComponent;

+ 8 - 0
src/pages/rule-engine/Alarm/Log/TabComponent/index.less

@@ -69,5 +69,13 @@
 
   .card-state-content {
     transform: skewX(-45deg);
+
+    .stateText {
+      width: 70px;
+      overflow: hidden;
+      white-space: nowrap;
+      text-align: center;
+      text-overflow: ellipsis;
+    }
   }
 }

+ 126 - 100
src/pages/rule-engine/Alarm/Log/TabComponent/index.tsx

@@ -14,6 +14,7 @@ import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
 import { useHistory } from 'umi';
 import classNames from 'classnames';
 import { useDomFullHeight } from '@/hooks';
+import PermissionButton from '@/components/PermissionButton';
 
 interface Props {
   type: string;
@@ -39,7 +40,9 @@ colorMap.set(4, '#999999');
 colorMap.set(5, '#C4C4C4');
 
 const TabComponent = observer((props: Props) => {
-  const { minHeight } = useDomFullHeight(`.alarmLog`);
+  const { minHeight } = useDomFullHeight(`.alarmLog`, 36);
+  const { permission } = PermissionButton.usePermission('rule-engine/Alarm/Log');
+
   const columns: ProColumns<any>[] = [
     {
       title: '名称',
@@ -106,21 +109,30 @@ const TabComponent = observer((props: Props) => {
   }, [props.type]);
 
   const tools = (record: any) => [
-    <Button
-      type={'link'}
+    <Tooltip
       key={'solve'}
-      style={{ padding: 0 }}
-      disabled={record.state.value === 'normal'}
-      onClick={() => {
-        AlarmLogModel.solveVisible = true;
-        AlarmLogModel.current = record;
-      }}
+      title={
+        !permission.action
+          ? '暂无权限,请联系管理员'
+          : record.state?.value === 'normal'
+          ? '无告警'
+          : ''
+      }
     >
-      <Tooltip title={record.state?.value === 'normal' ? '无告警' : ''}>
+      <Button
+        type={'link'}
+        key={'solve'}
+        style={{ padding: 0 }}
+        disabled={record.state.value === 'normal' || !permission.action}
+        onClick={() => {
+          AlarmLogModel.solveVisible = true;
+          AlarmLogModel.current = record;
+        }}
+      >
         <ToolFilled />
         告警处理
-      </Tooltip>
-    </Button>,
+      </Button>
+    </Tooltip>,
     <Button
       type={'link'}
       style={{ padding: 0 }}
@@ -180,104 +192,118 @@ const TabComponent = observer((props: Props) => {
           handleSearch(dt);
         }}
       />
-      <Card className="alarmLog" style={{ minHeight }}>
-        {dataSource?.data.length > 0 ? (
-          <Row gutter={[24, 24]} style={{ marginTop: 10 }}>
-            {(dataSource?.data || []).map((item: any) => (
-              <Col key={item.id} span={12}>
-                <div className={classNames('iot-card')}>
-                  <div className={'card-warp'}>
-                    <div className={classNames('card-content')}>
-                      <div
-                        style={{ fontSize: 20, fontWeight: 700, marginBottom: 20 }}
-                        className="ellipsis"
-                      >
-                        <Tooltip title={item.alarmName}>
-                          <a>{item.alarmName}</a>
-                        </Tooltip>
-                      </div>
-                      <div className="alarm-log-context">
-                        <div className="context-left">
-                          <div className="context-img">
-                            <img width={70} height={70} src={defaultImage} alt={''} />
+      <Card>
+        <div className="alarmLog" style={{ minHeight, position: 'relative' }}>
+          <div style={{ height: '100%', paddingBottom: 48 }}>
+            {dataSource?.data.length > 0 ? (
+              <Row gutter={[24, 24]} style={{ marginTop: 10 }}>
+                {(dataSource?.data || []).map((item: any) => (
+                  <Col key={item.id} span={12}>
+                    <div className={classNames('iot-card')}>
+                      <div className={'card-warp'}>
+                        <div className={classNames('card-content')}>
+                          <div
+                            style={{ fontSize: 20, fontWeight: 700, marginBottom: 20 }}
+                            className="ellipsis"
+                          >
+                            <Tooltip title={item.alarmName}>
+                              <a style={{ cursor: 'default' }}>{item.alarmName}</a>
+                            </Tooltip>
                           </div>
-                          <div className="left-item">
-                            <div className="left-item-title">{titleMap.get(item.targetType)}</div>
-                            <div className="left-item-value ellipsis">
-                              <Tooltip placement="topLeft" title={item.targetName}>
-                                {item.targetName}
-                              </Tooltip>
+                          <div className="alarm-log-context">
+                            <div className="context-left">
+                              <div className="context-img">
+                                <img width={70} height={70} src={defaultImage} alt={''} />
+                              </div>
+                              <div className="left-item">
+                                <div className="left-item-title">
+                                  {titleMap.get(item.targetType)}
+                                </div>
+                                <div className="left-item-value ellipsis">
+                                  <Tooltip placement="topLeft" title={item.targetName}>
+                                    {item.targetName}
+                                  </Tooltip>
+                                </div>
+                              </div>
                             </div>
-                          </div>
-                        </div>
-                        <div className="context-right">
-                          <div className="right-item">
-                            <div className="right-item-title">最近告警时间</div>
-                            <div className="right-item-value ellipsis">
-                              {moment(item.alarmTime).format('YYYY-MM-DD HH:mm:ss')}
+                            <div className="context-right">
+                              <div className="right-item">
+                                <div className="right-item-title">最近告警时间</div>
+                                <div className="right-item-value ellipsis">
+                                  {moment(item.alarmTime).format('YYYY-MM-DD HH:mm:ss')}
+                                </div>
+                              </div>
+                              <div className="right-item">
+                                <div className="right-item-title">状态</div>
+                                <div className="right-item-value">
+                                  <Badge
+                                    status={item.state.value === 'warning' ? 'error' : 'default'}
+                                  />
+                                  <span
+                                    style={{
+                                      color: item.state.value === 'warning' ? '#E50012' : 'black',
+                                    }}
+                                  >
+                                    {item.state.text}
+                                  </span>
+                                </div>
+                              </div>
                             </div>
                           </div>
-                          <div className="right-item">
-                            <div className="right-item-title">状态</div>
-                            <div className="right-item-value">
-                              <Badge
-                                status={item.state.value === 'warning' ? 'error' : 'default'}
-                              />
-                              <span
-                                style={{
-                                  color: item.state.value === 'warning' ? '#E50012' : 'black',
-                                }}
-                              >
-                                {item.state.text}
-                              </span>
+                          <div
+                            className={'alarm-log-state'}
+                            style={{ backgroundColor: colorMap.get(item.level) }}
+                          >
+                            <div className={'card-state-content'}>
+                              {AlarmLogModel.defaultLevel.find((i) => i.level === item.level)
+                                ?.title || item.level}
                             </div>
                           </div>
                         </div>
                       </div>
-                      <div
-                        className={'alarm-log-state'}
-                        style={{ backgroundColor: colorMap.get(item.level) }}
-                      >
-                        <div className={'card-state-content'}>
-                          {AlarmLogModel.defaultLevel.find((i) => i.level === item.level)?.title ||
-                            item.level}
-                        </div>
-                      </div>
+                      <div className={'card-tools'}>{getAction(tools(item))}</div>
                     </div>
-                  </div>
-                  <div className={'card-tools'}>{getAction(tools(item))}</div>
-                </div>
-              </Col>
-            ))}
-          </Row>
-        ) : (
-          <Empty style={{ marginTop: '10%' }} />
-        )}
-        {dataSource.data.length > 0 && (
-          <div style={{ display: 'flex', marginTop: 20, justifyContent: 'flex-end' }}>
-            <Pagination
-              showSizeChanger
-              size="small"
-              className={'pro-table-card-pagination'}
-              total={dataSource?.total || 0}
-              current={dataSource?.pageIndex + 1}
-              onChange={(page, size) => {
-                handleSearch({
-                  ...param,
-                  pageIndex: page - 1,
-                  pageSize: size,
-                });
-              }}
-              pageSizeOptions={[10, 20, 50, 100]}
-              pageSize={dataSource?.pageSize}
-              showTotal={(num) => {
-                const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
-                const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
-                return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
-              }}
-            />
+                  </Col>
+                ))}
+              </Row>
+            ) : (
+              <Empty style={{ marginTop: '10%' }} />
+            )}
           </div>
-        )}
+          {dataSource.data.length > 0 && (
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'flex-end',
+                position: 'absolute',
+                bottom: 0,
+                width: '100%',
+              }}
+            >
+              <Pagination
+                showSizeChanger
+                size="small"
+                className={'pro-table-card-pagination'}
+                total={dataSource?.total || 0}
+                current={dataSource?.pageIndex + 1}
+                onChange={(page, size) => {
+                  handleSearch({
+                    ...param,
+                    pageIndex: page - 1,
+                    pageSize: size,
+                  });
+                }}
+                pageSizeOptions={[10, 20, 50, 100]}
+                pageSize={dataSource?.pageSize}
+                showTotal={(num) => {
+                  const minSize = dataSource?.pageIndex * dataSource?.pageSize + 1;
+                  const MaxSize = (dataSource?.pageIndex + 1) * dataSource?.pageSize;
+                  return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
+                }}
+              />
+            </div>
+          )}
+        </div>
       </Card>
       {AlarmLogModel.solveVisible && (
         <SolveComponent

+ 1 - 1
src/pages/rule-engine/Scene/Save/action/VariableItems/user.tsx

@@ -8,7 +8,7 @@ import {
   queryRelationUsers,
   queryWechatUsers,
 } from '@/pages/rule-engine/Scene/Save/action/service';
-import { forkJoin, filter, from, defer, map } from 'rxjs';
+import { defer, filter, forkJoin, from, map } from 'rxjs';
 
 type ChangeType = {
   source?: string;

+ 35 - 19
src/pages/system/DataSource/Management/EditTable.tsx

@@ -1,8 +1,8 @@
+import { randomString } from '@/utils/util';
 import { ArrayTable, Editable, Form, FormItem, Input, NumberPicker, Radio } from '@formily/antd';
 import { createForm } from '@formily/core';
 import { createSchemaField } from '@formily/react';
 import { Button } from 'antd';
-import { useEffect } from 'react';
 import RemoveData from './RemoveData';
 
 interface Props {
@@ -15,6 +15,7 @@ interface Props {
 }
 
 const EditTable = (props: Props) => {
+  const _data = (props?.data || []).map((item) => ({ ...item, old_id: randomString() })) || [];
   const SchemaField = createSchemaField({
     components: {
       FormItem,
@@ -29,7 +30,7 @@ const EditTable = (props: Props) => {
 
   const form = createForm({
     initialValues: {
-      array: props.data,
+      array: _data,
     },
   });
 
@@ -52,6 +53,12 @@ const EditTable = (props: Props) => {
               'x-component': 'ArrayTable.Column',
               'x-component-props': { title: '列名' },
               properties: {
+                old_id: {
+                  type: 'string',
+                  'x-decorator': 'FormItem',
+                  'x-component': 'Input',
+                  'x-hidden': true,
+                },
                 name: {
                   type: 'string',
                   'x-decorator': 'FormItem',
@@ -71,6 +78,13 @@ const EditTable = (props: Props) => {
                     },
                   ],
                   required: true,
+                  'x-reactions': (field: any) => {
+                    const old_id = field.query('.old_id').take().value;
+                    const flag = _data.find((item: any) => {
+                      return old_id && item?.old_id && item?.old_id === old_id;
+                    });
+                    field.disabled = !!flag;
+                  },
                 },
               },
             },
@@ -107,23 +121,24 @@ const EditTable = (props: Props) => {
               'x-component-props': { title: '长度' },
               properties: {
                 length: {
-                  type: 'string',
+                  type: 'number',
                   'x-decorator': 'FormItem',
                   'x-component': 'NumberPicker',
                   'x-component-props': {
                     placeholder: '请输入长度',
                   },
+                  default: 0,
                   'x-validator': [
-                    {
-                      required: true,
-                      message: '请输入长度',
-                    },
+                    // {
+                    //   required: true,
+                    //   message: '请输入长度',
+                    // },
                     {
                       maximum: 99999,
                       minimum: 1,
                     },
                   ],
-                  required: true,
+                  // required: true,
                 },
               },
             },
@@ -133,23 +148,24 @@ const EditTable = (props: Props) => {
               'x-component-props': { title: '精度' },
               properties: {
                 scale: {
-                  type: 'string',
+                  type: 'number',
                   'x-decorator': 'FormItem',
                   'x-component': 'NumberPicker',
                   'x-component-props': {
                     placeholder: '请输入精度',
                   },
+                  default: 0,
                   'x-validator': [
-                    {
-                      required: true,
-                      message: '请输入精度',
-                    },
+                    // {
+                    //   required: true,
+                    //   message: '请输入精度',
+                    // },
                     {
                       maximum: 99999,
                       minimum: 0,
                     },
                   ],
-                  required: true,
+                  // required: true,
                 },
               },
             },
@@ -239,10 +255,6 @@ const EditTable = (props: Props) => {
     },
   };
 
-  useEffect(() => {
-    form.setValues({ array: props?.data || [] });
-  }, [props.data]);
-
   return (
     <div>
       <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
@@ -251,7 +263,11 @@ const EditTable = (props: Props) => {
           style={{ marginBottom: 20 }}
           onClick={async () => {
             const data: any = await form.submit();
-            props.onChange(data);
+            const list = (data?.array || []).map((i: any) => {
+              const { old_id, ...extra } = i;
+              return { ...extra };
+            });
+            props.onChange({ array: list });
           }}
         >
           保存

+ 13 - 1
src/pages/system/DataSource/Save/index.tsx

@@ -1,5 +1,5 @@
 import { Form, FormGrid, FormItem, Input, Password, Select } from '@formily/antd';
-import { createForm } from '@formily/core';
+import { createForm, onFieldValueChange } from '@formily/core';
 import type { ISchema } from '@formily/react';
 import { createSchemaField } from '@formily/react';
 import { Modal } from 'antd';
@@ -17,6 +17,18 @@ const Save = (props: Props) => {
   const form = createForm({
     validateFirst: true,
     initialValues: props.data,
+    effects: () => {
+      onFieldValueChange('typeId', (field, form1) => {
+        if (field.modified) {
+          form1.setFieldState('description', (state) => {
+            state.value = '';
+          });
+          form1.setFieldState('shareConfig.*', (state) => {
+            state.value = '';
+          });
+        }
+      });
+    },
   });
 
   const SchemaField = createSchemaField({

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

@@ -1,11 +1,11 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import React, { useRef, useState } from 'react';
 import {
-  CloseCircleOutlined,
   DeleteOutlined,
   EditOutlined,
   PlayCircleOutlined,
   PlusOutlined,
+  StopOutlined,
 } from '@ant-design/icons';
 import { Badge, Button, Dropdown, Menu, Popconfirm, Space, Tooltip, Upload } from 'antd';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
@@ -217,7 +217,7 @@ const Permission: React.FC = observer(() => {
             }),
           }}
         >
-          {record.status ? <CloseCircleOutlined /> : <PlayCircleOutlined />}
+          {record.status ? <StopOutlined /> : <PlayCircleOutlined />}
         </PermissionButton>,
         <PermissionButton
           type={'link'}

+ 1 - 1
src/pages/system/Tenant/Detail/Member/Bind.tsx

@@ -1,4 +1,4 @@
-import type { ProColumns, ActionType } from '@jetlinks/pro-table';
+import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
 import { service } from '@/pages/system/Tenant';
 import { Space } from 'antd';

+ 2 - 2
src/pages/system/User/index.tsx

@@ -5,12 +5,12 @@ import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
 import { Badge, Popconfirm } from 'antd';
 import {
-  CloseCircleOutlined,
   DeleteOutlined,
   EditOutlined,
   PlayCircleOutlined,
   PlusOutlined,
   SafetyOutlined,
+  StopOutlined,
 } from '@ant-design/icons';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { useRef, useState } from 'react';
@@ -177,7 +177,7 @@ const User = observer(() => {
             }),
           }}
         >
-          {record.status ? <CloseCircleOutlined /> : <PlayCircleOutlined />}
+          {record.status ? <StopOutlined /> : <PlayCircleOutlined />}
         </PermissionButton>,
         <PermissionButton
           type="link"