<template>
    <div class="deliveryRoom">
        <section class="section">
            <ul class="ul">

                <li @click="toDetail" class="li" v-for="(item, index) in list" :key="index">
                    <h5>产房00{{ index+1 }}</h5>
                    <img class="img" :src="typeImgUrl[item.type - 1]" />
                    <div class="info" v-if="item.type != 1">
                        <p class="p">
                            <span class="title">母猪耳标：</span>
                            <span class="content">16545</span>
                        </p>
                        <p class="p">
                            <span class="title">入床时间：</span>
                            <span class="content">2020-04-15</span>
                        </p>
                        <p class="p">
                            <span class="title">预计产仔：</span>
                            <span class="content">2020-04-15</span>
                        </p>
                    </div>
                    <p v-else class="info fontC">空床时间{{ 4 }}天</p>
                </li>

            </ul>
            <el-row type="flex" justify="center">
                <el-col :span="8" class="pagination">
                    <el-pagination
                        @current-change="pageChange"
                        background
                        layout="prev, pager, next"
                        :page-count="5"
                    ></el-pagination>
                </el-col>
            </el-row>
        </section>
    </div>
</template>


<script>
import typeImgUrl_1 from "@/assets/deliveryRoom_1.jpg";
import typeImgUrl_2 from "@/assets/deliveryRoom_2.jpg";
import typeImgUrl_3 from "@/assets/deliveryRoom_3.jpg";
import typeImgUrl_4 from "@/assets/deliveryRoom_4.jpg";

// import { reqDeliveryRoomList } from "@/api/deliveryRoomManagement.js"

// 每页数据条数
const pageSize = 10;

let list = [
    {
        type: 1
    },
    {
        type: 2
    },
    {
        type: 3
    },
    {
        type: 4
    },
    {
        type: 1
    },
    {
        type: 3
    },
    {
        type: 3
    },
    {
        type: 4
    },
    {
        type: 2
    },
    {
        type: 1
    }
];

export default {
    name: "deliveryRoom",
    data() {
        return {
            list,
            typeImgUrl: [
                typeImgUrl_1,
                typeImgUrl_2,
                typeImgUrl_3,
                typeImgUrl_4
            ],
            pageSize,
            page: 1
        };
    },
    created() {
    },
    methods: {
        
        toDetail() {
            this.$router.push({path: "Detail"})
        },
        pageChange(p) {
            console.log(p);
            this.page = p;
            // this.getDeviceList();
        }
    }
};
</script>

<style lang="scss" scoped>
.deliveryRoom {
    .section {
        .ul {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            
            .li {
                display: flex;
                flex-direction: column;
                width: 310px;
                height: 600px;
                margin: 10px;
                h5 {
                    text-align: center;
                    font-size: 30px;
                    color: #424242;
                    background-color: #D2E4F0;
                }
                .img {
                    width: 100%;
                }
                .info {
                    flex: 1;
                    display: flex;
                    padding-left: 20px;
                    flex-direction: column;
                    justify-content: space-around;
                    .p {
                        .title {
                            font-weight: 600;
                            color: rgb(136, 127, 127);
                        }
                        .content {
                            color: #777;
                        }
                    }
                }
                .fontC {
                    align-items: center;
                    padding-left: 0px;
                    color: rgb(80, 183, 231);
                    font-size: 20px;
                    font-weight: 600;
                }
            }
        }
    }
}

// border: 1px solid #00f;

.pagination {
    margin-top: 5px;
}
</style>