<!--专维-->
<template>
    <div class='zw-list'>
        <div class='eq-list-top'>
            <el-date-picker size='small' v-model='nd' type='date' placeholder='请选择年度' @change='getList' style='width:180px;margin-right:12px'></el-date-picker>
            <Select width='146' tipPlace='top' caption='类别：' :selectdata='dataSelect2' :placeholder='"请选择"' @change='getList'></Select>
            <Select width='120' tipPlace='top' caption='项目 ：' :selectdata='floorSelect' style='margin:0 12px' @change='getList'></Select>
            <Select width='180' tipPlace='top' caption='当前阶段' :selectdata='dataSelect2' :placeholder='"请选择"' @change='getList'></Select>
            <el-date-picker
                size='small'
                v-model='lxsjwcsj'
                type='date'
                placeholder='选择立项日期'
                @change='getList'
                style='width:180px;margin-left:12px;margin-right:12px'
            ></el-date-picker>
            <el-date-picker size='small' v-model='yssjwcsj' type='date' placeholder='选择验收日期' @change='getList' style='width:180px;margin-right:12px'></el-date-picker>
            <Select
                width='180'
                tipPlace='top'
                caption='验收结果'
                :selectdata='dataSelect2'
                :placeholder='"请选择"'
                style='margin-right:12px'
            >@change='getList'></Select>
            <el-input
                placeholder='请按照按照实施方案说明搜索'
                size='small'
                @change='getList'
                prefix-icon='el-icon-search'
                v-model='keyword'
                style='width:192px;margin-right:12px'
            ></el-input>
        </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='nd' label='年度' width='160' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.nd || '--'}}</template>
            </el-table-column>
            <el-table-column prop='qs' label='期数' width='160' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.qs || '--'}}</template>
            </el-table-column>
            <el-table-column prop='lb' label='类别' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.lb || '--'}}</template>
            </el-table-column>
            <el-table-column prop='xm' label='项目' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.xm || '--'}}</template>
            </el-table-column>
            <el-table-column prop='sl' label='数量' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.sl || '--'}}</template>
            </el-table-column>
            <el-table-column prop='ssfasm' label='实施方案说明' show-overflow-tooltip resizable width='200'>
                <template slot-scope='{row}'>{{row.ssfasm || '--'}}</template>
            </el-table-column>
            <el-table-column prop='sxjd' label='当前阶段' show-overflow-tooltip resizable width='140'>
                <template slot-scope='{row}'>{{row.sxjd || '--'}}</template>
            </el-table-column>
            <el-table-column prop='lxsjwcsj' label='立项日期' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.lxsjwcsj || '--'}}</template>
            </el-table-column>
            <el-table-column prop='yssjwcsj' label='验收日期' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.yssjwcsj || '--'}}</template>
            </el-table-column>
            <el-table-column prop='status' label='验收结果' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.status || '--'}}</template>
            </el-table-column>
            <el-table-column prop='zfje' label='结算金额' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.zfje || '--'}}</template>
            </el-table-column>
            <el-table-column prop='xlcfwz' label='资料存放位置' width='180' show-overflow-tooltip resizable>
                <template slot-scope='{row}'>{{row.xlcfwz || '--'}}</template>
            </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 { queryZw } from '@/api/equipmentList.js'
import { mapGetters } from 'vuex'
export default {
    components: { Select },
    data() {
        return {
            dataSelect2: [
                { id: 'test1', name: '选择项' },
                { id: 'test2', name: '单平米' },
                { id: 'test3', name: '下级分项' },
                { id: 'test4', name: '滑动平均滑动平均' }
            ],
            tableData: [],
            total: 0,
            currentPage: 1,
            yssjwcsj: '',
            lxsjwcsj: '',
            size: 10
        }
    },
    computed: {
        ...mapGetters(['floorSelect'])
    },
    props: ['smsxt', ''],
    methods: {
        pageChanged(page, size) {
            this.currentPage = page
            this.size = size
            this.getList()
        },
        //下拉框查询
        tabFind() {
            let postParams = [
                {
                    columnName: { nd: 'nd', lb: 'lb', xm: 'xm', sxjd: 'sxjd' },
                    params: {
                        // tab_code: this.param
                    },
                    tableName: 'glsms_asset' //视图名称
                }
            ]
            // let major
            // if (this.major.slice(0, 2) == 'GD') {
            //     major = '供电'
            // } else if (this.major.slice(0, 2) == 'XF') {
            //     major = '消防'
            // } else if (this.major.slice(0, 2) == 'GPS') {
            //     major = '给排水'
            // } else if (this.major.slice(0, 2) == 'DT') {
            //     major = '电梯'
            // } else if (this.major.slice(0, 2) == 'RQ') {
            //     major = '燃气'
            // } else {
            //     major = this.major
            // }
            let data = {
                major: this.major,
                plazaId: this.$store.state.plazaId
            }
            querySelect({ data, postParams }).then(res => {
                console.log(res)
                let sb_status = res.data.data.glsms_asset.sb_status
                let sbglgs = res.data.data.glsms_asset.sbglgs
                this.sbglgsOption = []
                this.statusOption = []
                sb_status.forEach(el => {
                    this.statusOption.push({
                        name: el.value,
                        id: el.key
                    })
                })
                sbglgs.forEach(el => {
                    this.sbglgsOption.push({
                        name: el.value,
                        id: el.key
                    })
                })
            })
        },
        getList() {
            let getParams = {
                data: {
                    smsxt: this.smsxt,
                    // tab: this.major,
                    // plazaId: this.$store.state.plazaId,
                    plazaId: '1000287',
                    page: this.currentPage,
                    size: this.size
                }
            }
            queryZw(getParams).then(res => {
                this.tableData = res.data || []
                this.total = res.count
            })
        }
    },
    watch: {
        smsxt(newV, oldV) {
            if (newV !== oldV) {
                this.getList()
            }
        }
    },
    mounted() {
        // this.tabFind()
        this.getList()
    }
}
</script>
<style lang="less" scoped>
.zw-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>