<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
    okText="确认入住"
    cancelText="关闭"
  >
    <bill-room-form ref="realForm" @ok="submitCallback"></bill-room-form>
  </j-modal>
</template>

<script>
import BillRoomForm from "./BillRoomForm.vue";
export default {
  name: "BillRoomFormModal",
  components: {
    BillRoomForm,
  },
  data() {
    return {
      title: "",
      width: 1300,
      visible: false,
      disableSubmit: false,
    };
  },
  methods: {
    add(record) {
      this.visible = true;
      this.$nextTick(() => {
        this.$refs.realForm.add2(record);
      });
    },
    addList(record,key,orderInfo) {
      this.visible = true;
      this.$nextTick(() => {
        this.$refs.realForm.addList(record,key,orderInfo);
      });
    },
    edit(record) {
      this.visible = true;
      this.$nextTick(() => {
        this.$refs.realForm.edit(record);
      });
    },
    close() {
      this.$emit("close");
      this.visible = false;
    },
    handleOk() {
      this.$refs.realForm.submitForm();
    },
    submitCallback(e) {
      console.log(e);
      this.$emit("ok",e);
      this.visible = false;
    },
    handleCancel() {
      this.$emit("close")
      this.close();
    },
  },
};
</script>

<style scoped>
/deep/.ant-modal-body {
  padding: 12px;
  max-height: calc(80vh - 150px);
  overflow-y: auto;
  &::-webkit-scrollbar {
    width: 6px;
    /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
  }

  &::-webkit-scrollbar-thumb {
    background: #e3e3e6;
    border-radius: 6px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 5px;
  }
}
</style>
