<template>
    <div class="formula realTime">
        <!-- 生态气象站 -->
        <div class="page-content new-data" v-if="deviceName == 30"
            :class="deviceName == 10 || deviceName == 30 ? 'control-page' : ''">

            <div class="table-title">
                <img src="../../assets/image/real-time.png" alt="" />
                {{$t('realTime.weatherStation')}}<span class="outline" v-if="deviceState == 0">({{$t('realTime.deviceOffline')}})</span>
            </div>
            <div class="timeNow" v-if="updateTime">
                <!-- {{ time.year.year }}-{{ time.year.month }}-{{ time.year.date }}<span> {{ time.time }}:{{ time.timeS
                }}</span> -->
                {{ updateTime}}
            </div>
            <div class="flex-view border-none warning-btn"  v-if="deviceName == 30">
                <div class="input-btn ">
                 
                    <div class="btn green" @click="openWarn">
                        <img src="../../assets/image/real-time-icon2.png" alt="" />{{$t('realTime.smsAlarm')}}
                    </div>
                </div>
            </div>
            <div class="flex-list realTime-bottom" :class="deviceName == 30 ? 'weather' : ''">
                <div class="left-view-new">
                    <div class="list-view" v-for="item, index in list " :key="index">
                        <img :src="item.img" alt="">
                        <div>
                              <div class="text">{{ item.name }}</div>
                            <div class="number"  :style="item.num==$t('realTime.fault')?'color:rgba(252, 125, 106, 1)':''"> {{ getControlData(item) }}</div>
                        </div>
                    </div>
                </div>
                <div class="right" id="realTime-line"></div>
            </div>
        </div>
        <!-- 控制器/施肥机 -->
        <div class="page-content new-data" v-else :class="deviceName !=1 ? 'control-page' : ''">
            <div class="page-iccid" v-if="validateIccid($store.state.equipmentList[indexs - 1].iccidcode)"><span>{{$t('realTime.iccid')}}:{{$store.state.equipmentList[indexs - 1].iccidcode?$store.state.equipmentList[indexs - 1].iccidcode:''}}</span>&nbsp;&nbsp;&nbsp;<span>到期时间: </span><span :class="getPackageTimeColor()?'color-red':''">{{getPackageTime()}}<span v-if="getPackageTimeColor()">(即将到期)</span></span> </div>
            <div class="control-view" v-if="deviceName !=1">
                <div class="title" @click='weatherModel = true'>{{$t('index.weatherStation')}}:</div>
                <vue-seamless class="control-list" :data="controlList" :class-option="defaultOption1">
                    <div class="list-view" v-for="item, index in controlList " :key="index">
                        <img class="icon" :src="item.img" alt="">
                        {{ item.environmentDataId
                        }}:{{ getControlData(item) }}
                    </div>
                </vue-seamless>
            </div>
            <!-- <div class="control-list" >
    <div v-for="(item, index) in controlList" :key="index">
        <img :src="item.img" alt="">
        {{ item.environmentDataId
        }}:{{ getControlData(item) }}
    </div>
