Browse Source

解决点击更改日期再跳转到指纹页面再返回,日期会变更的问题

hzj18279462576@163.com 3 years ago
parent
commit
4869b7f473

+ 1 - 0
admin/src/store/getters.js

@@ -2,6 +2,7 @@ const getters = {
     sidebar: (state) => state.app.sidebar,
     device: (state) => state.app.device,
     token: (state) => state.user.token,
+    time: (state) => state.user.time,
     avatar: (state) => state.user.avatar,
     userName: (state) => state.user.userName,
     headImage: (state) => state.user.headImage,

+ 4 - 0
admin/src/store/modules/user.js

@@ -7,6 +7,7 @@ const getDefaultState = () => {
         token: '',
         userName: '',
         headImage: '',
+        time: new Date(),
         avatar: '',
         roles: [],
         buttons: []
@@ -31,6 +32,9 @@ const mutations = {
 
     SET_ROLES: (state, roles) => {
         state.roles = roles
+    },
+    SET_TIME: (state, time) => {
+        state.time = time
     }
 }
 

+ 16 - 15
admin/src/views/fingerprint/index.vue

@@ -3,7 +3,12 @@
     <el-card class="box-card" style="width: 1612px; height: 950px">
       <!-- 标题区域 -->
       <div slot="header" class="clearfix">
-        <div class="inform-title">指纹管理</div>
+        <el-breadcrumb separator-class="el-icon-arrow-right">
+          <el-breadcrumb-item :to="{ path: '/home' }"
+            >房态管理</el-breadcrumb-item
+          >
+          <el-breadcrumb-item>指纹管理</el-breadcrumb-item>
+        </el-breadcrumb>
       </div>
       <!-- 主体内容区域 -->
       <div class="inform-body">
@@ -599,6 +604,12 @@ export default {
     this.getData();
   },
   methods: {
+    // 返回首页
+    goBack() {
+      this.$router.replace({
+        name: "Home",
+      });
+    },
     // 获取表格数据
     async getData(curPage) {
       if (curPage) {
@@ -826,28 +837,18 @@ export default {
   height: 950px;
   box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
   border-radius: 8px;
+
   .clearfix {
     height: 96px;
     width: 100%;
     border-bottom: 1px solid rgba(204, 204, 204, 1);
     box-sizing: border-box;
     display: flex;
-    justify-content: space-between;
     align-items: center;
-    .inform-title {
-      width: 96px;
-      height: 36px;
-      color: rgba(0, 0, 0, 1);
-      font-size: 24px;
-      font-weight: 500;
+    .el-breadcrumb {
       margin-left: 33px;
-    }
-    .inform-header {
-      display: flex;
-      margin-right: 29px;
-      .el-button {
-        margin-left: 9px;
-        background-color: rgba(41, 109, 227, 1);
+      .el-breadcrumb__item {
+        font-size: 20px;
       }
     }
   }

+ 66 - 7
admin/src/views/home/index.vue

@@ -132,8 +132,10 @@
                       @click="leisure(item)"
                       >清扫</el-button
                     > -->
-                    <el-button size="mini">IC卡</el-button>
-                    <el-button size="mini">指纹</el-button>
+                    <el-button size="mini" @click="ICpage">IC卡</el-button>
+                    <el-button size="mini" @click="fingerprintPage"
+                      >指纹</el-button
+                    >
                   </div>
                   <div
                     @click="EachRoom($event, item)"
@@ -308,7 +310,7 @@
                 @change="handleCheckAllChange"
                 >全选</el-checkbox
               >
-              <span class="all">{{ roomData.length }}间</span>
+              <span class="all">{{ ids }} / {{ roomData.length }}间</span>
             </div>
             <div style="margin: 15px 0"></div>
             <el-checkbox-group
@@ -423,7 +425,7 @@ export default {
           },
         ],
       },
-      date: new Date(),
+      date: "",
 
       // 房态筛选数据
       checkAll: false,
@@ -431,6 +433,7 @@ export default {
       cities: ["空闲", "预定", "入住", "脏房", "锁定"],
       citiesNum: [0, 0, 0, 0, 0],
       isIndeterminate: false,
+      ids: 0, // 勾选的房间数量
     };
   },
   mounted() {
@@ -439,10 +442,14 @@ export default {
     )[0].children[0].innerText = "<";
     document.getElementsByClassName(
       "el-button--plain"
-    )[1].children[0].innerText = "o";
+    )[1].children[0].innerText = "O";
     document.getElementsByClassName(
       "el-button--plain"
     )[2].children[0].innerText = ">";
+    console.log(this.$store);
+    // this.$store.commit("user/SET_TIME", this.date);
+
+    this.date = this.$store.state.user.time;
     this.roomList();
   },
   created() {
@@ -467,6 +474,7 @@ export default {
   watch: {
     date(newVal, oldVal) {
       console.log(newVal);
+      this.$store.commit("user/SET_TIME", this.date);
       this.roomList();
     },
   },
@@ -879,10 +887,32 @@ export default {
         .catch((_) => {});
     },
 
+    // IC卡页面
+    ICpage() {
+      this.$router.push({
+        name: "icCard",
+        params: {
+          id: 12345,
+        },
+      });
+    },
+    // 指纹页面
+    fingerprintPage() {
+      this.$router.push({
+        name: "fingerprint",
+        params: {
+          id: 12345,
+        },
+      });
+    },
     // 房态筛查
     handleCheckAllChange(val) {
       console.log(val);
-
+      if (val) {
+        this.ids = this.roomData.length;
+      } else {
+        this.ids = 0;
+      }
       this.checkedCities = val ? this.cities : [];
       this.isIndeterminate = false;
     },
@@ -892,11 +922,40 @@ export default {
       this.checkAll = checkedCount === this.cities.length;
       this.isIndeterminate =
         checkedCount > 0 && checkedCount < this.cities.length;
+
+      let startDay = dayjs(this.date).format("YYYY-MM-DD");
+      console.log(startDay);
+      let endDay = dayjs(this.date).add(1, "day").format("YYYY-MM-DD");
+      let ids = [];
+      this.Data.forEach((items) => {
+        items.room.filter((item) => {
+          if (
+            value.some((i) => {
+              return item.statuName == i;
+            })
+          ) {
+            ids.push(item.id);
+          }
+        });
+      });
+      this.ids = ids.length;
+      let roomIds = [];
+      ids.forEach((item) => {
+        roomIds.push("roomIds=" + item);
+      });
+      roomIds = roomIds.join("&");
+      let params =
+        "?" + "startDay=" + startDay + "&" + "endDay=" + endDay + "&" + roomIds;
+      // this.API.roomRealTimeStatu.realData(params).then((res) => {
+      //   console.log(res.data);
+      // this.roomList("", "");
+      // });
     },
     reset() {
       this.checkedCities = [];
       this.isIndeterminate = false;
       this.checkAll = false;
+      this.ids = 0;
     },
 
     //门锁管理
@@ -1061,7 +1120,7 @@ export default {
       height: 37px;
       background: rgba(240, 243, 247, 1);
       border-radius: 5px;
-      margin-left: 897px;
+      margin-left: 833px;
 
       /deep/ .el-input__inner {
         height: 37px !important;

+ 16 - 16
admin/src/views/icCard/index.vue

@@ -3,7 +3,12 @@
     <el-card class="box-card" style="width: 1612px; height: 950px">
       <!-- 标题区域 -->
       <div slot="header" class="clearfix">
-        <div class="inform-title">IC卡管理</div>
+        <el-breadcrumb separator-class="el-icon-arrow-right">
+          <el-breadcrumb-item :to="{ path: '/home' }"
+            >房态管理</el-breadcrumb-item
+          >
+          <el-breadcrumb-item>IC卡管理</el-breadcrumb-item>
+        </el-breadcrumb>
       </div>
       <!-- 主体内容区域 -->
       <div class="inform-body">
@@ -436,7 +441,7 @@ import * as XLSX from "xlsx";
 import dayjs from "dayjs";
 import _ from "lodash";
 export default {
-  name: "Inform",
+  name: "icCard",
   data() {
     return {
       // 显示的总数据
@@ -579,6 +584,12 @@ export default {
     this.getData();
   },
   methods: {
+    // 返回首页
+    goBack() {
+      this.$router.replace({
+        name: "Home",
+      });
+    },
     // 获取表格数据
     async getData(curPage) {
       if (curPage) {
@@ -809,22 +820,11 @@ export default {
     border-bottom: 1px solid rgba(204, 204, 204, 1);
     box-sizing: border-box;
     display: flex;
-    justify-content: space-between;
     align-items: center;
-    .inform-title {
-      width: 96px;
-      height: 36px;
-      color: rgba(0, 0, 0, 1);
-      font-size: 24px;
-      font-weight: 500;
+    .el-breadcrumb {
       margin-left: 33px;
-    }
-    .inform-header {
-      display: flex;
-      margin-right: 29px;
-      .el-button {
-        margin-left: 9px;
-        background-color: rgba(41, 109, 227, 1);
+      .el-breadcrumb__item {
+        font-size: 20px;
       }
     }
   }