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

fix: 在线修改修改

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