|
@@ -0,0 +1,108 @@
|
|
|
+<template>
|
|
|
+ <div class="legends" v-show="vectors.length > 0 && !store.state.viewer_flag">
|
|
|
+ <el-collapse accordion v-model="activeNames">
|
|
|
+ <el-collapse-item
|
|
|
+ :name="vector.id"
|
|
|
+ v-for="(vector, index) in vectors"
|
|
|
+ :key="index"
|
|
|
+ :title="vector.label"
|
|
|
+ >
|
|
|
+ <div v-for="legend in vector.legends" :key="legend.label">
|
|
|
+ <span class="legLabel"> {{ legend.label }}</span>
|
|
|
+ <img :src="legend.url" alt="" srcset="" />
|
|
|
+ </div>
|
|
|
+ </el-collapse-item>
|
|
|
+ </el-collapse>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "LayerLegend",
|
|
|
+ props: {},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeNames: [],
|
|
|
+ vectors: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ checkedNodes() {
|
|
|
+ return store.state.checkedNode;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ async GetLegend(vdata) {
|
|
|
+ let url = `${vdata.url}/legend.json?bbox=108.99%2C18.2%2C109.81%2C18.59`;
|
|
|
+ let res = await axios.get(url);
|
|
|
+ let legends = [];
|
|
|
+ res.data.layerLegends.forEach((la) => {
|
|
|
+ legends = [...legends, ...la.legends];
|
|
|
+ });
|
|
|
+ this.vectors.push({ id: vdata.id, label: vdata.label, legends });
|
|
|
+ // return legends;
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ watch: {
|
|
|
+ checkedNodes() {
|
|
|
+ this.vectors = [];
|
|
|
+ let vectors = this.checkedNodes.filter((ci) => ci.type == "Vector");
|
|
|
+ vectors.forEach((ve) => {
|
|
|
+ this.GetLegend(ve);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.legends {
|
|
|
+ position: absolute;
|
|
|
+ left: 40px;
|
|
|
+ top: 70vh;
|
|
|
+ width: 150px;
|
|
|
+ height: 200px;
|
|
|
+ cursor: pointer;
|
|
|
+ background: url(/static/images/ghzc/内容框.png) no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ background-position: center;
|
|
|
+ padding: 0px 10px;
|
|
|
+ box-sizing: content-box;
|
|
|
+ text-align: left;
|
|
|
+ overflow-x: hidden;
|
|
|
+ overflow-y: auto;
|
|
|
+ .legLabel {
|
|
|
+ min-width: 100px;
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+}
|
|
|
+.el-collapse {
|
|
|
+ // width: 95%;
|
|
|
+ border: none;
|
|
|
+ background-color: transparent !important;
|
|
|
+}
|
|
|
+.el-scrollbar {
|
|
|
+ border: 1px solid #0f7ac8 !important;
|
|
|
+ // padding: 0 10px;
|
|
|
+}
|
|
|
+.el-collapse-item__header {
|
|
|
+ // border-bottom: 1px solid rgba(102, 126, 143, 0.747);
|
|
|
+ background-color: transparent !important;
|
|
|
+ color: rgb(217, 237, 254) !important;
|
|
|
+ border-color: transparent !important;
|
|
|
+}
|
|
|
+
|
|
|
+.el-collapse-item__wrap {
|
|
|
+ background-color: transparent !important;
|
|
|
+ border-color: transparent !important;
|
|
|
+}
|
|
|
+.el-collapse-item__content {
|
|
|
+ // background-color: rgba(255, 192, 203, 0.425) !important;
|
|
|
+ background-color: transparent !important;
|
|
|
+ color: rgb(217, 237, 254) !important;
|
|
|
+}
|
|
|
+
|
|
|
+// @import "../../../views/complianceAnalysis/ghzc.scss";
|
|
|
+</style>
|