Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
country-energy-ecological-construction
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
范加坤
country-energy-ecological-construction
Commits
0d342b95
Commit
0d342b95
authored
Aug 02, 2021
by
吕超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 模块二添加子类选择,动态生成颜色段
parent
07bd3ec6
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
65 deletions
+126
-65
Lengend.vue
src/components/Lengend/Lengend.vue
+22
-21
index.vue
src/components/statusControl/index.vue
+13
-14
biogasManureMap.vue
src/pages/biomassEnergyWarm/components/biogasManureMap.vue
+15
-4
sortList.vue
src/pages/biomassEnergyWarm/components/sortList.vue
+1
-1
legend.config.js
src/pages/biomassEnergyWarm/config/legend.config.js
+6
-5
index.vue
src/pages/biomassEnergyWarm/index.vue
+63
-14
energyVillageMap.vue
...es/renewableEnergyVillage/components/energyVillageMap.vue
+1
-1
sortList.vue
src/pages/renewableEnergyVillage/components/sortList.vue
+3
-3
index.vue
src/pages/renewableEnergyVillage/index.vue
+2
-2
No files found.
src/components/Lengend/Lengend.vue
View file @
0d342b95
...
...
@@ -10,10 +10,9 @@
</div>
-->
<div
class=
"item"
>
<div
class=
"circle"
:style=
"
{ 'background-color': item }">
</div>
<label
>
{{
range
[
index
-
1
]
}}
{{
getCode
(
index
)
}}
{{
range
[
index
]
}}
</label
>
<label>
{{
showLabel
(
range
[
index
-
1
],
range
[
index
])
}}
</label>
</div>
</div>
</
template
>
...
...
@@ -24,33 +23,35 @@
<
script
>
export
default
{
data
()
{
return
{}
return
{}
;
},
props
:
{
title
:
{
type
:
String
type
:
String
,
},
colors
:
{
type
:
Array
type
:
Array
,
},
range
:
{
type
:
Array
}
type
:
Array
,
}
,
},
computed
:
{
getCode
()
{
return
function
(
index
)
{
if
(
index
===
0
)
{
return
'<'
}
if
(
index
===
this
.
colors
.
length
-
1
)
{
return
'>'
}
return
'-'
showLabel
()
{
return
function
(
min
,
max
)
{
if
(
max
&&
min
)
{
return
`
${
min
}
-
${
max
}
`
;
}
if
(
max
&&
!
min
)
{
return
`<
${
max
}
`
;
}
if
(
!
max
&&
min
)
{
return
`
${
min
}
<`
;
}
}
};
},
},
};
</
script
>
<
style
lang=
"less"
scoped
>
...
...
@@ -73,7 +74,7 @@ export default {
.item {
display: flex;
align-items: center;
margin-bottom: .3vh;
margin-bottom:
0
.3vh;
.circle {
border-radius: 2px;
width: 30px;
...
...
src/components/statusControl/index.vue
View file @
0d342b95
...
...
@@ -16,34 +16,34 @@
<
script
>
// #144683
export
default
{
name
:
'statusControl'
,
name
:
"statusControl"
,
props
:
{
list
:
{
type
:
Array
,
default
:
function
()
{
return
[]
}
return
[]
;
}
,
},
statusStyle
:
{
type
:
[
Object
,
String
],
default
:
''
default
:
""
,
},
value
:
{
type
:
Object
,
default
:
function
()
{
return
{}
}
}
return
{}
;
}
,
}
,
},
data
()
{
return
{}
return
{}
;
},
methods
:
{
onStatusChange
(
item
)
{
this
.
$emit
(
'input'
,
item
)
}
}
}
this
.
$emit
(
"input"
,
item
);
}
,
}
,
}
;
</
script
>
<
style
scoped
lang=
"less"
>
...
...
@@ -52,7 +52,7 @@ export default {
margin-bottom: 10px;
border-radius: 15px;
padding: 5px 10px;
width: 1
3
0px;
width: 1
7
0px;
color: #84c6ff;
// background-color: #fff;
box-shadow: 0 0 5px #fff9;
...
...
@@ -60,7 +60,6 @@ export default {
cursor: pointer;
border: 1px solid #84c6ff;
&.acitive {
color: #fff;
background-color: #16ceaf;
}
...
...
src/pages/biomassEnergyWarm/components/biogasManureMap.vue
View file @
0d342b95
...
...
@@ -7,7 +7,7 @@
<
script
>
import
Map
from
"@/components/Map/Map.vue"
;
import
{
BiomassData
}
from
"../config/biomass.config.js"
;
import
{
color
,
colorLabel
}
from
"../config/legend.config"
;
import
{
color
}
from
"../config/legend.config"
;
import
{
mapGetters
}
from
"vuex"
;
export
default
{
name
:
"biogasManure"
,
...
...
@@ -16,6 +16,14 @@ export default {
type
:
String
,
default
:
""
,
},
itemType
:
{
type
:
String
,
default
:
""
,
},
colorLabels
:
{
type
:
Array
,
default
:
()
=>
[],
},
data
:
{
type
:
Array
,
default
:
()
=>
[],
...
...
@@ -36,7 +44,7 @@ export default {
computed
:
{
getFilterColor
()
{
const
obj
=
BiomassData
[
this
.
type
].
find
(
(
item
)
=>
item
.
type
===
"aggregation"
(
item
)
=>
item
.
key
===
this
.
itemType
);
const
filterCon
=
[
"match"
,
[
"get"
,
"code"
]];
this
.
data
.
forEach
((
item
)
=>
{
...
...
@@ -63,11 +71,11 @@ export default {
this
.
setPaintColor
();
},
getCurrentColor
(
val
)
{
if
(
val
>
colorLabel
[
colorLabel
.
length
-
1
])
{
if
(
val
>
this
.
colorLabels
[
this
.
colorLabels
.
length
-
1
])
{
return
color
[
color
.
length
-
1
];
}
else
{
let
idx
=
-
1
;
colorLabel
.
find
((
item
,
index
)
=>
{
this
.
colorLabels
.
find
((
item
,
index
)
=>
{
idx
=
index
;
return
item
>=
val
;
});
...
...
@@ -103,6 +111,9 @@ export default {
type
()
{
this
.
setPaintColor
();
},
itemType
()
{
this
.
setPaintColor
();
},
data
()
{
this
.
setPaintColor
();
},
...
...
src/pages/biomassEnergyWarm/components/sortList.vue
View file @
0d342b95
...
...
@@ -44,7 +44,7 @@ export default {
computed
:
{
// 返回当前类型除了总数的信息
getItemOfType
()
{
return
BiomassData
[
this
.
type
].
filter
((
item
)
=>
!
/_local$/
.
test
(
item
.
key
)
);
return
BiomassData
[
this
.
type
].
filter
((
item
)
=>
!
item
.
type
);
},
getValOfdata
()
{
const
keys
=
this
.
getItemOfType
;
...
...
src/pages/biomassEnergyWarm/config/legend.config.js
View file @
0d342b95
export
const
color
=
[
"#7e82d0"
,
"#818bd4"
,
//
"#818bd4",
"#8492d7"
,
"#869adb"
,
//
"#869adb",
"#89a1de"
,
"#8dabe2"
,
//
"#8dabe2",
"#95c1e2"
,
"#9bcfe2"
,
//
"#9bcfe2",
"#a3e4e3"
,
];
export
const
colorLabel
=
[
1
,
3
,
5
,
10
,
30
,
50
,
100
,
500
];
// export const colorLabel = [1, 3, 5, 10, 30, 50, 100, 500];
export
const
colorLabel
=
[
1
,
30
,
50
,
100
];
src/pages/biomassEnergyWarm/index.vue
View file @
0d342b95
...
...
@@ -3,6 +3,8 @@
<LeftPart
:type=
"statusValue.key"
></LeftPart>
<BiogasManureMap
:type=
"statusValue.key"
:itemType=
"allItemValue.key"
:colorLabels=
"getRandomColorLabel"
:data=
"data"
:provinceCode=
"provinceCode"
></BiogasManureMap>
...
...
@@ -26,7 +28,20 @@
</div>
</PartWrap>
</div>
<Legend
class=
"legendPart"
:colors=
"color"
:range=
"colorLabel"
></Legend>
<StatusControl
:statusStyle=
"
{
position: 'absolute',
right: '27.7vw',
bottom: '30.5vh',
}"
:list="getAllItemOfType"
v-model="allItemValue"
>
</StatusControl>
<Legend
class=
"legendPart"
:colors=
"color"
:range=
"getRandomColorLabel"
></Legend>
</div>
</
template
>
...
...
@@ -59,6 +74,7 @@ export default {
color
,
colorLabel
,
provinceCode
:
""
,
allItemValue
:
{
key
:
"gn_local"
,
value
:
"数量(处)"
},
};
},
components
:
{
...
...
@@ -73,10 +89,13 @@ export default {
},
computed
:
{
getItemOfType
()
{
return
BiomassData
[
this
.
statusValue
.
key
].
find
(
(
item
)
=>
/_local$/
.
test
(
item
.
key
)
return
BiomassData
[
this
.
statusValue
.
key
].
find
(
(
item
)
=>
item
.
type
===
"aggregation"
);
},
getAllItemOfType
()
{
return
BiomassData
[
this
.
statusValue
.
key
];
},
getValOfdata
()
{
const
res
=
{
[
this
.
getItemOfType
.
key
]:
[],
...
...
@@ -94,7 +113,7 @@ export default {
return
function
(
type
)
{
const
data
=
this
.
getValOfdata
[
type
]
.
filter
((
item
)
=>
item
.
yAxis
)
.
sort
((
a
,
b
)
=>
b
.
xAxis
-
a
.
x
Axis
);
.
sort
((
a
,
b
)
=>
b
.
yAxis
-
a
.
y
Axis
);
const
xData
=
data
.
map
((
item
)
=>
item
.
xAxis
);
const
yData
=
data
.
map
((
item
)
=>
item
.
yAxis
);
const
option
=
{
...
...
@@ -113,11 +132,11 @@ export default {
yAxis
:
[
{
type
:
"value"
,
splitLine
:
{
lineStyle
:
{
color
:
"rgba(255,255,255,.15)"
,
},
},
//
splitLine: {
//
lineStyle: {
//
color: "rgba(255,255,255,.15)",
//
},
//
},
axisLine
:
{
lineStyle
:
{
color
:
"#fff"
,
...
...
@@ -143,7 +162,7 @@ export default {
],
series
:
[
{
name
:
"
入侵报告次数
"
,
name
:
""
,
type
:
"bar"
,
barWidth
:
`50%`
,
data
:
yData
,
...
...
@@ -152,9 +171,9 @@ export default {
position
:
"top"
,
},
itemStyle
:
{
emphasis
:
{
color
:
"rgba(201,59,60)"
,
},
//
emphasis: {
//
color: "rgba(201,59,60)",
//
},
},
},
],
...
...
@@ -162,11 +181,33 @@ export default {
return
option
;
};
},
// 获取所有值
getRandomLabel
()
{
const
obj
=
BiomassData
[
this
.
statusValue
.
key
].
find
(
(
item
)
=>
item
.
key
===
this
.
allItemValue
.
key
);
const
res
=
[];
this
.
data
.
forEach
((
item
)
=>
{
res
.
push
(
item
.
properties
[
obj
.
key
]);
});
return
[...
new
Set
(
res
)].
filter
((
item
)
=>
item
).
sort
((
a
,
b
)
=>
a
-
b
);
},
// 根据值生产颜色段
getRandomColorLabel
()
{
const
labels
=
this
.
getRandomLabel
;
const
min
=
labels
[
0
];
const
max
=
labels
[
labels
.
length
-
1
];
const
colorLabels
=
[];
const
part
=
(
max
-
min
)
/
4
;
for
(
let
i
=
1
;
i
<=
4
;
i
++
)
{
colorLabels
.
push
(
Number
((
part
*
i
-
1
).
toFixed
(
4
)));
}
return
colorLabels
;
},
...
mapGetters
([
"getMsgOfProvince"
]),
},
created
()
{
this
.
getEnergyWarm
();
console
.
log
(
this
.
getMsgOfProvince
(
"14"
));
},
methods
:
{
getEnergyWarm
()
{
...
...
@@ -184,6 +225,14 @@ export default {
code
&&
(
this
.
provinceCode
=
code
);
},
},
watch
:
{
statusValue
:
{
handler
(
val
)
{
this
.
allItemValue
=
BiomassData
[
val
.
key
][
0
];
},
deep
:
true
,
},
},
};
</
script
>
...
...
src/pages/renewableEnergyVillage/components/energyVillageMap.vue
View file @
0d342b95
...
...
@@ -44,7 +44,7 @@ export default {
[
135.087387
,
53.561602
],
],
{
padding
:
{
bottom
:
80
,
top
:
120
,
left
:
80
,
right
:
4
70
},
padding
:
{
bottom
:
80
,
top
:
120
,
left
:
80
,
right
:
2
70
},
}
);
await
this
.
getData
();
...
...
src/pages/renewableEnergyVillage/components/sortList.vue
View file @
0d342b95
...
...
@@ -128,11 +128,11 @@ export default {
<
style
scoped
lang=
"less"
>
.sortList {
position: absolute;
top: 1
00px
;
right: 1
0px
;
top: 1
1vh
;
right: 1
vh
;
display: flex;
flex-wrap: wrap;
width:
550px
;
width:
13vw
;
height: calc(100vh - 100px - 37vh - 2vw);
.left-part-item {
height: 100%;
...
...
src/pages/renewableEnergyVillage/index.vue
View file @
0d342b95
...
...
@@ -154,7 +154,7 @@ export default {
.filterProvince {
position: absolute;
right: calc(3vh +
550px
);
right: calc(3vh +
13vw
);
top: calc(11vh + 44px + 1vh);
}
...
...
@@ -167,7 +167,7 @@ export default {
.statusControl {
position: absolute;
top: 11vh;
right: calc(3vh +
550px
);
right: calc(3vh +
13vw
);
}
}
</
style
>
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