Browse Source

no message

hzj18279462576@163.com 3 years ago
parent
commit
e854416cf7
2 changed files with 70 additions and 69 deletions
  1. 5 0
      admin/src/api/roomThirdSetting.js
  2. 65 69
      admin/src/views/home/index.vue

+ 5 - 0
admin/src/api/roomThirdSetting.js

@@ -9,4 +9,9 @@ export function settingId(params) {
 //  电控制
 //  电控制
 export function changeElectric(roomId, operType) {
 export function changeElectric(roomId, operType) {
     return http.get(`${resquest}/changeElectric/${roomId}/${operType}`)
     return http.get(`${resquest}/changeElectric/${roomId}/${operType}`)
+}
+
+// 修改房间第三方平台设置
+export function Updata(params) {
+    return http.post(`${resquest}/update`, params)
 }
 }

+ 65 - 69
admin/src/views/home/index.vue

@@ -119,18 +119,13 @@
     <div class="home-body">
     <div class="home-body">
       <div class="room-floor wrapper">
       <div class="room-floor wrapper">
         <div class="scrollBlock" ref="scrollBlock">
         <div class="scrollBlock" ref="scrollBlock">
-          <div class="floor" v-for="(items, i) in floorRoomDatas" :key="i">
+          <div class="floor" v-for="(items, i) in Data" :key="i">
             <div class="header-title">
             <div class="header-title">
               <div class="tier">{{ parseInt(items.floor) }}层</div>
               <div class="tier">{{ parseInt(items.floor) }}层</div>
               <span>/&nbsp; 共{{ items.room.length }}间</span>
               <span>/&nbsp; 共{{ items.room.length }}间</span>
             </div>
             </div>
             <div class="main-floor">
             <div class="main-floor">
-              <div
-                class="room-num"
-                v-for="item in roomData"
-                :key="item.id"
-                v-show="items.floor == item.floor"
-              >
+              <div class="room-num" v-for="item in items.room" :key="item.id">
                 <el-popover
                 <el-popover
                   placement="right"
                   placement="right"
                   trigger="click"
                   trigger="click"
@@ -152,7 +147,12 @@
                     <el-button size="mini" @click="closeEle(item)"
                     <el-button size="mini" @click="closeEle(item)"
                       >关电</el-button
                       >关电</el-button
                     >
                     >
-                    <el-button size="mini">清扫</el-button>
+                    <el-button
+                      size="mini"
+                      :disabled="item.statuName != '脏房'"
+                      @click="leisure(item)"
+                      >清扫</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>
@@ -176,7 +176,7 @@
                         <span>电:{{ item.useInfo.startOfElectric }}度</span>
                         <span>电:{{ item.useInfo.startOfElectric }}度</span>
                       </div>
                       </div>
                       <div class="count-down">
                       <div class="count-down">
-                        <span>退房倒计时 {{ item.useInfo.EndTime }}</span>
+                        <span>退房倒计时 {{ item.EndTime }}</span>
                         <div class="tuifang" @click.stop="roomLock(item)">
                         <div class="tuifang" @click.stop="roomLock(item)">
                           <IconSvg :W="21" :H="21" name="tuifang" />
                           <IconSvg :W="21" :H="21" name="tuifang" />
                           <el-dialog
                           <el-dialog
@@ -388,7 +388,6 @@ export default {
       roomPassWord: [], // 密码列表
       roomPassWord: [], // 密码列表
       // 批量数据
       // 批量数据
       dialogVisible: false,
       dialogVisible: false,
-      enableEndTime: "", // 倒计时的日期
       Endtime: [],
       Endtime: [],
       count: [], // 选中的全部数据
       count: [], // 选中的全部数据
       title: "",
       title: "",
@@ -408,12 +407,9 @@ export default {
         },
         },
       ],
       ],
       floorRoomDatas: [],
       floorRoomDatas: [],
+      Data: [],
       roomData: [],
       roomData: [],
