<template>
    <div class="yingji_right">
        <div class="top">
            <div class="title">突发事件信息</div>
            <div class="page">
                <div class="page_input">
                    <el-input size="mini" placeholder="查看当前企业预案" suffix-icon="el-icon-search"></el-input>
                    <span class="page_look">查看</span>
                </div>

                <div class="page_div" v-for="(item, index) in rightList" :key="index">
                    <span class="icon"></span>
                    <div class="page_div_right">
                        <div class="text">{{item.title}}</div>
                        <div class="func" @click="onClickFunc(item)">应急预案</div>
                    </div>
                </div>

            </div>
        </div>

        <div class="center">
            <div class="title">
                <span>当前值班人员</span>
                <span class="btn" @click="is_info_dialog = true">值班详情</span>
            </div>

            <div class="page">
                <div class="page_div" v-for="(item, index) in rightData.slice(0,2)" :key="index">
                    <div class="left">{{item.company}}</div>
                    <div class="right">
                        <div class="right_block">
                            {{ item.name }}
                            值班人员
                        </div>

                        <div class="right_block">
                            {{ item.tel }}
                            <i class="el-icon-phone"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="bottom">
            <div class="title">数据汇总</div>
            <div class="page">
                <div class="page_div">
                    <span class="color_white"> <strong>1</strong>处</span>
                    <img src="@/assets/images/qu_xian.png" alt="">
                    <span>区县</span>
                </div>

                <div class="page_div">
                    <span class="color_white"><strong>6</strong>万</span>
                    <img src="@/assets/images/ren_kou.png" alt="">
                    <span>人口</span>
                </div>

                <div class="page_div">
                    <span class="color_white"><strong>10</strong>处</span>
                    <img src="@/assets/images/xiang_zhen.png" alt="">
                    <span>乡镇</span>
                </div>

                <div class="page_div">
                    <span class="color_white"><strong>4.73</strong>万km²</span>
                    <img src="@/assets/images/mian_ji.png" alt="">
                    <span>面积</span>
                </div>

                <div class="page_div">
                    <span class="color_white"><strong>1.2</strong>/km²</span>
                    <img src="@/assets/images/mi_du.png" alt="">
                    <span>人口密度</span>
                </div>

                <div class="page_div">
                    <span class="color_white"><strong>60</strong>个</span>
                    <img src="@/assets/images/qi_ye.png" alt="">
                    <span>企业</span>
                </div>
            </div>
        </div>

        <div class="dialog" v-if="is_dialog">
            <img src="@/assets/images/error.png" class="error" @click="onClickError">

            <div class="page">
                <div class="text">{{ rightListDialog.title  }}</div>

                <div class="page_div">
                    <br>
                    <div class="title">响应级别</div>

                    <div class="page_line">{{ rightListDialog.level}}</div>

                </div>

                <div class="page_div">
                    <div class="title">突发原因</div>
                    <div class="page_div_text">{{ rightListDialog.reply }}</div>
                </div>

                <div class="page_div">
                    <div class="title">响应措施</div>
                    <div class="page_div_text page_div_text2">{{ rightListDialog.content }}</div>
                </div>

                <!-- <el-button class="btn" type="warning" @click="onBtn">确认启动</el-button> -->

            </div>
        </div>

        <div class="info_dialog animated animate__backInUp" v-if="is_info_dialog">
            <img src="@/assets/images/error.png" class="error" @click="is_info_dialog = false">

            <el-table :data="rightData" height="55vh" style="width: 100%">
                <el-table-column prop="company" label="企业名称">
                </el-table-column>
                <el-table-column prop="name" label="值班人员">
                </el-table-column>
                <el-table-column prop="tel" label="联系电话">
                </el-table-column>
                <el-table-column prop="time" label="值班时长">
                </el-table-column>
            </el-table>
        </div>

    </div>
</template>

<script>

import { roster, emergencyPlan } from '@/api'

export default {
    data() {
        return {
            is_dialog: false,
            is_info_dialog: false,

            one_1: require('@/assets/images/yingji_1_1.png'),

            two_1: require('@/assets/images/yingji_2_2.png'),

            three_1: require('@/assets/images/yingji_3_3.png'),

            four_1: require('@/assets/images/yingji_4_4.png'),

            arrList: [],

            rightData: [],
            rightList: [],
            rightListDialog: '',
        }
    },

    mounted() {

        var arr = [
            {
                text: '一级风险',
                url: this.one_1,
                color: '#FB0B21',
            },

            {
                text: '二级风险',
                url: this.two_1,
                color: '#FC5004'
            },

            {
                text: '三级风险',
                url: this.three_1,
                color: '#D9DB12'
            },

            {
                text: '四级风险',
                url: this.four_1,
                color: '#0533FC'
            },

        ]

        this.arrList = arr




        emergencyPlan().then(res => {
            this.rightList = res
        })

        roster({name: ''}).then(res => {
            this.rightData = res
        })
    },

    methods: {
        onClickFunc(e) {
            this.rightListDialog = e;
            this.is_dialog = true
        },

        onClickError() {
            this.is_dialog = false
        },

        onBtn() {
            this.is_dialog = false
        }
    }
}
</script>

