Commit 5e6dc8c3 authored by 杨思琦's avatar 杨思琦

fix: 报警恢复修改

parent 1dda5aa7
Pipeline #87462 passed with stages
...@@ -27,19 +27,25 @@ const jessibucaObj = { ...@@ -27,19 +27,25 @@ const jessibucaObj = {
loadingText: '视频加载中', loadingText: '视频加载中',
decoder: '/JessibucaVideo/decoder.js', decoder: '/JessibucaVideo/decoder.js',
}; };
const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [] }) => { const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [], type }) => {
const [pageIndex, setPageIndex] = useState(1); const [pageIndex, setPageIndex] = useState(1);
const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]); const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]);
const isAlarm = message.infoClasses === MESSAGE_TYPE.ALARM_TYPE; const isAlarm = message.infoClasses === MESSAGE_TYPE.ALARM_TYPE;
const defaultIcon = isAlarm const isRecover = type === 'recover';
const defaultIcon =
isAlarm && !isRecover
? 'https://panda-water.com/web4/assets/images/message/报警图标.svg' ? 'https://panda-water.com/web4/assets/images/message/报警图标.svg'
: getMessageTypeIcon(message); : getMessageTypeIcon(message);
const icon = message.webIcon ? `${window.location.origin}/${message.webIcon}` : defaultIcon; const icon = message.webIcon && !isRecover ? `${window.location.origin}/${message.webIcon}` : defaultIcon;
return ( return (
<Modal <Modal
title={ title={
isAlarm ? ( isAlarm ? (
isRecover ? (
'报警恢复'
) : (
<FormattedMessage id="component.noticeIcon.modal.alarm.title" /> <FormattedMessage id="component.noticeIcon.modal.alarm.title" />
)
) : ( ) : (
<FormattedMessage id="component.noticeIcon.model.system.title" /> <FormattedMessage id="component.noticeIcon.model.system.title" />
) )
...@@ -50,7 +56,11 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m ...@@ -50,7 +56,11 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m
visible={platformVisible} visible={platformVisible}
zIndex={5000} zIndex={5000}
wrapClassName={styles.platformModalWrap} wrapClassName={styles.platformModalWrap}
className={classNames(styles.platformModal, !isAlarm && styles.platformModalDefault)} className={classNames(
styles.platformModal,
!isAlarm && styles.platformModalDefault,
isRecover && styles.platformModalRecover,
)}
footer={ footer={
<Pagination <Pagination
simple simple
...@@ -82,16 +92,24 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m ...@@ -82,16 +92,24 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m
{isAlarm ? ( {isAlarm ? (
<> <>
<div className={styles['content-mid']}> <div className={styles['content-mid']}>
<b>{message && message.infoContent && message.infoContent.alarmType}</b> <b className={classNames(isRecover && styles['content-mid-recover'])}>
{message && message.infoContent && message.infoContent.alarmType}
</b>
{`|${message && message.infoContent && message.infoContent.alarmContent}`} {`|${message && message.infoContent && message.infoContent.alarmContent}`}
</div> </div>
<div className={styles['content-bottom']}> <div className={styles['content-bottom']}>
<p> <p>
报警值: 报警值:
<b>{message && message.infoContent && message.infoContent.alarmValue}</b> <b className={classNames(isRecover && styles['content-bottom-recover'])}>
{message && message.infoContent && message.infoContent.alarmValue}
</b>
{!isRecover && (
<>
{' / '} {' / '}
预设值: 预设值:
{message && message.infoContent && message.infoContent.alarmThreshold} {message && message.infoContent && message.infoContent.alarmThreshold}
</>
)}
</p> </p>
</div> </div>
</> </>
...@@ -115,6 +133,7 @@ class NoticeIconView extends Component { ...@@ -115,6 +133,7 @@ class NoticeIconView extends Component {
count: 0, count: 0,
noticeData: [], noticeData: [],
platformVisible: false, platformVisible: false,
platformRecoverVisible: false,
videoVisible: false, videoVisible: false,
// eslint-disable-next-line react/no-unused-state // eslint-disable-next-line react/no-unused-state
noticeVisible: false, noticeVisible: false,
...@@ -143,7 +162,11 @@ class NoticeIconView extends Component { ...@@ -143,7 +162,11 @@ class NoticeIconView extends Component {
} }
get platformMessages() { get platformMessages() {
return this.state.noticeData.filter(item => item.infoLevel === '4'); return this.state.noticeData.filter(item => item.infoLevel === '4' && !item?.infoContent?.alarmState);
}
get platformRecoverMessages() {
return this.state.noticeData.filter(item => item.infoLevel === '4' && item?.infoContent?.alarmState === 1 );
} }
async componentDidMount() { async componentDidMount() {
...@@ -186,6 +209,7 @@ class NoticeIconView extends Component { ...@@ -186,6 +209,7 @@ class NoticeIconView extends Component {
this.setState({ this.setState({
popupVisible: value, popupVisible: value,
platformVisible: this.platformMessages.length > 0 ? true : this.state.platformVisible, platformVisible: this.platformMessages.length > 0 ? true : this.state.platformVisible,
platformRecoverVisible: this.platformRecoverMessages.length > 0 ? true : this.state.platformRecoverVisible,
sysTopVisible: false, sysTopVisible: false,
videoVisible: false, videoVisible: false,
}); });
...@@ -194,6 +218,7 @@ class NoticeIconView extends Component { ...@@ -194,6 +218,7 @@ class NoticeIconView extends Component {
this.setState({ this.setState({
popupVisible: value, popupVisible: value,
platformVisible: this.platformMessages.length > 0 ? true : this.state.platformVisible, platformVisible: this.platformMessages.length > 0 ? true : this.state.platformVisible,
platformRecoverVisible: this.platformRecoverMessages.length > 0 ? true : this.state.platformRecoverVisible,
sysTopVisible: false, sysTopVisible: false,
videoVisible: false, videoVisible: false,
}); });
...@@ -219,14 +244,22 @@ class NoticeIconView extends Component { ...@@ -219,14 +244,22 @@ class NoticeIconView extends Component {
}; };
handleClosePlatform = event => { handleClosePlatform = event => {
this.setState({ platformVisible: false }); this.setState({ platformVisible: false, platformRecoverVisible: false, });
}; };
// 显示报警弹窗 // 显示报警弹窗
renderPlatform = message => { renderPlatform = message => {
if (!this.state.platformVisible) { const { infoContent = {} } = message;
const { alarmState = 0 } = infoContent;
if (!alarmState && !this.state.platformVisible) {
this.setState({ this.setState({
platformVisible: true, platformVisible: true,
platformRecoverVisible: false
})
} else if (alarmState && !this.state.platformRecoverVisible) {
this.setState({
platformVisible: false,
platformRecoverVisible: true,
}) })
} }
}; };
...@@ -318,6 +351,7 @@ class NoticeIconView extends Component { ...@@ -318,6 +351,7 @@ class NoticeIconView extends Component {
this.setState({ this.setState({
sysTopVisible: true, sysTopVisible: true,
platformVisible: false, platformVisible: false,
platformRecoverVisible: false,
videoVisible: false, videoVisible: false,
sysMessage: { sysMessage: {
message, message,
...@@ -347,6 +381,7 @@ class NoticeIconView extends Component { ...@@ -347,6 +381,7 @@ class NoticeIconView extends Component {
} }
this.setState({ this.setState({
platformVisible: false, platformVisible: false,
platformRecoverVisible: false,
}); });
}; };
...@@ -428,6 +463,18 @@ class NoticeIconView extends Component { ...@@ -428,6 +463,18 @@ class NoticeIconView extends Component {
) )
} }
{
this.state.platformRecoverVisible && this.platformRecoverMessages.length > 0 && (
<PlatformModal
platformVisible={this.state.platformRecoverVisible}
handleClosePlatform={this.handleClosePlatform}
messages={this.platformRecoverMessages}
handlerMointer={this.handlerMointer}
type={'recover'}
/>
)
}
{this.state.videoVisible && this.state.videoMessage?.list?.length && ( {this.state.videoVisible && this.state.videoMessage?.list?.length && (
<VideoSliderModal <VideoSliderModal
modalInfo={{ modalInfo={{
......
...@@ -460,6 +460,9 @@ ...@@ -460,6 +460,9 @@
b { b {
color: rgba(255, 36, 36, 1); color: rgba(255, 36, 36, 1);
} }
&-recover {
color: #00b809 !important;
}
} }
&-bottom { &-bottom {
display: flex; display: flex;
...@@ -471,6 +474,9 @@ ...@@ -471,6 +474,9 @@
color: #ff2929; color: #ff2929;
} }
} }
&-recover {
color: #00b809 !important;
}
span { span {
font-size: 16px; font-size: 16px;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
...@@ -488,6 +494,13 @@ ...@@ -488,6 +494,13 @@
} }
} }
} }
.platformModalRecover {
:global {
.@{ant-prefix}-modal-header {
background: #00b809;
}
}
}
.videoPopup { .videoPopup {
:global(.@{ant-prefix}-modal-content) { :global(.@{ant-prefix}-modal-content) {
height: 520px; height: 520px;
......
This diff was suppressed by a .gitattributes entry.
...@@ -9,19 +9,25 @@ import taskIcon from '../images/types/task.png'; ...@@ -9,19 +9,25 @@ import taskIcon from '../images/types/task.png';
import workIcon from '../images/types/work.png'; import workIcon from '../images/types/work.png';
import writeIcon from '../images/types/write.png'; import writeIcon from '../images/types/write.png';
import otherIcon from '../images/types/other.png'; import otherIcon from '../images/types/other.png';
import recoverIcon from '../images/types/recover.png';
export const getMessageTypeIcon = message => { export const getMessageTypeIcon = message => {
const { webIcon } = message; const { messageType, infoType, infoContent = {} } = message;
if (webIcon) return `${window.location.origin}/${webIcon}`; const { alarmState = 0 } = infoContent;
const { messageType, infoType } = message;
let icon = otherIcon; let icon = otherIcon;
if (infoType === '通用报警') { if (infoType === '通用报警') {
icon = alarmIcon; icon = alarmIcon;
if (alarmState === 1) {
icon = recoverIcon;
return icon;
}
} else if (infoType === '系统通知') { } else if (infoType === '系统通知') {
icon = noticeIcon; icon = noticeIcon;
} else if (infoType === '工单提醒') { } else if (infoType === '工单提醒') {
icon = workIcon; icon = workIcon;
} }
const { webIcon } = message;
if (webIcon) return `${window.location.origin}/${webIcon}`;
if (!messageType) return icon; if (!messageType) return icon;
if (messageType === '工时填报') { if (messageType === '工时填报') {
icon = writeIcon; icon = writeIcon;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment