<!-- 电井商铺 -->
<template>
    <div class='djsp-list'>
        <div class='eq-list-top'>
            <el-input
                placeholder='搜索电井间'
                size='small'
                @change='getList'
                prefix-icon='el-icon-search'
                v-model='keyword'
                clearable
                style='width:192px;margin-right:12px'
            ></el-input>
            <el-input
                placeholder='搜索商铺编号'
                size='small'
                @change='getList'
                prefix-icon='el-icon-search'
                v-model='keyword'
                clearable
                style='width:192px;margin-right:12px'
            ></el-input>
            <Select @change='getList' v-model='floor' width='120' tipPlace='top' caption='楼层 ：' :selectdata='floorSelect'></Select>
        </div>
        <el-table :data='tableData' style='width: 100%' @row-click='innerVisible = true'>
            <el-table-column prop='floor' label='楼层' width='120'>
                <template slot-scope='{row}'>{{row.floor || '--'}}</template>
            </el-table-column>
            <el-table-column prop='welldes' label='电井间' width='160'>
                <template slot-scope='{row}'>{{row.welldes || '--'}}</template>
            </el-table-column>
            <el-table-column prop='meterbox' label='商铺电表数'>
                <template slot-scope='{row}'>{{row.meterbox || '--'}}</template>
            </el-table-column>
            <el-table-column prop='shopsnum' label='商铺编号'>
                <template slot-scope='{row}'>{{row.shopsnum || '--'}}</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 Select from '@/components/Select/Select.vue'
import EqDetail from './eqDetaileDialog'
import { queryEquipmentList } from '@/api/equipmentList.js'
import { mapGetters } from 'vuex'

export default {
    components: { Select, EqDetail },
    data() {
        return {
            dataSelect2: [
                { id: 'test1', name: '选择项' },
                { id: 'test2', name: '单平米' },
                { id: 'test3', name: '下级分项' },
                { id: 'test4', name: '滑动平均滑动平均' }
            ],
            tableData: [],
            total: 0,
            currentPage: 1,
            size: 10,
            floor: '',
            innerVisible: false, //详情弹框
            keyword: ''
        }
    },
    computed: {
        ...mapGetters(['floorSelect'])
    },
    props: ['major'],
    methods: {
        pageChanged(page) {
            this.currentPage = page
            this.getList()
        },
        getList() {
            let postParams = {
                // tab_code: this.param
            }
            let data = {
                page: this.currentPage,
                size: this.size,
                plazaId: this.$store.state.plazaId,
                major: this.major,
                keyword: this.keyword
            }
            queryEquipmentList({ data, postParams }).then(res => {
                console.log(res)
                this.tableData = res.data.data
                this.total = res.data.count
            })
        }
    },

    mounted() {
        // this.getList()
    }
}
</script>
<style lang="less" scoped>
.djsp-list {
    .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>