<template>
    <el-dialog :visible.sync="dialogVisible" width="530px" :close-on-click-modal="false">
        <div class="main">
            <div
                class="table"
                v-loading="bridgeStatus.loading"
                element-loading-text="拼命加载中"
                element-loading-spinner="el-icon-loading"
                element-loading-background="rgba(0, 0, 0, 0.5)"
            >
                <VueSeamlessScroll
                    :titleList="bridgeStatus.titleList"
                    :listData="bridgeStatus.listData"
                />
            </div>
        </div>
    </el-dialog>
</template>

<script >
import VueSeamlessScroll from './VueSeamlessScrolls.vue' // 表格滚动
export default {
    components: {
        VueSeamlessScroll,
        // CascaderCompany,
    },
    data() {
        return {
            dialogVisible: false,
            params: {
                groupRelation: 'AND',
                groupTree: {},
                pageBean: {
                    page: 1,
                    pageSize: -1,
                    showTotal: true,
                },
                querys: [],
                sorter: [
                    {
                        direction: 'ASC',
                        property: 'state',
                    },
                ],
            },
            bridgeStatus: {
                titleList: [
                    {key: 'sn', name: '序号'},
                    {key: 'deviceName', name: '设备名称'},
                    {key: 'deviceCode', name: '设备编码'},
                    {key: 'detailTypeName', name: '设备类型'},
                    {key: 'tpBridgeName', name: '所属桥梁'},
                    // {key: 'device', name: '故障设备'},
                    {key: 'status', name: '状态', color: 'green'},
                ],
                listData: [],
                loading: false,
            },
        }
    },
    mounted() {},
    methods: {
        open(params) {
            this.dialogVisible = true
            // this.params.querys = []
            this.bridgeStatus.listData = []
            this.loadsh(params)
        },
        loadsh(params) {
            // this.params.querys.push({
            //     group: 'main',
            //     operation: 'EQUAL',
            //     property: 'state',
            //     relation: 'AND',
            //     value: val,
            // })
            this.bridgeStatus.loading = true

            this.$http.post('${yhxt}' + '/bizTpDevice/v1/pageVo', params).then((res) => {
                // this.deviceDetailData = []
                // let data = res.data || {}
                // if (data.rows) {
                //     this.deviceDetailData = data.rows
                // }
                this.bridgeStatus.loading = false
                if (res.data.rows && res.data.rows.length) {
                    res.data.rows.forEach((item, index) => {
                        this.bridgeStatus.listData.push({
                            sn: index + 1,
                            deviceName: item.deviceName,
                            deviceCode: item.deviceCode,
                            detailTypeName: item.detailTypeName,
                            tpBridgeName: item.tpBridgeName,
                            status: item.state,
                        })
                    })
                } else {
                    this.bridgeStatus.listData = []
                }
                // console.log('设备详情state', this.bridgeStatus.listData)
            })
        },
    },
}
</script>

<style lang='scss' scoped>
/deep/ .el-dialog {
    min-width: 800px !important;
    //   padding: 30px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    background: url('../img/device-detail-border.png') no-repeat;
    background-size: cover;
    background-size: 100% 100%;
}
/deep/ .el-dialog__header {
    background: transparent;
    border: none;
    height: 0;
}
/deep/ .el-dialog__header .el-dialog__title {
    display: none;
}
/deep/ .el-dialog__body {
    width: 90%;
    padding: 20px 0 0 0;
    background: transparent !important;
}
/deep/ .el-dialog__headerbtn {
    width: 20px;
    height: 20px;

    display: flex;
    background-color: #0094ff;
    border-radius: 50%;
    margin: 10px;
    justify-content: center;
    align-items: center;
    i {
        color: #fff !important;
        font-size: 18px !important;
    }
}
/deep/ .el-descriptions__body,
/deep/ .el-descriptions-item__label.is-bordered-label {
    background-color: transparent;
    color: #fff;
}
/deep/ .el-descriptions .is-bordered .el-descriptions-item__cell {
    border-color: #0e3a66;
    height: 45px;
}
// /deep/ .el-dialog__close .el-icon .el-icon-close{

// }
.main {
    height: 400px;
    overflow-y: hidden;
}
</style>