-      roomDatas: [],
-      augument: {
-        curPage: 1,
-        pageSize: 20,
-      }, // 当前数据为第一页
+      DataClone: [],
       defaultProps: {
       defaultProps: {
         children: "children",
         children: "children",
         label: "label",
         label: "label",
@@ -472,8 +468,6 @@ export default {
       "el-button--plain"
       "el-button--plain"
     )[2].children[0].innerText = ">";
     )[2].children[0].innerText = ">";
     this.roomList();
     this.roomList();
-
-    alert(parseInt(3, 8));
   },
   },
   created() {
   created() {
     // let arr = {
     // let arr = {
@@ -524,11 +518,8 @@ export default {
     //   }
     //   }
     // },
     // },
 
 
-    roomList(augument) {
-      if (!augument) {
-        augument = this.augument;
-      }
-      this.API.room.roomPageGroup(augument).then((res) => {
+    roomList(Datas) {
+      this.API.room.roomPageGroup({ pageSize: 100 }).then((res) => {
         this.floorRoomDatas = [];
         this.floorRoomDatas = [];
         console.log(res);
         console.log(res);
         console.log(res.data.list);
         console.log(res.data.list);
@@ -553,8 +544,9 @@ export default {
             narr[n].room.push(...arrays[i].room);
             narr[n].room.push(...arrays[i].room);
           }
           }
         }
         }
-        console.log(res, narr);
-        this.floorRoomDatas = narr;
+        console.log(narr);
+        // 筛选时传进来的数据代替接口数据(Datas)
+        this.floorRoomDatas = Datas ? Datas : narr;
         console.log(this.floorRoomDatas);
         console.log(this.floorRoomDatas);
         this.floorRoomDatas.forEach((item) => {
         this.floorRoomDatas.forEach((item) => {
           item.room.forEach((items) => {
           item.room.forEach((items) => {
@@ -592,30 +584,50 @@ export default {
         this.API.roomRealTimeStatu.realData(params).then((res) => {
         this.API.roomRealTimeStatu.realData(params).then((res) => {
           console.log(res);
           console.log(res);
           this.roomData = res.data;
           this.roomData = res.data;
-          this.roomData.forEach((resItem) => {
-            if (resItem.statu == 1) {
-              resItem.statuName = "空闲";
-              this.citiesNum[resItem.statu - 1] += 1;
-            } else if (resItem.statu == 2) {
-              resItem.statuName = "预定";
-              this.citiesNum[resItem.statu - 1] += 1;
-            } else if (resItem.statu == 3) {
-              resItem.statuName = "入住";
-              this.citiesNum[resItem.statu - 1] += 1;
-            } else if (resItem.statu == 4) {
-              resItem.statuName = "脏房";
-              this.citiesNum[resItem.statu - 1] += 1;
-            } else if (resItem.statu == 5) {
-              resItem.statuName = "锁定";
-              this.citiesNum[resItem.statu - 1] += 1;
-            }
+          this.Data = _.cloneDeep(this.floorRoomDatas);
+          this.Data.forEach((items) => {
+            // console.log(items);
+            items.room.forEach((item) => {
+              // console.log(item);
+              this.roomData.forEach((i) => {
+                if (item.id == i.roomId) {
+                  item = Object.assign(item, i);
+                  i = Object.assign(i, item);
+                }
+              });
+            });
+          });
+          this.Data.forEach((items) => {
+            items.room.forEach((resItem) => {
+              if (resItem.useInfo) {
+                this.showTime(resItem, resItem.useInfo.enableEndTime);
+              }
+              this.cities.forEach((i, ind) => {
+                if (resItem.statu == ind + 1) {
+                  resItem.statuName = i;
+                  this.citiesNum[resItem.statu - 1] += 1;
+                }
+              });
+              // if (resItem.statu == 1) {
+              //   resItem.statuName = "空闲";
+              // } else if (resItem.statu == 2) {
+              //   resItem.statuName = "预定";
+              // } else if (resItem.statu == 3) {
+              //   resItem.statuName = "入住";
+              // } else if (resItem.statu == 4) {
+              //   resItem.statuName = "脏房";
+              // } else if (resItem.statu == 5) {
+              //   resItem.statuName = "锁定";
+              // }
+            });
           });
           });
+
           this.data[0].children = [];
           this.data[0].children = [];
-          this.floorRoomDatas.forEach((items) => {
+
+          this.Data.forEach((items) => {
             items.room.forEach((item) => {
             items.room.forEach((item) => {
               this.roomData.forEach((i, index) => {
               this.roomData.forEach((i, index) => {
                 if (item.id == i.roomId) {
                 if (item.id == i.roomId) {
-                  i = Object.assign(i, item);
                   // console.log(i);
                   // console.log(i);
                   let arr = {
                   let arr = {
                     id: i.roomId,
                     id: i.roomId,
@@ -624,24 +636,18 @@ export default {
                   if (i.statu != 5) {
                   if (i.statu != 5) {
                     this.data[0].children.push(arr);
                     this.data[0].children.push(arr);
                   }
                   }
-                  if (i.useInfo) {
-                    this.enableEndTime = i.useInfo.enableEndTime;
-                    this.showTime(index, i.useInfo.enableEndTime);
-                    // console.log(i.useInfo.enableEndTime);
-                  }
                 }
                 }
               });
               });
             });
             });
           });
           });
-          // this.showTime(this.enableEndTime);
-          console.log(this.roomData);
-          this.roomDatas = this.roomData;
+          console.log(this.Data);
+          this.DataClone = _.cloneDeep(this.Data);
           this.cardShow = true;
           this.cardShow = true;
         });
         });
       });
       });
     },
     },
     // 退房倒计时
     // 退房倒计时
-    showTime(index, endtime) {
+    showTime(item, endtime) {
       setInterval(() => {
       setInterval(() => {
         //设置2020年春节时间
         //设置2020年春节时间
         var newyear = new Date(endtime);
         var newyear = new Date(endtime);
@@ -670,13 +676,10 @@ export default {
           s = "0" + s;
           s = "0" + s;
         }
         }
         if (ms < 0) {
         if (ms < 0) {
-          this.$set(this.roomData[index].useInfo, "EndTime", "00:00:00:00");
+          this.$set(item, "EndTime", "00:00:00:00");
         } else {
         } else {
           let enableEndTime = day + ":" + h + ":" + m + ":" + s;
           let enableEndTime = day + ":" + h + ":" + m + ":" + s;
-          // this.roomData[index].useInfo.EndTime = enableEndTime;
-          if (this.roomData[index].useInfo) {
-            this.$set(this.roomData[index].useInfo, "EndTime", enableEndTime);
-          }
+          this.$set(item, "EndTime", enableEndTime);
         }
         }
       }, 0);
       }, 0);
     },
     },
@@ -755,7 +758,7 @@ 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.roomList(this.Data);
                 this.room = false;
                 this.room = false;
                 this.count = [];
                 this.count = [];
                 this.$refs.roomTree.setCheckedNodes([]);
                 this.$refs.roomTree.setCheckedNodes([]);
@@ -772,7 +775,7 @@ export default {
         .clean(item.statuId)
         .clean(item.statuId)
         .then((res) => console.log(res));
         .then((res) => console.log(res));
       console.log(item);
       console.log(item);
-      this.roomList();
+      this.roomList(this.Data);
     },
     },
 
 
     // 锁定房间
     // 锁定房间
@@ -788,7 +791,7 @@ 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.roomList(this.Data);
         });
         });
     },
     },
     // 转脏房
     // 转脏房
@@ -803,7 +806,7 @@ export default {
         .toDirty({ roomId, startDay, endDay })
         .toDirty({ roomId, startDay, endDay })
         .then((res) => {
         .then((res) => {
           console.log(res);
           console.log(res);
-          this.roomList();
+          this.roomList(this.Data);
         });
         });
     },
     },
     // 关电
     // 关电
@@ -818,7 +821,7 @@ export default {
             message: "关电成功",
             message: "关电成功",
             type: "success",
             type: "success",
           });
           });
-          this.roomList();
+          this.roomList(this.Data);
         }
         }
       });
       });
     },
     },
@@ -832,13 +835,6 @@ export default {
     },
     },
     handleCheckedCitiesChange(value) {
     handleCheckedCitiesChange(value) {
       console.log(value);
       console.log(value);
-      let arr = this.roomDatas.filter((item) => {
-        for (let i in value) {
-          console.log(i);
-          return item.statuName == value[i];
-        }
-      });
-      console.log(arr);
       let checkedCount = value.length;
       let checkedCount = value.length;
       this.checkAll = checkedCount === this.cities.length;
       this.checkAll = checkedCount === this.cities.length;
       this.isIndeterminate =
       this.isIndeterminate =