</div> -->
            <div class="table-title">
                <img src="../../assets/image/real-time.png" alt="" />
                {{$t('realTime.title')}}<span class="outline" v-if="deviceState == 0">({{$t('realTime.deviceOffline')}})</span>
            </div>
            <div class="timeNow" v-if="updateTime">
                <!-- {{ time.year.year }}-{{ time.year.month }}-{{ time.year.date }}<span> {{ time.time }}:{{ time.timeS
    }}</span> -->
    {{ updateTime}}
            </div>
            <div class="flex-view border-none warning-btn">
                <div class="input-btn ">
                    <div class="btn blue" @click='openDataModel'>
                        {{$t('realTime.viewAllData')}}
                    </div>
                    <div class="btn green" @click="openWarn">
                        <img src="../../assets/image/real-time-icon2.png" alt="" /> {{$t('realTime.smsAlarm')}}
                    </div>
                </div>
            </div>
            <div class="realTime-list" v-if="list.length">
                <vue-seamless class="seamless-warp" :data="list" :class-option="defaultOption">
                    <div class="list-view" v-for="item, index in list " :key="index">
                        <img :src="item.img" alt="">
                        <div>
                            <div class="text">{{ item.name }}</div>
                            <div class="number"  :style="item.num==$t('realTime.fault')?'color:rgba(252, 125, 106, 1)':''"> {{ getControlData(item) }}</div>
                        </div>
                    </div>
                </vue-seamless>

            </div>
            <div class="flex-list realTime-bottom">
                <div class="left-view" v-if="deviceName != 30">
                    <div ref="monitor" class="monitor" id="monitor">
                        <!-- <video ref="videoPlayer" class="video-js" id="video-js"></video> -->
                        <img  style="width: 100%;height: 100%;" :src="imgUrl" alt="">
                        <!-- <div v-else ref="videoPlayer" class="video-js" id="video-js"></div> -->
                    </div>
                </div>
                <div class="right" id="realTime-line"></div>
            </div>
        </div>
        <!-- 控制器 -->
        <div class="page-content" v-if="deviceName == 10">
            <div class="table-title">
                <img src="../../assets/image/status.png" alt="" />
                {{$t('realTime.deviceStatus')}}
                <div class="title-text" v-if="sunrise"><img src="../../assets/img/sunrise.png" alt="">{{$t('realTime.sunrise')}}:{{ sunrise }}
                </div>
                <div class="title-text" v-if="sunset"><img src="../../assets/img/sunset.png" alt="">{{$t('realTime.sunset')}}:{{ sunset }}
                </div>
                <div class="input-btn ">
                    <div class="btn blue" @click="openVolt">
                        {{$t('realTime.batteryVoltage')}}
                    </div>
                </div>
            </div>
            <div class="flex-view border-none">
                <div class="status-view" v-for="item, index in statusList" :key="index">
                    <div class="status-view-top">
                        <div class="status-view-top-left">{{ item.name }}</div>
                        <el-popover placement="top" width="140" v-model="item.deltrue">
                            <div class="set-status-red" @click="delStatus(item, index)">{{$t('realTime.delete')}}</div>

                            <img class="status-view-top-right" slot="reference" src="../../assets/img/more.png" alt="">
                        </el-popover>
                        <!-- <img class="status-view-top-right" slot="reference" src="../../assets/img/more.png" alt=""> -->
                    </div>
                    <!-- 风机 -->
                    <div class="status-view-content" v-if="item.type == 1">
                        <div v-if="item.open != 0" class="status-true">
                            <div class="status-true-sel">
                                <div class="sel-auto">
                                    <img v-if="item.open == 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.autoControl')}}
                                </div>
                                <div class="sel-phone">
                                    <img v-if="item.open != 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.mobileControl')}}
                                </div>
                            </div>
                            <div class="status-fan">
                                <div class="btn" :class="item.status[0] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[0] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>1#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[1] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[1] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt=""> <span>2#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[2] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[2] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt=""> <span>3#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[3] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[3] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt=""> <span>4#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[4] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[4] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt=""> <span>5#{{$t('setParams.fan')}}</span>
                                </div>
                                <div style="display: none;"></div>
                            </div>
                        </div>
                        <div v-else class="status-noTrue">
                            <img src="../../assets/img/status-no.png" alt="">
                            <div> {{$t('realTime.deviceInvalid')}}</div>
                        </div>
                    </div>
                    <!-- 补光灯 -->
                    <div class="status-view-content" v-else-if="item.type == 8">
                        <div v-if="item.open != 0" class="status-true">
                            <div class="status-true-sel">
                                <div class="sel-auto">
                                    <img v-if="item.open == 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.autoControl')}}
                                </div>
                                <div class="sel-phone">
                                    <img v-if="item.open != 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.mobileControl')}}
                                </div>
                            </div>
                            <div class="status-fan">
                                <div class="btn" :class="item.status[0] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[0] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>1#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[1] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[1] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>2#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[2] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[2] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>3#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[3] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[3] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>4#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[4] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[4] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>5#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[5] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[5] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>6#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[6] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[6] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>7#{{$t('realTime.light')}}</span>
                                </div>
                                <div class="btn" :class="item.status[7] == 1 ? 'blue' : 'off'">
                                    <img class="light-img" v-if="item.status[7] == 1" src="../../assets/img/LED-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>8#{{$t('realTime.light')}}</span>
                                </div>
                                <div style="display: none;"></div>
                            </div>
                        </div>
                        <div v-else class="status-noTrue">
                            <img src="../../assets/img/status-no.png" alt="">
                            <div>{{$t('realTime.deviceInvalid')}}</div>
                        </div>
                    </div>
                    <!-- 冷暖风机 -->
                     <div class="status-view-content" v-else-if="item.type == 18">
                        <div v-if="item.open != 0" class="status-true">
                            <div class="status-true-sel" style="margin-bottom: 10px;">
                                <div class="sel-auto">
                                    <img v-if="item.open == 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.autoControl')}}
                                </div>
                                <div class="sel-phone">
                                    <img v-if="item.open != 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.mobileControl')}}
                                </div>
                            </div>
                               <div class="status-true-sel text-blue"  style="justify-content: center;margin-top:10px">
                                <div class="sel-auto"  v-if="item.count == 1">
                                    {{$t('realTime.heatingMode')}}
                                </div>
                                <div class="sel-phone" v-if="item.count != 1">
                                    {{$t('realTime.coolingMode')}}
                                </div>
                            </div>
                            <div class="status-fan">
                                <div class="btn" :class="item.status[0] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[0] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>1#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[1] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[1] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>2#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[2] == 1 ? 'blue' : 'off'">
                                     <img class="fan-img" v-if="item.status[2] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>3#{{$t('setParams.fan')}}</span>
                                </div>
                                <div class="btn" :class="item.status[3] == 1 ? 'blue' : 'off'">
                                    <img class="fan-img" v-if="item.status[3] == 1" src="../../assets/img/fan-on.png"
                                        alt="">
                                    <img v-else src="../../assets/img/fan-off.png" alt="">
                                    <span>4#{{$t('setParams.fan')}}</span>
                                </div>
                                <div style="display: none;"></div>
                            </div>
                        </div>
                        <div v-else class="status-noTrue">
                            <img src="../../assets/img/status-no.png" alt="">
                            <div>{{$t('realTime.deviceInvalid')}}</div>
                        </div>
                    </div>
                    <!-- 空调 -->
                        <div class="status-view-content" v-else-if="item.type == 17">
                        <div v-if="item.open != 0" class="status-true">
                            <div class="status-true-sel" style="margin-bottom: 10px;">
                                <div class="sel-auto">
                                    <img v-if="item.open == 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.autoControl')}}
                                </div>
                                <div class="sel-phone">
                                    <img v-if="item.open != 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.mobileControl')}}
                                </div>
                            </div>
                                <!-- 空调六选一 -->
                            <div class="status-true-sel text-blue" style="justify-content: center;margin-top:10px">
                                <div class="sel-auto" v-if="item.count==0">
                                    自动模式  {{$t('realTime.autoMode')}}
                                </div>
                                <div class="sel-auto" v-if="item.count==1">
                                  制冷模式  {{$t('realTime.coolingMode')}}
                                </div>
                                 <div class="sel-auto" v-if="item.count==2">
                                    制热模式  {{$t('realTime.heatingMode1')}}
                                </div>
                                 <div class="sel-auto" v-if="item.count==3">
                                   除湿模式  {{$t('realTime.dehumidifyMode')}}
                                </div>
                                 <div class="sel-auto" v-if="item.count==4">
                                    送风模式  {{$t('realTime.airSupplyMode')}}
                                </div>
                                <div class="sel-auto" v-if="item.count==5">
                                    冷暖模式  {{$t('realTime.heatingCoolingMode')}}
                                </div>
                            </div>
                          <div class="status-fan status-btn">
                                <div class="btn" :class="item.index == 1 ? 'blue' : 'off'">
                                    <img class="light-img" :src="getIcon(item)" alt="">
                                    <!-- <img v-else src="../../assets/img/fan-off.png" alt=""> -->
                                    <span>{{ item.index == 1 ? $t('realTime.open') : $t('realTime.close') }}</span>
                                </div>
                            </div>
                        </div>
                        <div v-else class="status-noTrue">
                            <img src="../../assets/img/status-no.png" alt="">
                            <div>{{$t('realTime.deviceInvalid')}}</div>
                        </div>
                    </div>
                    <!-- 顶卷膜及其他 -->
                    <div class="status-view-content" v-else>
                        <div v-if="item.open != 0" class="status-true">
                            <div class="status-true-sel">
                                <div class="sel-auto">
                                    <img v-if="item.open == 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.autoControl')}}
                                </div>
                                <div class="sel-phone">
                                    <img v-if="item.open != 1" src="../../assets/img/status-true-sel.png" alt="">
                                    <img v-else src="../../assets/img/status-true-nosel.png" alt="">
                                    {{$t('realTime.mobileControl')}}
                                </div>
                            </div>
                            <div class="status-true-charts"
                                v-if="item.type == 6 || item.type == 5 || item.type == 2 || item.type == 15 || item.type == 14 || item.type == 13 || item.type == 12|| item.type == 16">
                                <img src="../../assets/img/status-true-charts-icon.png" alt="">
                                <div :id="'statusCharts' + index"></div>
                            </div>
                            <div class="status-true-charts" style="background: unset;height: 50px;" v-else>
                            </div>
                        
                            <div class="status-true-text" v-if="item.type == 2 || item.type == 5 || item.type == 6 || item.type == 12
            || item.type == 13 || item.type == 14 || item.type == 15 || item.type == 16">
                                <div class="status-true-text-left">{{ getNumberStatus(item) }}</div>
                                <div class="status-true-text-right"
                                    v-if="item.type == 6 || item.type == 5 || item.type == 2 || item.type == 15|| item.type == 16 || item.type == 14 || item.type == 13 || item.type == 12">
                                    {{ item.progress }}%</div>
                            </div>

                            <div class="status-fan status-btn" v-else>
                                <div class="btn" :class="item.index == 1 ? 'blue' : 'off'">
                                    <img class="light-img" :src="getIcon(item)" alt="">
                                    <!-- <img v-else src="../../assets/img/fan-off.png" alt=""> -->
                                    <span>{{ item.index == 1 ? $t('realTime.open') : $t('realTime.close') }}</span>
                                </div>
                            </div>
                            <div class="status-true-text" v-if="item.type == 15">
                                <div class="status-true-text-left">{{$t('realTime.CalculationResults')}}</div>
                                <div class="status-true-text-right">
                                    {{ item.count }}</div>
                            </div>
                        </div>
                        <div v-else class="status-noTrue">
                            <img src="../../assets/img/status-no.png" alt="">
                            <div>{{$t('realTime.deviceInvalid')}}</div>
                        </div>
                    </div>
                </div>

                <div class="status-view">
                    <div class="status-view-top">
                        <div class="status-view-top-left">{{$t('realTime.addDevice')}}</div>
                    </div>
                    <div class="status-view-content">
                        <div class="status-noTrue status-add" @click="addModel = true">
                            <img src="../../assets/img/status-add.png" alt="">
                            <div>{{$t('realTime.clickToAdd')}}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <el-dialog :title="$t('index.weatherStation')" class="vrcode-model" :append-to-body="true" :visible.sync="weatherModel" width="1030px">
            <el-button class="model-return-btn" type="primary" @click="weatherModel = false">{{$t('realTime.return')}}</el-button>
            <div class="vrcode-model-title vrcode-model-title-282">{{$t('index.weatherStation')}}</div>
            <div class="dataModel">
                <div class="view-new">
                    <div class="list-view" v-for="item, index in controlList " :key="index">
                        <img class="icon" :src="item.img" alt="">
                        <div>
                            <div class="text">{{ item.environmentDataId }}</div>
                            <div class="number"> {{ getControlData(item) }}</div>
                        </div>

                    </div>
                </div>
            </div>

        </el-dialog>
        <el-dialog :title="$t('realTime.title')" class="vrcode-model" :append-to-body="true" :visible.sync="dataModel" width="1030px">
            <el-button class="model-return-btn" type="primary" @click="dataModel = false">{{$t('realTime.return')}}</el-button>
            <div class="vrcode-model-title vrcode-model-title-282">{{$t('realTime.title')}}</div>
            <div class="dataModel scroll">
                <div class="view-new border">
                   <template  v-for="item, index in list">
                     <div class="list-view" :key="index" v-if="item.targetValue==1"> 
                        <img :src="item.img" alt="">
                        <div>
                            <div class="text">{{ item.name }}</div>
                            <div class="number" :style="item.num==$t('realTime.fault')?'color:rgba(252, 125, 106, 1)':''"> {{ getControlData(item) }}</div>
                        </div>
                    </div>
                   </template>
                </div>
                <div class="view-new border">
                   <template  v-for="item, index in list">
                     <div class="list-view" :key="index" v-if="item.targetValue==0&&(item.equipmentNumber==0||item.equipmentNumber==15)"> 
                        <img :src="item.img" alt="">
                        <div>
                            <div class="text">{{ item.name }}</div>
                            <div class="number" :style="item.num==$t('realTime.fault')?'color:rgba(252, 125, 106, 1)':''"> {{ getControlData(item) }}</div>
                        </div>
                    </div>
                   </template>
                </div>
               <template v-for="item1,index1 in 13" >
                <div class="view-new border" :key="index1" v-if="list.some(item => item.targetValue==0 && item.equipmentNumber==(index1+1))">
                   <template  v-for="item, index in list">
                     <div class="list-view" :key="index" v-if="item.targetValue==0&&(item.equipmentNumber==(index1+1))"> 
                        <img :src="item.img" alt="">
                        <div>
                            <div class="text">{{ item.name }}</div>
                            <div class="number" :style="item.num==$t('realTime.fault')?'color:rgba(252, 125, 106, 1)':''"> {{ getControlData(item) }}</div>
                        </div>
                    </div>
                   </template>
                </div>
               </template>
                
             
            </div>

        </el-dialog>

        <el-dialog :title="$t('realTime.dialog.title')" :append-to-body="true" :visible.sync="addModel" width="70%">
            <div class="model-title">{{$t('realTime.dialog.title')}}</div>
            <div class="model-sel scroll">
                <div v-for="item, index in selDevicestatus" :key="index">
                    <div @click="selClick(item)" :class="item.select ? 'sel' : 'no-sel'"></div>
                    {{ item.statePermissions }}
                </div>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="addModel = false">{{$t('realTime.dialog.confirm')}}</el-button>
            </span>
        </el-dialog>

        <el-dialog :title="$t('realTime.alarm.title')" class="vrcode-model" top="5vh" :append-to-body="true" :visible.sync="warnModel"
            width="1200px">
            <el-button class="model-return-btn" type="primary" @click="returnWarn">{{$t('realTime.return')}}</el-button>
            <div class="vrcode-model-title vrcode-model-title-282">{{$t('realTime.alarm.title')}}</div>
            <div class="warning-model ">
                <div class="title-tips">{{$t('realTime.alarm.newRule')}}</div>
                <div class="flex-view border-none">
                    <div class="input-main">
                        <div>{{$t('realTime.alarm.deviceCode')}}</div>
                        <input disabled type="text" v-model="warnForm.deviceId">
                    </div>
                </div>
                <div class="flex-view">
                    <div class="input-main">
                        <div>{{$t('realTime.alarm.phone1')}}</div>
                        <input type="text" v-model="warnForm.phonenumber">
                        <span></span>
                    </div>
                    <div class="input-main">
                        <div>{{$t('realTime.alarm.phone2')}}</div>
                        <input type="text" v-model="warnForm.phonenumber2">
                    </div>
                </div>
                <div class="flex-view">
                    <div class="input-sel">
                        <span>{{$t('realTime.alarm.condition')}}</span>
                        <el-dropdown @command="handleCommand">
                            <div class="el-dropdown-link">
                                <input v-model="warnModelSel1" type="text" class="input-input" :placeholder="$t('realTime.dialog.choose')">
                                <div class="arrow"><img src="../../assets/image/arrow.png" alt=""></div>
                            </div>
                            <el-dropdown-menu class="warning-sel" slot="dropdown">
                                <el-dropdown-item v-for="item, index in typeSelList" :key="index" :command="index">{{
            item.name
        }}</el-dropdown-item>

                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                    <div class="input-sel">
                        <el-dropdown @command="handleCommand1">
                            <div class="el-dropdown-link">
                                <input v-model="warnModelSel2" type="text" class="input-input" :placeholder="$t('realTime.dialog.choose')">
                                <div class="arrow"><img src="../../assets/image/arrow.png" alt=""></div>
                            </div>
                            <el-dropdown-menu class="warning-sel" slot="dropdown">
                                <el-dropdown-item v-for="item, index in typeSelList1" :key="index" :command="index">{{
            item.name
        }}</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                    <div class="input-main">
                        <input type="text" v-model="warnForm.environmentData" style="width: 200px;"
                            placeholder="请输入设定值">
                        <span></span>
                    </div>
                    <div class="input-btn ">
                        <div class="btn blue" @click="addMessage">
                            <img src="../../assets/img/add.png" alt="" />{{$t('realTime.alarm.add')}}
                        </div>
                    </div>
                </div>
                <div class="title-tips">{{$t('realTime.alarm.existingRules')}}</div>
                <div class="vrcode-table">
                    <div class="vrcode-table-view table-view">
                        <el-table :data="tableData" :row-class-name="tableRowClassName" height="520"
                            style="width: 100%">

                            <el-table-column prop="environmentName" :label="$t('realTime.alarm.alarmName')">
                            </el-table-column>
                            <el-table-column prop="environmentId" :label="$t('realTime.alarm.condition')">
                                <template slot-scope="scope">
                                    <div>
                                        {{ typeSelList1[scope.row.unit - 1].name }}
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column prop="environmentData" :label="$t('realTime.alarm.value')"></el-table-column>
                            <el-table-column prop="phonenumber" :label="$t('realTime.alarm.phone1')"></el-table-column>
                            <el-table-column prop="phonenumber2" :label="$t('realTime.alarm.phone2')"></el-table-column>
                            <el-table-column :label="$t('realTime.alarm.operation')" width="100">

                                <template slot-scope="scope">
                                    <div class="vrcode-table-btn">
                                        <div class="vrcode-btn red-btn" @click="delMessage(scope.row)">
                                            {{$t('realTime.alarm.delete')}}
                                        </div>
                                    </div>
                               </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>

            </div>
        </el-dialog>

        <el-dialog :close-on-click-modal="false" title="提示" top="15vh" :visible.sync="voltModel" width="564px"
      class="vrcode-model manage-model" :append-to-body="true">
      <div class="vrcode-model-title">
       {{$t('realTime.wirelessSensor.title')}}
      </div>
      <div class="vrcode-content">
        <div class="manage-left">
          <div class="manage-input">
            <div class="input-title">1#{{$t('realTime.wirelessSensor.batteryVoltage')}}</div>
            <input type="text" disabled v-model="voltData['1208']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">2#{{$t('realTime.wirelessSensor.batteryVoltage')}}</div>
            <input type="text" disabled v-model="voltData['1210']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">3#{{$t('realTime.wirelessSensor.batteryVoltage')}}</div>
            <input type="text" disabled v-model="voltData['1212']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">4#{{$t('realTime.wirelessSensor.batteryVoltage')}}</div>
            <input type="text" disabled v-model="voltData['1214']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">5#{{$t('realTime.wirelessSensor.batteryVoltage')}}</div>
            <input type="text" disabled v-model="voltData['1216']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">6#{{$t('realTime.wirelessSensor.batteryVoltage')}}</div>
            <input type="text" disabled v-model="voltData['1218']"  placeholder="">
          </div>
        </div>
        <div class="manage-right">
          <div class="manage-input">
            <div class="input-title">1#{{$t('realTime.wirelessSensor.signalQuality')}}</div>
            <input type="text" disabled v-model="voltData['1209']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">2#{{$t('realTime.wirelessSensor.signalQuality')}}</div>
            <input type="text" disabled v-model="voltData['1211']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">3#{{$t('realTime.wirelessSensor.signalQuality')}}</div>
            <input type="text" disabled v-model="voltData['1213']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">4#{{$t('realTime.wirelessSensor.signalQuality')}}</div>
            <input type="text" disabled v-model="voltData['1215']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">5#{{$t('realTime.wirelessSensor.signalQuality')}}</div>
            <input type="text" disabled v-model="voltData['1217']"  placeholder="">
          </div>
          <div class="manage-input">
            <div class="input-title">6#{{$t('realTime.wirelessSensor.signalQuality')}}</div>
            <input type="text" disabled v-model="voltData['1219']"  placeholder="">
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="vrcode-btn blue-btn w-100" @click="voltModel=false">{{$t('index.confirm')}}</div>
        <div class="vrcode-btn cancle-btn w-100" @click="voltModel = false">{{$t('index.cancel')}}</div>
      </span>
    </el-dialog>
    </div>
