Browse Source

fix: 2个点轨迹问题

sun-chaochao 3 năm trước cách đây
mục cha
commit
d4b2133532

+ 1 - 1
src/components/AMapComponent/hooks/Distance.tsx

@@ -4,7 +4,7 @@ const useDistance = () => {
   const [distance, setDistance] = useState(0);
   const [distance, setDistance] = useState(0);
 
 
   const onDistance = (data: number[][]) => {
   const onDistance = (data: number[][]) => {
-    if (window.AMap && data && data.length > 2) {
+    if (window.AMap && data && data.length >= 2) {
       const pointArr = data.map((point) => new window.AMap.LngLat(point[0], point[1]));
       const pointArr = data.map((point) => new window.AMap.LngLat(point[0], point[1]));
       const distanceOfLine = AMap.GeometryUtil.distanceOfLine(pointArr);
       const distanceOfLine = AMap.GeometryUtil.distanceOfLine(pointArr);
       setDistance(Math.round(distanceOfLine));
       setDistance(Math.round(distanceOfLine));

+ 3 - 1
src/components/ProTableCard/CardItems/AlarmConfig.tsx

@@ -36,7 +36,9 @@ export default (props: AlarmConfigProps) => {
         </div>
         </div>
         <div className={'card-item-body'}>
         <div className={'card-item-body'}>
           <div className={'card-item-header'}>
           <div className={'card-item-header'}>
-            <span className={'card-item-header-name ellipsis'}>{props?.name}</span>
+            <span className={'card-item-header-name ellipsis'}>
+              <Tooltip title={props?.name}>{props?.name}</Tooltip>
+            </span>
           </div>
           </div>
           <div className={'card-item-content'}>
           <div className={'card-item-content'}>
             <div>
             <div>

+ 11 - 2
src/components/ProTableCard/CardItems/noticeConfig.tsx

@@ -3,6 +3,7 @@ import { TableCard } from '@/components';
 import '@/style/common.less';
 import '@/style/common.less';
 import '../index.less';
 import '../index.less';
 import { imgMap, typeList } from './noticeTemplate';
 import { imgMap, typeList } from './noticeTemplate';
+import { Tooltip } from 'antd';
 
 
 export interface NoticeCardProps extends ConfigItem {
 export interface NoticeCardProps extends ConfigItem {
   detail?: React.ReactNode;
   detail?: React.ReactNode;
@@ -19,7 +20,11 @@ export default (props: NoticeCardProps) => {
         </div>
         </div>
         <div className={'card-item-body'}>
         <div className={'card-item-body'}>
           <div className={'card-item-header'}>
           <div className={'card-item-header'}>
-            <span className={'card-item-header-name ellipsis'}>{props.name}</span>
+            <span className={'card-item-header-name ellipsis'}>
+              <Tooltip placement="topLeft" title={props.name}>
+                {props.name}
+              </Tooltip>
+            </span>
           </div>
           </div>
           <div className={'card-item-content'}>
           <div className={'card-item-content'}>
             <div>
             <div>
@@ -28,7 +33,11 @@ export default (props: NoticeCardProps) => {
             </div>
             </div>
             <div>
             <div>
               <label>说明</label>
               <label>说明</label>
-              <div className={'ellipsis'}>{props.description}</div>
+              <div className={'ellipsis'}>
+                <Tooltip placement="topLeft" title={props.description}>
+                  {props.description}
+                </Tooltip>
+              </div>
             </div>
             </div>
           </div>
           </div>
         </div>
         </div>

+ 7 - 2
src/components/ProTableCard/CardItems/noticeTemplate.tsx

@@ -2,6 +2,7 @@ import React from 'react';
 import { TableCard } from '@/components';
 import { TableCard } from '@/components';
 import '@/style/common.less';
 import '@/style/common.less';
 import '../index.less';
 import '../index.less';
+import { Tooltip } from 'antd';
 
 
 export interface NoticeCardProps extends TemplateItem {
 export interface NoticeCardProps extends TemplateItem {
   detail?: React.ReactNode;
   detail?: React.ReactNode;
@@ -64,7 +65,9 @@ export default (props: NoticeCardProps) => {
         </div>
         </div>
         <div className={'card-item-body'}>
         <div className={'card-item-body'}>
           <div className={'card-item-header'}>
           <div className={'card-item-header'}>
-            <span className={'card-item-header-name ellipsis'}>{props.name}</span>
+            <span className={'card-item-header-name ellipsis'}>
+              <Tooltip title={props.name}>{props.name}</Tooltip>
+            </span>
           </div>
           </div>
           <div className={'card-item-content'}>
           <div className={'card-item-content'}>
             <div>
             <div>
@@ -73,7 +76,9 @@ export default (props: NoticeCardProps) => {
             </div>
             </div>
             <div>
             <div>
               <label>说明</label>
               <label>说明</label>
-              <div className={'ellipsis'}>{props.description}</div>
+              <div className={'ellipsis'}>
+                <Tooltip title={props.description}>{props.description}</Tooltip>
+              </div>
             </div>
             </div>
           </div>
           </div>
         </div>
         </div>

+ 2 - 2
src/pages/device/Instance/Detail/Tags/location/AMap.tsx

@@ -24,8 +24,8 @@ export default (props: Props) => {
   };
   };
 
 
   useEffect(() => {
   useEffect(() => {
-    setValue(props.value);
-    const list = props?.value.split(',') || [];
+    setValue(props?.value || '');
+    const list = (props?.value || '').split(',') || [];
     if (!!props.value && list.length === 2) {
     if (!!props.value && list.length === 2) {
       setMarkerCenter({
       setMarkerCenter({
         longitude: list[0],
         longitude: list[0],

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

@@ -54,6 +54,7 @@ const Config = observer(() => {
     {
     {
       dataIndex: 'name',
       dataIndex: 'name',
       title: '配置名称',
       title: '配置名称',
+      ellipsis: true,
     },
     },
     {
     {
       dataIndex: 'provider',
       dataIndex: 'provider',
@@ -62,6 +63,7 @@ const Config = observer(() => {
     },
     },
     {
     {
       dataIndex: 'description',
       dataIndex: 'description',
+      ellipsis: true,
       title: '说明',
       title: '说明',
     },
     },
     {
     {

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

@@ -50,6 +50,7 @@ const Template = observer(() => {
     {
     {
       dataIndex: 'name',
       dataIndex: 'name',
       title: '模版名称',
       title: '模版名称',
+      ellipsis: true,
     },
     },
     {
     {
       dataIndex: 'provider',
       dataIndex: 'provider',
@@ -59,7 +60,7 @@ const Template = observer(() => {
     {
     {
       dataIndex: 'description',
       dataIndex: 'description',
       title: '说明',
       title: '说明',
-      // valueType: 'dateTime',
+      ellipsis: true,
     },
     },
     {
     {
       title: intl.formatMessage({
       title: intl.formatMessage({

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

@@ -35,6 +35,7 @@ const Configuration = () => {
     {
     {
       dataIndex: 'name',
       dataIndex: 'name',
       title: '名称',
       title: '名称',
+      ellipsis: true,
     },
     },
     {
     {
       title: '类型',
       title: '类型',