<!-- 设备清单的有select的表格 -->
<template>
    <div class='zw-list'>
        <div class='eq-list-top'>
            <Select width='146' tipPlace='top' caption='类别：' :selectdata='dataSelect2' :placeholder='"请选择"' @change='getList'></Select>
            <Select width='120' tipPlace='top' caption='楼层 ：' :selectdata='dataSelect2' style='margin:0 12px' @change='getList'></Select>
            <Select width='224' tipPlace='top' caption='生产厂商：' :selectdata='dataSelect2' :placeholder='"请选择"' @change='getList'></Select>
            <a-input-search placeholder style='width: 192px;margin-left:12px;height:32px;' @search='getList' />
        </div>
        <el-table :data='tableData' :border='true' style='width: 100%'>
            <el-table-column type='index' label='序号' width='80'></el-table-column>
            <el-table-column prop='sbjbm' label='类别' width='160'></el-table-column>
            <el-table-column prop='sl' label='项目'></el-table-column>
            <el-table-column prop='brand' label='金额'></el-table-column>
            <el-table-column prop='sbxh' label='费用说明'></el-table-column>
            <el-table-column prop='floor' label='项目说明'></el-table-column>
            <el-table-column prop='wzjc' label='当前阶段' show-overflow-tooltip resizable width='140'></el-table-column>
            <el-table-column prop='manufacturer' label='开始日期'></el-table-column>
            <el-table-column prop='manufacturer' label='验收日期'></el-table-column>
        </el-table>
        <div class='foot'>
            <el-pagination
                background
                layout='prev, pager, next'
                :total='total/size'
                :page-size='size'
                @prev-click='pageChanged'
                @next-click='pageChanged'
                @current-change='pageChanged'
            ></el-pagination>
        </div>
    </div>
</template>
<script>
import Select from '@/components/Select/Select.vue'
import { queryEquipmentList } from '@/api/equipmentList.js'
export default {
    components: { Select },
    data() {
        return {
            dataSelect2: [
                { id: 'test1', name: '选择项' },
                { id: 'test2', name: '单平米' },
                { id: 'test3', name: '下级分项' },
                { id: 'test4', name: '滑动平均滑动平均' }
            ],
            tableData: [],
            total: 0,
            currentPage: 1,
            size: 10
        }
    },
    props: ['param', 'major'],
    methods: {
        pageChanged(page, size) {
            this.currentPage = page
            this.size = size
            this.getList()
        },
        getList() {
            let postParams = {
                CLASSSTRUCTUREID: this.param
            }
            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
            })
        }
    },
    watch: {
        param(newV, oldV) {
            if (newV !== oldV) {
                this.getList()
            }
        }
    },
    mounted() {
        this.getList()
    }
}
</script>
<style lang="less" scoped>
.zw-list {
    .eq-list-top {
        display: flex;
    }
    .foot {
        position: absolute;
        height: 32px;
        right: 26px;
        bottom: 20px;
    }
    td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
</style>