<template>
    <div>
        <div class="communication">
            <div class="battery_title">
                <span class="first"><img src="../assets/cangwei.png" /><p> {{chargerCode}}号仓位充电机</p></span>
                <!-- <span><el-button :class="buttonState[0]" @click="sendCharger" :disabled="buttonState === 1">{{buttonState === 1 ?'不可操作':buttonState[1]}}</el-button></span> -->
            </div>
            <div :class="statustext[1]">{{statustext[0]}}</div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "BatteryCharger",
        props:['chargerCode','comState'],
        data(){
            return{
                loading:false,
            }
        },
        computed:{
            statustext(){
                if(this.comState===1){
                    return ['通讯正常','success']
                }else{
                    return ['通讯异常','warning']
                }
            },
            buttonState(){
                if((this.chgState === 0 || this.chgState === 3) && this.storeState === 1){
                    return ['btnState','充电']
                }else if(this.chgState === 2  && this.storeState === 1){
                    return ['purple','断电']
                }else{
                    return 1
                }
            }
        },
        methods:{
            
        }
    }
</script>

<style lang="scss" scoped>
.communication {
    display: flex;
    margin-top: 10px;
    margin-bottom: 25px;
    div {
        line-height: 36px;
        font-size: 16px;
        font-weight: 600;
        height: 36px;
        width: 136px;
        text-align: center;
    }
    @media screen and (min-width: 1024px) and (max-width: 1153px) {
        div{
            font-weight: normal;
            font-size: 12px;
            white-space:nowrap;
        }
        .success,.warning{
            transform: scale(0.9);
        }
    }
    .battery_title{
        background-color: #1b263a;
        border: #25334d solid 1px;
        color: white;
        line-height: 34px;
        display: flex;
        justify-content: space-between;
        padding: 0 5px;
        width: 298px;
        
        .is-disabled{
            width:90px;
            height: 28px;
            padding: 0 0 0 18px;
            border-radius: 15px;
            color: #5f6571;
            border-color:#353c4c;
            background: url('../assets/d3.png') #353c4c no-repeat 6px center;
            background-size: 14px 14px;
            @media screen and (min-width: 1024px) and (max-width: 1153px) {
                :first-child{
                    display: inline-block;
                    transform:scale(0.9);
                    color: white;
                    margin-left: -18px;
                }
                .is-disabled{
                    background-image: none;
                }
            }
        }
        @media screen and (min-width: 1024px) and (max-width: 1153px) {
            .is-disabled{
                background-image: none;
            }
        }
        .first{
            display: flex;
            img{
                width: 30px;
                height: 30px;
                margin-top: 2px;
            }
            p{
                flex: 1;
                margin: 0;
                padding: 0;
            }
            @media screen and (min-width: 1024px) and (max-width: 1153px) {
                p{
                    font-weight: normal;
                    white-space: nowrap;
                    transform: scale(0.9);
                }
            }
        }
        
        .btnState{
            width:70px;
            height: 28px;
            padding: 0 0 0 15px;
            font-size: 14px;
            color: #fff;
            border-radius: 15px;
            line-height: 28px;
            margin-top: 2px;
            cursor: pointer;
            border: none;
            letter-spacing: 1px;
            background: url('../assets/d1.png') rgb(105, 184, 137) no-repeat 10px center;
            background-size: 14px 14px;
        }
        @media screen and (min-width: 1024px) and (max-width: 1153px) {
            .btnState{
                font-size: 12px;
                background-image: none;
                padding: 0;
                text-align: center;
                line-height: 28px;
            }
        }
        .btnState:hover{
            background-color:rgb(105, 184, 137,0.8);
        }
        .purple{
            width:70px;
            height: 28px;
            padding: 0 0 0 15px;
            font-size: 14px;
            color: #fff;
            border-radius: 15px;
            margin-top: 2px;
            cursor: pointer;
            border: none;
            letter-spacing: 1px;
            background: url('../assets/d2.png') rgb(224, 125, 68) no-repeat 10px center;
            background-size: 14px 14px;
        }
        .purple:hover{
            background-color:rgb(224, 125, 68,0.8);
        }
        img {
            vertical-align: middle;
        }
    }

    .success {
        color: #246CF9;
        text-align: right;
    }
    .warning {
        color: #c85e60;
        text-align: right;
    }
}
</style>