<style lang="scss">
@import '@/assets/scss/var.scss';

.yingji_right {
    position: absolute;
    background: #040624;
    width: 18%;
    right: 0;
    top: 0;
    bottom: 10px;
    z-index: 99;
    color: #7afffd;
    padding: 0 1vw;

    .title {
        height: 4vh;
        display: flex;
        font-size: 2vh;
        align-items: center;
    }

    .top {
        height: 35vh;
        .page {
            height: 85%;

            .page_input {
                display: flex;
                align-items: center;
                width: 100%;
                .page_look {
                    width: 3vw;
                    display: flex;
                    justify-content: center;
                    cursor: pointer;
                }

                .el-input__inner {
                    background-image: url('~@/assets/images/yingji_input.png');
                    background-color: transparent;
                    background-size: 100% 100%;
                    border: none;
                }

                .el-input__prefix,
                .el-input__suffix {
                    color: #7afffd;
                }
            }

            .page_div {
                display: flex;
                align-items: center;
                width: 100%;
                height: 15%;
                .icon {
                    width: 1.4vw;
                    height: 1.4vw;
                    margin-right: 0.5vw;
                    background-image: url('~@/assets/images/yingji_icon.png');
                    background-size: 100% 100%;
                }

                .page_div_right {
                    flex: 1;
                    display: flex;
                    justify-content: space-between;

                    .text {
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                        width: 9vw;
                    }

                    .func {
                        color: #efb311;
                        cursor: pointer;

                        &:hover {
                            color: #fff;
                        }
                    }
                }
            }
        }
    }

    .center {
        height: 23vh;
        font-size: 1.5vh;

        .title {
            display: flex;
            justify-content: space-between;
        }
        .btn {
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1vh;
            padding: 0.5vh 0;
            border-radius: 4px;
            background-image: url('~@/assets/images/yingji_input.png');
            background-size: 100% 100%;
            width: 3vw;
        }

        .page {
            height: 19vh;

            .page_div {
                display: flex;
                height: 8vh;
                margin-bottom: 2%;
                background-image: url('~@/assets/images/yingji_block.png');
                background-size: 100% 100%;

                .left {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: 30%;
                    color: #fff;
                }

                .right {
                    padding-top: 5%;

                    color: #d5dafa;
                    .right_block {
                        display: flex;
                        align-items: center;
                        height: 40%;
                    }
                }
            }
        }
    }

    .bottom {
        height: 32vh;
        overflow: hidden;
        .page {
            margin-top: 1vh;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
        }

        .page_div {
            margin-bottom: 3vh;
            text-align: center;
            display: flex;
            flex-direction: column;
            width: 30%;
            justify-content: center;
            cursor: pointer;

            .color_white {
                color: #fff;
            }

            img {
                width: 100%;
                margin: 1vh 0;
            }

            strong {
                font-size: 2.2vh;
                color: #efb311;
            }
        }
    }

    .dialog {
        position: absolute;
        right: 100%;
        top: 0;
        padding: 2vw 1vw;
        width: 20vw;
        height: 82vh;
        background-image: url('~@/assets/images/kuang.png');
        background-size: 100% 100%;
        color: #fff;

        .error {
            position: absolute;
            width: 1vw;
            top: 1.4vw;
            right: 1.4vw;
            cursor: pointer;
        }

        .page_line {
            color: #fff;
        }

        .page_div {
            color: #07c1f7;
            font-size: 1.5vh;
            margin-bottom: 1vh;
            .page_div_text {
                line-height: 1.7;
                color: #fff;
            }

            .page_div_text2 {
                height: 37vh;
                overflow-y: auto;
                @include scrollbar;
            }
        }

        .text {
            margin-top: 2vh;
            text-align: center;
        }

        .btn {
            position: absolute;
            bottom: 30px;
            left: 0;
            right: 0;
            margin: auto;
            background-image: linear-gradient(#f97f21, #ffa921);
        }
    }

    .info_dialog {
        position: absolute;
        border-radius: 5px;
        top: 4vh;
        right: 110%;
        width: 40vw;
        height: 65vh;
        padding: 4vh 1vw 2vh;
        background-color: #040624;

        .error {
            cursor: pointer;
            position: absolute;
            right: 1vw;
            top: 1vw;
        }

        .el-pagination {
            text-align: right;
        }

        .el-table--scrollable-y,
        .el-table--scrollable-x,
        .el-table__body-wrapper {
            @include scrollbar;
        }

        .el-table {
            background: transparent;
        }

        .el-table th > .cell {
            background-color: transparent;
        }

        .el-table td,
        .el-table th,
        .el-table th,
        .el-table tr {
            background: transparent !important;
            color: #02d9fd;
            font-size: 0.7vw;
        }

        .el-table td {
            border: none !important;
            background: #003046 !important;
        }

        .el-table td,
        .el-table th.is-leaf {
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .el-table--border::after,
        .el-table--group::after,
        .el-table::before {
            background-color: transparent;
        }

        .el-table__body-wrapper {
            overflow-y: auto;
        }
    }
}
</style>