<template>
    <div class="GroupRecord">
        <header id="header">
            <el-row type="flex">
                <el-col :span="4">
                    <el-select v-model="value" placeholder="请选择">
                        <el-option label="1区" value="11"></el-option>
                        <el-option label="2区" value="22"></el-option>
                    </el-select>
                </el-col>
                <el-col :span="4">
                    <el-select v-model="value" placeholder="请选择">
                        <el-option label="1舍" value="13"></el-option>
                        <el-option label="2舍" value="24"></el-option>
                    </el-select>
                </el-col>
                <el-col :span="4">
                    <el-select v-model="value" placeholder="请选择">
                        <el-option label="可用" value="15"></el-option>
                        <el-option label="可用" value="26"></el-option>
                    </el-select>
                </el-col>
                <el-col :span="4">
                    <el-button type="primary">查找</el-button>
                </el-col>
            </el-row>
        </header>
        <section>
            <article class="table">
                <el-table :data="tableData" border style="width: 100%">
                    <el-table-column prop="date" sortable label="日期" width="180"></el-table-column>
                    <el-table-column  sortable label="猪编号" width="180"></el-table-column>
                    <el-table-column prop="name" label="状态" width="180"></el-table-column>
                    <el-table-column prop="address" label="耳标号"></el-table-column>
                    <el-table-column label="操作" width="150">
                        <template slot-scope="scope">
                            <el-button @click="look(scope.row)" type="text" size="small">查看</el-button>
                            <el-button @click="edit(scope.row)" type="text" size="small">编辑</el-button>
                            <el-popconfirm title="是否删除此设备的信息？" @onConfirm="del(scope.row)">
                                <el-button slot="reference" type="text" size="small">删除</el-button>
                            </el-popconfirm>
                        </template>
                    </el-table-column>
                </el-table>
                <el-row type="flex" justify="end">
                    <el-col :span="8" class="pagination">
                        <el-pagination
                            @current-change="pageChange"
                            background
                            layout="prev, pager, next"
                            :page-count="10"
                        ></el-pagination>
                    </el-col>
                </el-row>
            </article>
        </section>
    </div>
</template>

<script>
export default {
    data() {
        return {
            value: "",
            tableData: [
                {
                    date: "2016-05-02",
                    name: "可用",
                    address: "6895564457554"
                },
                {
                    date: "2016-05-04",
                    name: "不可用",
                    address: "6895564456725"
                },
                {
                    date: "2016-05-01",
                    name: "不可用",
                    address: "6895564415514"
                },
                {
                    date: "2016-05-03",
                    name: "可用",
                    address: "6895564457594"
                }
            ]
        };
    },
    created() {},
    methods: {
        look(row) {
            this.$router.push({
                path: 'UnityTrace'
            })
        },
        edit(row) {},
        del(row) {},
        pageChange(p) {
            console.log(p)
        }
    }
};
</script>

<style lang="scss" scoped>
#header {
    margin-bottom: 15px;
}
.table {
    .pagination {
        margin-top: 20px;
    }
}
</style>