<!-- 设备清单的有select的表格 -->
<template>
    <div class='look-page'>
        <div class='eq-list-top'>
            <a-input-search placeholder style='width: 192px;margin-bottom:12px;height:32px;' @search='onSearch' />
        </div>
        <el-table :data='tableData' style='width: 100%'>
            <el-table-column type='index' label='序号' width='80'></el-table-column>
            <el-table-column prop='lb' label='分类' width='160'></el-table-column>
            <el-table-column prop='sl' label='文件名称'></el-table-column>
            <el-table-column prop='unit' label='文件类型'></el-table-column>
            <el-table-column prop='brand' label='文件大小(M)'></el-table-column>

            <el-table-column prop='brand' label='操作'>
                <template slot-scope='{row}'>
                    <el-button type='text' size='mini' @click='handleDown(row)'>
                        <i class='el-icon-download'></i>下载
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class='foot'>
            <el-pagination
                background
                layout='prev, pager, next'
                :total='total/pageSize'
                :page-size='size'
                @prev-click='pageChanged'
                @next-click='pageChanged'
                @current-change='pageChanged'
            ></el-pagination>
        </div>
    </div>
</template>
<script>
import { queryEquipmentList } from '@/api/equipmentList.js'
export default {
    data() {
        return {
            pageSize: 10,
            tableData: [{ index: 1 }],
            total: 0,
            currentPage: 1,
            size: 10
        }
    },
    props: ['major'],
    methods: {
        onSearch() {},
        pageChanged(page, size) {
            this.currentPage = page
            this.size = size
            this.getList()
        },
        getList() {
            let postParams = {}
            let data = {
                page: this.currentPage,
                size: this.size,
                plazaId: this.$store.state.plazaId,
                major: this.major
            }
            queryEquipmentList({ data, postParams }).then(res => {
                console.log(res)
                this.tableData = res.data.data
                this.total = res.data.count
            })
        },
        handleDown() {}
    },
    mounted() {
        // this.getList()
    }
}
</script>
<style lang="less" scoped>
.look-page {
    .eq-list-top {
        display: flex;
    }
    .foot {
        position: absolute;
        height: 32px;
        right: 26px;
        bottom: 20px;
    }
    td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
</style>