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

fix: 消息模板修改

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