Commit 9ca6780e authored by 李纪文's avatar 李纪文

fix: 增加状态模型

parent ce174dca
...@@ -169,6 +169,7 @@ const ConfigurationView = (props) => { ...@@ -169,6 +169,7 @@ const ConfigurationView = (props) => {
} else { } else {
myDiagram.model.setDataProperty(node, 'showVal', realVal); myDiagram.model.setDataProperty(node, 'showVal', realVal);
} }
if (node.stateName) return false;
shRule = ruleOperation(node, realVal); shRule = ruleOperation(node, realVal);
myDiagram.model.setDataProperty( myDiagram.model.setDataProperty(
node, node,
...@@ -281,6 +282,30 @@ const ConfigurationView = (props) => { ...@@ -281,6 +282,30 @@ const ConfigurationView = (props) => {
} }
}; };
/** *********************************节点状态展示逻辑****************************** */
const stateMethod = (node, list) => {
const realVal = list.Value * 1;
if (!node.shType) return false;
let shRule = [];
try {
switch (node.category) {
case 'valCase': // 实时值模型
// 颜色规则
shRule = ruleOperation(node, realVal);
myDiagram.model.setDataProperty(
node,
'fontStroke',
shRule ? shRule.attr : node.fontStroke,
);
break;
default:
break;
}
} catch (err) {
console.log(err);
}
};
/** ***********************************展示规则运算********************************* */ /** ***********************************展示规则运算********************************* */
const ruleOperation = (node, realVal) => { const ruleOperation = (node, realVal) => {
const patt = /[><=]/gi; const patt = /[><=]/gi;
...@@ -740,14 +765,16 @@ const ConfigurationView = (props) => { ...@@ -740,14 +765,16 @@ const ConfigurationView = (props) => {
}); });
if (!bindList || item.stationName !== bindList.name) return false; if (!bindList || item.stationName !== bindList.name) return false;
if ( if (
!pvList || (!pvList ||
pvList.pv === null || pvList.pv === null ||
list.sensorName !== item.shName || list.sensorName !== item.shName ||
item.realVal === pvList.pv item.realVal === pvList.pv) &&
list.sensorName !== item.stateName
) )
return false; return false;
pvList.Value = pvList.pv; pvList.Value = pvList.pv;
showNodeMethod(node, pvList); if (list.sensorName === item.shName) showNodeMethod(node, pvList);
if (list.sensorName === item.stateName) stateMethod(node, pvList);
}); });
}); });
} catch (e) { } catch (e) {
......
...@@ -199,6 +199,7 @@ const ConfigurationView = (props) => { ...@@ -199,6 +199,7 @@ const ConfigurationView = (props) => {
myDiagram.model.setDataProperty(node, 'showVal', realVal); myDiagram.model.setDataProperty(node, 'showVal', realVal);
} }
// 颜色规则 // 颜色规则
if (node.stateName) return false;
shRule = ruleOperation(node, realVal); shRule = ruleOperation(node, realVal);
myDiagram.model.setDataProperty( myDiagram.model.setDataProperty(
node, node,
...@@ -311,6 +312,30 @@ const ConfigurationView = (props) => { ...@@ -311,6 +312,30 @@ const ConfigurationView = (props) => {
} }
}; };
/** *********************************节点状态展示逻辑****************************** */
const stateMethod = (node, list) => {
const realVal = list.Value * 1;
if (!node.shType) return false;
let shRule = [];
try {
switch (node.category) {
case 'valCase': // 实时值模型
// 颜色规则
shRule = ruleOperation(node, realVal);
myDiagram.model.setDataProperty(
node,
'fontStroke',
shRule ? shRule.attr : node.fontStroke,
);
break;
default:
break;
}
} catch (err) {
console.log(err);
}
};
/** ***********************************展示规则运算********************************* */ /** ***********************************展示规则运算********************************* */
const ruleOperation = (node, realVal) => { const ruleOperation = (node, realVal) => {
const patt = /[><=]/gi; const patt = /[><=]/gi;
...@@ -424,9 +449,13 @@ const ConfigurationView = (props) => { ...@@ -424,9 +449,13 @@ const ConfigurationView = (props) => {
const ptName = itemID.substring(0, num); const ptName = itemID.substring(0, num);
const shName = itemID.substring(num + 1, Infinity); const shName = itemID.substring(num + 1, Infinity);
if (editionList && `${editionList.name}.${editionList.version}` !== ptName) return false; if (editionList && `${editionList.name}.${editionList.version}` !== ptName) return false;
if (list.Value == null || shName !== item.shName || item.realVal === list.Value) if (
(list.Value == null || shName !== item.shName || item.realVal === list.Value) &&
shName !== item.stateName
)
return false; return false;
showNodeMethod(node, list); if (shName === item.shName) showNodeMethod(node, list);
if (shName === item.stateName) stateMethod(node, list);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -875,14 +904,16 @@ const ConfigurationView = (props) => { ...@@ -875,14 +904,16 @@ const ConfigurationView = (props) => {
}); });
if (!bindList || item.stationName !== bindList.name) return false; if (!bindList || item.stationName !== bindList.name) return false;
if ( if (
!pvList || (!pvList ||
pvList.pv === null || pvList.pv === null ||
pvList.dName !== item.shName || pvList.dName !== item.shName ||
item.realVal === pvList.pv item.realVal === pvList.pv) &&
pvList.dName !== item.stateName
) )
return false; return false;
pvList.Value = pvList.pv; pvList.Value = pvList.pv;
showNodeMethod(node, pvList); if (pvList.dName === item.shName) showNodeMethod(node, pvList);
if (pvList.dName === item.stateName) stateMethod(node, list);
}); });
}); });
} catch (e) { } catch (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