fix: 预警记录渲染卡顿
This commit is contained in:
parent
a4ff47ea1a
commit
faf0a5682e
@ -2,7 +2,6 @@ import React, { useImperativeHandle, useRef, useState, forwardRef, useContext }
|
|||||||
import { Modal, ModalProps, Space, SpaceProps } from 'antd';
|
import { Modal, ModalProps, Space, SpaceProps } from 'antd';
|
||||||
import theme from 'antd/lib/theme';
|
import theme from 'antd/lib/theme';
|
||||||
import { DownloadOutlined } from '@ant-design/icons';
|
import { DownloadOutlined } from '@ant-design/icons';
|
||||||
import { pxToRem } from '@zhst/func';
|
|
||||||
import { ConfigProvider, CropperImage } from '@zhst/meta';
|
import { ConfigProvider, CropperImage } from '@zhst/meta';
|
||||||
|
|
||||||
import './index.less'
|
import './index.less'
|
||||||
@ -86,15 +85,14 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
|
|||||||
{...modalProps}
|
{...modalProps}
|
||||||
>
|
>
|
||||||
<Space size={0} {...spaceProps}>
|
<Space size={0} {...spaceProps}>
|
||||||
<div className={`${componentName}-left-img`}>
|
<div className={`${componentName}-left-img`} style={{ ...imgStyle }}>
|
||||||
<div style={{ width: `${pxToRem('789px')}`, height: `${pxToRem('444px')}`, ...imgStyle }}>
|
|
||||||
<CropperImage
|
<CropperImage
|
||||||
// editAble={false}
|
// editAble={false}
|
||||||
// selectAble={false}
|
// selectAble={false}
|
||||||
odList={odRectDefault}
|
odList={odRectDefault}
|
||||||
url={imageKey}
|
url={imageKey}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className='right-context'>
|
<div className='right-context'>
|
||||||
{warningData?.map(({ label, value }) => (
|
{warningData?.map(({ label, value }) => (
|
||||||
@ -103,7 +101,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
|
|||||||
{value}
|
{value}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{imageKey && downloadImg && <div className='img-download' style={{ color: token.colorPrimary }} onClick={() => downloadImg?.(imageKey)} ><DownloadOutlined /><span style={{ paddingLeft: 3 }}>{downloadText}</span></div>}
|
{imageKey && downloadImg && <div className='img-download' style={{ color: token.colorPrimary }} onClick={() => downloadImg?.(imageKey)} ><DownloadOutlined /><span className='img-download-text'>{downloadText}</span></div>}
|
||||||
</div>
|
</div>
|
||||||
</Space>
|
</Space>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
.zhst-biz-warning-larger-image {
|
.zhst-biz-warning-larger-image {
|
||||||
font-family: MicrosoftYaHei;
|
font-family: MicrosoftYaHei;
|
||||||
|
|
||||||
|
&-left-img {
|
||||||
|
width: 789px;
|
||||||
|
height: 444px;
|
||||||
|
}
|
||||||
|
|
||||||
.ant-modal-content {
|
.ant-modal-content {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 492px;
|
height: 492px;
|
||||||
@ -52,6 +57,10 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
.img-download-text {
|
||||||
|
padding-left: 3px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { Card, Space, Divider, CardProps } from 'antd';
|
import { Card, Space, Divider, CardProps, theme } from 'antd';
|
||||||
import { theme } from 'antd/lib';
|
|
||||||
import React, { useContext } from 'react';
|
import React, { useContext } from 'react';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { ConfigProvider, CropperImage } from '@zhst/meta';
|
import { ConfigProvider, CropperImage } from '@zhst/meta';
|
||||||
import { pxToRem } from '@zhst/func';
|
|
||||||
|
|
||||||
import './index.less'
|
import './index.less'
|
||||||
export interface IRecord {
|
export interface IRecord {
|
||||||
@ -101,35 +99,37 @@ export const WarningRecordCard: React.FC<WarningRecordCardProps> = (props) => {
|
|||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
onRecordClick?.(record);
|
onRecordClick?.(record);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={componentName} key={id} onClick={handleClick} style={style}>
|
<div className={componentName} key={id} onClick={handleClick} style={style}>
|
||||||
<Card
|
<Card
|
||||||
cover={
|
className={`${componentName}-card`}
|
||||||
<div style={{ width: `${pxToRem("356px")}`, height: `${pxToRem("203px")}`, ...imgStyle }}>
|
style={{ ...selectedCardStyle, ...cardStyle }}
|
||||||
<CropperImage
|
|
||||||
// 无法触发 图片点击时间需要 加 selectAble
|
|
||||||
selectAble={false}
|
|
||||||
odList={odRectDefault}
|
|
||||||
url={imageKey}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
style={{ padding: `${pxToRem("10px")}`, borderRadius: `${pxToRem("4px")}`, ...selectedCardStyle, ...cardStyle }}
|
|
||||||
{...cardProps}
|
{...cardProps}
|
||||||
>
|
>
|
||||||
<div className={`${componentName}-left-context`}>
|
<div className={`${componentName}-card-img`} style={{ ...imgStyle }}>
|
||||||
<div className={`${componentName}-left-context-warning-type`}>{warningType}</div>
|
<CropperImage
|
||||||
<Space size={0} split={<Divider type="vertical" />}>
|
// 无法触发 图片点击时间需要 加 selectAble
|
||||||
{warningInfo?.map((item, index) => (
|
selectAble={false}
|
||||||
<div key={index} className="info-item">
|
odList={odRectDefault}
|
||||||
{item}
|
url={imageKey}
|
||||||
</div>
|
/>
|
||||||
))}
|
|
||||||
</Space>
|
|
||||||
<div className={`${componentName}-left-context-warning-time`}>{warningTimeShow}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className={`${componentName}-cabietInfo`} >{cabietText}</div>
|
<div style={{ display: 'flex' }}>
|
||||||
|
<div className={`${componentName}-left-context`}>
|
||||||
|
<div className={`${componentName}-left-context-warning-type`}>{warningType}</div>
|
||||||
|
<Space size={0} split={<Divider type="vertical" />}>
|
||||||
|
{warningInfo?.map((item, index) => (
|
||||||
|
<div key={index} className="info-item">
|
||||||
|
{item}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Space>
|
||||||
|
<div className={`${componentName}-left-context-warning-time`}>{warningTimeShow}</div>
|
||||||
|
</div>
|
||||||
|
<div className={`${componentName}-cabietInfo`} >{cabietText}</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@ import { Space } from 'antd';
|
|||||||
// 例如 后端返回这样的数据结构
|
// 例如 后端返回这样的数据结构
|
||||||
const backEndData = [
|
const backEndData = [
|
||||||
{
|
{
|
||||||
imageKey : 'https://i.yourimageshare.com/lRHiD2UnAT.png',
|
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
|
||||||
id: '1561561',
|
id: '1561561',
|
||||||
warningType: '火焰识别',
|
warningType: '火焰识别',
|
||||||
boxId: '2',
|
boxId: '2',
|
||||||
@ -24,7 +24,7 @@ const backEndData = [
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imageKey : 'https://i.yourimageshare.com/lRHiD2UnAT.png',
|
imageKey: 'https://i.yourimageshare.com/lRHiD2UnAT.png',
|
||||||
id: '156156155',
|
id: '156156155',
|
||||||
warningType: '火焰识别',
|
warningType: '火焰识别',
|
||||||
boxId: '1',
|
boxId: '1',
|
||||||
@ -46,7 +46,7 @@ const backEndData = [
|
|||||||
// 前端处理数据结构
|
// 前端处理数据结构
|
||||||
const dataSource = backEndData.map(o => {
|
const dataSource = backEndData.map(o => {
|
||||||
return {
|
return {
|
||||||
imageKey : o.imageKey ,
|
imageKey: o.imageKey,
|
||||||
id: o.id,
|
id: o.id,
|
||||||
warningType: o.warningType,
|
warningType: o.warningType,
|
||||||
boxId: o.boxId,
|
boxId: o.boxId,
|
||||||
|
@ -1,24 +1,31 @@
|
|||||||
.zhst-biz-warning-record-card {
|
.zhst-biz-warning-record-card {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
.ant-card-body {
|
|
||||||
padding: 0;
|
|
||||||
font-family: MicrosoftYaHei;
|
|
||||||
line-height: 19px;
|
|
||||||
display: flex;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-card-bordered {
|
.ant-card-bordered {
|
||||||
border: 2px solid #f0f0f0;
|
border: 2px solid #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-cover-img img {
|
&-card {
|
||||||
width: 336px;
|
border-radius: 4px;
|
||||||
height: 203px;
|
|
||||||
border-radius: 0,
|
&-img {
|
||||||
|
width: 356px ;
|
||||||
|
height: 203px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-card-body {
|
||||||
|
padding: 10px;
|
||||||
|
font-family: MicrosoftYaHei;
|
||||||
|
line-height: 19px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
&-left-context {
|
&-left-context {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user