Commit 88576ce0 authored by 李纪文's avatar 李纪文

fix: 在线修改修改

parent 1ec160b3
......@@ -272,10 +272,9 @@ const ConfigurationView = (props) => {
node.realType === '在线'
? shRule
? shRule.attr
: node.fontStroke
: node.dtStroke
: node.oflColor || '#999999',
);
myDiagram.model.setDataProperty(node, 'dtStroke', shRule ? shRule.attr : node.fontStroke);
break;
case 'waterCase': // 水池模型
const height = node.height - node.strokeWidth * 2;
......@@ -398,10 +397,9 @@ const ConfigurationView = (props) => {
node.realType === '在线'
? shRule
? shRule.attr
: node.fontStroke
: node.dtStroke
: node.oflColor || '#999999',
);
myDiagram.model.setDataProperty(node, 'dtStroke', shRule ? shRule.attr : node.fontStroke);
break;
default:
break;
......@@ -499,23 +497,18 @@ const ConfigurationView = (props) => {
// 水流样式
}
// 离线判断
try {
onlineColorMethod(jsonCopy.nodeDataArray, name, mqttData);
} catch (err) {
// console.log(err)
}
try {
jsonCopy.nodeDataArray.forEach((item) => {
if (!(item.shName || item.category === 'timeCase') || item.stationName !== name)
return false;
const node = myDiagram.model.findNodeDataForKey(item.key);
if (!item.stateName) {
const onlineList = onLineDataMethod(mqttData);
if (onlineList) {
node.realType = onlineList.Value * 1 ? '在线' : '离线';
myDiagram.model.setDataProperty(
node,
'realType',
onlineList.Value * 1 ? '在线' : '离线',
);
onlineColorMethod(node);
}
}
mqttData.forEach((list) => {
const itemID = list.ItemID;
const num = itemID.lastIndexOf('.');
......@@ -586,23 +579,37 @@ const ConfigurationView = (props) => {
};
/** **************************************是否在线颜色变化****************************************** */
const onlineColorMethod = (node) => {
if (node.realVal === '--' || !node.shName) return false;
try {
switch (node.category) {
case 'valCase': // 实时值模型
myDiagram.model.setDataProperty(
node,
'fontStroke',
node.realType === '在线' ? node.dtStroke : node.oflColor || '#999999',
);
break;
default:
break;
const onlineColorMethod = (nodeDataArray, name, mqttData) => {
const onlineList = onLineDataMethod(mqttData);
if (!onlineList) return false;
const onlineType = onlineList.Value * 1 ? '在线' : '离线';
nodeDataArray.forEach((item) => {
if (
item.shName &&
item.stationName === name &&
item.category === 'valCase' &&
!item.stateName
) {
const node = myDiagram.model.findNodeDataForKey(item.key);
const shRule = node.realVal !== '--' ? ruleOperation(node, node.realVal) : null;
switch (node.category) {
case 'valCase': // 实时值模型
myDiagram.model.setDataProperty(
node,
'fontStroke',
onlineType === '在线'
? shRule
? shRule.attr
: node.dtStroke
: node.oflColor || '#999999',
);
myDiagram.model.setDataProperty(node, 'realType', onlineType);
break;
default:
break;
}
}
} catch (e) {
// console.log(e)
}
});
};
/** **************************************合管****************************************** */
......
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