Commit eb4e9796 authored by 邓晓峰's avatar 邓晓峰

fix: alarm notice message

parent 6246d3d8
Pipeline #21450 passed with stages
in 19 minutes 24 seconds
......@@ -183,6 +183,13 @@ module.exports = options => ({
`${pkg.name.toLocaleLowerCase()}/theme`,
),
},
{
from: path.resolve(process.cwd(), 'web.config'),
to: path.resolve(
process.env.npm_config_releasepath || process.cwd(),
`${pkg.name.toLocaleLowerCase()}/web.config`,
),
},
]),
]),
resolve: {
......
"use strict";
/* eslint consistent-return:0 import/order:0 */
var express = require('express');
var logger = require('./logger');
var argv = require('./argv');
var port = require('./port');
var setup = require('./middlewares/frontendMiddleware');
var isDev = process.env.NODE_ENV !== 'production';
var pkg = require('../package.json');
var ngrok = isDev && process.env.ENABLE_TUNNEL || argv.tunnel ? require('ngrok') : false;
var _require = require('path'),
resolve = _require.resolve;
var app = express();
setup(app, {
outputPath: resolve(process.cwd(), pkg.name.toLocaleLowerCase()),
publicPath: "/".concat(pkg.name.toLocaleLowerCase())
});
var customHost = argv.host || process.env.HOST;
var host = customHost || null;
var prettyHost = customHost || 'localhost'; // use the gzipped bundle
app.get('*.js', function (req, res, next) {
req.url = req.url + '.gz'; // eslint-disable-line
res.set('Content-Encoding', 'gzip');
next();
}); // Start your app.
app.listen(port, host, function _callee(err) {
var url;
return regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!err) {
_context.next = 2;
break;
}
return _context.abrupt("return", logger.error(err.message));
case 2:
if (!ngrok) {
_context.next = 15;
break;
}
_context.prev = 3;
_context.next = 6;
return regeneratorRuntime.awrap(ngrok.connect(port));
case 6:
url = _context.sent;
_context.next = 12;
break;
case 9:
_context.prev = 9;
_context.t0 = _context["catch"](3);
return _context.abrupt("return", logger.error(_context.t0));
case 12:
logger.appStarted(port, prettyHost, url);
_context.next = 16;
break;
case 15:
logger.appStarted(port, prettyHost);
case 16:
case "end":
return _context.stop();
}
}
}, null, null, [[3, 9]]);
});
\ No newline at end of file
"use strict";
var argv = require('./argv');
console.log(argv.port);
module.exports = parseInt(argv.port || process.env.PORT || '3005', 10);
\ No newline at end of file
......@@ -8,6 +8,7 @@ import NoticeIcon from '../NoticeIcon';
import Notifier from '../Notifier';
import { NEW_MESSAGE } from '../Notifier/constants';
import styles from './index.less';
import { findPathByWidget } from '../../utils/utils';
class NoticeIconView extends Component {
constructor(props) {
......@@ -164,12 +165,14 @@ class NoticeIconView extends Component {
this.notifier.confirmRead(false, [item.id]);
if (detail) {
const widgetID = 'widget_city_综合运营_管网监控_实时监控_报警监控';
const webPath =
item.webPath || 'product/scada/AlertMonitoring/AlertMonitoring';
const webPath = 'product/scada/AlertMonitoring/AlertMonitoring';
debugger
let widget = findPathByWidget("productex/water/IOTMonitor/RealTimeAlarm/RealTimeAlarm", this.props.global.widgets, "", "url");
console.log(widget)
window.share.event.emit('listenerMointer', {
widgetId: widgetID,
label: '报警监控',
url: webPath,
url: widget.url || webPath,
});
}
this.setState({
......@@ -201,61 +204,9 @@ class NoticeIconView extends Component {
hasMore={this.notifier.hasMore}
/>
</NoticeIcon>
{/* {
this.state.platformVisible ? <Modal title="未读消息"
visible={this.state.platformVisible}
zIndex={5000}
className={styles.platformModal}
footer={null}
centered
maskClosable={false}
onCancel={(event) => this.handleClosePlatform(event)}>
<List
itemLayout="vertical"
dataSource={this.state.noticeData.filter(item => item.infoLevel === "4")}
pagination={{
size:"small",
onChange: page => {
console.log(page);
},
pageSize: 1,
}}
renderItem={
item => (
<List.Item
key={item.id}
extra={<img width={16} alt="点击标为已读" src="https://panda-water.com/web4/assets/images/message/%E5%B7%B2%E8%AF%BB-%E9%BB%98%E8%AE%A4.svg" onClick={() => this.handlerMointer(item, false)}/>}>
<List.Item.Meta
avatar={<img size="63" src="https://panda-water.com/web4/assets/images/message/%E6%8A%A5%E8%AD%A6%E5%9B%BE%E6%A0%87.svg" />}
title={<a onClick={() => this.handlerMointer(item, true)}>{item.infoContent.alarmDevice}</a>}
description={
<>
<div className={styles.content}>
<b>{item.infoContent.alarmType}</b>
{
'|' + item.infoContent.alarmContent
}
</div>
<div>
<span>
<b>{item.infoContent.alarmValue}/</b>
{item.infoContent.alarmThreshold}
</span>
<span>{item.time}</span>
</div>
</>
}
/>
</List.Item>
)
}>
</List>
</Modal>: null
} */}
{this.state.platformVisible
? this.notifier.renderPlatformElement
: null
// this.renderPlatform()
}
{this.state.videoVisible ? this.notifier.renderVideoElement : null}
......
......@@ -114,7 +114,7 @@ class NoticeList extends React.Component {
switch (item.infoType) {
case 'scadaType':
messageTemplate = (
<Alarm message={item} confirmRead={this.confirmRead} />
<Alarm message={item} confirmRead={this.confirmRead} config={this.props.config} />
);
break;
case 'caseType':
......
import React from 'react';
import classNames from 'classnames';
import { findPathByWidget } from '../../../../utils/utils';
import commonStyles from '../common.less';
import styles from './index.less';
/* eslint-disable */
......@@ -25,17 +25,19 @@ export class AlarmContent {
}
}
const Alarm = ({ message, confirmRead }) => {
const Alarm = ({ message, confirmRead, config }) => {
const alarmContent = message.infoContent;
const goPath = item => {
confirmRead(false, [message.id]);
const widgetID = 'widget_city_综合运营_管网监控_实时监控_报警监控';
const webPath =
item.webPath || 'product/scada/AlertMonitoring/AlertMonitoring';
const webPath = 'product/scada/AlertMonitoring/AlertMonitoring';
debugger
const widget = findPathByWidget("productex/water/IOTMonitor/RealTimeAlarm/RealTimeAlarm", config.widgets, "", "url");
console.log(widget)
window.share.event.emit('listenerMointer', {
widgetId: widgetID,
label: '报警监控',
url: webPath,
url: widget.url || webPath,
});
};
const alarmValue =
......
......@@ -56,7 +56,13 @@ const NoticeIcon = props => {
}
const { list, title } = child.props;
panes.push(
<NoticeList {...child.props} data={list} key={child} title={title} />,
<NoticeList
{...child.props}
data={list}
key={child}
title={title}
config={props.global}
/>,
);
});
return (
......
......@@ -85,3 +85,31 @@ export function transformURL(path) {
String.fromCharCode(92);
return el.value.replace(/\\/g, '/');
}
export function findPathByWidget(leafId, nodes, path, key) {
if (path === undefined) {
path = {};
}
let tmpPath = path;
// eslint-disable-next-line no-plusplus
for (let i = 0; i < nodes.length; i++) {
if (nodes[i] && nodes[i][key] && nodes[i][key].indexOf(leafId) > -1) {
tmpPath = nodes[i];
return tmpPath;
}
if (nodes[i] && nodes[i].widgets) {
const findResult = findPathByWidget(
leafId,
nodes[i].widgets,
tmpPath,
key,
// eslint-disable-next-line no-restricted-globals
location,
);
if (findResult) {
return findResult;
}
}
}
return tmpPath;
}
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