fanghuisheng 3 rokov pred
rodič
commit
6b8c4da384
7 zmenil súbory, kde vykonal 100 pridanie a 96 odobranie
  1. BIN
      dist.zip
  2. 2 0
      public/static/config.js
  3. 9 9
      src/main.js
  4. 8 8
      src/router/index.js
  5. 78 76
      src/views/home/index.vue
  6. 1 1
      src/views/index.vue
  7. 2 2
      vue.config.js

BIN
dist.zip


+ 2 - 0
public/static/config.js

@@ -4,6 +4,8 @@ var PLATFROM_CONFIG = {};
 // PLATFROM_CONFIG.baseUrl = "http://172.16.1.196:8010/"  //超博本地
 
 // console.log(window.location)
+
+
 if (window.location.host.indexOf("localhost") != -1 || window.location.host.indexOf("pcdev.ewoogi.com") != -1) {
     PLATFROM_CONFIG.baseUrl = "https://qhome.usky.cn/fivapi/" //线上
     PLATFROM_CONFIG.fileUrl = "https://qhome.usky.cn/file/" //xlsx文件访问路径

+ 9 - 9
src/main.js

@@ -48,8 +48,8 @@ router.beforeEach((to, from, next) => {
 
     if (to.path !== '/') {
         if (localStorage.getItem('accessToken') === null) {
-            removeToken()//不用管
-            // if (localStorage.getItem('userInfo') === null) {
+            removeToken() //不用管
+                // if (localStorage.getItem('userInfo') === null) {
 
             // 本地存储的accessToken不存在时,跳转至后台登录页
             // alert('本地存储的accessToken不存在')
@@ -63,12 +63,12 @@ router.beforeEach((to, from, next) => {
             }
 
             document.getElementById('routers').style.display = "none"
-            // setTimeout(() => {
-            //     ElMessage.warning({
-            //         message: '请登录后重试!',
-            //         type: 'warning'
-            //     })
-            // }, 100);
+                // setTimeout(() => {
+                //     ElMessage.warning({
+                //         message: '请登录后重试!',
+                //         type: 'warning'
+                //     })
+                // }, 100);
 
         } else {
             // alert('本地存储的accessToken存在')
@@ -76,7 +76,7 @@ router.beforeEach((to, from, next) => {
         }
     } else {
         document.getElementById('routers').style.display = "block"
-        //路由的next必须存在,否则无法进入下一页
+            //路由的next必须存在,否则无法进入下一页
         if (localStorage.getItem('accessToken') != null) {
             next({ path: '/home' })
         } else {

+ 8 - 8
src/router/index.js

@@ -12,7 +12,7 @@ let routes = [
         name: 'login',
         meta: { title: '登录', name: "登录 ", type: "" },
         component: () =>
-            import('../views/login.vue'),
+            import ('../views/login.vue'),
         hidden: true,
     },
     {
@@ -20,7 +20,7 @@ let routes = [
         name: 'home',
         meta: { title: '首页', name: "智慧用电监控平台", type: "index" },
         component: () =>
-            import('../views/home/index.vue'),
+            import ('../views/home/index.vue'),
     },
 
     // ming router end
@@ -55,7 +55,7 @@ let routes = [
         name: 'overview',
         meta: { title: '概览', name: "测试站点一", type: "menu" },
         component: () =>
-            import('../views/site/Overview.vue'),
+            import ('../views/site/Overview.vue'),
     },
     //配电系统图页面
     {
@@ -63,7 +63,7 @@ let routes = [
         name: 'power_diagram',
         meta: { title: '配电系统图', name: "测试站点一", type: "menu" },
         component: () =>
-            import('../views/site/Power_diagram.vue'),
+            import ('../views/site/Power_diagram.vue'),
         // import ('../views/site/CircuitEdit.vue'),
     },
 
@@ -73,7 +73,7 @@ let routes = [
         name: 'device_motore',
         meta: { title: '设备监控', name: "测试站点一", type: "menu" },
         component: () =>
-            import('../views/site/Device_motore.vue'),
+            import ('../views/site/Device_motore.vue'),
     },
     //事件告警页面
     {
@@ -81,7 +81,7 @@ let routes = [
         name: 'event_alarm',
         meta: { title: '事件告警', name: "测试站点一", type: "menu" },
         component: () =>
-            import('../views/site/Event_alarm.vue'),
+            import ('../views/site/Event_alarm.vue'),
     },
 
 
@@ -92,7 +92,7 @@ let routes = [
         name: 'CircuitEdit1',
         meta: { title: '编辑器', name: "测试站点一", type: "" },
         component: () =>
-            import('../views/CircuitEdit1.vue'),
+            import ('../views/CircuitEdit1.vue'),
     },
     // 预览页页面
     {
@@ -101,7 +101,7 @@ let routes = [
         meta: { title: '预览', name: "测试站点一", type: "" },
         component: () =>
             // import('../views/CircuitPreview.vue'),
-            import('../views/CircuitPreview.vue'),
+            import ('../views/CircuitPreview.vue'),
         // import('../views/site/Power_diagram.vue'),
     },
 ]

+ 78 - 76
src/views/home/index.vue

@@ -109,6 +109,7 @@
     <!-- bottomBox end -->
   </section>
 </template>
+
 <script>
 import statisTop from "./components/statisTop";
 import statisBottom from "./components/statisBottom";
@@ -124,6 +125,7 @@ mapData;
 
 // 地图
 import AMap from "AMap";
+
 // import AMapUI from "AMapUI";
 
 import api from "@/api/home/home.js";
@@ -183,6 +185,9 @@ export default {
         ["#7dc", "#F33"],
       ],
       colorIndList: [-1, 7, 21, 26, 31, 37, 46, 52, 57, 66, 68, 71, 74, 100],
+
+      district: null,
+      polygons: [],
     };
   },
   watch: {
@@ -207,6 +212,8 @@ export default {
     this.htAnalogData_api();
     // this.eptrendIco_api();
     this.eptrendIcoMonth_api();
+
+    
   },
   methods: {
     // searchSite(){
@@ -282,7 +289,6 @@ export default {
         this.initMap();
       });
     },
-
     //地图撒点
 
     // 日月年用电量
@@ -313,6 +319,7 @@ export default {
     Overview() {
       // this.$router.push({ path: "/Overview" }); //, query: { title: title }
     },
+
     async initMap() {
       this.map = await new AMap.Map("mapF", {
         mapStyle: "amap://styles/blue", //设置地图的显示样式
@@ -321,7 +328,6 @@ export default {
         zooms: [3, 16],
         // features: [] //清空背景道路等
       });
-      // this.initMapUi();
 
       var con = `<div class="siteModelBox" >
                   <h2>
@@ -368,6 +374,8 @@ export default {
       });
 
       this.addMarker(dataList, "water");
+
+      // this.drawBounds();
     },
 
     addMarker(lnglats) {
@@ -430,32 +438,32 @@ export default {
       this.map.add(new AMap.OverlayGroup(markers));
       this.map.setFitView(); // 根据所有点自适应
 
-      this.mapPolList = mapData.map((val, ind) => {
-        // console.log(val)
-        let color =
-          this.colorList[
-            this.colorIndList.findIndex(
-              (value, index) =>
-                value <= ind && ind < this.colorIndList[index + 1]
-            )
-          ];
-        return [
-          new AMap.Polygon({
-            map: this.map,
-            fillOpacity: 0.5,
-            path: val[3],
-            fillColor: color[0],
-            strokeColor: color[1],
-          }),
-          new AMap.Polygon({
-            map: this.map,
-            fillOpacity: 0.5,
-            path: val[3],
-            fillColor: color[1],
-            strokeColor: color[0],
-          }),
-        ];
-      });
+      // this.mapPolList = mapData.map((val, ind) => {
+      //   // console.log(val)
+      //   let color =
+      //     this.colorList[
+      //       this.colorIndList.findIndex(
+      //         (value, index) =>
+      //           value <= ind && ind < this.colorIndList[index + 1]
+      //       )
+      //     ];
+      //   return [
+      //     new AMap.Polygon({
+      //       map: this.map,
+      //       fillOpacity: 0.5,
+      //       path: val[3],
+      //       fillColor: color[0],
+      //       strokeColor: color[1],
+      //     }),
+      //     new AMap.Polygon({
+      //       map: this.map,
+      //       fillOpacity: 0.5,
+      //       path: val[3],
+      //       fillColor: color[1],
+      //       strokeColor: color[0],
+      //     }),
+      //   ];
+      // });
       this.map.on("mousemove", (e) => {
         var point = [e.lnglat.getLng(), e.lnglat.getLat()];
         var pointList = mapData.map((val) => {
@@ -472,7 +480,6 @@ export default {
         });
       });
     },
-
     // 添加标点
     addMarkerInfo(position, content, value = "") {
       value;
@@ -488,57 +495,54 @@ export default {
       infoWindow.open(this.map, position);
     },
 
-    poiPickerReady(poiPicker) {
-      // console.log(poiPicker);
-      var marker = new AMap.Marker();
-
-      var infoWindow = new AMap.InfoWindow({
-        offset: new AMap.Pixel(0, -20),
-      });
-
-      //选取了某个POI
-      poiPicker.on("poiPicked", (poiResult) => {
-        var source = poiResult.source,
-          poi = poiResult.item,
-          info = {
-            source: source,
-            id: poi.id,
-            name: poi.name,
-            location: poi.location.toString(),
-            address: poi.address,
-          };
-
-        marker.setMap(this.map);
-        infoWindow.setMap(this.map);
-
-        marker.setPosition(poi.location);
-        infoWindow.setPosition(poi.location);
-
-        infoWindow.setContent(
-          "POI信息: <pre>" + JSON.stringify(info, null, 2) + "</pre>"
-        );
-        // infoWindow.open(this.map, marker.getPosition());
-
-        this.map.setCenter(marker.getPosition());
-      });
+    // 嘉定区边界高亮 start
+    drawBounds() {
+      //加载行政区划插件
+      if (!this.district) {
+        //实例化DistrictSearch
+        var that=this
+        AMap.plugin("AMap.DistrictSearch", function () {
+          that.district = new AMap.DistrictSearch({
+            subdistrict: 0, //获取边界不需要返回下级行政区
+            extensions: "all", //返回行政区边界坐标组等具体信息
+            level: "district", //查询行政级别为 市
+          });
 
-      poiPicker.onCityReady(() => {
-        // poiPicker.suggest("美食");
-      });
+          //行政区查询
+          that.district.search("嘉定区", function (status, result) {
+            that.map.remove(that.polygons); //清除上次结果
+            that.polygons = [];
+            var bounds = result.districtList[0].boundaries;
+            if (bounds) {
+              for (var i = 0, l = bounds.length; i < l; i++) {
+                //生成行政区划polygon
+                var polygon = new AMap.Polygon({
+                  strokeWeight: 1,
+                  path: bounds[i],  
+                  fillOpacity:.2,
+                  fillColor: "pink",
+                  strokeColor: "pink",
+                });
+                that.polygons.push(polygon);
+              }
+            }
+            that.map.add(that.polygons);
+            that.map.setFitView(that.polygons); //视口自适应
+          });
+        });
+      }
     },
-    // initMapUi() {
-    //   AMapUI.load(["ui/misc/PoiPicker"], (PoiPicker) => {
-    //     // console.log(PoiPicker);
-    //     let poiPickers = new PoiPicker({
-    //       input: "pickerInput",
-    //     });
-    //     this.poiPickerReady(poiPickers);
-    //   });
-    // },
+
+    // 嘉定区边界高亮 end
   },
 };
 </script>
 
+
+
+
+
+
 <style lang="scss">
 #pickerBox {
   position: absolute;
@@ -569,7 +573,6 @@ export default {
   color: #fff;
 }
 
-
 #poiInfo {
   background: #fff;
 }
@@ -577,5 +580,4 @@ export default {
 .amap-icon img {
   width: 25px;
 }
-
 </style>

+ 1 - 1
src/views/index.vue

@@ -61,7 +61,7 @@
             :class="
               title == route.meta.title ? 'router_rigth2' : 'router_rigth1'
             "
-            v-for="route in router.slice(4, 6)"
+            v-for="route in router.slice(5, 7)"
             :key="route"
             :to="route.path"
             v-show="route.meta.type === 'menu'"

+ 2 - 2
vue.config.js

@@ -6,8 +6,8 @@ function resolve(dir) {
 // 基本结构
 module.exports = {
     // 打包后路径错误导致的空白页面问题。
-    publicPath: '/vuefiv/',
-    // publicPath: '/panel/',
+    // publicPath: '/vuefiv/',
+    publicPath: '/panel/',
     outputDir: process.env.outputDir,
     // assetsPublicPath: '/vuefiv/',
     // assetsDir: 'vuefiv',