<template>
    <div class="rankingDialog">
        <el-dialog width="836px" title="报警频发地点排名" :visible.sync="rankingData.dialogVisible">
            <el-table :data="tableData" >
                <el-table-column width="55" type="index" label="序号"></el-table-column>
                <el-table-column width="150" property="railwayName" label="线路"></el-table-column>
                <el-table-column width="150" property="lineDirStr" label="行别"></el-table-column>
                <el-table-column width="300" property="alarmMiles" label="里程位置"></el-table-column>
                <el-table-column property="frequency" label="次数"></el-table-column>
            </el-table>
            <div class="pagination">
                <el-pagination @current-change="handleCurrentChange" layout="prev, pager, next,sizes, jumper"
                    :total="total">
                </el-pagination>
            </div>
        </el-dialog>

    </div>
</template>
<script>
import {
    alarmTypeAreaCount
} from "@/api/sum";
export default {
    name: 'rankingDialog',
    props: {
        rankingData: {
            type: Object,
            default: {}
        },
        nedData:{
            type: Object,
            default: {}
        }
    },
    data() {
        return {
            tableData: [],
            total: 0,
            params: {
                pageNum: 1,
                pageSize: 10,
                railwayCode: '',
                currentYear: '',
                currentMonth: ''
            }
        }
    },
    created() {
        this.alarmTypeAreaCount(this.params)
        console.log(this.nedData,'nedDatanedData')
    },
    methods: {
        alarmTypeAreaCount(params) {
            this.params.railwayCode=this.nedData.railwayCode
            this.params.currentYear=this.nedData.currentYear
            this.params.currentMonth=this.nedData.currentMonth
            alarmTypeAreaCount(params).then(res => {
                this.total = res.data.total
                this.tableData = res.data.records
            })
        },
        handleCurrentChange(val) {            
            this.params.pageNum = val
            this.alarmTypeAreaCount(this.params)
        }
    }
}
</script>
<style lang="scss" scoped>
.pagination {    
    width: 100%;
    height: 10px;    
    margin: 10px 0;
    text-align: right;
}
</style>