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
b0331d21
Commit
b0331d21
authored
Jul 30, 2021
by
吕超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增省范围的获取方法
parent
9d7ad0a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
App.vue
src/App.vue
+7
-0
index.js
src/store/index.js
+38
-4
energyVillage.js
src/store/module/energyVillage.js
+9
-0
No files found.
src/App.vue
View file @
b0331d21
...
...
@@ -7,10 +7,17 @@
</
template
>
<
script
>
import
{
mapActions
}
from
"vuex"
;
export
default
{
data
()
{
return
{};
},
created
()
{
this
.
getRegionProvince
();
},
methods
:
{
...
mapActions
([
"getRegionProvince"
]),
},
};
</
script
>
...
...
src/store/index.js
View file @
b0331d21
import
Vue
from
"vue"
;
import
Vuex
from
"vuex"
;
import
energyVillage
from
"./module/energyVillage"
;
import
{
query
}
from
"@/api/modules/layer.js"
;
Vue
.
use
(
Vuex
);
export
default
new
Vuex
.
Store
({
state
:
{},
mutations
:
{},
actions
:
{},
modules
:
{},
state
:
{
province
:
[],
},
mutations
:
{
GET_REGION_PROVINCE
(
state
,
data
)
{
state
.
province
=
data
;
},
},
actions
:
{
getRegionProvince
({
commit
})
{
query
(
"land_region_province"
).
then
((
res
)
=>
{
commit
(
"GET_REGION_PROVINCE"
,
res
.
data
.
features
);
});
},
},
getters
:
{
getMsgOfProvince
:
(
state
)
=>
(
code
)
=>
{
const
detail
=
state
.
province
.
find
(
(
item
)
=>
item
.
properties
.
PXZQDM
===
code
);
if
(
!
detail
)
return
null
;
const
{
PXZQDM
,
PXZQMC
,
x_max
,
x_min
,
y_max
,
y_min
}
=
detail
.
properties
;
const
res
=
{
key
:
PXZQDM
,
value
:
PXZQMC
,
bbox
:
[
[
x_min
,
y_min
],
[
x_max
,
y_max
],
],
};
return
res
;
},
},
modules
:
{
energyVillage
,
},
});
src/store/module/energyVillage.js
0 → 100644
View file @
b0331d21
export
default
{
namespaced
:
true
,
state
:
{
data
:
1
,
},
mutations
:
{},
actions
:
{},
getters
:
{},
};
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