Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
N
national-dashboard
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
national-dashboard
Commits
133be7d0
Commit
133be7d0
authored
Dec 31, 2019
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
8a2155be
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
15 deletions
+64
-15
App.vue
src/App.vue
+8
-1
monitor-chart.vue
src/components/MonitorChart/monitor-chart.vue
+24
-3
china-farming.vue
src/views/china-farming.vue
+25
-8
china-fishing.vue
src/views/china-fishing.vue
+7
-3
No files found.
src/App.vue
View file @
133be7d0
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
<div
id=
"app"
>
<div
id=
"app"
>
<transition
name=
"custom-classes-transition"
enter-active-class=
"animated fadeIn"
leave-active-class=
"animated fadeOut"
>
<transition
name=
"custom-classes-transition"
enter-active-class=
"animated fadeIn"
leave-active-class=
"animated fadeOut"
>
<router-view
:key=
"$route.fullPath"
/>
<router-view
:key=
"$route.fullPath"
/>
<!--
<keep-alive>
<router-view></router-view>
</keep-alive>
-->
</transition>
</transition>
</div>
</div>
</
template
>
</
template
>
...
@@ -19,7 +22,10 @@ export default {
...
@@ -19,7 +22,10 @@ export default {
}
}
},
},
mounted
()
{
mounted
()
{
this
.
$router
.
push
({
// this.$router.push({
// name: this.routes[this.cur]
// })
this
.
$router
.
replace
({
name
:
this
.
routes
[
this
.
cur
]
name
:
this
.
routes
[
this
.
cur
]
})
})
this
.
setTimer
()
this
.
setTimer
()
...
@@ -27,6 +33,7 @@ export default {
...
@@ -27,6 +33,7 @@ export default {
},
},
beforeDestroy
()
{
beforeDestroy
()
{
clearInterval
(
this
.
timer
)
clearInterval
(
this
.
timer
)
document
.
body
.
removeEventListener
(
'mousemove'
)
},
},
methods
:
{
methods
:
{
setTimer
()
{
setTimer
()
{
...
...
src/components/MonitorChart/monitor-chart.vue
View file @
133be7d0
...
@@ -59,7 +59,13 @@ export default {
...
@@ -59,7 +59,13 @@ export default {
options
.
legend
.
data
=
this
.
data
.
map
(
item
=>
item
.
name
)
options
.
legend
.
data
=
this
.
data
.
map
(
item
=>
item
.
name
)
}
}
options
.
xAxis
=
Object
.
assign
(
this
.
defaultOptions
.
xAxis
,
this
.
options
.
xAxis
)
options
.
xAxis
=
Object
.
assign
(
this
.
defaultOptions
.
xAxis
,
this
.
options
.
xAxis
)
options
.
yAxis
=
Object
.
assign
(
this
.
defaultOptions
.
yAxis
,
this
.
options
.
yAxis
)
if
(
Array
.
isArray
(
this
.
options
.
yAxis
)
&&
this
.
options
.
yAxis
.
length
>
0
)
{
options
.
yAxis
=
this
.
options
.
yAxis
.
map
((
item
,
index
)
=>
{
return
Object
.
assign
(
this
.
defaultOptions
.
yAxis
,
item
)
})
}
else
{
options
.
yAxis
=
Object
.
assign
(
this
.
defaultOptions
.
yAxis
,
this
.
options
.
yAxis
||
{})
}
options
.
series
=
this
.
data
.
map
((
item
,
index
)
=>
{
options
.
series
=
this
.
data
.
map
((
item
,
index
)
=>
{
let
color
=
colors
[
index
]
let
color
=
colors
[
index
]
let
shadow
=
{}
let
shadow
=
{}
...
@@ -80,8 +86,23 @@ export default {
...
@@ -80,8 +86,23 @@ export default {
itemStyle
:
{
color
,
...
shadow
},
itemStyle
:
{
color
,
...
shadow
},
data
:
item
.
data
||
[]
data
:
item
.
data
||
[]
}
}
if
(
this
.
options
.
series
)
{
if
(
Array
.
isArray
(
this
.
options
.
series
)
&&
this
.
options
.
series
.
length
>
0
)
{
return
Object
.
assign
(
result
,
this
.
options
.
series
)
// 双y轴设置一样的间隔
const
y1
=
[],
y2
=
[]
this
.
options
.
series
.
forEach
((
el
,
i
)
=>
{
if
(
el
.
yAxisIndex
)
{
y2
.
push
(...
this
.
data
[
i
].
data
)
}
else
{
y1
.
push
(...
this
.
data
[
i
].
data
)
}
const
y1Max
=
Math
.
max
.
apply
(
null
,
y1
)
const
y2Max
=
Math
.
max
.
apply
(
null
,
y2
)
options
.
yAxis
[
0
]
=
Object
.
assign
({...
options
.
yAxis
[
0
]},
{
min
:
0
,
max
:
y1Max
,
interval
:
y1Max
/
5
})
options
.
yAxis
[
1
]
=
Object
.
assign
({...
options
.
yAxis
[
1
]},
{
min
:
0
,
max
:
y2Max
,
interval
:
y2Max
/
5
})
})
return
Object
.
assign
(
result
,
this
.
options
.
series
[
index
])
}
else
{
return
Object
.
assign
(
result
,
this
.
options
.
series
||
{})
}
}
return
result
return
result
})
})
...
...
src/views/china-farming.vue
View file @
133be7d0
...
@@ -58,6 +58,7 @@ export default {
...
@@ -58,6 +58,7 @@ export default {
primaryYear
:
2018
,
primaryYear
:
2018
,
secondaryYear
:
2017
,
secondaryYear
:
2017
,
curCardIndex
:
null
,
curCardIndex
:
null
,
curProvinceData
:
null
,
area
:
0
,
area
:
0
,
waterProduction
:
0
,
waterProduction
:
0
,
farmProduction
:
0
,
farmProduction
:
0
,
...
@@ -111,14 +112,28 @@ export default {
...
@@ -111,14 +112,28 @@ export default {
itemWidth
:
10
,
itemWidth
:
10
,
itemHeight
:
10
,
itemHeight
:
10
,
},
},
yAxis
:
[{},{}],
xAxis
:
{
xAxis
:
{
data
:
[],
data
:
[],
},
},
series
:
{
series
:
[
{
type
:
'bar'
,
type
:
'bar'
,
barGap
:
0
,
barGap
:
0
,
barWidth
:
'20%'
,
barWidth
:
'20%'
,
}
},
{
type
:
'bar'
,
barGap
:
0
,
barWidth
:
'20%'
,
},
{
type
:
'bar'
,
barGap
:
0
,
barWidth
:
'20%'
,
yAxisIndex
:
1
,
},
]
},
},
data3
:
[],
data3
:
[],
visualConfig
:
{
visualConfig
:
{
...
@@ -160,7 +175,7 @@ export default {
...
@@ -160,7 +175,7 @@ export default {
},
},
handleYearChange
(
val
,
type
)
{
handleYearChange
(
val
,
type
)
{
this
[
type
]
=
val
this
[
type
]
=
val
this
.
transformChartData
()
this
.
transformChartData
(
this
.
curProvinceData
||
this
.
nation
)
this
.
transformProvinceData
()
this
.
transformProvinceData
()
},
},
calcYearLabel
()
{
calcYearLabel
()
{
...
@@ -217,12 +232,14 @@ export default {
...
@@ -217,12 +232,14 @@ export default {
},
},
handleMapSelect
(
name
)
{
handleMapSelect
(
name
)
{
this
.
curCardIndex
=
this
.
mapData
.
findIndex
(
item
=>
item
.
name
==
name
)
this
.
curCardIndex
=
this
.
mapData
.
findIndex
(
item
=>
item
.
name
==
name
)
this
.
curProvinceData
=
null
this
.
setChartData
()
this
.
setChartData
()
this
.
$refs
.
areaCard
.
handleSelect
(
this
.
curCardIndex
)
this
.
$refs
.
areaCard
.
handleSelect
(
this
.
curCardIndex
)
},
},
handleCardSelect
(
index
)
{
handleCardSelect
(
index
)
{
if
(
this
.
curCardIndex
==
index
)
return
if
(
this
.
curCardIndex
==
index
)
return
this
.
curCardIndex
=
index
this
.
curCardIndex
=
index
this
.
curProvinceData
=
null
this
.
setChartData
()
this
.
setChartData
()
if
(
!
index
&&
index
!=
0
)
{
if
(
!
index
&&
index
!=
0
)
{
this
.
$refs
.
map
.
setRegions
(
index
)
this
.
$refs
.
map
.
setRegions
(
index
)
...
@@ -236,8 +253,8 @@ export default {
...
@@ -236,8 +253,8 @@ export default {
return
return
}
}
const
curProvince
=
this
.
mapData
[
this
.
curCardIndex
].
name
const
curProvince
=
this
.
mapData
[
this
.
curCardIndex
].
name
const
p
rovinceData
=
this
.
province
.
find
(
item
=>
item
.
name
==
curProvince
)
this
.
curP
rovinceData
=
this
.
province
.
find
(
item
=>
item
.
name
==
curProvince
)
this
.
transformChartData
(
p
rovinceData
)
this
.
transformChartData
(
this
.
curP
rovinceData
)
},
},
},
},
}
}
...
...
src/views/china-fishing.vue
View file @
133be7d0
...
@@ -86,6 +86,7 @@ export default {
...
@@ -86,6 +86,7 @@ export default {
primaryYear
:
2018
,
primaryYear
:
2018
,
secondaryYear
:
2017
,
secondaryYear
:
2017
,
curCardIndex
:
null
,
curCardIndex
:
null
,
curProvinceData
:
null
,
total
:
0
,
total
:
0
,
mapData
:
[],
mapData
:
[],
totalData
:
[],
totalData
:
[],
...
@@ -125,7 +126,8 @@ export default {
...
@@ -125,7 +126,8 @@ export default {
},
},
handleYearChange
(
val
,
type
)
{
handleYearChange
(
val
,
type
)
{
this
[
type
]
=
val
this
[
type
]
=
val
this
.
transformChartData
()
const
data
=
this
.
curProvinceData
?
[
this
.
curProvinceData
.
value
,
this
.
curProvinceData
.
total
]
:
[
this
.
nation
]
this
.
transformChartData
(...
data
)
this
.
transformProvinceData
()
this
.
transformProvinceData
()
},
},
transformChartData
(
flag
=
this
.
nation
,
provinceTotal
=
null
)
{
transformChartData
(
flag
=
this
.
nation
,
provinceTotal
=
null
)
{
...
@@ -179,12 +181,14 @@ export default {
...
@@ -179,12 +181,14 @@ export default {
},
},
handleMapSelect
(
name
)
{
handleMapSelect
(
name
)
{
this
.
curCardIndex
=
this
.
mapData
.
findIndex
(
item
=>
item
.
name
==
name
)
this
.
curCardIndex
=
this
.
mapData
.
findIndex
(
item
=>
item
.
name
==
name
)
this
.
curProvinceData
=
null
this
.
setChartData
()
this
.
setChartData
()
this
.
$refs
.
areaCard
.
handleSelect
(
this
.
curCardIndex
)
this
.
$refs
.
areaCard
.
handleSelect
(
this
.
curCardIndex
)
},
},
handleCardSelect
(
index
)
{
handleCardSelect
(
index
)
{
if
(
this
.
curCardIndex
==
index
)
return
if
(
this
.
curCardIndex
==
index
)
return
this
.
curCardIndex
=
index
this
.
curCardIndex
=
index
this
.
curProvinceData
=
null
this
.
setChartData
()
this
.
setChartData
()
if
(
!
index
&&
index
!=
0
)
{
if
(
!
index
&&
index
!=
0
)
{
this
.
$refs
.
map
.
setRegions
(
index
)
this
.
$refs
.
map
.
setRegions
(
index
)
...
@@ -198,8 +202,8 @@ export default {
...
@@ -198,8 +202,8 @@ export default {
return
return
}
}
const
curProvince
=
this
.
mapData
[
this
.
curCardIndex
].
name
const
curProvince
=
this
.
mapData
[
this
.
curCardIndex
].
name
const
p
rovinceData
=
this
.
province
.
find
(
item
=>
item
.
name
==
curProvince
)
this
.
curP
rovinceData
=
this
.
province
.
find
(
item
=>
item
.
name
==
curProvince
)
this
.
transformChartData
(
provinceData
.
value
,
p
rovinceData
.
total
)
this
.
transformChartData
(
this
.
curProvinceData
.
value
,
this
.
curP
rovinceData
.
total
)
},
},
},
},
computed
:
{
computed
:
{
...
...
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