Commit a3c8111c authored by 杨思琦's avatar 杨思琦

fix: 消息模板修改

parent d8eb5a36
Pipeline #65105 passed with stages
...@@ -314,7 +314,7 @@ class NoticeIconView extends Component { ...@@ -314,7 +314,7 @@ class NoticeIconView extends Component {
this.renderSysPlatform(message); this.renderSysPlatform(message);
}; };
handlerUnknowDetail = message => { handlerUnknowDetail = (message, type) => {
// 需要有跳转路径 // 需要有跳转路径
if (!message.webPath) if (!message.webPath)
return notification.info({ message: '提示', duration: 3, description: '未配置跳转路径' }); return notification.info({ message: '提示', duration: 3, description: '未配置跳转路径' });
...@@ -343,6 +343,9 @@ class NoticeIconView extends Component { ...@@ -343,6 +343,9 @@ class NoticeIconView extends Component {
} }
params._source = '消息通知'; params._source = '消息通知';
params._target = message.webPath; params._target = message.webPath;
if (type) {
if (/civweb4/.test(targetMenuPath)) return true;
}
sessionStorage.setItem('routerParams', JSON.stringify(params)); sessionStorage.setItem('routerParams', JSON.stringify(params));
window.history.pushState(params, '', `/civbase/${targetMenuPath}?v=${Date.now()}`); window.history.pushState(params, '', `/civbase/${targetMenuPath}?v=${Date.now()}`);
} }
......
...@@ -17,7 +17,6 @@ export const MESSAGE_TYPE = { ...@@ -17,7 +17,6 @@ export const MESSAGE_TYPE = {
export const NEW_MESSAGE = 'NEW_MESSAGE'; export const NEW_MESSAGE = 'NEW_MESSAGE';
export const USERNAME = 'mao2080'; export const USERNAME = 'mao2080';
export const PASSWORD = '123'; export const PASSWORD = '123';
export const PLATFORM_LEVEL = '4'; export const PLATFORM_LEVEL = '4';
......
import React from 'react'; import React from 'react';
import { Badge, Button, ConfigProvider } from 'antd'; import { Badge, Button, ConfigProvider } from 'antd';
// eslint-disable-next-line import/no-unresolved
import classNames from 'classnames'; import classNames from 'classnames';
import useMergeValue from 'use-merge-value'; import useMergeValue from 'use-merge-value';
...@@ -40,8 +41,8 @@ const messageSvg = () => ( ...@@ -40,8 +41,8 @@ const messageSvg = () => (
/> />
</svg> </svg>
); );
const BellOutlined = (props) => <Icon component={messageSvg} {...props} />; const BellOutlined = props => <Icon component={messageSvg} {...props} />;
const NoticeIcon = (props) => { const NoticeIcon = props => {
const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext);
const prefixCls = props.prefixCls || getPrefixCls(); const prefixCls = props.prefixCls || getPrefixCls();
const btnPrefixCls = `${prefixCls}-head-notifier-button`; const btnPrefixCls = `${prefixCls}-head-notifier-button`;
...@@ -54,14 +55,12 @@ const NoticeIcon = (props) => { ...@@ -54,14 +55,12 @@ const NoticeIcon = (props) => {
} }
const panes = []; const panes = [];
React.Children.forEach(children, (child) => { React.Children.forEach(children, child => {
if (!child) { if (!child) {
return; return;
} }
const { list, title } = child.props; const { list, title } = child.props;
panes.push( panes.push(<NoticeList {...child.props} data={list} key={child} title={title} config={props.config} />);
<NoticeList {...child.props} data={list} key={child} title={title} config={props.config} />,
);
}); });
const childProps = panes.length === 1 ? panes[0].props : { list: [] }; const childProps = panes.length === 1 ? panes[0].props : { list: [] };
return ( return (
...@@ -72,7 +71,9 @@ const NoticeIcon = (props) => { ...@@ -72,7 +71,9 @@ const NoticeIcon = (props) => {
type="link" type="link"
onClick={() => (childProps.list.length > 0 ? confirmRead(true) : null)} onClick={() => (childProps.list.length > 0 ? confirmRead(true) : null)}
disabled={childProps.list.length === 0} disabled={childProps.list.length === 0}
>全部标记已读</Button> >
全部标记已读
</Button>
</div> </div>
{panes} {panes}
{renderFooter && renderFooter()} {renderFooter && renderFooter()}
......
import React from 'react'; import React from 'react';
import { List, Spin, ConfigProvider } from 'antd'; import { List, Spin, ConfigProvider } from 'antd';
// eslint-disable-next-line import/no-unresolved
import classNames from 'classnames'; import classNames from 'classnames';
import './style/list.less'; import './style/list.less';
import { Alarm, Case, Notice, Unknown } from './templates'; import { Alarm, Case, Notice, Unknown } from './templates';
...@@ -11,10 +12,7 @@ const Empty = ({ emptyText, ...props }) => { ...@@ -11,10 +12,7 @@ const Empty = ({ emptyText, ...props }) => {
const prefixCls = props.prefixCls || getPrefixCls(); const prefixCls = props.prefixCls || getPrefixCls();
return ( return (
<div className={`${prefixCls}-notFound`}> <div className={`${prefixCls}-notFound`}>
<img <img src="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg" alt="not found" />
src="https://gw.alipayobjects.com/zos/rmsportal/sAuJeJzSKbUmHfBQRzmZ.svg"
alt="not found"
/>
<div>{emptyText}</div> <div>{emptyText}</div>
</div> </div>
); );
...@@ -113,11 +111,11 @@ class NoticeList extends React.Component { ...@@ -113,11 +111,11 @@ class NoticeList extends React.Component {
switch (item.infoClasses) { switch (item.infoClasses) {
case MESSAGE_TYPE.ALARM_TYPE: case MESSAGE_TYPE.ALARM_TYPE:
messageTemplate = ( messageTemplate = (
<Alarm message={item} confirmRead={this.confirmRead} config={this.props.config} /> <Alarm message={item} confirmRead={this.confirmRead} config={this.props.config} handlerUnknowDetail={this.handlerUnknowDetail} />
); );
break; break;
case MESSAGE_TYPE.CASE_TYPE: case MESSAGE_TYPE.CASE_TYPE:
messageTemplate = <Case message={item} confirmRead={this.confirmRead} />; messageTemplate = <Case message={item} confirmRead={this.confirmRead} handlerUnknowDetail={this.handlerUnknowDetail} />;
break; break;
case MESSAGE_TYPE.SYS_TYPE: case MESSAGE_TYPE.SYS_TYPE:
messageTemplate = ( messageTemplate = (
......
...@@ -99,9 +99,9 @@ export const createMessageFromReal = (realMesssage, options = {}) => { ...@@ -99,9 +99,9 @@ export const createMessageFromReal = (realMesssage, options = {}) => {
// 2.0 消息 // 2.0 消息
infoContent = JSON.parse(realMesssage.content || '{}'); infoContent = JSON.parse(realMesssage.content || '{}');
} }
const template = { const template = {
id: realMesssage.infoId, id: realMesssage.infoId || realMesssage.ID,
infoContent, infoContent,
time, time,
infoType: realMesssage.infoType, infoType: realMesssage.infoType,
...@@ -109,7 +109,7 @@ export const createMessageFromReal = (realMesssage, options = {}) => { ...@@ -109,7 +109,7 @@ export const createMessageFromReal = (realMesssage, options = {}) => {
dateTime: realMesssage.createTime, dateTime: realMesssage.createTime,
webConfig: realMesssage.web_config, webConfig: realMesssage.web_config,
webPath: realMesssage.web_path, webPath: realMesssage.web_path,
messType: realMesssage.messType, messType: realMesssage.messType || realMesssage.MessType,
defaultContent: (_.isString(realMesssage.defaultContent) && realMesssage.defaultContent.replace(new RegExp(/ /g), "").length > 0) ? realMesssage.defaultContent : null, defaultContent: (_.isString(realMesssage.defaultContent) && realMesssage.defaultContent.replace(new RegExp(/ /g), "").length > 0) ? realMesssage.defaultContent : null,
webIcon: (_.isString(realMesssage.webIcon) && realMesssage.webIcon.replace(new RegExp(/ /g), "").length > 0) ? realMesssage.webIcon : null, webIcon: (_.isString(realMesssage.webIcon) && realMesssage.webIcon.replace(new RegExp(/ /g), "").length > 0) ? realMesssage.webIcon : null,
title: (_.isString(realMesssage.title) && realMesssage.title.replace(new RegExp(/ /g), "").length > 0) ? realMesssage.title : null, title: (_.isString(realMesssage.title) && realMesssage.title.replace(new RegExp(/ /g), "").length > 0) ? realMesssage.title : null,
......
...@@ -28,7 +28,7 @@ export class AlarmContent { ...@@ -28,7 +28,7 @@ export class AlarmContent {
} }
} }
const Alarm = ({ message, confirmRead, config }) => { const Alarm = ({ message, confirmRead, config, handlerUnknowDetail }) => {
const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls(); const prefixCls = getPrefixCls();
...@@ -41,20 +41,22 @@ const Alarm = ({ message, confirmRead, config }) => { ...@@ -41,20 +41,22 @@ const Alarm = ({ message, confirmRead, config }) => {
const alarmThreshold = message?.infoContent?.alarmThreshold; const alarmThreshold = message?.infoContent?.alarmThreshold;
const goPath = (item) => { const goPath = (item) => {
if(handlerUnknowDetail && handlerUnknowDetail(message, 'alarm')) {
const widgetID = 'widget_city_综合运营_管网监控_实时监控_报警监控';
const webPath = 'product/scada/AlertMonitoring/AlertMonitoring';
const widget = findPathByWidget(
'productex/water/IOTMonitor/RealTimeAlarm/RealTimeAlarm',
config.widgets,
'',
'url',
);
window.share.event.emit('listenerMointer', {
widgetId: widgetID,
label: '实时报警',
url: widget.url || webPath,
});
}
confirmRead(false, [message.id]); confirmRead(false, [message.id]);
const widgetID = 'widget_city_综合运营_管网监控_实时监控_报警监控';
const webPath = 'product/scada/AlertMonitoring/AlertMonitoring';
const widget = findPathByWidget(
'productex/water/IOTMonitor/RealTimeAlarm/RealTimeAlarm',
config.widgets,
'',
'url',
);
window.share.event.emit('listenerMointer', {
widgetId: widgetID,
label: '实时报警',
url: widget.url || webPath,
});
}; };
......
...@@ -19,7 +19,7 @@ export class CaseContent { ...@@ -19,7 +19,7 @@ export class CaseContent {
} }
} }
const Case = ({ message, confirmRead }) => { const Case = ({ message, confirmRead, handlerUnknowDetail }) => {
const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls(); const prefixCls = getPrefixCls();
const caseType = message?.infoContent?.caseType; const caseType = message?.infoContent?.caseType;
...@@ -29,34 +29,36 @@ const Case = ({ message, confirmRead }) => { ...@@ -29,34 +29,36 @@ const Case = ({ message, confirmRead }) => {
const content = message?.infoContent?.content; const content = message?.infoContent?.content;
const goPath = item => { const goPath = item => {
confirmRead(false, [message.id]); if (handlerUnknowDetail && handlerUnknowDetail(message, 'case')) {
const messageType = item.messType; const messageType = item.messType;
let label = ''; let label = '';
let widgetID = ''; let widgetID = '';
switch (messageType) { switch (messageType) {
case '任务派发': case '任务派发':
label = '任务派发'; label = '任务派发';
widgetID = 'widget_city_综合运营_二供管理_维修管理_工单办理'; widgetID = 'widget_city_综合运营_二供管理_维修管理_工单办理';
break; break;
case '任务驳回': case '任务驳回':
label = '任务驳回'; label = '任务驳回';
widgetID = 'widget_city_综合运营_二供管理_维修管理_工单办理'; widgetID = 'widget_city_综合运营_二供管理_维修管理_工单办理';
// eslint-disable-next-line no-underscore-dangle,no-case-declarations // eslint-disable-next-line no-underscore-dangle,no-case-declarations
let _tab; let _tab;
// eslint-disable-next-line prefer-const // eslint-disable-next-line prefer-const
_tab = '任务驳回'; _tab = '任务驳回';
break; break;
default: default:
label = '工单办理'; label = '工单办理';
widgetID = 'widget_city_综合运营_二供管理_维修管理_工单办理'; widgetID = 'widget_city_综合运营_二供管理_维修管理_工单办理';
break; break;
}
const webPath = item.webPath || 'product/maintenance/CaseManage/CaseDoingBox/StardCaseDoingBoxView|isDelay=1';
window.share.event.emit('listenerMointer', {
widgetId: widgetID,
label,
url: webPath,
});
} }
const webPath = item.webPath || 'product/maintenance/CaseManage/CaseDoingBox/StardCaseDoingBoxView|isDelay=1'; confirmRead(false, [message.id]);
window.share.event.emit('listenerMointer', {
widgetId: widgetID,
label,
url: webPath,
});
}; };
return ( return (
......
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