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
3e9e3014
Commit
3e9e3014
authored
Aug 03, 2020
by
pangjh
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
13149244
980e8162
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
27 deletions
+82
-27
G2Line.vue
src/components/G2Plot/G2Line.vue
+27
-5
index.vue
src/views/object-visible/dashboard/index.vue
+55
-22
No files found.
src/components/G2Plot/G2Line.vue
View file @
3e9e3014
...
@@ -20,6 +20,10 @@ export default {
...
@@ -20,6 +20,10 @@ export default {
title
:
{
title
:
{
type
:
String
,
type
:
String
,
default
:
'
line
'
default
:
'
line
'
},
description
:
{
type
:
String
,
default
:
''
}
}
},
},
data
()
{
data
()
{
...
@@ -40,16 +44,34 @@ export default {
...
@@ -40,16 +44,34 @@ export default {
visible
:
true
,
visible
:
true
,
text
:
this
.
title
text
:
this
.
title
},
},
description
:
{
visible
:
true
,
text
:
'
用平滑的曲线代替折线
'
},
xField
:
'
time
'
,
xField
:
'
time
'
,
yField
:
'
value
'
,
yField
:
'
value
'
,
xAxis
:
{
xAxis
:
{
type
:
'
time
'
,
type
:
'
time
'
,
mask
:
'
HH:mm:ss
'
mask
:
'
HH:mm:ss
'
},
tooltip
:
{
visible
:
true
,
shared
:
true
,
showCrosshairs
:
true
,
crosshairs
:
{
type
:
'
y
'
},
offset
:
20
},
description
:
{
visible
:
true
,
text
:
`单位为:
${
this
.
description
}
`
},
guideLine
:
[
{
type
:
'
mean
'
,
lineStyle
:
{},
text
:
{
content
:
'
中位数
'
}
}
}
]
})
})
this
.
line
.
render
()
this
.
line
.
render
()
}
}
...
...
src/views/object-visible/dashboard/index.vue
View file @
3e9e3014
...
@@ -13,13 +13,15 @@
...
@@ -13,13 +13,15 @@
>
>
<div
v-if=
"activeModel === model.id.toString()"
>
<div
v-if=
"activeModel === model.id.toString()"
>
<el-form
<el-form
:ref=
"'form'+activeModel"
:model=
"chartField"
:model=
"chartField"
inline
inline
label-width=
"100px"
label-width=
"100px"
style=
"margin-top: 20px"
style=
"margin-top: 20px"
:rules=
"rules"
>
>
<div>
<div>
<el-form-item
label=
"选择实例:"
>
<el-form-item
label=
"选择实例:"
prop=
"instanceId"
>
<el-radio-group
v-model=
"chartField.instanceId"
>
<el-radio-group
v-model=
"chartField.instanceId"
>
<el-radio
<el-radio
v-for=
"(ins, index) in instanceList"
v-for=
"(ins, index) in instanceList"
...
@@ -30,7 +32,7 @@
...
@@ -30,7 +32,7 @@
</el-form-item>
</el-form-item>
</div>
</div>
<div>
<div>
<el-form-item
label=
"Y轴:"
>
<el-form-item
label=
"Y轴:"
prop=
"yFields"
>
<el-checkbox-group
v-model=
"chartField.yFields"
>
<el-checkbox-group
v-model=
"chartField.yFields"
>
<el-checkbox
<el-checkbox
v-for=
"(prop, i) in propertyList"
v-for=
"(prop, i) in propertyList"
...
@@ -64,15 +66,16 @@
...
@@ -64,15 +66,16 @@
</el-form>
</el-form>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
<el-col
v-for=
"(chart, index) in chart
s
"
v-for=
"(chart, index) in chart
List
"
:key=
"100 + index"
:key=
"100 + index"
:span=
"12"
:span=
"12"
style=
"height: 400px"
style=
"height: 400px"
>
>
<g2-line
<g2-line
:id=
"'line-' + index"
:id=
"'line-' + index"
:title=
"chart"
:title=
"chart.propertyName"
:line-data=
"setChartData(chart)"
:line-data=
"setChartData(chart.propertyCode)"
:description=
"chart.propertyUnit"
style=
"min-width: 500px;height: 400px"
style=
"min-width: 500px;height: 400px"
/>
/>
</el-col>
</el-col>
...
@@ -102,13 +105,20 @@ export default {
...
@@ -102,13 +105,20 @@ export default {
activeModel
:
null
,
activeModel
:
null
,
modelList
:
[],
modelList
:
[],
objectId
:
'
1
'
,
objectId
:
'
1
'
,
lineData
:
[],
chartData
:
[],
timer
:
0
,
timer
:
0
,
count
:
0
,
count
:
0
,
instanceList
:
[],
instanceList
:
[],
propertyList
:
[],
propertyList
:
[],
charts
:
[]
chartData
:
[],
chartList
:
[],
rules
:
{
instanceId
:
[
{
required
:
true
,
message
:
'
请选择实例
'
,
trigger
:
'
change
'
}
],
yFields
:
[
{
type
:
'
array
'
,
required
:
true
,
message
:
'
请至少选择一个属性
'
,
trigger
:
'
change
'
}
]
}
}
}
},
},
created
()
{
created
()
{
...
@@ -122,24 +132,16 @@ export default {
...
@@ -122,24 +132,16 @@ export default {
})
})
.
catch
(
err
=>
console
.
error
(
err
))
.
catch
(
err
=>
console
.
error
(
err
))
},
},
mounted
()
{
// this.timer = setInterval(() => {
// this.chartData.push({
// time: new Date().getTime(),
// value: {
// power: this.random(100, 120),
// temperature: this.random(20, 30),
// humidity: this.random(200, 300)
// }
// })
// this.count++
// }, this.chartField.refresh * 1000)
},
beforeDestroy
()
{
beforeDestroy
()
{
clearInterval
(
this
.
timer
)
clearInterval
(
this
.
timer
)
},
},
methods
:
{
methods
:
{
onTabClick
()
{
onTabClick
()
{
this
.
chartField
=
{
instanceId
:
null
,
yFields
:
[],
refresh
:
1
}
this
.
getDetail
(
parseInt
(
this
.
activeModel
))
this
.
getDetail
(
parseInt
(
this
.
activeModel
))
},
},
getDetail
(
id
)
{
getDetail
(
id
)
{
...
@@ -162,7 +164,38 @@ export default {
...
@@ -162,7 +164,38 @@ export default {
}
}
})
})
},
},
createCharts
()
{}
createCharts
()
{
const
form
=
`form
${
this
.
activeModel
}
`
this
.
$refs
[
form
][
0
].
validate
()
.
then
(
_
=>
{
this
.
chartList
=
this
.
chartField
.
yFields
.
map
(
v
=>
{
const
prop
=
this
.
propertyList
.
find
(
item
=>
item
.
id
===
v
)
return
{
...
prop
}
})
this
.
chartData
=
[]
this
.
timer
&&
clearInterval
(
this
.
timer
)
this
.
timer
=
setInterval
(
async
()
=>
{
await
this
.
mockData
()
this
.
count
++
},
this
.
chartField
.
refresh
*
1000
)
})
.
catch
(
err
=>
console
.
error
(
err
))
},
mockData
()
{
return
new
Promise
(
resolve
=>
{
// this.chartData.pop()
this
.
chartData
.
push
({
time
:
new
Date
().
getTime
(),
value
:
{
inpressure
:
this
.
random
(
100
,
120
),
outpressure
:
this
.
random
(
20
,
30
)
}
})
resolve
()
})
}
}
}
}
}
</
script
>
</
script
>
...
...
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