Browse Source

实现房态管理日期查询功能

hzj18279462576@163.com 3 years ago
parent
commit
b0a71c3e16
2 changed files with 41 additions and 19 deletions
  1. 40 18
      admin/src/views/home/index.vue
  2. 1 1
      admin/src/views/inform/index.vue

+ 40 - 18
admin/src/views/home/index.vue

@@ -106,7 +106,10 @@
                       :disabled="item.statu != 1"
                       :disabled="item.statu != 1"
                       >关房</el-button
                       >关房</el-button
                     >
                     >
-                    <el-button size="mini" @click="todirty(item)"
+                    <el-button
+                      size="mini"
+                      @click="todirty(item)"
+                      :disabled="item.statu == 4 || item.statu == 5"
                       >转脏房</el-button
                       >转脏房</el-button
                     >
                     >
                     <el-button
                     <el-button
@@ -115,15 +118,15 @@
                       @click="leisure(item)"
                       @click="leisure(item)"
                       >转空闲</el-button
                       >转空闲</el-button
                     >
                     >
-                    <el-button size="mini" @click="closeEle(item)"
-                      >关电</el-button
-                    >
-                    <el-button
+                    <el-button size="mini" @click="closeEle(item)">{{
+                      switchOff
+                    }}</el-button>
+                    <!-- <el-button
                       size="mini"
                       size="mini"
                       :disabled="item.statuName != '脏房'"
                       :disabled="item.statuName != '脏房'"
                       @click="leisure(item)"
                       @click="leisure(item)"
                       >清扫</el-button
                       >清扫</el-button
-                    >
+                    > -->
                     <el-button size="mini">IC卡</el-button>
                     <el-button size="mini">IC卡</el-button>
                     <el-button size="mini">指纹</el-button>
                     <el-button size="mini">指纹</el-button>
                   </div>
                   </div>
@@ -332,6 +335,7 @@ export default {
       cardShow: false,
       cardShow: false,
       clickId: "",
       clickId: "",
       inquireValue: "", // 房间号
       inquireValue: "", // 房间号
+      switchOff: "关电",
       // 门锁管理
       // 门锁管理
       doorLock: false,
       doorLock: false,
       doorLockList: {
       doorLockList: {
@@ -449,6 +453,12 @@ export default {
     window.removeEventListener("scroll", this.lazyLoading);
     window.removeEventListener("scroll", this.lazyLoading);
     //页面离开后销毁,防止切换路由后上一个页面监听scroll滚动事件会在新页面报错问题
     //页面离开后销毁,防止切换路由后上一个页面监听scroll滚动事件会在新页面报错问题
   },
   },
+  watch: {
+    date(newVal, oldVal) {
+      console.log(newVal);
+      this.roomList();
+    },
+  },
   methods: {
   methods: {
     // 数据滚动加载
     // 数据滚动加载
     // lazyLoading() {
     // lazyLoading() {
@@ -531,8 +541,9 @@ export default {
           roomIds.push("roomIds=" + item);
           roomIds.push("roomIds=" + item);
         });
         });
         roomIds = roomIds.join("&");
         roomIds = roomIds.join("&");
-        let startDay = dayjs(new Date()).format("YYYY-MM-DD");
-        let endDay = dayjs(new Date()).add(1, "day").format("YYYY-MM-DD");
+        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 params =
         let params =
           "?" +
           "?" +
           "startDay=" +
           "startDay=" +
@@ -582,7 +593,7 @@ export default {
                   // console.log(i);
                   // console.log(i);
                   let arr = {
                   let arr = {
                     id: i.roomId,
                     id: i.roomId,
-                    label: i.build + "栋" + i.roomno,
+                    label: i.build + "栋" + i.roomNo,
                   };
                   };
                   if (i.statu == 1) {
                   if (i.statu == 1) {
                     this.data[0].children.push(arr);
                     this.data[0].children.push(arr);
@@ -733,10 +744,18 @@ export default {
               .lock({ roomId, startDate, endDate, remark })
               .lock({ roomId, startDate, endDate, remark })
               .then((res) => {
               .then((res) => {
                 console.log(res);
                 console.log(res);
-                this.roomList(this.Data);
-                this.room = false;
-                this.count = [];
-                this.$refs.roomTree.setCheckedNodes([]);
+                if (res.success) {
+                  this.$message({
+                    message: "关房成功",
+                    type: "success",
+                  });
+                  this.roomList(this.Data);
+                  this.room = false;
+                  this.count = [];
+                  this.$refs.roomTree.setCheckedNodes([]);
+                } else {
+                  this.$message.error(res.message);
+                }
               });
               });
           })
           })
           .catch((_) => {});
           .catch((_) => {});
@@ -792,8 +811,8 @@ export default {
     todirty(item) {
     todirty(item) {
       console.log(item);
       console.log(item);
       let roomId = item.roomId;
       let roomId = item.roomId;
-      let startDay = dayjs(new Date()).format("YYYY-MM-DD");
-      let endDay = dayjs(new Date()).add(1, "day").format("YYYY-MM-DD");
+      let startDay = dayjs(this.date).format("YYYY-MM-DD");
+      let endDay = dayjs(this.date).add(1, "day").format("YYYY-MM-DD");
       // let startDate = "2022-08-23";
       // let startDate = "2022-08-23";
       // let endDate = "2022-08-24";
       // let endDate = "2022-08-24";
       this.API.roomRealTimeStatu
       this.API.roomRealTimeStatu
@@ -816,7 +835,7 @@ export default {
       console.log(item);
       console.log(item);
       let operType = "2";
       let operType = "2";
       let roomId = item.roomId;
       let roomId = item.roomId;
-      this.$confirm(`确认关电吗?`)
+      this.$confirm(`确认${this.switchOff}吗?`)
         .then((_) => {
         .then((_) => {
           this.API.roomThirdSetting
           this.API.roomThirdSetting
             .changeElectric(roomId, operType)
             .changeElectric(roomId, operType)
@@ -827,7 +846,8 @@ export default {
                   message: "关电成功",
                   message: "关电成功",
                   type: "success",
                   type: "success",
                 });
                 });
-                this.roomList(this.Data);
+                this.switchOff = "开电";
+                // this.roomList(this.Data);
               } else {
               } else {
                 this.$message.error(res.message);
                 this.$message.error(res.message);
               }
               }
@@ -1595,8 +1615,9 @@ export default {
 .el-popover.popperOptions {
 .el-popover.popperOptions {
   min-width: 0;
   min-width: 0;
   padding: 0;
   padding: 0;
-  height: 167px;
+  height: 145px;
   width: 70px;
   width: 70px;
+  // background-color: #f0f3f7;
 
 
   .control-room {
   .control-room {
     width: 70px;
     width: 70px;
@@ -1621,6 +1642,7 @@ export default {
       color: rgba(0, 0, 0, 1);
       color: rgba(0, 0, 0, 1);
       border: none;
       border: none;
       border-radius: 0;
       border-radius: 0;
+      // background-color: #f0f3f7;
     }
     }
   }
   }
   .popper__arrow {
   .popper__arrow {

+ 1 - 1
admin/src/views/inform/index.vue

@@ -174,7 +174,7 @@ export default {
     // 查询
     // 查询
     inquire() {
     inquire() {
       console.log(111);
       console.log(111);
-      this.Data = this.Data.filter((item, index) => {
+      this.Data = this.tableData.filter((item, index) => {
         return item.createTime.includes(this.inquireValue);
         return item.createTime.includes(this.inquireValue);
       });
       });
       this.handleCurrentChange(1);
       this.handleCurrentChange(1);