maxiaoxiao 5 mesiacov pred
rodič
commit
da114b63e0
1 zmenil súbory, kde vykonal 31 pridanie a 48 odobranie
  1. 31 48
      src/views/basicGeographic/index.vue

+ 31 - 48
src/views/basicGeographic/index.vue

@@ -10,7 +10,7 @@
 
       </div>
       <div style="width: 50%;">
-        <el-input placeholder="请输入查询内容" prefix-icon="el-icon-search" v-model="graphText" size="small"
+        <el-input placeholder="请输入查询名称或Id" prefix-icon="el-icon-search" v-model="graphText" size="small"
           @change="setSelected">
         </el-input>
       </div>
@@ -18,7 +18,6 @@
       <div id="myContext" class="myContextMenu" style="display: none;">
         <div @click="fly"> 定位</div>
         <div @click="info">详情</div>
-
       </div>
     </div>
     <div class="sm-panel infoDiv" v-show="showinfo">
@@ -30,28 +29,9 @@
 </template>
 
 <script>
-let data = [
-  {
-    name: "李富贵",
-    id: "lfg",
-    tooltip: {
-      formatter: "{b} <br/>定位<br/>详情",
-    },
-    category: 0
-  },
-  {
-    tooltip: {
-      formatter: "{b} <br/>性别:男<br/>出生年月:19951114<br/>星座:处女座",
-    },
-    name: "王桂花",
-    id: "wgh",
-  }
-];
-
-
 let categors = [
   {
-    name: "李富贵",
+    name: "高亮",
     itemStyle: {
       normal: {
         color: "#FCBB5B",
@@ -70,7 +50,7 @@ let categors = [
   }]
 
 import Info from "../Idleland/components/info.vue";
-import EntityManage from "./entityManage.vue";
+import EntityManage from "../BasicGeographic/entityManage.vue";
 import graph from "@/components/echartsTemplate/graph.vue";
 import { getData, getRelationship } from "@/api/basicGeographic.js";
 import { loadGeoJSON, removeGeoJSON } from "@/utils/MapHelper/help.js";
@@ -98,7 +78,7 @@ export default {
   },
   created() { },
   mounted() {
-    this.detail({ id: 'MA1001NE103K103501003XXXXXXXXXXX2501010000' })//MA1001NE103K103501004XXXXXXXXXXX2203040000
+    this.detail({ id: 'MA1001NE103K103501003XXXXXXXXXXX2501010000', label: '测试' })//MA1001NE103K103501004XXXXXXXXXXX2203040000
   },
   methods: {
     click(params) {
@@ -113,7 +93,7 @@ export default {
       this.showInter = true
       this.graphdata = []
       this.gralinks = []
-      this.graphdata.push({ name: obj.label, id: obj.id, category: 0, })
+      this.graphdata.push({ name: obj.label, id: obj.id, category: 0, data: obj })
       this.getRelationship(obj)
 
     },
@@ -121,27 +101,29 @@ export default {
       this.showInter = false
     },
     setSelected() {
-      let sdata = this.graphdata.map((node) => {
-        console.log();
-        return {
-          name: node.name,
-          value: node.value,
-          selected: node.name.includes(this.graphText)
-        };
-      })
-      this.$refs.graphEchart.setOptions(sdata, this.gralinks, categors);
-      // this.$refs.graphEchart.setOptions(this.graphdata, this.gralinks, categors);
+      if (this.graphText) {
+        this.$refs.graphEchart.myChart.dispatchAction({
+          type: 'highlight',
+          seriesIndex: 0,
+          dataIndex: this.graphdata.findIndex((node) => {
+            return node.name.includes(this.graphText) || node.id.includes(this.graphText)
+          })
+        });
+      } else {
+        this.$refs.graphEchart.myChart.clear()
+        this.$refs.graphEchart.setOptions(this.graphdata, this.gralinks, categors);
+      }
+
     },
     getData(obj) {
       getData({ entityid: obj.id }).then((res) => {
         if (res.statuscode == 200) {
           this.showinfo = true;
-          Object.keys(res.data.info).forEach((key) => {
+          Object.keys(res.data).forEach((key) => {
             this.jbxxData.push({ name: key, value: res.data.info[key], });
           });
-          res.data.geom.forEach(item => {
-            console.log(obj.id, item)
-            loadGeoJSON(item.siweigeomewkt, "#facd91", { isfly: true }, (data) => {
+          res.data.forEach(item => {
+            loadGeoJSON(item.geom.siweigeomewkt, "#facd91", { isfly: true }, (data) => {
               geoSources[obj.id] = data;
               data.name = obj.id;
             });
@@ -155,10 +137,11 @@ export default {
       getRelationship({ entityid: obj.id }).then((res) => {
         if (res.statuscode == 200) {
           res.data.data.forEach((item, i) => {
-            if (item.info.entityid && !this.graphdata.find(gi => gi.id == item.info.entityid)) {
+            if (item.entityid && !this.graphdata.find(gi => gi.id == item.entityid)) {
               this.graphdata.push({
-                name: item.info.entityname != 'null' ? item.info.entityname : item.info.entityid,
-                id: item.info.entityid,
+                name: item.entityname != 'null' ? item.entityname : item.entityid,
+                id: item.entityid,
+                data: item
               })
             }
           })
@@ -168,10 +151,12 @@ export default {
         }
       });
     },
-    fly() {
+    fly(params) {
+      console.log(params, "paramsparams");
       console.log('fly,', '---');
     },
-    info() {
+    info(params) {
+      console.log(params, "paramsparams");
       console.log('info', '---');
     }
   },
@@ -234,14 +219,12 @@ export default {
   }
 
   .infoDiv {
-    right: 40%;
+    right: 50%;
   }
-
-  // }
 }
 </style>
 <style lang="scss">
-@import "../complianceAnalysis//ghzc.scss";
+@import "../complianceAnalysis/ghzc.scss";