<!-- 查看图纸-->
<template>
    <div class='look-page'>
        <div class='eq-list-top'>
            <el-input
                placeholder='搜索文件名'
                size='small'
                @keyup.enter.native='getList'
                @blur="getList"
                clearable
                prefix-icon='el-icon-search'
                v-model='keyword'
                style='width:192px;margin-right:12px'
            ></el-input>
            <Select @change='getList' v-model='floor' width='180' tipPlace='top' caption='楼层 ：' :selectdata='floorSelect'></Select>
            <!-- <Select @change='getList' v-model='fileType' width='180' tipPlace='top' caption='文件类型：' :selectdata='files'></Select> -->
        </div>
        <el-table :data='tableData' style='width: 100%' :border='true'>
            <el-table-column type='index' label='序号' width='60' :index='indexMethod'></el-table-column>
            <el-table-column prop='lb' label='分类' width='300' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
            </el-table-column>
            <el-table-column prop='sl' label='文件名称' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
            </el-table-column>
            <el-table-column prop='assetnum' label='文件类型' width='70' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
            </el-table-column>
            <el-table-column prop='assetnum' label='上传文件名'>
                <template slot-scope='{row}'>{{row.assetnum || '--'}}</template>
            </el-table-column>
            <el-table-column label='操作' width='70'>
                <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'
                :page-size='size'
                @prev-click='pageChanged'
                @next-click='pageChanged'
                @current-change='pageChanged'
            ></el-pagination>
        </div>
    </div>
</template>
<script>
import { queryEquipmentList } from '@/api/equipmentList.js'
import { mapGetters } from 'vuex'
export default {
    data() {
        return {
            tableData: [{ index: 1 }],
            total: 0,
            currentPage: 1,
            size: 11,
            keyword: '',
            floor: '',
            fileType: '',
            files: []
        }
    },
    props: ['major'],
    computed: {
        ...mapGetters(['floorSelect'])
    },
    methods: {
        //序号的方法
        indexMethod(index) {
            return (this.currentPage - 1) * this.size + index + 1
        },
        pageChanged(page, size) {
            this.currentPage = page
            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;
        margin-bottom: 12px;
    }
    td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .foot {
        height: 32px;
        display: flex;
        justify-content: flex-end;
        margin-top: 28px;
    }
}
</style>