Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
develop-platform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1d265bab
authored
Dec 30, 2020
by
zhouzy
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加标识
1 parent
1c4210f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
135 additions
and
112 deletions
src/views/index/index.vue
src/views/index/index.vue
View file @
1d265ba
...
@@ -56,110 +56,123 @@
...
@@ -56,110 +56,123 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
_
from
'lodash'
import
_
from
"lodash"
;
import
echarts
from
'echarts'
import
echarts
from
"echarts"
;
import
walden
from
'./walden'
import
walden
from
"./walden"
;
import
{
getStatisticData
,
getGraphData
,
getPolylineData
}
from
'@api/api'
import
{
getStatisticData
,
getGraphData
,
getPolylineData
}
from
"@api/api"
;
export
default
{
export
default
{
name
:
'index'
,
name
:
"index"
,
data
()
{
data
()
{
return
{
return
{
radio
:
'全部'
,
radio
:
"全部"
,
TopNumberData
:
{},
TopNumberData
:
{},
message
:
''
,
message
:
""
,
// 绘图
// 绘图
option
:
{
option
:
{
title
:
{
title
:
{
top
:
'20'
,
top
:
"20"
,
text
:
''
,
text
:
""
,
subtext
:
''
,
subtext
:
""
,
left
:
'20'
left
:
"20"
,
},
},
tooltip
:
{
tooltip
:
{
trigger
:
'item'
,
trigger
:
"item"
,
formatter
:
'{a} <br/>{b} : {c} ({d}%)'
formatter
:
"{a} <br/>{b} : {c} ({d}%)"
,
},
},
legend
:
{
legend
:
{
orient
:
'vertical'
,
orient
:
"vertical"
,
left
:
'right'
,
left
:
"right"
,
data
:
[]
data
:
[]
,
},
},
series
:
[
series
:
[
{
{
name
:
'访问来源'
,
name
:
"访问来源"
,
type
:
'pie'
,
type
:
"pie"
,
radius
:
'55%'
,
radius
:
"55%"
,
center
:
[
'50%'
,
'60%'
],
center
:
[
"50%"
,
"60%"
],
data
:
[],
data
:
[],
emphasis
:
{
emphasis
:
{
itemStyle
:
{
itemStyle
:
{
shadowBlur
:
10
,
shadowBlur
:
10
,
shadowOffsetX
:
0
,
shadowOffsetX
:
0
,
shadowColor
:
'rgba(0, 0, 0, 0.5)'
shadowColor
:
"rgba(0, 0, 0, 0.5)"
,
}
}
,
}
}
,
}
}
,
]
]
,
},
},
Trendoption
:
{
Trendoption
:
{
tooltip
:
{
trigger
:
"axis"
,
},
xAxis
:
{
xAxis
:
{
type
:
'category'
,
type
:
"category"
,
data
:
[]
data
:
[]
,
},
},
yAxis
:
{
yAxis
:
{
type
:
'value'
type
:
"value"
,
},
},
series
:
[
series
:
[
{
{
data
:
[],
data
:
[],
type
:
'line'
type
:
"line"
,
}
}
,
]
]
,
}
}
,
}
}
;
},
},
mounted
()
{
mounted
()
{
// 初始化各表实例
// 初始化各表实例
this
.
$echarts
=
echarts
this
.
$echarts
=
echarts
;
this
.
totalECharts
=
this
.
$echarts
.
init
(
document
.
getElementById
(
'decivceType'
),
'walden'
)
this
.
totalECharts
=
this
.
$echarts
.
init
(
this
.
totalEChart2
=
this
.
$echarts
.
init
(
document
.
getElementById
(
'serviceType'
),
'walden'
)
document
.
getElementById
(
"decivceType"
),
this
.
trendCharts
=
this
.
$echarts
.
init
(
document
.
getElementById
(
'AccessTrend'
),
'walden'
)
"walden"
this
.
apiCallCharts
=
this
.
$echarts
.
init
(
document
.
getElementById
(
'CallTrend'
),
'walden'
)
);
this
.
totalEChart2
=
this
.
$echarts
.
init
(
document
.
getElementById
(
"serviceType"
),
"walden"
);
this
.
trendCharts
=
this
.
$echarts
.
init
(
document
.
getElementById
(
"AccessTrend"
),
"walden"
);
this
.
apiCallCharts
=
this
.
$echarts
.
init
(
document
.
getElementById
(
"CallTrend"
),
"walden"
);
// this.getPie()
// this.getPie()
// 获取顶部数据
// 获取顶部数据
getStatisticData
({}).
then
((
res
)
=>
{
getStatisticData
({}).
then
((
res
)
=>
{
this
.
TopNumberData
=
res
this
.
TopNumberData
=
res
;
// console.log( this.TopNumberData)
// console.log( this.TopNumberData)
this
.
TopNumberData
.
customerCount
=
this
.
formatNumber
(
res
.
customerCount
)
this
.
TopNumberData
.
customerCount
=
this
.
formatNumber
(
res
.
customerCount
)
;
this
.
TopNumberData
.
deviceCount
=
this
.
formatNumber
(
res
.
deviceCount
)
this
.
TopNumberData
.
deviceCount
=
this
.
formatNumber
(
res
.
deviceCount
)
;
this
.
TopNumberData
.
userCount
=
this
.
formatNumber
(
res
.
userCount
)
this
.
TopNumberData
.
userCount
=
this
.
formatNumber
(
res
.
userCount
)
;
this
.
TopNumberData
.
apiCallCount
=
this
.
formatNumber
(
res
.
apiCallCount
)
this
.
TopNumberData
.
apiCallCount
=
this
.
formatNumber
(
res
.
apiCallCount
)
;
})
})
;
// 获取饼状图数据
// 获取饼状图数据
getGraphData
({}).
then
((
res
)
=>
{
getGraphData
({}).
then
((
res
)
=>
{
this
.
chartData
=
res
this
.
chartData
=
res
;
// console.log(res)
// console.log(res)
// 修改特定的数值,注意数组和对象的区别
// 修改特定的数值,注意数组和对象的区别
// 左图
// 左图
var
option1
=
_
.
cloneDeep
(
this
.
option
)
var
option1
=
_
.
cloneDeep
(
this
.
option
)
;
option1
.
legend
.
padding
=
[
50
,
50
,
50
,
0
]
option1
.
legend
.
padding
=
[
50
,
50
,
50
,
0
]
;
option1
.
title
.
text
=
'设备接入类型分布'
option1
.
title
.
text
=
"设备接入类型分布"
;
option1
.
legend
.
data
=
res
.
deviceGraphData
.
map
((
item
)
=>
item
.
deviceType
)
option1
.
legend
.
data
=
res
.
deviceGraphData
.
map
((
item
)
=>
item
.
deviceType
)
;
option1
.
series
[
0
].
data
=
res
.
deviceGraphData
.
map
((
item
)
=>
{
option1
.
series
[
0
].
data
=
res
.
deviceGraphData
.
map
((
item
)
=>
{
return
{
return
{
value
:
item
.
num
,
value
:
item
.
num
,
name
:
item
.
deviceType
name
:
item
.
deviceType
,
}
}
;
})
})
;
// 无数据显示
// 无数据显示
// if( option1.legend.data =="" || option1.series[0].data=="" ){
// if( option1.legend.data =="" || option1.series[0].data=="" ){
// option1.title.text = "暂无数据"
// option1.title.text = "暂无数据"
...
@@ -169,75 +182,87 @@ export default {
...
@@ -169,75 +182,87 @@ export default {
// }
// }
// 右图
// 右图
var
option2
=
_
.
cloneDeep
(
this
.
option
)
var
option2
=
_
.
cloneDeep
(
this
.
option
)
;
option2
.
title
.
text
=
'调用服务类型分布'
option2
.
title
.
text
=
"调用服务类型分布"
;
// option2.legend.data=res.apiCallGraphData.map(item => item.apiClassification)
// option2.legend.data=res.apiCallGraphData.map(item => item.apiClassification)
var
formatData
=
res
.
apiCallGraphData
.
map
((
item
)
=>
{
var
formatData
=
res
.
apiCallGraphData
.
map
((
item
)
=>
{
return
{
return
{
1
:
'授权管理'
,
1
:
"授权管理"
,
2
:
'设备管理'
,
2
:
"设备管理"
,
3
:
'数据服务'
3
:
"数据服务"
,
}[
item
.
apiClassification
]
}[
item
.
apiClassification
]
;
})
})
;
// formatData == '1' ? formatData = '授权管理' : (formatData== '2' ? formatData= '设备管理' : formatData = '数据服务')
// formatData == '1' ? formatData = '授权管理' : (formatData== '2' ? formatData= '设备管理' : formatData = '数据服务')
// console.log(formatData)
// console.log(formatData)
option2
.
legend
.
data
=
formatData
option2
.
legend
.
data
=
formatData
;
option2
.
legend
.
padding
=
[
50
,
50
,
50
,
0
]
option2
.
legend
.
padding
=
[
50
,
50
,
50
,
0
]
;
option2
.
series
[
0
].
data
=
res
.
apiCallGraphData
.
map
((
item
)
=>
{
option2
.
series
[
0
].
data
=
res
.
apiCallGraphData
.
map
((
item
)
=>
{
return
{
return
{
value
:
item
.
num
,
value
:
item
.
num
,
name
:
{
name
:
{
1
:
'授权管理'
,
1
:
"授权管理"
,
2
:
'设备管理'
,
2
:
"设备管理"
,
3
:
'数据服务'
3
:
"数据服务"
,
}[
item
.
apiClassification
]
}[
item
.
apiClassification
]
,
}
}
;
})
})
;
// console.log(option2.series[0].data)
// console.log(option2.series[0].data)
// 渲染
// 渲染
this
.
totalEChart2
.
setOption
(
option2
)
this
.
totalEChart2
.
setOption
(
option2
)
;
window
.
onresize
=
this
.
totalEChart2
.
resize
window
.
onresize
=
this
.
totalEChart2
.
resize
;
this
.
totalECharts
.
setOption
(
option1
)
this
.
totalECharts
.
setOption
(
option1
)
;
window
.
onresize
=
this
.
totalECharts
.
resize
window
.
onresize
=
this
.
totalECharts
.
resize
;
})
})
;
// 折线图数据获取
// 折线图数据获取
getPolylineData
({}).
then
((
res
)
=>
{
getPolylineData
({}).
then
((
res
)
=>
{
var
trendData
=
res
var
trendData
=
res
;
console
.
log
(
trendData
)
console
.
log
(
trendData
)
;
// 接入设备折线图
// 接入设备折线图
var
option3
=
_
.
cloneDeep
(
this
.
Trendoption
)
var
option3
=
_
.
cloneDeep
(
this
.
Trendoption
);
option3
.
grid
=
{
// option3.grid = {
x
:
30
,
// x: 30,
y
:
50
,
// y: 50,
x2
:
10
,
// x2: 10,
y2
:
50
// y2: 50
}
// }
option3
.
xAxis
.
data
=
res
.
deviceAccessTrendList
.
map
((
item
)
=>
item
.
activatTime
)
option3
.
xAxis
.
data
=
res
.
deviceAccessTrendList
.
map
((
item
)
=>
item
.
activatTime
);
option3
.
series
[
0
].
data
=
res
.
deviceAccessTrendList
.
map
((
item
)
=>
item
.
num
)
option3
.
series
[
0
].
data
=
res
.
deviceAccessTrendList
.
map
((
item
)
=>
{
return
{
value
:
item
.
num
,
// name: item.deviceAccessTrendList
};
});
// option1.series[0].data = res.deviceGraphData.map((item) => {
// return {
// value: item.num,
// name: item.deviceType
// }
// })
// console.log(option3)
// console.log(option3)
// 服务调用趋势
// 服务调用趋势
var
option4
=
_
.
cloneDeep
(
this
.
Trendoption
)
var
option4
=
_
.
cloneDeep
(
this
.
Trendoption
)
;
option4
.
xAxis
.
data
=
res
.
apiCallTrendList
.
map
((
item
)
=>
item
.
createTime
)
option4
.
xAxis
.
data
=
res
.
apiCallTrendList
.
map
((
item
)
=>
item
.
createTime
)
;
option4
.
series
[
0
].
data
=
res
.
apiCallTrendList
.
map
((
item
)
=>
item
.
num
)
option4
.
series
[
0
].
data
=
res
.
apiCallTrendList
.
map
((
item
)
=>
item
.
num
)
;
option4
.
grid
=
{
//
option4.grid = {
x
:
30
,
//
x: 30,
y
:
50
,
//
y: 50,
x2
:
10
,
//
x2: 10,
y2
:
50
//
y2: 50
}
//
}
this
.
trendCharts
.
setOption
(
option3
)
this
.
trendCharts
.
setOption
(
option3
)
;
this
.
apiCallCharts
.
setOption
(
option4
)
this
.
apiCallCharts
.
setOption
(
option4
)
;
})
})
;
// 渲染
// 渲染
...
@@ -273,18 +298,18 @@ export default {
...
@@ -273,18 +298,18 @@ export default {
// 每隔三位加一个逗号
// 每隔三位加一个逗号
formatNumber
(
n
)
{
formatNumber
(
n
)
{
var
b
=
parseInt
(
n
).
toString
()
var
b
=
parseInt
(
n
).
toString
()
;
var
len
=
b
.
length
var
len
=
b
.
length
;
if
(
len
<=
3
)
{
if
(
len
<=
3
)
{
return
b
return
b
;
}
}
var
r
=
len
%
3
var
r
=
len
%
3
;
return
r
>
0
return
r
>
0
?
b
.
slice
(
0
,
r
)
+
','
+
b
.
slice
(
r
,
len
).
match
(
/
\d{3}
/g
).
join
(
','
)
?
b
.
slice
(
0
,
r
)
+
","
+
b
.
slice
(
r
,
len
).
match
(
/
\d{3}
/g
).
join
(
","
)
:
b
.
slice
(
r
,
len
).
match
(
/
\d{3}
/g
).
join
(
','
)
:
b
.
slice
(
r
,
len
).
match
(
/
\d{3}
/g
).
join
(
","
);
}
}
,
}
}
,
}
}
;
</
script
>
</
script
>
<
style
>
<
style
>
/* html {
/* html {
...
@@ -305,8 +330,8 @@ body {
...
@@ -305,8 +330,8 @@ body {
overflow: hidden;
overflow: hidden;
} */
} */
.indexPage
{
.indexPage
{
overflow-y
:
scroll
;
overflow-y
:
scroll
;
}
}
:root
{
:root
{
overflow-y
:
auto
;
overflow-y
:
auto
;
...
@@ -315,8 +340,8 @@ body {
...
@@ -315,8 +340,8 @@ body {
:root
body
.indexPage
{
:root
body
.indexPage
{
position
:
absolute
;
position
:
absolute
;
}
}
body
.indexPage
{
body
.indexPage
{
width
:
100vw
;
width
:
100vw
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
...
@@ -357,7 +382,6 @@ body.indexPage{
...
@@ -357,7 +382,6 @@ body.indexPage{
border-radius
:
4px
;
border-radius
:
4px
;
min-height
:
36px
;
min-height
:
36px
;
min-width
:
100px
;
min-width
:
100px
;
}
}
.row-bg
{
.row-bg
{
padding
:
10px
0
;
padding
:
10px
0
;
...
@@ -373,7 +397,6 @@ body.indexPage{
...
@@ -373,7 +397,6 @@ body.indexPage{
}
}
.charts
{
.charts
{
display
:
flex
;
display
:
flex
;
}
}
.chart
{
.chart
{
border
:
1px
solid
#999999
;
border
:
1px
solid
#999999
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment