浏览代码

智能选址现状信息显示不全,点击饼图联动图斑

maxiaoxiao 11 月之前
父节点
当前提交
0bf3469fc3

+ 20 - 15
src/components/echartsTemplate/pie.vue

@@ -22,6 +22,11 @@ let colors = [
 ];
 let option = {
   backgroundColor: "rgba(0,0,0,0)",
+  label: {
+    //图例文字的样式
+    color: "#fff",
+    fontSize: 16,
+  },
   title: {
     // text: "报建数量",
     x: "20%",
@@ -173,17 +178,17 @@ export default {
       cartData.data.forEach((item, index) => {
         option.legend.data.push(item.name);
         item.itemStyle = {
-          // color: colors[index % colors.length],
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-            {
-              offset: 0,
-              color: colors[index % colors.length],
-            },
-            {
-              offset: 1,
-              color: colors[index % colors.length],
-            },
-          ]),
+          color: colors[index % colors.length],
+          // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+          //   {
+          //     offset: 0,
+          //     color: colors[index % colors.length],
+          //   },
+          //   {
+          //     offset: 1,
+          //     color: colors[index % colors.length],
+          //   },
+          // ]),
         };
         // dataAll += item.value;
       });
@@ -200,9 +205,9 @@ export default {
         option.legend.top = "center";
         option.legend.orient = "vertical";
       }
-      option.legend.right= cartData.legend_right||"2%"
-      let max = cartData.max || 4
-      option.legend.textStyle.rich.name.width = max * 15
+      option.legend.right = cartData.legend_right || "2%";
+      let max = cartData.max || 4;
+      option.legend.textStyle.rich.name.width = max * 15;
       option.legend.formatter = function (name) {
         const sItem = cartData.data.find((item) =>
           `${item.name}`.includes(`${name}`)
@@ -228,7 +233,7 @@ export default {
         _this.$emit("echartClick", params.name, params.selected[params.name]);
       });
       this.myChart.on("click", function (params) {
-        _this.$emit("echartClick", params.name);
+        _this.$emit("echartClick", params.name, { color: params.color });
       });
       // }
     },

+ 18 - 17
src/views/siteselection/components/dkDetails.vue

@@ -24,10 +24,7 @@
         :key="index_item"
         @change="handleChange"
       >
-        <el-collapse-item
-          :title="'地块' + (index_item + 1)"
-          name="1"
-        >
+        <el-collapse-item :title="'地块' + (index_item + 1)" name="1">
           <div
             class="list_vector_multi"
             v-for="(value_field, index_field) in value"
@@ -62,9 +59,10 @@ export default {
     return {
       title: "",
       itemObj: {},
+      dataList: [],
       collapseList: [],
       loading: true,
-      isDateilsShow:false
+      isDateilsShow: false,
     };
   },
   methods: {
@@ -88,13 +86,13 @@ export default {
       AddHgxfxV1(formdata).then((res) => {
         if (res.success) {
           res.data.data.forEach((e) => {
-            let c = e.dataList || [];
-            c.map((ci) => {
-              ci.name = ci.yslx_name;
+            this.dataList = e.dataList || [];
+            this.dataList.map((ci) => {
+              ci.name = ci.yslx_name || "未知";
               ci.value = ci.mj;
               ci.geom = ci.geom || "";
             });
-            if (e.scxstyle == 0) this.setEchart(c, "vertical");
+            if (e.scxstyle == 0) this.setEchart(this.dataList, "vertical");
           });
         }
       });
@@ -110,11 +108,14 @@ export default {
         });
       });
     },
-    echartClick(name) {},
+    echartClick(name) {
+      let click = this.dataList.filter((c) => c.name == name);
+      if (click.length > 0) this.$emit("mapview", click[0]);
+    },
 
     getCollapseList() {
-      this.loading = true
-      this.collapseList = []
+      this.loading = true;
+      this.collapseList = [];
       function cutStringFromFirstSemiColon(str) {
         var index = str.indexOf(";"); // 获取第一个分号的索引
         if (index !== -1) {
@@ -134,12 +135,12 @@ export default {
         if (tempArr.data) {
           this.collapseList = tempArr.data;
         }
-        this.loading = false
+        this.loading = false;
       });
     },
-    close(){
-      this.isDateilsShow = false
-    }
+    close() {
+      this.isDateilsShow = false;
+    },
   },
   mounted() {},
   computed: {},
@@ -189,7 +190,7 @@ export default {
 .filed_box {
   display: inline-block;
 }
-.loadingDiv{
+.loadingDiv {
   width: 100%;
   // height: 100%;
   height: calc(100% - 46px);

+ 2 - 1
src/views/siteselection/components/xzjg.vue

@@ -114,7 +114,7 @@
         >
       </div>
     </div> -->
-    <dkDetails ref="dkDetails"></dkDetails>
+    <dkDetails ref="dkDetails" @mapview="mapview"></dkDetails>
   </div>
 </template>
 
@@ -286,6 +286,7 @@ export default {
           viewer.flyTo(data, {
             offset: new Cesium.HeadingPitchRange(0, -45, 5000),
           });
+          // viewer.zoomTo(data);
           if (id) {
             this.tempdataSourcesId = id;
             dataSources[id] = data;