Просмотр исходного кода

fix: 修改证书名称过长的问题

sun-chaochao 3 лет назад
Родитель
Сommit
dd51d21cea

+ 7 - 4
src/components/ProTableCard/CardItems/AlarmConfig.tsx

@@ -41,19 +41,22 @@ export default (props: AlarmConfigProps) => {
           <div className={'card-item-content'}>
             <div>
               <label>关联场景联动</label>
-              <div>
+              <div className={'ellipsis'}>
                 <PermissionButton
                   type={'link'}
                   isPermission={!!getMenuPathByCode(MENUS_CODE['rule-engine/Scene'])}
                   style={{ padding: 0, height: 'auto' }}
+                  tooltip={{
+                    title: !!getMenuPathByCode(MENUS_CODE['rule-engine/Scene'])
+                      ? props?.sceneName
+                      : '没有权限,请联系管理员',
+                  }}
                   onClick={() => {
                     const url = getMenuPathByCode('rule-engine/Scene/Save');
                     history.push(`${url}?id=${props.sceneId}`);
                   }}
                 >
-                  <div className={'ellipsis'}>
-                    <Tooltip title={props?.sceneName || ''}>{props?.sceneName || ''}</Tooltip>
-                  </div>
+                  {props?.sceneName || ''}
                 </PermissionButton>
               </div>
             </div>

+ 1 - 0
src/pages/device/Instance/Detail/MetadataLog/Property/AMap.tsx

@@ -49,6 +49,7 @@ export default (props: Props) => {
             type="primary"
             onClick={() => {
               if (PathNavigatorRef.current) {
+                PathNavigatorRef.current.moveToPoint(0, 0);
                 PathNavigatorRef.current.stop();
               }
             }}

+ 22 - 3
src/pages/device/Instance/Detail/Running/Property/index.tsx

@@ -11,7 +11,7 @@ import EditProperty from './EditProperty';
 import { useParams } from 'umi';
 import PropertyLog from '../../MetadataLog/Property';
 import styles from './index.less';
-import { throttle } from 'lodash';
+import { groupBy, throttle, toArray } from 'lodash';
 import PropertyTable from './PropertyTable';
 
 interface Props {
@@ -166,9 +166,28 @@ const Property = (props: Props) => {
     setLoading(true);
     service.propertyRealTime(param).subscribe({
       next: (resp) => {
+        if (resp.status === 200) {
+          const t1 = (resp?.result || []).map((item: any) => {
+            return {
+              timeString: item.data?.timeString,
+              timestamp: item.data?.timestamp,
+              ...item?.data?.value,
+            };
+          });
+          const obj: any = {};
+          toArray(groupBy(t1, 'property'))
+            .map((item) => {
+              return {
+                list: item.sort((a, b) => b.timestamp - a.timestamp),
+                property: item[0].property,
+              };
+            })
+            .forEach((i) => {
+              obj[i.property] = i.list[0];
+            });
+          setPropertyValue({ ...propertyValue, ...obj });
+        }
         setLoading(false);
-        propertyValue[resp.property] = resp.list[0];
-        setPropertyValue({ ...propertyValue });
       },
     });
   };

+ 17 - 18
src/pages/device/Instance/service.ts

@@ -1,9 +1,9 @@
 import BaseService from '@/utils/BaseService';
 import { request } from 'umi';
-import type { DeviceInstance, PropertyData } from '@/pages/device/Instance/typings';
+import type { DeviceInstance } from '@/pages/device/Instance/typings';
 import SystemConst from '@/utils/const';
-import { defer, from, mergeMap, toArray } from 'rxjs';
-import { filter, groupBy, map } from 'rxjs/operators';
+import { defer, from } from 'rxjs';
+import { map } from 'rxjs/operators';
 
 class Service extends BaseService<DeviceInstance> {
   public detail = (id: string) => request(`${this.uri}/${id}/detail`, { method: 'GET' });
@@ -82,21 +82,20 @@ class Service extends BaseService<DeviceInstance> {
           data,
         }),
       ).pipe(
-        filter((resp) => resp.status === 200),
-        map((resp) => resp.result),
-        mergeMap((temp: PropertyData[]) => from(temp)),
-        map((item) => ({
-          timeString: item.data.timeString,
-          timestamp: item.data.timestamp,
-          ...item.data.value,
-        })),
-        groupBy((group$) => group$.property),
-        mergeMap((group) => group.pipe(toArray())),
-        map((arr) => ({
-          list: arr.sort((a, b) => a.timestamp - b.timestamp),
-          property: arr[0].property,
-        })),
-        // toArray()
+        // filter((resp) => resp.status === 200),
+        map((resp) => resp),
+        // mergeMap((temp: PropertyData[]) => from(temp)),
+        // map((item) => ({
+        //   timeString: item.data.timeString,
+        //   timestamp: item.data.timestamp,
+        //   ...item.data.value,
+        // })),
+        // groupBy((group$) => group$.property),
+        // mergeMap((group) => group.pipe(toArray())),
+        // map((arr) => ({
+        //   list: arr.sort((a, b) => a.timestamp - b.timestamp),
+        //   property: arr[0].property,
+        // }))
       ),
     );
 

+ 11 - 1
src/pages/link/Certificate/index.tsx

@@ -2,7 +2,7 @@ import { PageContainer } from '@ant-design/pro-layout';
 import { useRef, useState } from 'react';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
-import { message } from 'antd';
+import { message, Tooltip } from 'antd';
 import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import SearchComponent from '@/components/SearchComponent';
@@ -29,10 +29,20 @@ const Certificate = () => {
     {
       dataIndex: 'name',
       title: '证书名称',
+      width: '30%',
+      ellipsis: true,
     },
     {
       dataIndex: 'description',
       title: '说明',
+      width: '30%',
+      render: (text: any) => (
+        <div style={{ width: '100%' }} className="ellipsis">
+          <Tooltip placement="topLeft" title={text}>
+            {text}
+          </Tooltip>
+        </div>
+      ),
     },
     {
       title: intl.formatMessage({

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

@@ -62,17 +62,23 @@ const Configuration = () => {
     {
       title: '关联场景联动',
       dataIndex: 'sceneName',
+      width: 160,
       render: (text: any, record: any) => (
         <PermissionButton
           type={'link'}
           isPermission={!!getMenuPathByCode(MENUS_CODE['rule-engine/Scene'])}
-          style={{ padding: 0, height: 'auto' }}
+          style={{ padding: 0, height: 'auto', width: '100%' }}
+          tooltip={{
+            title: !!getMenuPathByCode(MENUS_CODE['rule-engine/Scene'])
+              ? text
+              : '没有权限,请联系管理员',
+          }}
           onClick={() => {
             const url = getMenuPathByCode('rule-engine/Scene/Save');
             history.push(`${url}?id=${record.sceneId}`);
           }}
         >
-          {text}
+          <span className="ellipsis">{text}</span>
         </PermissionButton>
       ),
     },
@@ -86,6 +92,7 @@ const Configuration = () => {
     {
       title: '说明',
       dataIndex: 'description',
+      ellipsis: true,
     },
     {
       title: '操作',
@@ -143,12 +150,11 @@ const Configuration = () => {
           key="action"
           style={{ padding: 0 }}
           popConfirm={{
-            title: intl.formatMessage({
-              id: `pages.data.option.${
-                record.state?.value !== 'disabled' ? 'disabled' : 'disabled'
-              }.tips`,
-              defaultMessage: `确认${record.state?.value !== 'disabled' ? '禁用' : '启用'}?`,
-            }),
+            title: `${
+              record.state?.value !== 'disabled'
+                ? '禁用告警不会影响关联的场景状态,确定要禁用吗'
+                : '确认启用'
+            }?`,
             onConfirm: async () => {
               if (record.state?.value === 'disabled') {
                 await service._enable(record.id);
@@ -174,7 +180,7 @@ const Configuration = () => {
           }}
           type="link"
         >
-          {record.state?.value === 'disabled' ? <CloseCircleOutlined /> : <PlayCircleOutlined />}
+          {record.state?.value === 'disabled' ? <PlayCircleOutlined /> : <CloseCircleOutlined />}
         </PermissionButton>,
         <PermissionButton
           type="link"
@@ -274,12 +280,11 @@ const Configuration = () => {
                 isPermission={permission.action}
                 style={{ padding: 0 }}
                 popConfirm={{
-                  title: intl.formatMessage({
-                    id: `pages.data.option.${
-                      record.state?.value !== 'disabled' ? 'disabled' : 'enabled'
-                    }.tips`,
-                    defaultMessage: `确认${record.state?.value !== 'disabled' ? '禁用' : '启用'}?`,
-                  }),
+                  title: `${
+                    record.state?.value !== 'disabled'
+                      ? '禁用告警不会影响关联的场景状态,确定要禁用吗'
+                      : '确认启用'
+                  }?`,
                   onConfirm: async () => {
                     if (record.state?.value === 'disabled') {
                       await service._enable(record.id);