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
d1a7021f
Commit
d1a7021f
authored
Jul 01, 2025
by
龚桂斌
Browse files
Options
Browse Files
Download
Plain Diff
合并分支 'tht-project' 到 'master'
修改bug 查看合并请求
!22
parents
d54af864
c2fd3503
Show 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 @
d1a7021f
...
@@ -233,6 +233,7 @@
...
@@ -233,6 +233,7 @@
if
(
this
.
getUrlSearch
(
"factory_code"
))
{
if
(
this
.
getUrlSearch
(
"factory_code"
))
{
this
.
factoryCode
=
this
.
getUrlSearch
(
"factory_code"
);
//截取url后面的参数
this
.
factoryCode
=
this
.
getUrlSearch
(
"factory_code"
);
//截取url后面的参数
}
}
// this.factoryCode = "66c6bd8c-fd58-11ef-9692-00163e04c506"
this
.
initCurrentTimeFn
()
this
.
initCurrentTimeFn
()
},
},
computed
:
{
computed
:
{
...
@@ -529,12 +530,12 @@
...
@@ -529,12 +530,12 @@
this
.
allEquipmentData
.
forEach
(
function
(
equip
)
{
this
.
allEquipmentData
.
forEach
(
function
(
equip
)
{
codeToSeqMap
[
equip
.
code
]
=
equip
.
sequence
;
codeToSeqMap
[
equip
.
code
]
=
equip
.
sequence
;
});
});
// 获取当前车间下的设备 code 列表
// 获取当前车间下的设备 code 列表
var
validCodes
=
this
.
allEquipmentData
var
validCodes
=
this
.
allEquipmentData
.
filter
(
function
(
e
)
{
.
filter
(
function
(
e
)
{
return
!
this
.
selectedWorkshop
||
e
.
plant_name
===
this
.
selectedWorkshop
;
}.
bind
(
this
))
return
!
this
.
selectedWorkshop
||
e
.
plant_name
===
this
.
selectedWorkshop
;
.
map
(
function
(
e
)
{
return
e
.
code
;
});
}.
bind
(
this
)).
map
(
function
(
e
)
{
return
e
.
code
;
});
// 过滤掉不属于当前车间的设备
// 过滤掉不属于当前车间的设备
var
filteredDevices
=
deviceStateData
.
filter
(
function
(
d
)
{
var
filteredDevices
=
deviceStateData
.
filter
(
function
(
d
)
{
return
!
this
.
selectedWorkshop
||
validCodes
.
includes
(
d
.
code
);
return
!
this
.
selectedWorkshop
||
validCodes
.
includes
(
d
.
code
);
...
@@ -545,7 +546,7 @@
...
@@ -545,7 +546,7 @@
});
});
// 将API返回的数据转换为页面所需的格式
// 将API返回的数据转换为页面所需的格式
this
.
deviceList
=
filteredDevices
.
map
(
function
(
device
)
{
var
deviceList
=
filteredDevices
.
map
(
function
(
device
,
index
)
{
// 根据API返回的状态确定前端显示的状态
// 根据API返回的状态确定前端显示的状态
var
status
=
"off"
;
var
status
=
"off"
;
if
(
device
.
state
===
"green"
)
{
if
(
device
.
state
===
"green"
)
{
...
@@ -581,10 +582,10 @@
...
@@ -581,10 +582,10 @@
var
deviceName
=
device
.
name
||
device
.
code
// 默认使用API返回的名称或编码
var
deviceName
=
device
.
name
||
device
.
code
// 默认使用API返回的名称或编码
// 在所有设备列表中查找匹配的设备
// 在所有设备列表中查找匹配的设备
if
(
this
.
allEquipmentData
&&
this
.
allEquipmentData
.
length
>
0
)
{
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
)
{
if
(
matchedDevice
&&
matchedDevice
.
name
)
{
deviceName
=
device
.
name
?
matchedDevice
.
name
:
device
.
code
deviceName
=
matchedDevice
?.
name
||
device
.
code
}
else
{
}
else
{
return
false
return
false
}
}
...
@@ -603,7 +604,9 @@
...
@@ -603,7 +604,9 @@
}
}
}.
bind
(
this
)).
sort
(
function
(
a
,
b
)
{
}.
bind
(
this
)).
sort
(
function
(
a
,
b
)
{
return
(
codeToSeqMap
[
a
.
code
]
||
Number
.
MAX_SAFE_INTEGER
)
-
(
codeToSeqMap
[
b
.
code
]
||
Number
.
MAX_SAFE_INTEGER
);
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
)
{
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