Ver Fonte

首页地图点击跳转中心预测功能

xusl há 6 meses atrás
pai
commit
738f1f6093

+ 17 - 0
cpp-admin/src/main/java/com/cpp/web/controller/configManager/ElectricFieldController.java

@@ -235,4 +235,21 @@ public class ElectricFieldController {
     public R findCapacityByStationCode(String stationCode) {
         return R.ok(electricFieldService.findByStationCode(stationCode));
     }
+
+    @GetMapping("/getLargeScreenStation")
+    public R getLargeScreenStation() {
+        List<ElectricField> electricFieldList = electricFieldService.list();
+        List<Map<String, Object>> list = new ArrayList<>();
+        for (ElectricField e : electricFieldList) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("stationCode", e.getStationCode());
+            map.put("name", e.getName());
+            List zbList = new ArrayList();
+            zbList.add(e.getLongitude());
+            zbList.add(e.getLatitude());
+            map.put("value", zbList);
+            list.add(map);
+        }
+        return R.ok(list);
+    }
 }

+ 11 - 1
cpp-ui/src/views/cloudDataQuery/index.vue

@@ -685,6 +685,10 @@ export default {
     this.zhxChart.dispose()
     this.zhxChart = null
   },
+  destroyed() {
+    // 清空缓存中首页地图跳转的参数
+    localStorage.setItem('map-jump-staion','')
+  },
   computed: {},
   methods: {
     cellClassName({row, rowIndex, column, columnIndex}) {
@@ -778,7 +782,13 @@ export default {
       await this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
         this.stationList = response.data
         if (this.stationList.length > 0) {
-          this.stationCode = this.stationList[0].value
+          // 判断缓存中是否是首页地图跳转
+          if (localStorage.getItem('map-jump-staion')==''){
+            this.stationCode = this.stationList[0].value
+          }
+          else{
+            this.stationCode = localStorage.getItem('map-jump-staion')
+          }
           this.dataQuery()
         }
       })

+ 35 - 31
cpp-ui/src/views/largeScreen/echartsMap/index.vue

@@ -28,34 +28,39 @@ export default {
   },
   methods: {
     init() {
-      let scatterData = [
-        {
-          value: [87.6, 43.8],
-          name: '新疆乌鲁木齐'
-        },
-        {
-          name: '阿勒泰',
-          value: [87.70, 47.81],
-        },
-        {
-          name: '卡拉玛依',
-          value: [84.88, 45.58],
-        },
-        {
-          name: '喀什',
-          value: [75.94, 39.45],
-        },
-        {
-          name: '哈密',
-          value: [93.52, 42.82],
-        },
-        {
-          name: '吐鲁番',
-          value: [89.26, 42.97],
-        }
-      ]
-      let lineData = this.filterLines(scatterData)
-      this.initOption(lineData, scatterData);
+      // 调用后端查询场站列表
+      this.$axios({url: '/electricfield/getLargeScreenStation', method: 'get'}).then(response => {
+        let scatterData = response.data
+        let lineData = this.filterLines(scatterData)
+        this.initOption(lineData, scatterData);
+      })
+
+      // let scatterData = [
+      //   {
+      //     value: [87.6, 43.8],
+      //     name: '新疆乌鲁木齐'
+      //   },
+      //   {
+      //     name: '阿勒泰',
+      //     value: [87.70, 47.81],
+      //   },
+      //   {
+      //     name: '卡拉玛依',
+      //     value: [84.88, 45.58],
+      //   },
+      //   {
+      //     name: '喀什',
+      //     value: [75.94, 39.45],
+      //   },
+      //   {
+      //     name: '哈密',
+      //     value: [93.52, 42.82],
+      //   },
+      //   {
+      //     name: '吐鲁番',
+      //     value: [89.26, 42.97],
+      //   }
+      // ]
 
     },
     filterLines(currentData) {
@@ -304,10 +309,9 @@ export default {
       this.myChart.on('click', function (params) {
         // 控制台打印点击的数据
         if(params.componentType === 'series' && params.componentSubType==='scatter'){
-          console.log(params.name)
+          localStorage.setItem('map-jump-staion',params.data.stationCode)
           // TODO 跳转页面
-          // _this.$router.push({path: "/configManager/electricField"})
-          localStorage.setItem('map-jump-staion',params.name)
+          _this.$router.push({path: "cloudDataQuery"})
         }
         // 你可以在这里添加你的逻辑代码
       });

+ 0 - 1
cpp-ui/src/views/largeScreen/index.vue

@@ -565,7 +565,6 @@ export default {
       return data
     },
     drawChart() {
-      console.log(this.xdczs)
       gaugeOption.series[0].data[0].value = this.xdczs
       gaugeOption.series[1].data[0].value = this.xdczs
       gaugeOption.series[0].max = this.zczs