</template>

<script>
// import EZUIKit from 'ezuikit-js';
import { getnowtime } from '../../assets/js/nowTime'
import { realTimeLine, statusCharts } from '@/assets/js/charts'
// import videojs from 'video.js';
// import video_zhCN from 'video.js/dist/lang/zh-CN.json'
import vueSeamless from 'vue-seamless-scroll'
  import {  changeLanguage, getLanguage } from '@/utils/language'

export default {
    components: { vueSeamless },
    computed: {
        defaultOption() {
            return {
                step: 0.3, // 数值越大速度滚动越快
                limitMoveNum: 7, // 开始无缝滚动的数据量 this.dataList.length
                hoverStop: true, // 是否开启鼠标悬停stop
                direction: 2, // 0向下 1向上 2向左 3向右
                openWatch: true, // 开启数据实时监控刷新dom
                singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
                singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
                waitTime: 1000 // 单步运动停止的时间(默认值1000ms)
            }
        },
        defaultOption1() {
            return {
                step: 0.3, // 数值越大速度滚动越快
                limitMoveNum: 6, // 开始无缝滚动的数据量 this.dataList.length
                hoverStop: true, // 是否开启鼠标悬停stop
                direction: 2, // 0向下 1向上 2向左 3向右
                openWatch: true, // 开启数据实时监控刷新dom
                singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
                singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
                waitTime: 1000 // 单步运动停止的时间(默认值1000ms)
            }
        },
            typeSelList1(){
            return  this.$t('comparisonOperators')   
            }
    },
    data() {
        return {
            sunrise: "00:00",
            sunset: "00:00",
            statusList: [],
            dataModel: false,//全部实时数据弹窗
            weatherModel: false,
            updateTime:'',
            time: null,//右上角时间
            list: [],
            inputData: [],
            indexs: 1,
            player: null,
            url: '',
            imgUrl: '',
            timer: null,
            deviceName: 1,
            deviceState: 1,
            controlList: [],
            statusInterval: null,//status状态的Interval
            statusTime: 2,//status状态的秒数

            allDevicestatus: [],//所有权限
            nowDevicestatus: [],//当前设备权限
            selDevicestatus: [],//重叠上面数组 判断选择弹窗是否打勾
            addModel: false,//添加弹窗

            warnModelSel1: '',
            warnModelSel2: '',
            warnModel: false,//短信报警弹窗
            deviceId: '',//当前打开的设备id
            warnForm: {
                "deviceId": '',
                "userId": '',
                "environmentData": '',
                "environmentId": '',
                "unit": '',
                "phonenumber": '',
                "phonenumber2": ''
            },
            tableData: [],
            //选择内容
            typeSelList: [],
        

            voltModel:false,//无线电池电压弹窗
            voltData:{},
        }
    },
    watch: {
        $route(newVal, oldVal) {
            const that = this;
            const store = this.$store.state
            this.indexs = this.$route.query.index ? this.$route.query.index : store.equipmentIndex;
            this.deviceName = store.equipmentList[this.indexs - 1].deviceName
            this.deviceState = store.equipmentList[this.indexs - 1].deviceState
            clearInterval(this.statusInterval) && this.statusInterval
             this.inputData = [];
             this.list = []
             this.updateTime=''
            this.nowDevicestatus=[]
            setTimeout(() => {

                if (this.player) {
                    this.player.stop()
                    that.player.destroy()
                    that.player = null
                }
                that.dataInit();
            }, 0);
        },
          '$i18n.locale'() {
    this.dataInit()
  }
    },
    mounted() {
        const that = this;
        const store = this.$store.state
        this.indexs = this.$route.query.index ? this.$route.query.index : store.equipmentIndex;
        this.deviceName = store.equipmentList[this.indexs - 1].deviceName
        this.deviceState = store.equipmentList[this.indexs - 1].deviceState
        // this.getTime()
       
   
      
        setTimeout(() => {
            that.dataInit();
            that.timer && clearInterval(that.timer)
            that.timer = setInterval(() => {
                that.dataInit();
            }, 60000);
        }, 0);

    },
    beforeDestroy() {
        const that = this;
        // 销毁播放器
        if (this.player) {
            // this.player.dispose();
            this.player.stop()
            this.player.destroy()
            this.player = null
        }
        clearInterval(this.statusInterval) && this.statusInterval
        that.timer && clearInterval(that.timer)
        this.$bus.$off('refreshTime')
    },
    methods: {
        getPackageTime(){
 
           var item= this.$store.state.iccidList.find(item=> item?.iccid==this.$store.state.equipmentList[this.indexs - 1].iccidcode)
          return item? item.packageTime: this.$t('index.noData')   
        },
         getPackageTimeColor(){
         
           var item= this.$store.state.iccidList.find(item=>item?.iccid==this.$store.state.equipmentList[this.indexs - 1].iccidcode)

          return item? item.expired:false
        },
        openVolt(){
            this.voltModel=true
        },
        openDataModel() {
            this.dataModel = true
        },
        tableRowClassName({ row, rowIndex }) {
            if (rowIndex % 2 == 1) {
                return 'warning-row';
            } else if (rowIndex % 2 == 0) {
                return 'success-row';
            }
            return '';
        },
        delMessage(item) {
            var data = {
                messageId: item.id
            }
            this.api.delMessage(data).then(res => {
                if (res.data.code == 200) {
                    this.$message({
                        message: this.$t('message.delete')   ,
                        type: "success",
                    });
                    this.getMessageList()
                } else {
                    this.$message.error(res.data.msg);
                }
            })
        },
        getMessageList() {
            var data = {
                deviceId: this.warnForm.deviceId
            }
            this.api.messageList(data).then(res => {
                if (res.data.code == 200) {
                    this.tableData = res.data.data
                } else {
                    this.$message.error(res.data.msg);
                }
            })
        },
        addMessage() {
            this.api.addWarnMessage(this.warnForm).then(res => {
                if (res.data.code == 200) {
                    this.$message({
                        message: this.$t('message.add'),
                        type: "success",
                    });
                    var userid = JSON.parse(localStorage.getItem('userInfo')).userid
                    this.warnForm = {
                        'deviceId': this.warnForm.deviceId,
                        "userId": userid,
                        "environmentData": '',
                        "environmentId": '',
                        "unit": '',
                        "phonenumber": '',
                        "phonenumber2": ''
                    }
                      
          
                    this.warnModelSel1 = ''
                    this.warnModelSel2 = ''
                    this.$forceUpdate()
                    this.getMessageList()
                } else {
                    this.$message.error(res.data.msg);
                }
            })
        },
        returnWarn() {
            this.warnForm = {
                'deviceId': this.warnForm.deviceId,
                "userId": '',
                "environmentData": '',
                "environmentId": '',
                "unit": '',
                "phonenumber": '',
                "phonenumber2": ''
            }
            this.warnModel = false
        },
        //打开短信告警弹窗
        openWarn() {
            this.warnForm = {
                'deviceId': '',
                "userId": '',
                "environmentData": '',
                "environmentId": '',
                "unit": '',
                "phonenumber": '',
                "phonenumber2": ''
            }
            var store = this.$store.state
            var userid = JSON.parse(localStorage.getItem('userInfo')).userid
            this.warnForm.userId = userid
            this.warnForm.deviceId = store.equipmentList[this.indexs - 1].deviceId
            this.getMessageList()
            this.warnModel = true
        },
        //类型选择
        handleCommand(index) {
            this.warnModelSel1 = this.typeSelList[index].name
            this.warnForm.environmentId = this.typeSelList[index].environmentId
            this.warnForm.equipmentNumber = this.typeSelList[index].equipmentNumber
            //   this.TypeSel = this.typeSelList[index].name
            //   this.TypeSelIndex = this.typeSelList[index].value
            //   var dataNum = {
            //     target: {
            //       value: this.TypeSelIndex,
            //     },
            //   };
            //   this.changeBtn(21657 + (this.indexs - 1), dataNum);
        },
        //类型选择1
        handleCommand1(index) {
            this.warnModelSel2 = this.typeSelList1[index].name
            this.warnForm.unit = this.typeSelList1[index].value
        },
        padString(str, length) {
            return str.padStart(length, '0');
        },
        // createVideoNew(accessToken) {
        //     // divW和divH是获取了父级宽高 使播放容器能铺满div
        //     let divW = this.$refs.monitor.clientWidth
        //     let divH = this.$refs.monitor.clientHeight
        //     this.player = new EZUIKit.EZUIKitPlayer({
        //         id: 'video-js', // 视频容器ID
        //         accessToken: accessToken,
        //         url: this.url,
        //         // 官方url例子：ezopen://open.ys7.com/G39444019/1.live 也可并非.live结尾 详见GitHub
        //         // 播放主题  simple-极简版; standard-标准版; security-安防版; voice-语音版; 自定义主题详见GitHub
        //         template: 'security',
        //         useHardDev: true,// 开启高性能模式 依赖需高于7.7.x 截止到2023.11.7 建议保持最新版本为7.7.6
        //         plugin: ["talk"], // 加载插件，talk-对讲 非必填
        //         width: divW,  // 播放容器宽高 也可以直接设置成数字 如 1920 单位是px
        //         height: divH, // 播放容器宽高 也可以直接设置成数字 如 1080 单位是px
        //     })
            
        // },
        getIcon(item) {
            var index = item.index
            if (item.type == 3) {
                //加温水泵
                if (index == 0) {
                    return require('../../assets/img/fan-off.png')
                } else if (index == 1) {
                    return require('../../assets/img/status-icon3.png')
                } else {
                    return ''
                }

            } else if (item.type == 10) {
                //环流风扇
                if (index == 0) {
                    return require('../../assets/img/fan-off.png')
                } else if (index == 1) {
                    return require('../../assets/img/status-icon1.png')
                } else {
                    return ''
                }
            } else if (item.type == 4||item.type == 17) {
                //地热风机
                if (index == 0) {
                    return require('../../assets/img/fan-off.png')
                } else if (index == 1) {
                    return require('../../assets/img/status-icon1.png')
                } else {
                    return ''
                }
            } else if (item.type == 9) {
                //高压微雾
                if (index == 0) {
                    return require('../../assets/img/fan-off.png')
                } else if (index == 1) {
                    return require('../../assets/img/status-icon.png')
                } else {
                    return ''
                }
            }
            else if (item.type == 11) {
                //湿帘泵
                if (index == 0) {
                    return require('../../assets/img/fan-off.png')
                } else if (index == 1) {
                    return require('../../assets/img/status-icon5.png')
                } else {
                    return ''
                }
            }
            else if (item.type == 7) {
                //除雪
                if (index == 0) {
                    return require('../../assets/img/fan-off.png')
                } else if (index == 1) {
                    return require('../../assets/img/status-icon2.png')
                } else {
                    return ''
                }
            }

        },
        getNumberStatus(item) {
            var index = item.index
            if (item.type == 2 || item.type == 5 || item.type == 6 ) {
                //顶卷膜
                if (index == 0) {
                    return this.$t('realTime.status.still')
                } else if (index == 1) {
                    return this.$t('realTime.status.opening')
                } else if (index == 2) {
                    return this.$t('realTime.status.closing')
                } else {
                    return ''
                }
            }
           
           if(item.type == 16|| item.type == 13 || item.type == 14){
             if (index == 0) {
                    return this.$t('realTime.status.still')
                } else if (index == 1) {
                    return this.$t('realTime.status.unfolding')
                } else if (index == 2) {
                    return this.$t('realTime.status.folding')
                } else {
                    return ''
                }
           }
            if(item.type == 15|| item.type == 12){
             if (index == 0) {
                    return this.$t('realTime.status.still')
                } else if (index == 1) {
                    return this.$t('realTime.status.openWindow')
                } else if (index == 2) {
                    return this.$t('realTime.status.closeWindow')
                } else {
                    return ''
                }
           }
        },
        // createVideo() {

        //     // 创建视频播放器
        //     videojs.addLanguage('zh-CN', video_zhCN)
        //     this.player = videojs(this.$refs.videoPlayer, {
        //         techOrder: ['html5', 'hls'], // 优先使用HTML5播放器，如果不支持，则使用HLS
        //         sources: [{
        //             src: this.url, // 替换为您的.m3u8链接
        //             type: 'application/x-mpegURL'
        //         }],
        //         autoplay: true, // 自动播放
        //         controls: true, // 显示控制条
        //         language: 'zh-CN'
        //     });
        // },
        countData100(data) {
            var num = 0
            if (data) {
                num = data / 100
            } else {
                num = 0
            }
            return num
        },

        //16进制转为时间 16位无符号高字节是时，低字节是分
        convertToTimeMinutes(hexValue) {
            // 将十进制数转换为16进制字符串
            let hexString = hexValue.toString(16);

            // 补零，确保结果是4位16进制数
            while (hexString.length < 4) {
                hexString = "0" + hexString;
            }

            return hexString;
        },
        insertColonEveryTwoDigits(inputString) {
            // 使用正则表达式将字符串每两位切割
            const chunks = inputString.match(/.{1,2}/g);
            return chunks.join(":");
            // 使用join方法将切割后的数组元素用冒号连接起来
        },
        // 判断iccid是否显示
        validateIccid(iccidcode) {
  // 如果 iccidcode 是 false（严格判断，排除 0、"" 等情况）
  if (iccidcode === false) {
    return false;
  }

  // 如果 iccidcode 不是字符串，先转为字符串（防止数字 0 等情况）
  const str = String(iccidcode);

  // 检测是否全为 0
  const isAllZeros = /^0+$/.test(str);

  // 检测是否包含中文（Unicode 范围：\u4e00-\u9fa5）
  const hasChinese = /[\u4e00-\u9fa5]/.test(str);

  // 如果全为 0 或包含中文，返回 false
  if (isAllZeros || hasChinese) {
    return false;
  }

  // 其他情况返回 true（表示有效）
  return true;
},
        //countType计算类型 
        //0是原数据 
        //1是原数据-400 
        //2是原数据/10 
        //3是(原数据-400) / 10
        //4是(原数据-1000) / 10
        countType1(data) {
            if(data==undefined){
                return ''
            }
            var num = data - 400
            return num.toFixed(2)
        },
        countType5(data) {
            if(data==undefined){
                return ''
            }
            var num = data / 100
            return num.toFixed(2)
        },
        countType2(data) {
            if(data==undefined){
                return ''
            }
            var num = data / 10
            return num.toFixed(2)
        },
        countType3(data) {
            if(data==undefined){
                return ''
            }
            var num = (data - 400) / 10
            return num.toFixed(2)
        },
        countType4(data) {
            if(data==undefined){
                return ''
            }
            var num = (data - 1000) / 10
            return num.toFixed(2)
        },
        //右上角数据过滤
        getControlData(item) {
            var x = item.environmentData
            var num = item.num
            if (item.formula == '12') {
                if (x < 22 || x > 337) {
                    return this.$t('realTime.directions.north')
                } else if (x >= 22 && x <= 67) {
                    return this.$t('realTime.directions.northeast')
                } else if (x > 67 && x < 112) {
                    return this.$t('realTime.directions.east')
                } else if (x >= 112 && x <= 157) {
                    return this.$t('realTime.directions.southeast')
                } else if (x > 157 && x < 202) {
                    return this.$t('realTime.directions.south')
                } else if (x >= 202 && x <= 247) {
                    return this.$t('realTime.directions.southwest')
                } else if (x > 247 && x < 292) {
                    return this.$t('realTime.directions.west')
                } else if (x >= 292 && x <= 337) {
                    return this.$t('realTime.directions.northwest')
                }
            } else {
                return num
            }
        },
        dataInit() {
            var store = this.$store.state
            var equipmentId = store.equipmentList[this.indexs - 1].deviceId
            // var data = {
            //     equipmentId: store.equipmentList[this.indexs - 1].deviceId,
            //     // pattern: 0, //需要根据文档填写 //6目标ph-数值
            //     // regNum: 73,
            // };
          
            var selData={
                messageId:store.equipmentList[this.indexs - 1].deviceId
            }
          var params={
                    equipmentId:store.equipmentList[this.indexs - 1].deviceId,
                    enName:getLanguage()
                }
            this.api.selnowmes(selData).then(res=>{
        
            if(res.data.code==200){
                this.typeSelList=res.data.data
            }else{
                 this.typeSelList=[]
            }
        })
            var list = store.typeList
            if (this.deviceName == 1) {
                this.api.postRtdata(params).then((res) => {
                    if (res.data.code == 200) {
                        this.inputData = res.data.data;
                        this.list = []
                
                        this.updateTime=res.data.data.length?res.data.data[0].updateTime:''
                        
                        this.inputData.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    var num = 0
                                    var name = ''
                                  
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                
                                    if (el.targetValue == 1) {
                                        if (el.equipmentNumber == 0) {
                                            name = this.$t('realTime.target') + el.environmentDataId
                                        } else {
                                            name = this.$t('realTime.target') + el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    } else {
                                        if (el.equipmentNumber == 0) {
                                            name = '1#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else if (el.equipmentNumber == 15) {
                                            name = '2#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else {
                                            name = el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    }


                                    this.list.push({
                                        ...el,
                                        name: name,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)

                                    })

                                }
                            })
                        })
                    } else {
                             this.inputData = [];
                        this.list = []
                        // this.$message.error(res.data.msg);
                    }
                });
                var data1 = store.equipmentList[this.indexs - 1].deviceId

                this.api.postFsdata(params).then(res => {
                    if (res.data.code == 200) {
                        var chartsData = res.data.data
                        realTimeLine('realTime-line', chartsData, data1)
                    } else {
                           var chartsData = []
                        // this.$message.error(res.data.msg);
                    }
                })
                var nowDevice = store.equipmentList[this.indexs - 1]
                var data2 = {
                    cameraid: nowDevice.cameraSerialNumber,
                    channelid: nowDevice.cameraChannelNumber
                }
                this.imgUrl = nowDevice.hls
                //当前没有设备 默认写死 后续有数据需要改回去
                // var data2 = {
                //     cameraid: 'L18357958',
                //     channelid: '1'
                // }
                if (!this.player) {
                 
                    // this.api.getGethls(data2).then(res => {
                    //     if (res.data.code == 200) {
                    //         this.url = res.data.data.ezopen
                    //         this.createVideoNew(res.data.data.accesstoken)
                    //     } else {
                        // this.imgUrl = nowDevice.hls
                    //     }
                    // })
                }
           
            } else if (this.deviceName == 10) {
                this.api.getControlRtdata(params).then((res) => {
                    if (res.data.code == 200) {
                        this.inputData = res.data.data;
                        this.list = []
                       
                        this.updateTime=res.data.data[0].updateTime
                        this.inputData.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    var num = 0
                                    var name = ''
                           
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                    //    }
                                    if (el.targetValue == 1) {
                                        if (el.equipmentNumber == 0) {
                                            name = this.$t('realTime.target') + el.environmentDataId
                                        } else {
                                            name = this.$t('realTime.target') + el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    } else {
                                        if (el.equipmentNumber == 0) {
                                            name = '1#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else if (el.equipmentNumber == 15) {
                                            name = '2#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else {
                                            name = el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    }
                                    this.list.push({
                                        ...el,
                                        name: name,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)

                                    })

                                }
                            })
                        })
                    } else {
                                 this.inputData = [];
                        this.list = []
                        // this.$message.error(res.data.msg);
                    }
                });
                this.api.getControlRtDatastation(params).then(res => {
                    this.controlList = []
                    if (res.data.code == 200) {
                        res.data.data.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    // console.log(el1);
                                    var num = 0
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                    this.controlList.push({
                                        ...el,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)
                                    })
                                }
                            })
                        })
                    }
                    // console.log(this.controlList);
                })

                this.getStatus()
                this.getStatePermissionStatus()
                clearInterval(this.statusInterval) && this.statusInterval
                this.statusInterval = setInterval(() => {
                    if (this.deviceName == 10) {
                        this.getStatus()
                    }
                }, this.statusTime * 1000);
                var data1 = store.equipmentList[this.indexs - 1].deviceId
               
                this.api.getControlFsdata(params).then(res => {
                    if (res.data.code == 200) {
                        var chartsData = res.data.data
                        realTimeLine('realTime-line', chartsData, data1)
                    } else {
                          var chartsData = []
                        // this.$message.error(res.data.msg);
                    }
                })
                var nowDevice = store.equipmentList[this.indexs - 1]
                var data2 = {
                    cameraid: nowDevice.cameraSerialNumber,
                    channelid: nowDevice.cameraChannelNumber
                }
                this.imgUrl = nowDevice.hls
                //当前没有设备 默认写死 后续有数据需要改回去
                // var data2 = {
                //     cameraid: 'L18357958',
                //     channelid: '1'
                // }
                if (!this.player) {
                    // this.imgUrl = nowDevice.hls
                    // this.api.getGethls(data2).then(res => {
                    //     // console.log(res.data, 11);
                    //     if (res.data.code == 200) {
                    //         this.url = res.data.data.ezopen
                    //         this.createVideoNew(res.data.data.accesstoken)
                    //     } else {
                    //         this.imgUrl = nowDevice.hls
                    //     }
                    // })
                }
            } else if (this.deviceName == 30) {
                 this.api.getControlRtDatastation(params).then(res => {
                    this.controlList = []
                      this.list = []
                    this.updateTime=res.data.data[0].updateTime
                    if (res.data.code == 200) {
                        res.data.data.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    // console.log(el1);
                                    var num = 0
                                    var name = ''
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                    if(el.equipmentName==30){
                                           if (el.targetValue == 1) {
                                        if (el.equipmentNumber == 0) {
                                            name = this.$t('realTime.target') + el.environmentDataId
                                        } else {
                                            name = this.$t('realTime.target') + el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    } else {
                                        if (el.equipmentNumber == 0) {
                                            name = '1#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else if (el.equipmentNumber == 15) {
                                            name = '2#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else {
                                            name = el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    }
                                    }else{
                                        name=el.environmentDataId
                                    }
                                

                                    this.list.push({
                                        ...el,
                                        name: name,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)
                                    })
                                    this.controlList.push({
                                        ...el,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)
                                    })
                                }
                            })
                        })
                    }
                    // console.log(this.controlList);
                })
                this.api.getControlChartdata(params).then(res => {
                    if (res.data.code == 200) {
                        res.data.data.forEach((el, index) => {
                            var chartsData = res.data.data
                            realTimeLine('realTime-line', chartsData, equipmentId)
                        })
                    }else{

                    }
                })

            }else if(this.deviceName==20){
                this.getFi_rtdata(params)
                this.getControlRtDatastation(params)
              
                var nowDevice = store.equipmentList[this.indexs - 1]
                this.imgUrl = nowDevice.hls
                    this.chart_fidata(params)
             
            }else if(this.deviceName==40){
                   this.api.getdataRtdata(params).then((res) => {
                    if (res.data.code == 200) {
                        this.inputData = res.data.data;
                        this.list = []
                
                        this.updateTime=res.data.data.length?res.data.data[0].updateTime:''
                        
                        this.inputData.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    var num = 0
                                    var name = ''
                                  
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                
                                    if (el.targetValue == 1) {
                                        if (el.equipmentNumber == 0) {
                                            name = this.$t('realTime.target') + el.environmentDataId
                                        } else {
                                            name = this.$t('realTime.target') + el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    } else {
                                        if (el.equipmentNumber == 0) {
                                            name = '1#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else if (el.equipmentNumber == 15) {
                                            name = '2#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else {
                                            name = el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    }


                                    this.list.push({
                                        ...el,
                                        name: name,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)

                                    })

                                }
                            })
                        })
                    } else {
                        // this.$message.error(res.data.msg);
                        this.inputData =[];
                        this.list = []
                    }
                });
                  var data1 = store.equipmentList[this.indexs - 1].deviceId

                this.api.postFsdata(params).then(res => {
                    if (res.data.code == 200) {
                        var chartsData = res.data.data
                        realTimeLine('realTime-line', chartsData, data1)
                    } else {
                        // this.$message.error(res.data.msg);
                    }
                })
                this.getControlRtDatastation(params)
              
                var nowDevice = store.equipmentList[this.indexs - 1]
                this.imgUrl = nowDevice.hls
            }

        },
        chart_fidata(params){
             var store = this.$store.state
               this.api.chart_fidata(params).then(res=>{
                    if (res.data.code == 200) {
                        var chartsData = res.data.data
                         var data1 = store.equipmentList[this.indexs - 1].deviceId
                        realTimeLine('realTime-line', chartsData, data1)
                    } else {
                        // this.$message.error(res.data.msg);
                    }
                })
        },
        getControlRtDatastation(params){
            
            var store = this.$store.state
               var list = store.typeList
              this.api.getControlRtDatastation(params).then(res => {
                    this.controlList = []
                    if (res.data.code == 200) {
                        res.data.data.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    // console.log(el1);
                                    var num = 0
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                    this.controlList.push({
                                        ...el,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)
                                    })
                                }
                            })
                        })
                    }
                    // console.log(this.controlList);
                })
        },
        getFi_rtdata(params){
            
            var store = this.$store.state
               var list = store.typeList
              this.api.getFi_rtdata(params).then(res=>{
                    if (res.data.code == 200) {
                        this.inputData = res.data.data;
                        this.list = []
                
                        this.updateTime=res.data.data[0].updateTime
                        
                        this.inputData.forEach((el, index) => {
                            list.forEach((el1, index1) => {
                                if (el.formula == el1.value) {
                                    var num = 0
                                    var name = ''
                                    if (el.equipmentStart == 0) {
                                        num = this.$t('realTime.fault')
                                    } else {
                                        num = el.environmentData + el1.unit
                                    }
                                 
                                    if (el.targetValue == 1) {
                                        if (el.equipmentNumber == 0) {
                                            name = this.$t('realTime.target') + el.environmentDataId
                                        } else {
                                            name = this.$t('realTime.target') + el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    } else {
                                        if (el.equipmentNumber == 0) {
                                            name = '1#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else if (el.equipmentNumber == 15) {
                                            name = '2#'+this.$t('realTime.average')  + el.environmentDataId
                                        } else {
                                            name = el.equipmentNumber + '#' + el.environmentDataId
                                        }
                                    }


                                    this.list.push({
                                        ...el,
                                        name: name,
                                        num: num,
                                        img: require(`../../assets/image/real-time-${el.formula}.png`)

                                    })

                                }
                            })
                        })
                    } else {
                        // this.$message.error(res.data.msg);
                    }
                })
        },
        //获取全部status数据
        getStatePermissionStatus() {
            this.api.getStatePermissionStatus().then(res => {
                if (res.data.code == 200) {
                    this.allDevicestatus = res.data.data
                    this.getPermissionStatus()
                }
            })
        },
        //获取当前设备的权限
        getPermissionStatus() {
            var store = this.$store.state
            var TargetValue = {
                deviceId: store.equipmentList[this.indexs - 1].deviceId
            }
            this.api.getPermissionStatus(TargetValue).then(res => {
                if (res.data.code == 200) {
                    this.nowDevicestatus = res.data.data
                    var list1 = this.allDevicestatus
                    var list2 = this.nowDevicestatus
                    var resultArray = []
                    // 遍历 list1
                    for (const item1 of list1) {
                        // 查找在 list2 中是否有相同 id 的对象
                        const matchingItem = list2.find(item2 => item2.id === item1.id);

                        // 如果找到匹配的对象，则在 list1 对应的对象中添加 select 属性
                        if (matchingItem) {
                            item1.select = true;
                        } else {
                            // 如果没找到匹配的对象，则添加 select 属性并设置为 false
                            item1.select = false;
                        }

                        // 将处理后的对象添加到结果数组中
                        resultArray.push(item1);
                    }
                    this.selDevicestatus = resultArray
                }
            })
        },
        selClick(item) {
            var store = this.$store.state
            var deviceId = store.equipmentList[this.indexs - 1].deviceId
            var statusId = item.id
            if (item.select) {
                item.select = false
                this.$forceUpdate();
                this.api.delPermissionStatus(deviceId, statusId).then((res => {
                    if (res.data.code == 200) {
                        this.$message({
                            message: this.$t('message.change'),
                            type: "success",
                        });
                        this.getPermissionStatus()
                    } else {
                        this.$message({
                            message: res.data.msg,
                            type: "warning",
                        });
                    }
                }))
            } else {
                item.select = true
                this.$forceUpdate();
                this.api.addPermissionStatus(deviceId, statusId).then((res => {
                    if (res.data.code == 200) {
                        this.$message({
                            message: this.$t('message.change'),
                            type: "success",
                        });
                        this.getPermissionStatus()
                    }
                }))
            }
        },
        //删除设备
        delStatus(item, index) {
            this.statusList[index].deltrue = false
            var store = this.$store.state
            var deviceId = store.equipmentList[this.indexs - 1].deviceId
            var statusId = item.id
            this.api.delPermissionStatus(deviceId, statusId).then((res => {
                if (res.data.code == 200) {
                    this.getPermissionStatus()
                }
            }))
        },
        //获取当前权限能看到的
        getStatus() {
            var store = this.$store.state
            var TargetValue = {
                deviceId: store.equipmentList[this.indexs - 1].deviceId
            }
            this.api.getControlGetState(TargetValue).then(res => {
                if (res.data.code == 200) {
                    this.voltData=res.data.data
                    this.voltData['1208']=this.countType5(res.data.data['1208'])
                    this.voltData['1209']=this.countType1(res.data.data['1209'])
                    this.voltData['1210']=this.countType5(res.data.data['1210'])
                    this.voltData['1211']=this.countType1(res.data.data['1211'])
                    this.voltData['1212']=this.countType5(res.data.data['1212'])
                    this.voltData['1213']=this.countType1(res.data.data['1213'])
                    this.voltData['1214']=this.countType5(res.data.data['1214'])
                    this.voltData['1215']=this.countType1(res.data.data['1215'])
                    this.voltData['1216']=this.countType5(res.data.data['1216'])
                    this.voltData['1217']=this.countType1(res.data.data['1217'])
                    this.voltData['1218']=this.countType5(res.data.data['1218'])
                    this.voltData['1219']=this.countType1(res.data.data['1219'])
                    if (res.data.data["1119"]) {
                        this.sunrise = this.insertColonEveryTwoDigits(
                            this.convertToTimeMinutes(res.data.data["1119"])
                        );
                    } else {
                        this.sunrise = ''
                    }
                    if (res.data.data["1120"]) {
                        this.sunset = this.insertColonEveryTwoDigits(
                            this.convertToTimeMinutes(res.data.data["1120"])
                        );
                    } else {
                        this.sunset = ''
                    }

                    const statusList = []
                    this.nowDevicestatus.forEach((el, index) => {
                        if (el.id == 1) {
                            //风机
                            var fandata = {}
                            fandata.open = res.data.data['1023']
                            fandata.id = el.id
                            fandata.type = 1
                            fandata.name = el.nickName
                            fandata.status = []
                            var num = res.data.data['1024'] ? res.data.data['1024'] : 0
                            var num1 = this.padString(num.toString(2), 5)
                            var openListNew = []
                            openListNew = num1.split("")
                            fandata.status = openListNew.reverse()
                            statusList.push(fandata)
                        } else if (el.id == 17) {
                            //风机
                            var fandata = {}
                            fandata.open = res.data.data['1078']
                            fandata.id = el.id
                            fandata.type = 1
                            fandata.name = el.nickName
                            fandata.status = []
                            var num = res.data.data['1079'] ? res.data.data['1079'] : 0
                            var num1 = this.padString(num.toString(2), 5)
                            var openListNew = []
                            openListNew = num1.split("")
                            fandata.status = openListNew.reverse()
                            statusList.push(fandata)
                        } else if (el.id == 12) {
                            //补光灯
                            var fandata = {}
                            fandata.open = res.data.data['1068']
                            fandata.id = el.id
                            fandata.type = 8
                            fandata.name = el.nickName
                            fandata.status = []
                            var num = res.data.data['1069'] ? res.data.data['1069'] : 0
                            var num1 = this.padString(num.toString(2), 8)
                            var openListNew = []
                            openListNew = num1.split("")
                            fandata.status = openListNew.reverse()
                            statusList.push(fandata)
                        } else if (el.id == 39) {
                            //冷暖风机
                            var fandata = {}
                            fandata.open = res.data.data['1175']
                            fandata.id = el.id
                            fandata.type = 18
                            fandata.name = el.nickName
                            fandata.status = []
                            fandata.count = res.data.data['1176'] 
                            var num = res.data.data['1177'] ? res.data.data['1177'] : 0
                            var num1 = this.padString(num.toString(2), 4)
                            var openListNew = []
                            openListNew = num1.split("")
                            fandata.status = openListNew.reverse()
                            statusList.push(fandata)
                        } 
                        else if (el.id == 2 || el.id == 3 || el.id == 4 || el.id == 5) {
                            //顶卷膜
                            var statusData = { name: el.nickName, type: 2, id: el.id, open: res.data.data[(1025 + ((el.id - 2) * 3))], progress: res.data.data[(1027 + ((el.id - 2) * 3))], index: res.data.data[(1026 + ((el.id - 2) * 3))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 6) {
                            //加温水泵
                            var statusData = { name: el.nickName, type: 3, id: el.id, open: res.data.data['1000'], progress: 0, index: res.data.data['1001'], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 7) {
                            //地热风机
                            var statusData = { name: el.nickName, type: 4, id: el.id, open: res.data.data['1002'], progress: 0, index: res.data.data['1003'], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 8) {
                            //上风口
                            var statusData = { name: el.nickName, type: 5, id: el.id, open: res.data.data['1004'], progress: res.data.data['1006'], index: res.data.data['1005'], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 9) {
                            //下风口
                            var statusData = { name: el.nickName, type: 5, id: el.id, open: res.data.data['1007'], progress: res.data.data['1009'], index: res.data.data['1008'], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 10) {
                            //卷被
                            var statusData = { name: el.nickName, type: 6, id: el.id, open: res.data.data['1010'], progress: res.data.data['1012'], index: res.data.data['1011'], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 11) {
                            //除雪
                            var statusData = { name: el.nickName, type: 7, id: el.id, open: res.data.data['1013'], progress: 0, index: res.data.data['1014'], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 13 || el.id == 14) {
                            //高压微雾
                            var statusData = { name: el.nickName, type: 9, id: el.id, open: res.data.data[(1070 + ((el.id - 13) * 2))], progress: 0, index: res.data.data[(1071 + ((el.id - 13) * 2))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 15 || el.id == 16) {
                            //环流风扇
                            var statusData = { name: el.nickName, type: 10, id: el.id, open: res.data.data[(1074 + ((el.id - 15) * 2))], progress: 0, index: res.data.data[(1075 + ((el.id - 15) * 2))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 18 || el.id == 19) {
                            //湿帘泵
                            var statusData = { name: el.nickName, type: 11, id: el.id, open: res.data.data[(1080 + ((el.id - 18) * 2))], progress: 0, index: res.data.data[(1081 + ((el.id - 18) * 2))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 20 || el.id == 21) {
                            //湿帘外翻窗
                            var statusData = { name: el.nickName, type: 12, id: el.id, open: res.data.data[(1084 + ((el.id - 20) * 3))], progress: res.data.data[(1086 + ((el.id - 20) * 3))], index: res.data.data[(1085 + ((el.id - 20) * 3))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 22 || el.id == 23) {
                            //内遮阳
                            var statusData = { name: el.nickName, type: 13, id: el.id, open: res.data.data[(1090 + ((el.id - 22) * 3))], progress: res.data.data[(1092 + ((el.id - 22) * 3))], index: res.data.data[(1091 + ((el.id - 22) * 3))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 24 || el.id == 25) {
                            //外遮阳
                            var statusData = { name: el.nickName, type: 14, id: el.id, open: res.data.data[(1096 + ((el.id - 24) * 3))], progress: res.data.data[(1098 + ((el.id - 24) * 3))], index: res.data.data[(1097 + ((el.id - 24) * 3))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 26 || el.id == 27 || el.id == 28 || el.id == 29) {
                            //通风窗1234
                            var statusData = { name: el.nickName, type: 15, id: el.id, open: res.data.data[(1102 + ((el.id - 26) * 3))], progress: res.data.data[(1104 + ((el.id - 26) * 3))], index: res.data.data[(1103 + ((el.id - 26) * 3))], count: res.data.data[1115 + (el.id - 26)] }
                            statusList.push(statusData)
                        } else if (el.id == 30 || el.id == 31) {
                            //内保温
                            var statusData = { name: el.nickName, type: 16, id: el.id, open: res.data.data[(1182 + ((el.id - 30) * 3))], progress: res.data.data[(1184 + ((el.id - 30) * 3))], index: res.data.data[(1183 + ((el.id - 30) * 3))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id == 32 || el.id == 33) {
                            //通风窗56
                            var statusData = { name: el.nickName, type: 15, id: el.id, open: res.data.data[(1188 + ((el.id - 32) * 3))], progress: res.data.data[(1190 + ((el.id - 32) * 3))], index: res.data.data[(1189 + ((el.id - 32) * 3))], count: res.data.data[1194 + (el.id - 32)] }
                            statusList.push(statusData)
                        } else if (el.id == 34 || el.id == 35|| el.id == 36|| el.id == 37) {
                            //立面保温1234
                            var statusData = { name: el.nickName, type: 16, id: el.id, open: res.data.data[(1196 + ((el.id - 34) * 3))], progress: res.data.data[(1198 + ((el.id - 34) * 3))], index: res.data.data[(1197 + ((el.id - 34) * 3))], count: 0 }
                            statusList.push(statusData)
                        } else if (el.id ==38) {
                            //空调
                            var statusData = { name: el.nickName, type:17, id: el.id, open: res.data.data['1160'], progress: 0, index: res.data.data['1161'], count: res.data.data['1162'] }
                            statusList.push(statusData)
                        } else if (el.id ==40||el.id ==41) {
                            //CO2补气
                            var statusData = { name: el.nickName, type:11, id: el.id, open: res.data.data[(1178 + ((el.id - 40) * 2))], progress: 0, index: res.data.data[(1179 + ((el.id - 40) * 2))], count: 0 }
                            statusList.push(statusData)
                        }else if (el.id ==42||el.id ==43||el.id ==44||el.id ==45||el.id ==46||el.id ==47||el.id ==48||el.id ==49) {
                            //电磁阀
                            var statusData = { name: el.nickName, type:9, id: el.id, open: res.data.data[(1166 + (el.id - 42))], progress: 0, index:this.getDCF(el,res.data.data), count: 0 }
                            statusList.push(statusData)
                        }

                    })

                    this.statusList = statusList
                 

                    setTimeout(() => {

                        this.statusList.forEach((el, index) => {
                            if (el.open != 0 && (el.type == 6 || el.type == 5 || el.type == 2 || el.type == 15 || el.type == 14 ||el.type == 16 || el.type == 13 || el.type == 12)) {

                                setTimeout(() => {
                                    statusCharts(`statusCharts${index}`, el.progress)
                                }, 0);
                            }
                        })
                    }, 10);
                       this.$forceUpdate();

                } else {
                    this.statusList = []

                    this.$forceUpdate();
                    // this.$message.error(res.data.msg);
                }
            })
        },
            //二进制转换后的补全
        padString(str, length) {
            return str.padStart(length, '0');
        },
        getDCF(item,data){
            var index=item.id-42
            var num=data[1174]
                var num1 = this.padString(num.toString(2), 8)

            var openListNew = []
            openListNew = num1.split("")
           var actList = openListNew.reverse();
           
            return actList[index]
        },
        getTime() {
            this.time = getnowtime()
            const that = this
            setInterval(() => {
                that.time = getnowtime()
            }, 1000);
        },
    },

}
</script>

<style lang="scss">
.video-js-select-quality-item {
    color: rgba(0, 0, 0, 0.85) !important;
}

.set-status-blue {
    color: #409eff;
    font-size: 14px;
    cursor: pointer;
    padding: 5px 0;
}

.set-status-red {
    color: red;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 0;
}

.del-text {
    color: #000;
    font-size: 14px;
}

.color-blue {
    span {
        color: #409eff;
        font-size: 14px;
    }
}

.status-save {
    width: 45px;
    height: 28px;
    text-align: center;
    border-radius: 4px;
    border: 1px solid #dcdfe6;
    color: #606266;
    font-size: 14px;
}
</style>