Commit 8769f449 authored by 范加坤's avatar 范加坤

Merge remote-tracking branch 'origin/lc_branch' into van_branch

parents ca377fca b0331d21
...@@ -7,10 +7,17 @@ ...@@ -7,10 +7,17 @@
</template> </template>
<script> <script>
import { mapActions } from "vuex";
export default { export default {
data() { data() {
return {}; return {};
}, },
created() {
this.getRegionProvince();
},
methods: {
...mapActions(["getRegionProvince"]),
},
}; };
</script> </script>
......
...@@ -33,10 +33,10 @@ export default { ...@@ -33,10 +33,10 @@ export default {
const obj = BiomassData[this.type].find( const obj = BiomassData[this.type].find(
(item) => item.type === "aggregation" (item) => item.type === "aggregation"
); );
const filterCon = ["match", ["get", "province_c"]]; const filterCon = ["match", ["get", "code"]];
this.data.forEach((item) => { this.data.forEach((item) => {
const currentColor = this.getCurrentColor(item.properties[obj.key]); const currentColor = this.getCurrentColor(item.properties[obj.key]);
filterCon.push(Number(item.properties.pcode), currentColor); filterCon.push(item.properties.pcode, currentColor);
}); });
filterCon.push("#f00"); filterCon.push("#f00");
return filterCon; return filterCon;
...@@ -45,9 +45,7 @@ export default { ...@@ -45,9 +45,7 @@ export default {
methods: { methods: {
onload(map) { onload(map) {
this.map = map; this.map = map;
console.log(this.map.getStyle());
this.setPaintColor(); this.setPaintColor();
console.log("地图加载完成");
}, },
getCurrentColor(val) { getCurrentColor(val) {
if (val > colorLabel[colorLabel.length - 1]) { if (val > colorLabel[colorLabel.length - 1]) {
......
...@@ -66,7 +66,6 @@ export default { ...@@ -66,7 +66,6 @@ export default {
// res.rj_local.push({ xAxis: pname, yAxis: rj_local }); // res.rj_local.push({ xAxis: pname, yAxis: rj_local });
// res.th_local.push({ xAxis: pname, yAxis: th_local }); // res.th_local.push({ xAxis: pname, yAxis: th_local });
}); });
console.log(res);
return res; return res;
}, },
setOptionOfEchart() { setOptionOfEchart() {
...@@ -155,17 +154,11 @@ export default { ...@@ -155,17 +154,11 @@ export default {
filter: ["!=", "pcode", 10], filter: ["!=", "pcode", 10],
}; };
this.$api.layer.query(this.dataSetCode, param).then((res) => { this.$api.layer.query(this.dataSetCode, param).then((res) => {
console.log(res);
this.data = res.data.features; this.data = res.data.features;
this.getValOfdata; this.getValOfdata;
}); });
}, },
}, },
watch: {
getItemOfType(val) {
console.log(val);
},
},
}; };
</script> </script>
......
...@@ -158,7 +158,6 @@ export default { ...@@ -158,7 +158,6 @@ export default {
}, },
], ],
}; };
console.log(option);
return option; return option;
}; };
}, },
......
...@@ -5,39 +5,38 @@ ...@@ -5,39 +5,38 @@
</template> </template>
<script> <script>
import Map from '@/components/Map/Map.vue' import Map from "@/components/Map/Map.vue";
export default { export default {
name: 'methane', name: "methane",
data() { data() {
return { return {
map: '' map: "",
} };
}, },
components: { components: {
Map Map,
}, },
computed: {}, computed: {},
methods: { methods: {
async onload(map) { async onload(map) {
this.map = map this.map = map;
this.map.addLayer({ this.map.addLayer({
id: 'province', id: "province",
source: 'province', source: "province",
type: 'fill', type: "fill",
layout: {}, layout: {},
paint: { paint: {
'fill-outline-color': '#fff', "fill-outline-color": "#fff",
'fill-color': 'rgba(0, 0, 0, 0)' "fill-color": "rgba(0, 0, 0, 0)",
} },
}) });
await this.$emit('onload', map) await this.$emit("onload", map);
}, },
async setBackground(data) { async setBackground(data) {
console.log(this.map.getStyle()) await this.map.setPaintProperty("province", "fill-color", data);
await this.map.setPaintProperty('province', 'fill-color', data) },
} },
} };
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
......
import Vue from "vue"; import Vue from "vue";
import Vuex from "vuex"; import Vuex from "vuex";
import energyVillage from "./module/energyVillage";
import { query } from "@/api/modules/layer.js";
Vue.use(Vuex); Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
state: {}, state: {
mutations: {}, province: [],
actions: {}, },
modules: {}, 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,
},
}); });
export default {
namespaced: true,
state: {
data: 1,
},
mutations: {},
actions: {},
getters: {},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment