소스 검색

修改新增加的需求

“yueshang” 1 년 전
부모
커밋
e5d4d512b3
1개의 변경된 파일39개의 추가작업 그리고 63개의 파일을 삭제
  1. 39 63
      src/views/index.vue

+ 39 - 63
src/views/index.vue

@@ -94,7 +94,7 @@
           >
             <!-- 弹框 -->
             <bm-info-window
-              :show="selectedMarker == marker ||show"
+              :show="selectedMarker == marker || show"
               @close="infoWindowClose"
               @open="infoWindowOpen(marker)"
               @mouseleave="infoWindowClose"
@@ -147,7 +147,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 +164,7 @@
             start-placeholder="开始日期"
             end-placeholder="结束日期"
             :default-time="['00:00:00', '23:59:59']"
+            @change="checkDrillDate"
           />
           <div class="real-signal">
             <div>
@@ -201,9 +202,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 +214,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 +243,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[0];
+      this.end = this.drillDate[1];
+      this.selectedValue="6"
+      this.$forceUpdate()
+      this.getInfo();
     },
-    //选择时间
-    choiceTime() {},
     //关闭点位
     infoWindowClose() {
       this.selectedMarker = null;
@@ -339,7 +311,11 @@ export default {
     },
     getInfo() {
       //头部
-      indexInfo().then((response) => {
+      indexInfo({
+        filter: this.selectedValue,
+        start: this.start,
+        end: this.end,
+      }).then((response) => {
         this.topData = response;
         console.log("response", response);
       });
@@ -582,13 +558,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 +587,7 @@ export default {
     .title {
       position: sticky;
       top: 0;
-      background-color: #FFF;
+      background-color: #fff;
       padding: 10px;
       color: #72838c;
       z-index: 99999;