Browse Source

联防按钮开启功能

gqx 2 years ago
parent
commit
6121309225
1 changed files with 38 additions and 3 deletions
  1. 38 3
      src/views/room/fangtailive.vue

+ 38 - 3
src/views/room/fangtailive.vue

@@ -76,9 +76,9 @@
               >锁房</a-button
             >
             <a-button
-              disabled
+              :disabled="joinDisabled"
               style="margin-bottom: 10px"
-              @click="handleAdd"
+              @click="addUnion"
               type="danger"
               >联房</a-button
             ><a-button
@@ -801,7 +801,6 @@ import continuedModalVue from "./modules/fangtaiModal/continuedModal/continuedMo
 import SelectCheckInRoomOrderModal from "./modules/checkIn/SelectCheckInRoomOrderModal.vue";
 import CustomerModal from "./modules/checkIn/CustomerModal.vue";
 import exchangeHousesModalVue from "./modules/fangtaiModal/exchangeHouses/exchangeHousesModal.vue";
-
 import { TreeSelect } from "ant-design-vue";
 import moment from "moment";
 const SHOW_PARENT = TreeSelect.SHOW_PARENT;
@@ -915,6 +914,18 @@ export default {
     },
   },
   computed: {
+    joinDisabled() {
+      return !this.roomList.some((t) => {
+        return (
+          t.rooms.filter((c) => c.roomInfo.state === 88).length == 1 &&
+          t.rooms.filter(
+            (c) =>
+              c.roomInfo.state === 88 &&
+              (c.roomInfo.roomStatus === 3 || c.roomInfo.roomStatus === 4)
+          ).length == 1
+        );
+      });
+    },
     lockDisabled() {
       return !this.roomList.some((t) =>
         t.rooms.some(
@@ -1022,6 +1033,30 @@ export default {
     // this.$refs.ModalEditScheduleRoom.disableSubmit = false;
   },
   methods: {
+    addUnion() {
+      var selectRoom = [];
+      this.roomList.forEach((t) => {
+        t.rooms.forEach((c) => {
+          if (c.roomInfo.state === 88) {
+            selectRoom.push({
+              roomId: c.roomInfo.id,
+              livingOrderId: c.livingData.livingOrder.id,
+            });
+          }
+        });
+      });
+      if (selectRoom.length === 0) {
+        this.$message.warning("请先选择房间");
+        return;
+      }
+      this.$refs.modalSelectCheckInRoomOrder.add();
+      this.$refs.modalSelectCheckInRoomOrder.title = "请选择需要关联的订单";
+      this.$refs.modalSelectCheckInRoomOrder.disableSubmit = false;
+      this.$refs.modalSelectCheckInRoomOrder.livingOrderId =
+        selectRoom[0].livingOrderId;
+      this.$refs.modalSelectCheckInRoomOrder.livingRoomId =
+        selectRoom[0].roomId;
+    },
     moment,
     posOrderClick() {
       this.$refs.posOrderModal.visible = true;