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
c2fd3503
Commit
c2fd3503
authored
Jul 01, 2025
by
冀忠欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
3d3bbfe2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
tht_project/static/src/view/equipment_status.html
+12
-9
No files found.
tht_project/static/src/view/equipment_status.html
View file @
c2fd3503
...
...
@@ -233,6 +233,7 @@
if
(
this
.
getUrlSearch
(
"factory_code"
))
{
this
.
factoryCode
=
this
.
getUrlSearch
(
"factory_code"
);
//截取url后面的参数
}
// this.factoryCode = "66c6bd8c-fd58-11ef-9692-00163e04c506"
this
.
initCurrentTimeFn
()
},
computed
:
{
...
...
@@ -529,12 +530,12 @@
this
.
allEquipmentData
.
forEach
(
function
(
equip
)
{
codeToSeqMap
[
equip
.
code
]
=
equip
.
sequence
;
});
// 获取当前车间下的设备 code 列表
var
validCodes
=
this
.
allEquipmentData
.
filter
(
function
(
e
)
{
return
!
this
.
selectedWorkshop
||
e
.
plant_name
===
this
.
selectedWorkshop
;
}.
bind
(
this
))
.
map
(
function
(
e
)
{
return
e
.
code
;
});
var
validCodes
=
this
.
allEquipmentData
.
filter
(
function
(
e
)
{
return
!
this
.
selectedWorkshop
||
e
.
plant_name
===
this
.
selectedWorkshop
;
}.
bind
(
this
)).
map
(
function
(
e
)
{
return
e
.
code
;
});
// 过滤掉不属于当前车间的设备
var
filteredDevices
=
deviceStateData
.
filter
(
function
(
d
)
{
return
!
this
.
selectedWorkshop
||
validCodes
.
includes
(
d
.
code
);
...
...
@@ -545,7 +546,7 @@
});
// 将API返回的数据转换为页面所需的格式
this
.
deviceList
=
filteredDevices
.
map
(
function
(
device
)
{
var
deviceList
=
filteredDevices
.
map
(
function
(
device
,
index
)
{
// 根据API返回的状态确定前端显示的状态
var
status
=
"off"
;
if
(
device
.
state
===
"green"
)
{
...
...
@@ -581,10 +582,10 @@
var
deviceName
=
device
.
name
||
device
.
code
// 默认使用API返回的名称或编码
// 在所有设备列表中查找匹配的设备
if
(
this
.
allEquipmentData
&&
this
.
allEquipmentData
.
length
>
0
)
{
var
matchedDevice
=
this
.
allEquipmentData
.
find
(
function
(
equip
)
{
return
equip
.
code
===
device
.
code
;
})
;
var
matchedDevice
=
this
.
allEquipmentData
.
find
(
function
(
equip
)
{
return
equip
.
code
===
device
.
code
;
})
// 如果找到匹配的设备,使用其名称
if
(
matchedDevice
&&
matchedDevice
.
name
)
{
deviceName
=
device
.
name
?
matchedDevice
.
name
:
device
.
code
deviceName
=
matchedDevice
?.
name
||
device
.
code
}
else
{
return
false
}
...
...
@@ -603,7 +604,9 @@
}
}.
bind
(
this
)).
sort
(
function
(
a
,
b
)
{
return
(
codeToSeqMap
[
a
.
code
]
||
Number
.
MAX_SAFE_INTEGER
)
-
(
codeToSeqMap
[
b
.
code
]
||
Number
.
MAX_SAFE_INTEGER
);
});
})
// 过滤没有信息项的数据
this
.
deviceList
=
deviceList
.
filter
(
item
=>
item
.
id
)
},
formatTime
:
function
(
seconds
)
{
...
...
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