<template>
  <div class="meetingRooms">
    <div class="meetingRooms-query">
      <Query :show="['floor']" :query-data.sync="queryData" :reset="reset" :search="search">
        <template #extraItem>
          <a-form-model-item label="会议室状态：" class="formItem">
            <a-select default-value="0" style="width: 120px" v-model="queryData.size">
              <a-select-option value="0"> 全部 </a-select-option>
              <a-select-option v-for="item in roomStatusData" :key="item.value" :value="item.value">
                {{ item.label }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
          <a-form-model-item label="会议室人数：" class="formItem">
            <a-select default-value="0" style="width: 120px" v-model="queryData.size">
              <a-select-option value="0"> 全部 </a-select-option>
              <a-select-option v-for="item in roomSizeData" :key="item.value" :value="item.value">
                {{ item.label }}
              </a-select-option>
            </a-select>
          </a-form-model-item>
          <a-form-model-item label="日期：" class="formItem">
            <a-date-picker :default-value="formDateDefaultValue" @change="handleDatePickerChange" format="YYYY/MM/DD" />
          </a-form-model-item>
        </template>
      </Query>
    </div>

    <div class="meetingRooms-content">
      <div v-for="(floor, index) in roomData" :key="floor.floor" :index="index">
        <div class="meetingRooms-floor">
          <div class="meetingRooms-floor-title">
            <a-divider orientation="left" :dashed="true"> {{ floor.floor }} </a-divider>
          </div>
          <a-row :gutter="12">
            <a-col :lg="{ span: 6 }" :sm="{ span: 6 }" :xxl="{ span: 4 }" v-for="room in floor.rooms" :key="room.id">
              <MeetingRoomItem :obj="room" />
            </a-col>
          </a-row>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import MeetingRoomItem from "@/components/scene/meeting/config/meetingRoomItem.vue";
import Query from "@/components/common/query.vue";
import apiSceneMeeting from "@/api/scene/meeting/apiSceneMeeting";

export default {
  components: {
    MeetingRoomItem,
    Query
  },
  data() {
    let timeRange = this.$util.dateUtil.getNearlyMonthRange();
    let now = this.$moment();
    let nowFormat = now.format("YYYY/MM/DD");
    return {
      formDateDefaultValue: now,
      queryData: {
        floorId: "0",
        size: "0",
        date: nowFormat,
        timeRange: timeRange
      },
      roomSizeData: [
        {
          label: "3人",
          value: "3"
        },
        {
          label: "5人",
          value: "5"
        }
      ],
      roomStatusData: [
        {
          label: "会议中",
          value: "1"
        },
        {
          label: "闲置中",
          value: "2"
        },
        {
          label: "已预订",
          value: "3"
        }
      ],
      roomData: [
        {
          floor: "3F",
          rooms: [
            {
              id: 1,
              name: "301会议室",
              timeRange: ["9:00", "10:00"],
              status: "1",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            },
            {
              id: 2,
              name: "301会议室",
              timeRange: ["9:00", "10:00"],
              status: "1",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            },
            {
              id: 3,
              name: "301会议室",
              timeRange: ["9:00", "10:00"],
              status: "2",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            },
            {
              id: 4,
              name: "301会议室",
              timeRange: ["9:00", "10:00"],
              status: "3",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            }
          ]
        },
        {
          floor: "4F",
          rooms: [
            {
              id: 401,
              name: "401会议室",
              timeRange: ["9:00", "10:00"],
              status: "1",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            },
            {
              id: 402,
              name: "402会议室",
              timeRange: ["9:00", "10:00"],
              status: "1",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            }
          ]
        },
        {
          floor: "5F",
          rooms: [
            {
              id: 501,
              name: "501会议室",
              timeRange: ["9:00", "10:00"],
              status: "1",
              time: 8,
              devices: [
                { icon: "audio" },
                { icon: "camera" },
                { icon: "api" },
                { icon: "control" },
                { icon: "notification" },
                { icon: "unlock" },
                { icon: "safety-certificate" }
              ]
            }
          ]
        }
      ]
    };
  },
  props: {},
  mounted() {
    this.getMeetingRooms();
  },
  methods: {
    reset() {},
    search() {},
    handleDatePickerChange(val) {
      this.queryData.date = val.format("YYYY/MM/DD");
    },
    getMeetingRooms() {
      //apiSceneMeeting.getMeetingRoomList(this.queryData).then(res=>{
      //  console.log(res)
      //})
    }
  }
};
</script>

<style lang="less" scoped>
.meetingRooms {
  width: 100%;
  height: 100%;
  .meetingRooms-floor {
    width: 99%;
    height: auto;
    margin: 8px;
    .meetingRooms-floor-title {
    }
    .meetingRooms-floor-item {
      width: 100%;
      height: 150px;
      border: 1px solid red;
      padding: 2% 5%;
      border-left: 2px solid red;
    }
  }
}
.formItem {
  margin: 0px 15px;
}
</style>
