<!-- 维保 -->
<template>
    <div class='wb-list'>
        <div class='eq-list-top'>
            <el-input
                placeholder='请按照设备名称、设备编号搜索'
                size='small'
                @change='getList'
                prefix-icon='el-icon-search'
                v-model='keyword'
                style='width:192px;margin-right:12px'
            ></el-input>
            <el-input
                placeholder='请按照重要事项记录、描述搜索'
                size='small'
                @change='getList'
                prefix-icon='el-icon-search'
                v-model='keyword'
                style='width:192px;margin-right:12px'
            ></el-input>
            <el-input
                placeholder='请按照任务编号搜索'
                size='small'
                @change='getList'
                prefix-icon='el-icon-search'
                v-model='keyword'
                style='width:192px;margin-right:12px'
            ></el-input>
            <el-date-picker
                size='small'
                v-model='reportdate'
                type='date'
                placeholder='选择填报时间'
                @change='getList'
                style='width:180px;margin-right:12px'
            ></el-date-picker>
            <el-date-picker size='small' v-model='sjjssj' type='date' placeholder='选择验收时间' @change='getList' style='width:180px;margin-right:12px'></el-date-picker>
            <Select @change='getList' v-model='ischange' width='120' tipPlace='top' caption='是否更换配件信息 ：' :selectdata='changeOption'></Select>
        </div>
        <el-table :data='tableData' style='width: 100%'>
            <el-table-column type='index' label='序号' width='80'></el-table-column>
            <el-table-column prop='sbjc' label='设备名称' width='160' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.sbjc || '--'}}</template>
            </el-table-column>
            <el-table-column prop='sbjbm' label='设备编码' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.sbjbm || '--'}}</template>
            </el-table-column>
            <el-table-column prop='matters' label='重要事项记录' width='240' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.matters || '--'}}</template>
            </el-table-column>
            <el-table-column prop='description' label='描述' width='200' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.description || '--'}}</template>
            </el-table-column>
            <el-table-column label='更换配件信息' align='center'>
                <el-table-column prop='ischangepj' label='是/否更换' width='120'>
                    <template slot-scope='{row}'>{{row.ischangepj || '--'}}</template>
                </el-table-column>
                <el-table-column prop='model' label='配件名称型号' width='120' show-overflow-tooltip resizable>
                    <template slot-scope='{row}'>{{row.model || '--'}}</template>
                </el-table-column>
                <el-table-column prop='sl' label='数量'>
                    <template slot-scope='{row}'>{{row.sl || '--'}}</template>
                </el-table-column>
                <el-table-column prop='cost' label='费用(万元)' width='120'>
                    <template slot-scope='{row}'>{{row.cost || '--'}}</template>
                </el-table-column>
                <el-table-column prop='source' label='费用出处' width='120' show-overflow-tooltip resizable>
                    <template slot-scope='{row}'>{{row.source || '--'}}</template>
                </el-table-column>
            </el-table-column>
            <el-table-column prop='brand' label='现场照片'>
                <template slot-scope='{row}'>{{row.brand || '--'}}</template>
            </el-table-column>
            <el-table-column prop='reportdate' label='填报时间'>
                <template slot-scope='{row}'>{{row.reportdate || '--'}}</template>
            </el-table-column>
            <el-table-column prop='sjjssj' label='验收时间'>
                <template slot-scope='{row}'>{{row.sjjssj || '--'}}</template>
            </el-table-column>
            <el-table-column prop='wonum' label='工单编号' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.wonum || '--'}}</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 { queryWbsms } from '@/api/equipmentList.js'
import { mapGetters } from 'vuex'
import Select from '@/components/Select/Select.vue'
export default {
    components: { Select },
    data() {
        return {
            tableData: [],
            total: 0,
            currentPage: 1,
            size: 10,
            sjjssj: '',
            reportdate: '',
            ischange: '',
            changeOption: [
                {
                    id: '1',
                    name: '是'
                },
                {
                    id: ' 0',
                    name: '否'
                }
            ],
            keyword: ''
        }
    },
    props: ['smsxt', 'major'],
    computed: {
        ...mapGetters(['floorSelect'])
    },
    methods: {
        onSearch() {},
        pageChanged(page, size) {
            this.currentPage = page
            this.size = size
            this.getList()
        },
        getList() {
            let getParams = {
                data: {
                    smsxt: this.smsxt,
                    // tab: this.major,
                    // plazaId: this.$store.state.plazaId,
                    plazaId: '1000287',
                    page: this.currentPage,
                    size: this.size
                }
            }
            queryWbsms(getParams).then(res => {
                this.tableData = res.data || []
                this.total = res.count
            })
        }
    },
    watch: {
        smsxt(newV, oldV) {
            if (newV !== oldV) {
                this.getList()
            }
        }
    },
    mounted() {
        this.getList()
    }
}
</script>
<style lang="less" scoped>
.wb-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>