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
fd4f831e
Commit
fd4f831e
authored
Aug 03, 2020
by
wends
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update mock data
parent
9025fa9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
14 deletions
+103
-14
index.vue
src/views/object-visible/dashboard/index.vue
+103
-14
No files found.
src/views/object-visible/dashboard/index.vue
View file @
fd4f831e
...
@@ -66,13 +66,13 @@
...
@@ -66,13 +66,13 @@
</el-form>
</el-form>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
<el-col
v-for=
"(chart
, index
) in chartList"
v-for=
"(chart) in chartList"
:key=
"
100 + index
"
:key=
"
chart.id
"
:span=
"12"
:span=
"12"
style=
"height: 400px"
style=
"height: 400px"
>
>
<g2-line
<g2-line
:id=
"'line-' +
index
"
:id=
"'line-' +
chart.propertyCode
"
:title=
"chart.propertyName"
:title=
"chart.propertyName"
:line-data=
"setChartData(chart.propertyCode)"
:line-data=
"setChartData(chart.propertyCode)"
:description=
"chart.propertyUnit"
:description=
"chart.propertyUnit"
...
@@ -118,7 +118,79 @@ export default {
...
@@ -118,7 +118,79 @@ export default {
yFields
:
[
yFields
:
[
{
type
:
'
array
'
,
required
:
true
,
message
:
'
请至少选择一个属性
'
,
trigger
:
'
change
'
}
{
type
:
'
array
'
,
required
:
true
,
message
:
'
请至少选择一个属性
'
,
trigger
:
'
change
'
}
]
]
}
},
fakeData
:
[
{
time
:
null
,
value
:
{
inpressure
:
110
,
outpressure
:
21
}
},
{
time
:
null
,
value
:
{
inpressure
:
111
,
outpressure
:
25
}
},
{
time
:
null
,
value
:
{
inpressure
:
112
,
outpressure
:
24
}
},
{
time
:
null
,
value
:
{
inpressure
:
115
,
outpressure
:
23
}
},
{
time
:
null
,
value
:
{
inpressure
:
117
,
outpressure
:
22
}
},
{
time
:
null
,
value
:
{
inpressure
:
110
,
outpressure
:
21
}
},
{
time
:
null
,
value
:
{
inpressure
:
111
,
outpressure
:
25
}
},
{
time
:
null
,
value
:
{
inpressure
:
112
,
outpressure
:
24
}
},
{
time
:
null
,
value
:
{
inpressure
:
115
,
outpressure
:
23
}
},
{
time
:
null
,
value
:
{
inpressure
:
117
,
outpressure
:
22
}
}
]
}
}
},
},
created
()
{
created
()
{
...
@@ -143,6 +215,8 @@ export default {
...
@@ -143,6 +215,8 @@ export default {
refresh
:
1
refresh
:
1
}
}
this
.
getDetail
(
parseInt
(
this
.
activeModel
))
this
.
getDetail
(
parseInt
(
this
.
activeModel
))
this
.
chartList
=
[]
clearInterval
(
this
.
timer
)
},
},
getDetail
(
id
)
{
getDetail
(
id
)
{
Promise
.
all
([
getModelInstanceList
({
id
}),
getModelDetail
({
id
})])
Promise
.
all
([
getModelInstanceList
({
id
}),
getModelDetail
({
id
})])
...
@@ -168,13 +242,17 @@ export default {
...
@@ -168,13 +242,17 @@ export default {
const
form
=
`form
${
this
.
activeModel
}
`
const
form
=
`form
${
this
.
activeModel
}
`
this
.
$refs
[
form
][
0
].
validate
()
this
.
$refs
[
form
][
0
].
validate
()
.
then
(
_
=>
{
.
then
(
_
=>
{
this
.
chartList
=
this
.
chartField
.
yFields
.
map
(
v
=>
{
const
prop
=
this
.
propertyList
.
find
(
item
=>
item
.
id
===
v
)
return
{
...
prop
}
})
this
.
chartData
=
[]
this
.
chartData
=
[]
this
.
chartList
=
[]
this
.
mockData
()
.
then
(
_
=>
{
const
arr
=
[]
this
.
propertyList
.
forEach
(
v
=>
{
const
index
=
this
.
chartField
.
yFields
.
findIndex
(
item
=>
item
===
v
.
id
)
index
!==
-
1
&&
arr
.
push
({
...
v
})
})
this
.
chartList
=
[...
arr
]
})
this
.
timer
&&
clearInterval
(
this
.
timer
)
this
.
timer
&&
clearInterval
(
this
.
timer
)
this
.
timer
=
setInterval
(
async
()
=>
{
this
.
timer
=
setInterval
(
async
()
=>
{
await
this
.
mockData
()
await
this
.
mockData
()
...
@@ -185,14 +263,25 @@ export default {
...
@@ -185,14 +263,25 @@ export default {
},
},
mockData
()
{
mockData
()
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
// this.chartData.pop
()
this
.
fakeData
.
shift
()
this
.
chart
Data
.
push
({
this
.
fake
Data
.
push
({
time
:
n
ew
Date
().
getTime
()
,
time
:
n
ull
,
value
:
{
value
:
{
inpressure
:
this
.
random
(
10
0
,
120
),
inpressure
:
this
.
random
(
8
0
,
120
),
outpressure
:
this
.
random
(
20
,
30
)
outpressure
:
this
.
random
(
20
,
30
)
}
}
})
})
const
arr
=
[]
const
time
=
new
Date
().
getTime
()
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
arr
.
push
({
time
:
time
-
(
9
-
i
)
*
1000
,
value
:
{
...
this
.
fakeData
[
i
].
value
}
})
}
this
.
chartData
=
[...
arr
]
resolve
()
resolve
()
})
})
}
}
...
...
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