Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
28bb7ad6
Commit
28bb7ad6
authored
Jan 20, 2025
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 组态时间模型增加当前时间
parent
592c7c76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
20 deletions
+78
-20
RealModel.js
...s/extend-components/EC_ConfigurationView/src/RealModel.js
+39
-10
configuration_custom.js
...mponents/EC_ConfigurationView/src/configuration_custom.js
+39
-10
No files found.
packages/extend-components/EC_ConfigurationView/src/RealModel.js
View file @
28bb7ad6
...
...
@@ -570,7 +570,11 @@ const ConfigurationView = (props) => {
shName
!==
item
.
stateName
)
return
false
;
if
(
node
.
category
===
'timeCase'
&&
shName
===
item
.
shName
)
{
if
(
node
.
category
===
'timeCase'
&&
shName
===
item
.
shName
&&
node
.
shType
===
'更新时间'
)
{
myDiagram
.
model
.
setDataProperty
(
node
,
'text'
,
moment
(
list
.
Time
).
format
(
node
.
format
));
myDiagram
.
model
.
setDataProperty
(
node
,
...
...
@@ -743,6 +747,25 @@ const ConfigurationView = (props) => {
diagram
.
skipsUndoManager
=
oldskips
;
};
// 当前时间更新
const
updateTimeCase
=
()
=>
{
let
data
=
[];
myDiagram
?.
nodes
?.
map
((
list
)
=>
{
const
node
=
list
?.
data
||
{};
if
(
node
?.
category
===
'timeCase'
&&
node
?.
shType
===
'当前时间'
)
{
myDiagram
.
model
.
setDataProperty
(
node
,
'text'
,
moment
().
format
(
node
.
format
));
myDiagram
.
model
.
setDataProperty
(
node
,
'timeStr'
,
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
));
data
.
push
(
node
||
{});
}
});
mySetInterval
(()
=>
{
data
.
map
((
node
)
=>
{
myDiagram
.
model
.
setDataProperty
(
node
,
'text'
,
moment
().
format
(
node
.
format
));
myDiagram
.
model
.
setDataProperty
(
node
,
'timeStr'
,
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
));
});
},
1000
);
};
const
myTimeout
=
(
fn
,
delay
)
=>
{
let
timer
;
const
stime
=
+
new
Date
();
...
...
@@ -1255,17 +1278,9 @@ const ConfigurationView = (props) => {
try {
jsonCopy.nodeDataArray.forEach((item) => {
if (!(item.shName || item.
figure === '
updateTim
e
')) return false;
if (!(item.shName || item.
category === '
timeCas
e
')) return false;
const node = myDiagram.model.findNodeDataForKey(item.key);
mqttData.forEach((list) => {
if (node.figure === '
updateTime
') {
myDiagram.model.setDataProperty(
node,
'
text
',
new Date(list.PT).format('
yyyy
-
MM
-
dd
hh
:
mm
:
ss
'),
);
return false;
}
const bindList = bindData.find((arr) => {
return arr.code === list.code;
});
...
...
@@ -1274,6 +1289,19 @@ const ConfigurationView = (props) => {
});
if (!bindList || !pvList) return false;
if (item.stationName !== bindList.name) return false;
if (
node.category === '
timeCase
' &&
item.stationName === bindList.name &&
item?.shType === '
更新时间
'
) {
myDiagram.model.setDataProperty(node, '
text
', moment(list.pt).format(node.format));
myDiagram.model.setDataProperty(
node,
'
timeStr
',
moment(list.pt).format('
YYYY
-
MM
-
DD
HH
:
mm
:
ss
'),
);
return false;
}
if (
(pvList.pv === null || pvList.dName !== item.shName || item.realVal === pvList.pv) &&
pvList.dName !== item.stateName
...
...
@@ -3463,6 +3491,7 @@ const ConfigurationView = (props) => {
rotateSvg();
blenderSvg();
animationSvg();
updateTimeCase();
}, 100);
const json = JSON.parse(JSON.stringify(fromJson));
json.linkDataArray.forEach((item) => {
...
...
packages/extend-components/EC_ConfigurationView/src/configuration_custom.js
View file @
28bb7ad6
...
...
@@ -539,7 +539,11 @@ const ConfigurationView = (props) => {
shName
!==
item
.
stateName
)
return
false
;
if
(
node
.
category
===
'timeCase'
&&
shName
===
item
.
shName
)
{
if
(
node
.
category
===
'timeCase'
&&
shName
===
item
.
shName
&&
node
.
shType
===
'更新时间'
)
{
myDiagram
.
model
.
setDataProperty
(
node
,
'text'
,
moment
(
list
.
Time
).
format
(
node
.
format
));
myDiagram
.
model
.
setDataProperty
(
node
,
...
...
@@ -686,6 +690,25 @@ const ConfigurationView = (props) => {
diagram
.
skipsUndoManager
=
oldskips
;
};
// 当前时间更新
const
updateTimeCase
=
()
=>
{
let
data
=
[];
myDiagram
?.
nodes
?.
map
((
list
)
=>
{
const
node
=
list
?.
data
||
{};
if
(
node
?.
category
===
'timeCase'
&&
node
?.
shType
===
'当前时间'
)
{
myDiagram
.
model
.
setDataProperty
(
node
,
'text'
,
moment
().
format
(
node
.
format
));
myDiagram
.
model
.
setDataProperty
(
node
,
'timeStr'
,
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
));
data
.
push
(
node
||
{});
}
});
mySetInterval
(()
=>
{
data
.
map
((
node
)
=>
{
myDiagram
.
model
.
setDataProperty
(
node
,
'text'
,
moment
().
format
(
node
.
format
));
myDiagram
.
model
.
setDataProperty
(
node
,
'timeStr'
,
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
));
});
},
1000
);
};
const
myTimeout
=
(
fn
,
delay
)
=>
{
let
timer
;
const
stime
=
+
new
Date
();
...
...
@@ -1197,17 +1220,9 @@ const ConfigurationView = (props) => {
try {
jsonCopy.nodeDataArray.forEach((item) => {
if (!(item.shName || item.
figure === '
updateTim
e
')) return false;
if (!(item.shName || item.
category === '
timeCas
e
')) return false;
const node = myDiagram.model.findNodeDataForKey(item.key);
mqttData.forEach((list) => {
if (node.figure === '
updateTime
') {
myDiagram.model.setDataProperty(
node,
'
text
',
new Date(list.PT).format('
yyyy
-
MM
-
dd
hh
:
mm
:
ss
'),
);
return false;
}
const bindList = bindData.find((arr) => {
return arr.code === list.code;
});
...
...
@@ -1216,6 +1231,19 @@ const ConfigurationView = (props) => {
});
if (!bindList || !pvList) return false;
if (item.stationName !== bindList.name) return false;
if (
node.category === '
timeCase
' &&
item.stationName === bindList.name &&
item?.shType === '
更新时间
'
) {
myDiagram.model.setDataProperty(node, '
text
', moment(list.pt).format(node.format));
myDiagram.model.setDataProperty(
node,
'
timeStr
',
moment(list.pt).format('
YYYY
-
MM
-
DD
HH
:
mm
:
ss
'),
);
return false;
}
if (
(pvList.pv === null || pvList.dName !== item.shName || item.realVal === pvList.pv) &&
pvList.dName !== item.stateName
...
...
@@ -3268,6 +3296,7 @@ const ConfigurationView = (props) => {
rotateSvg();
blenderSvg();
animationSvg();
updateTimeCase();
}, 100);
const json = JSON.parse(JSON.stringify(fromJson));
json.linkDataArray.forEach((item) => {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment