Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dwsproject
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dws
dwsproject
Commits
f8b6d9cd
Commit
f8b6d9cd
authored
Jun 05, 2025
by
nningxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 设备sort
parent
b0a240ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
tht_project/static/src/view/equipment_status.html
+14
-4
tht_project/views/views.xml
+3
-0
No files found.
tht_project/static/src/view/equipment_status.html
View file @
f8b6d9cd
...
@@ -526,17 +526,24 @@
...
@@ -526,17 +526,24 @@
if
(
!
deviceStateData
||
!
Array
.
isArray
(
deviceStateData
))
{
if
(
!
deviceStateData
||
!
Array
.
isArray
(
deviceStateData
))
{
return
;
return
;
}
}
const
codeToSeqMap
=
{};
this
.
allEquipmentData
.
forEach
(
equip
=>
{
codeToSeqMap
[
equip
.
code
]
=
equip
.
sequence
;
});
// 获取当前车间下的设备 code 列表
// 获取当前车间下的设备 code 列表
const
validCodes
=
this
.
allEquipmentData
const
validCodes
=
this
.
allEquipmentData
.
filter
(
e
=>
!
this
.
selectedWorkshop
||
e
.
plant_name
===
this
.
selectedWorkshop
)
.
filter
(
e
=>
!
this
.
selectedWorkshop
||
e
.
plant_name
===
this
.
selectedWorkshop
)
.
map
(
e
=>
e
.
code
);
.
map
(
e
=>
e
.
code
);
// 过滤掉不属于当前车间的设备
// 过滤掉不属于当前车间的设备
const
filteredDevices
=
deviceStateData
.
filter
(
d
=>
const
filteredDevices
=
deviceStateData
.
filter
(
d
=>
!
this
.
selectedWorkshop
||
validCodes
.
includes
(
d
.
code
)
!
this
.
selectedWorkshop
||
validCodes
.
includes
(
d
.
code
)
);
).
map
(
device
=>
({
...
device
,
seq
:
codeToSeqMap
[
device
.
code
]
||
Number
.
MAX_SAFE_INTEGER
// 如果找不到 seq,默认排最后
}));
// 将API返回的数据转换为页面所需的格式
// 将API返回的数据转换为页面所需的格式
this
.
deviceList
=
filteredDevices
.
map
((
device
)
=>
{
this
.
deviceList
=
filteredDevices
.
map
((
device
)
=>
{
...
@@ -553,7 +560,9 @@
...
@@ -553,7 +560,9 @@
}
}
// 计算持续时间的显示格式
// 计算持续时间的显示格式
let
durationText
=
"0"
let
durationText
=
"0"
if
(
device
.
duration_hours
!==
undefined
)
{
durationText
=
this
.
formatTime
(
Number
(
device
.
duration_hours
*
3600
))
}
if
(
device
.
duration_hours
!==
undefined
)
{
durationText
=
this
.
formatTime
(
Number
(
device
.
duration_hours
*
3600
))
}
let
run_seconds
=
"0"
let
run_seconds
=
"0"
if
(
device
.
run_seconds
!==
undefined
)
run_seconds
=
this
.
formatTime
(
Number
(
device
.
run_seconds
))
if
(
device
.
run_seconds
!==
undefined
)
run_seconds
=
this
.
formatTime
(
Number
(
device
.
run_seconds
))
...
@@ -594,7 +603,8 @@
...
@@ -594,7 +603,8 @@
yellow_seconds
:
yellow_seconds
,
yellow_seconds
:
yellow_seconds
,
red_seconds
:
red_seconds
red_seconds
:
red_seconds
}
}
});
}).
sort
((
a
,
b
)
=>
(
codeToSeqMap
[
a
.
code
]
||
Number
.
MAX_SAFE_INTEGER
)
-
(
codeToSeqMap
[
b
.
code
]
||
Number
.
MAX_SAFE_INTEGER
));
},
},
formatTime
(
seconds
)
{
formatTime
(
seconds
)
{
...
...
tht_project/views/views.xml
View file @
f8b6d9cd
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
<xpath
expr=
"//field[@name='workshop_id']"
position=
"after"
>
<xpath
expr=
"//field[@name='workshop_id']"
position=
"after"
>
<field
name=
"data_acquisition_code"
/>
<field
name=
"data_acquisition_code"
/>
</xpath>
</xpath>
<xpath
expr=
"//field[@name='work_center_id']"
position=
"after"
>
<field
name=
"sequence"
/>
</xpath>
</field>
</field>
</record>
</record>
<record
id=
"view_roke_mes_equipment_tree_tht"
model=
"ir.ui.view"
>
<record
id=
"view_roke_mes_equipment_tree_tht"
model=
"ir.ui.view"
>
...
...
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