Parcourir la source

Merge branch 'master' of ssh://94.191.59.107:10222/wukai/dayun-ui

wukai il y a 2 ans
Parent
commit
033bd5af15
1 fichiers modifiés avec 43 ajouts et 66 suppressions
  1. 43 66
      src/views/index.vue

+ 43 - 66
src/views/index.vue

@@ -91,13 +91,14 @@
               url: require('@/assets/images/org-icon.png'),
               size: { width: 150, height: 157 },
             }"
+            @mouseout="infoWindowClose"
           >
             <!-- 弹框 -->
             <bm-info-window
-              :show="selectedMarker == marker ||show"
+              :show="selectedMarker == marker || show"
               @close="infoWindowClose"
               @open="infoWindowOpen(marker)"
-              @mouseleave="infoWindowClose"
+              @mouseout="infoWindowClose"
             >
               <div class="tankuang">
                 <div class="poptop" @click="goBluetooth">
@@ -147,7 +148,7 @@
             @change="choiceTime"
           >
             <el-option
-              v-for="item in options"
+              v-for="item in dict.type.index_filter"
               :key="item.value"
               :label="item.label"
               :value="item.value"
@@ -164,6 +165,7 @@
             start-placeholder="开始日期"
             end-placeholder="结束日期"
             :default-time="['00:00:00', '23:59:59']"
+            @change="checkDrillDate"
           />
           <div class="real-signal">
             <div>
@@ -201,9 +203,10 @@ import storeChart from "./dashboard/storeChart";
 import twinChart from "./dashboard/twinChart";
 import MyPopup from "./components/MyPopup.vue";
 import BmMarkers from "vue-baidu-map/components/overlays/Marker.vue";
-import { listData} from "@/api/system/dict/data";
+import { listData } from "@/api/system/dict/data";
 export default {
   name: "Dict",
+  dicts: ["index_filter"],
   components: {
     storeChart,
     twinChart,
@@ -212,72 +215,25 @@ export default {
   },
   data() {
     return {
-      selectedValue: "当天",
+      selectedValue: "1",
       drillDate: [], //自定义时间
       realTimeData: [], //实时数据
       show: false,
       //=======地图
       center: { lng: 104.064856, lat: 30.658876 }, // 成都的经纬度
       zoom: 12, // 地图缩放级别
-      markerPositionCeshi: [
-        {
-          lng: 104.243116,
-          lat: 30.593938,
-          type: "WIFI",
-          name: "地点1",
-          info: "这是地点1的信息",
-        },
-        {
-          lng: 104.113,
-          lat: 30.546,
-          type: "蓝牙",
-          name: "地点2",
-          info: "这是地点2的信息",
-        },
-        {
-          lng: 104.243116,
-          lat: 30.593938,
-          type: "WIFI",
-          name: "地点1",
-          info: "这是地点1的信息",
-        },
-        {
-          lng: 104.113,
-          lat: 30.546,
-          type: "蓝牙",
-          name: "地点2",
-          info: "这是地点2的信息",
-        },
-        // 其他地点...
-      ],
-      options: [
-        {
-          value: "当天",
-          label: "当天",
-        },
-        {
-          value: "本周",
-          label: "本周",
-        },
-        {
-          value: "本月",
-          label: "本月",
-        },
-        {
-          value: "本年",
-          label: "本年",
-        },
-      ],
       selectedMarker: null,
       //=======地图
       data: "sdff",
       topData: {},
       rightData: [],
       wheight: 0,
+      start: "",
+      end: "",
     };
   },
   created() {
-    console.log('first', this.dict)
+    // console.log('first', this.dict.getDictValue())
     this.$nextTick(() => {
       this.wheight = document.getElementById("contbody").clientHeight;
     });
@@ -288,24 +244,41 @@ export default {
     this.realTimeInfo();
     setInterval(() => {
       this.getInfo();
-      this.$forceUpdate;
     }, 5 * 60 * 1000);
+    setInterval(() => {
+      this.realTimeInfo();
+    }, 1 * 60 * 1000);
   },
   methods: {
+    //实时数据
     realTimeInfo() {
       realTimeInfo().then((res) => {
         this.realTimeData = res;
-        console.log("res", res);
       });
     },
     lookPosition(items) {
       //查看位置
       this.center = { lng: items.lng, lat: items.lat };
       console.log(items, "22222");
-      this.show=true
+      this.show = true;
+    },
+    //选择周,天。。。
+    choiceTime(selectedValue) {
+      if (this.selectedValue == 6 && this.drillDate.length == 0) {
+        return this.$modal.msg("请选择自定义时间");
+      } else {
+        this.getInfo();
+      }
+    },
+    //自定义时间
+    checkDrillDate() {
+      console.log("drillDate", this.drillDate);
+      this.start = this.drillDate?this.drillDate[0]:"";
+      this.end = this.drillDate?this.drillDate[1]:"";
+      this.selectedValue=this.drillDate?"6":"1"
+      this.$forceUpdate()
+      this.getInfo();
     },
-    //选择时间
-    choiceTime() {},
     //关闭点位
     infoWindowClose() {
       this.selectedMarker = null;
@@ -316,8 +289,7 @@ export default {
     infoWindowOpen(marker) {
       this.selectedMarker = marker;
       // this.show = true;
-      console.log("marker", marker, marker);
-      this.$forceUpdate();
+
     },
     goDevice() {
       //去设备
@@ -339,8 +311,13 @@ export default {
     },
     getInfo() {
       //头部
-      indexInfo().then((response) => {
+      indexInfo({
+        filter: this.selectedValue,
+        start: this.start,
+        end: this.end,
+      }).then((response) => {
         this.topData = response;
+        this.$modal.msgSuccess('加载成功')
         console.log("response", response);
       });
     },
@@ -582,13 +559,13 @@ export default {
   z-index: 9;
   ::v-deep .el-input__inner {
     border: none;
-    width: 84px;
+    width: 90px;
     height: 38px;
   }
 }
 .choice-mytime {
   width: 244px;
-  left: 180px;
+  left: 184px;
   top: 24px;
   height: 33px !important;
 }
@@ -611,7 +588,7 @@ export default {
     .title {
       position: sticky;
       top: 0;
-      background-color: #FFF;
+      background-color: #fff;
       padding: 10px;
       color: #72838c;
       z-index: 99999;