Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
super-hive-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
front-end
super-hive-web
Commits
6abc3a90
Commit
6abc3a90
authored
Aug 14, 2020
by
wends
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 设备详情
parent
24c15e14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
12 deletions
+32
-12
index.vue
src/views/device-management/device-detail/index.vue
+32
-12
No files found.
src/views/device-management/device-detail/index.vue
View file @
6abc3a90
...
...
@@ -73,7 +73,7 @@
v-for=
"(property, index) in propertyList"
:key=
"index"
:label=
"property.propertyName"
:value=
"
`$
{property.propertyValue} ${property.propertyUnit}`
"
:value=
"
formatProperty(property)
"
/>
</descriptions>
</el-tab-pane>
...
...
@@ -135,17 +135,37 @@ export default {
},
created
()
{
const
{
deviceTypeId
,
deviceInstanceId
}
=
this
.
$route
.
query
getAllDeviceModel
()
.
then
(
res
=>
{
this
.
deviceTypeList
=
res
.
data
this
.
form
.
deviceType
=
deviceTypeId
||
(
this
.
deviceTypeList
.
length
?
this
.
deviceTypeList
[
0
].
id
:
null
)
this
.
getAllInstanceByDeviceTypeId
(
this
.
form
.
deviceType
,
deviceInstanceId
)
this
.
getDataModelByDeviceTypeId
(
this
.
form
.
deviceType
)
this
.
getDeviceInstanceDetail
(
this
.
form
.
deviceType
)
})
.
catch
(
_
=>
{})
// getAllDeviceModel()
// .then(res => {
// this.deviceTypeList = res.data
// this.form.deviceType = deviceTypeId || (this.deviceTypeList.length ? this.deviceTypeList[0].id : null)
// this.getAllInstanceByDeviceTypeId(this.form.deviceType, deviceInstanceId)
// this.getDataModelByDeviceTypeId(this.form.deviceType)
// this.getDeviceInstanceDetail(this.form.deviceType)
// })
// .catch(_ => {})
this
.
init
(
deviceTypeId
,
deviceInstanceId
)
},
methods
:
{
async
init
(
deviceTypeId
,
deviceInstanceId
)
{
const
deviceTypeList
=
await
getAllDeviceModel
()
this
.
deviceTypeList
=
deviceTypeList
.
data
this
.
form
.
deviceType
=
deviceTypeId
||
(
this
.
deviceTypeList
.
length
?
this
.
deviceTypeList
[
0
].
id
:
null
)
const
deviceInstanceList
=
await
getAllInstanceByDeviceTypeId
({
deviceTypeId
:
this
.
form
.
deviceType
})
this
.
deviceInstanceList
=
deviceInstanceList
.
data
this
.
form
.
deviceInstance
=
deviceInstanceId
||
this
.
deviceInstanceList
.
length
?
this
.
deviceInstanceList
[
0
].
id
:
null
const
dataModelList
=
await
getDataModelByDeviceTypeId
({
id
:
this
.
form
.
deviceType
})
this
.
dataModelList
=
dataModelList
.
data
this
.
activeDataModel
=
this
.
dataModelList
.
length
?
this
.
dataModelList
[
0
].
name
:
null
await
this
.
getDeviceInstanceDetail
(
this
.
form
.
deviceType
)
await
this
.
getPropertyDetail
(
this
.
dataModelList
[
0
].
id
,
this
.
form
.
deviceInstance
)
return
{}
},
formatProperty
(
property
)
{
return
property
.
propertyValue
?
`
${
property
.
propertyValue
}
${
property
.
propertyUnit
}
`
:
''
},
onTabClick
()
{
const
dataModel
=
this
.
dataModelList
.
find
(
v
=>
v
.
name
===
this
.
activeDataModel
)
this
.
getPropertyDetail
(
dataModel
.
id
,
this
.
form
.
deviceInstance
)
...
...
@@ -187,7 +207,6 @@ export default {
this
.
dataModelList
=
res
.
data
if
(
this
.
dataModelList
.
length
)
{
this
.
activeDataModel
=
this
.
dataModelList
[
0
].
name
this
.
getPropertyDetail
(
this
.
dataModelList
[
0
].
id
,
this
.
form
.
deviceInstance
)
}
})
.
catch
(
_
=>
{})
...
...
@@ -195,13 +214,14 @@ export default {
getPropertyDetail
(
dataModelId
,
deviceId
)
{
getPropertyDetail
({
dataModelId
,
deviceId
})
.
then
(
res
=>
{
this
.
propertyList
=
res
.
data
.
propertyList
this
.
propertyList
=
res
.
data
.
propertyList
.
length
?
res
.
data
.
propertyList
:
[]
})
.
catch
(
_
=>
{})
},
queryData
()
{
this
.
getDataModelByDeviceTypeId
(
this
.
form
.
deviceType
)
this
.
getDeviceInstanceDetail
(
this
.
form
.
deviceType
)
this
.
getPropertyDetail
(
this
.
dataModelList
[
0
].
id
,
this
.
form
.
deviceInstance
)
}
}
}
...
...
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