<template>
  <div>
    <div class="box-first">
      <div class="video-box">
        <canvas id="video-1" />
      </div>
      <div class="infolist">
        <div class="userlist">
          <ul>
            <li>
              <UserItem title="用户名信息" name="USER INFORMATION" />
              <label>驾驶员</label>
              <pannel-item :value="driverInfo.name" />
              <label>联系方式</label>
              <pannel-item :value="driverInfo.mobile" />
              <label>身份证号</label>
              <pannel-item :value="driverInfo.cardNum" />
              <label>所属车队</label>
              <pannel-item :value="driverInfo.motorcade" />
            </li>
            <li>
              <UserItem title="车辆信息" name="VEHICLE INFORMATION" @ShowCarline="ShowCarline" />
              <div class="carVin">
                <label>车辆VIN码</label>
                <label class="linkeState" v-if="vehicleInfo.conState==1">
                    <div><img src="./assets/link.png"></div>
                    <div>{{ Carlink }}</div>
                </label>
                <label class="linkeState" v-else>
                  <div><img src="./assets/break.png"></div>
                  <div class="break">未链接{{ totalSecond?totalSecond+'s' :' '}}</div>
                </label>
              </div>
              <pannel-item :value="vehicleInfo.vin" />
              <div class="carinfo">
                <p>
                  <label>车牌号</label>
                  <pannel-item :value="vehicleInfo.plate" label="车牌号" @HandleEditPlate="HandleEditPlate" />
                </p>
                <p>
                  <label>到位状态</label>
                  <pannel-item :value="Carsensor" />
                </p>
              </div>
              <div class="carinfo">
                <p>
                  <label>累计里程 (km)</label>
                  <pannel-item :value="vehicleInfo.mileage" />
                </p>
                <p>
                  <label>解锁状态</label>
                  <pannel-item :value="Carlock" />
                </p>
              </div>
              <div class="carinfo">
                  <p>
                    <label>累计换电 (次)</label>
                    <pannel-item :value="vehicleInfo.swap" />
                  </p>
                  <p>
                    <label>上电状态</label>
                    <pannel-item :value="Carbattery" />
                </p>
              </div>
            </li>
            <li>
              <UserItem title="电池信息" name="Battery INFORMATION" />
              <label>电池编号</label>
              <pannel-item :value="batteryInfo.sn" />
              <label>电池仓</label>
              <pannel-item :value="batteryInfo.space" />
              <div class="carinfo">
                <P>
                  <label>换电电池SOC</label>
                  <pannel-item :value="batteryInfo.swapSoc | exchangerFilter" />
                </P>
                <P>
                  <label>车辆电池SOC</label>
                  <pannel-item :value="batteryInfo.vehSoc" />
                </P>
              </div>
              <label>换电量(kWh)</label>
              <pannel-item :value="batteryInfo.swapCapacity" />
            </li>
          </ul>
          <div class="bin-info">
            <!--
              * @step：动画步骤
              * @BatteryOnCar：控制车上亏电电池是否亮起
              * @storeInfoList：充电仓电池列表
              * @swapCode：换电电池编号
              * @connectionState：车站连接状态 1已连接 0断开连接
              * @swapCurrent：绿电池缓存电流,
              * @swapSoc：绿电池缓存SOC,
            -->
            <BinInfomation
              :battery-on-car="swapAnimationVo.soc"
              :store-info-list="storeInfoList"
              :swap-code="swapAnimationVo.swapCode*1-1"
              :step="swapAnimationVo.step"
              :connection-state="swapAnimationVo.connectionState"
              :swap-soc="swapAnimationVo.swapSoc"
              :swap-current="swapAnimationVo.swapCurrent"
            />
          </div>
        </div>
      </div>
    </div>
    <div class="box-second">
      <sub-title
        name="换电业务流程"
        statement="power exchange business process"
        :logInfo="swapProcess.logInfo"
        swaplogInfo="1"
        :swapTime="swapTime"
        :robotState="robotInfoVo.robotState"
        :plcpause="robotInfoVo.pause"
        :forbidLockState="forbidLockState"
      />
      <process-symbol
        :processtext="processtext"
        :process-done="processDone"
      />
      <div class="process-details">
        <div v-for="(item, index) in processDone" :key="index" class="detail">
          <span
            class="process-state"
            :style="{color: item === true ? 'rgb(4,220,223)' : 'rgb(69,85,115)',}"
          >
            <div v-if="swapProcess.validation === null && index === 0">待验证</div>
            <div v-else-if="swapProcess.validation && index === 0">
              {{ swapProcess.validation }}
            </div>

            <div v-if="swapProcess.apply === null && index === 1">待申请</div>
            <div v-else-if="swapProcess.apply && index === 1">
              {{ swapProcess.apply }}
            </div>

            <div v-if="swapProcess.begin === null && index === 2">待开始</div>
            <div v-else-if="swapProcess.begin && index === 2">
              {{ swapProcess.begin }}
            </div>

            <div v-if="swapProcess.swap === null && index === 3">待更换</div>
            <div v-else-if="swapProcess.swap && index === 3">
              {{ swapProcess.swap }}
            </div>

            <div v-if="swapProcess.end === null && index === 4">待确定</div>
            <div v-else-if="swapProcess.end && index === 4">
              {{ swapProcess.end }}
            </div>
          </span>
          <quarter-change
            :percent="percent[index]"
            :process-deg="processDeg[index]"
            :is-done="item"
            :image="processImages[index]"
          />
        </div>
      </div>
    </div>
    <div class="box-three">
      <div class="exchange-statistics">
        <sub-title name="换电信息" statement="Power Change Details" />
        <div class="statistic-boxes">
          <statistic-item
            label="今日换电次数"
            :value="swapInfo.todaySwapFreq"
            unit="次"
          />
          <statistic-item
            label="今日换电量"
            :value="swapInfo.todayCapacity"
            unit="kWh"
          />
          <statistic-item
            label="累计换电次数"
            :value="swapInfo.swapFreq"
            unit="次"
          />
          <statistic-item
            label="累计换电量"
            :value="swapInfo.capacity"
            unit="kWh"
          />
          <statistic-item
            label="当前可换电池"
            :value="swapInfo.quantity"
            unit="块"
          />
          <statistic-item
            label="今日告警数"
            :value="swapInfo.todayAlarmFreq"
            unit="次"
          />
        </div>
      </div>

      <div class="exchange-records">
        <sub-title name="换电记录" statement="Exchange Records" />
        <div class="exchange-details">
          <div class="header-row">
            <span class="v-plate">车牌号</span>
            <span class="v-type">车型</span>
            <span class="v-power">换电量</span>
            <span class="v-time">换电时间</span>
          </div>
          <div v-for="item in carRecord" :key="item.id" class="record-row">
            <span class="v-plate">{{ item.vehiclePlate }}</span>
            <span class="v-type">{{ item.modelName }}</span>
            <span class="v-power color-blue">{{ item.swapCapacity }} kWh</span>
            <span class="v-time">{{ item.swapBeginTime }}</span>
          </div>
        </div>
      </div>

      <div class="gate-details">
        <sub-title name="告警记录" statement="ALARM LOG" />
        <div class="recordlist">
          <div class="recordtilte">
            <span>告警代码</span><span>告警设备</span><span>告警信息</span><span>告警时间</span>
          </div>
          <div
            v-for="item in alarmRecordList"
            :key="item.id"
            class="recordinfo"
          >
            <span>{{ item.code }}</span><span>{{ item.equipment }}</span><span :title="item.info">{{ item.info }}</span><span>{{ item.beginTime }}</span>
          </div>
        </div>
      </div>
    </div>
    <!--实时车辆弹窗-->
    <div class="onlineManage">
      <el-dialog
        title="实时车辆连接信息"
        :visible.sync="dialogCarlineVisible"
        :destroy-on-close="true"
        width="1600px"
      >
        <div class="charge-table-bottom">
          <el-table
            :data="CarlineList"
            :header-cell-style="{
              background: '#1d283e',
              borderColor: '#2f3c86',
              height: '36px',
              lineHeight: '36px',
              color:'white',
              fontSize: '16px',
            }"
            stripe
            fit
            :height="tableheight-80"
            style="width: 100%"
          >
            <el-table-column label="车牌号">
                <template slot-scope="{row}">
                  <div class="iscar">
                    <span>{{ row.vehiclePlate }}</span><img src="./assets/iscar.png" v-if="vehicleInfo.plate==row.vehiclePlate">
                  </div>
                </template>
            </el-table-column>
            <el-table-column label="启动状态">
                <template slot-scope="{row}">
                  <span class="item" :class="{disable:row.state === 0}">{{ row.state === 0 ? '熄火' : '启动' }}</span>
                </template>
            </el-table-column>
            <el-table-column
              prop="vehicleVin"
              label="VIN码"
              width="160"
            />
            <!-- <el-table-column
              prop="mileage"
              label="行驶里程(KW)"
            />
            <el-table-column
              prop="sn"
              label="电池编号"
              width="220"
            />
            <el-table-column
              prop="Voltage"
              label="电压(V)"
            />
            <el-table-column
              prop="Current"
              label="电流(A)"
            />
            <el-table-column
              prop="swapSoc"
              label="SOC"
            />
            <el-table-column
              prop="swapSoh"
              label="SOH"
            />
            <el-table-column
              prop="driver"
              label="司机"
            />
            <el-table-column
              prop="phone"
              label="联系电话"
            /> -->
          </el-table>
        </div>
        <div class="pageblock">
          站内连接车辆数：<span>{{ CarlineList.length }}</span>
        </div>
        <div slot="footer" class="dialog-footer" />
      </el-dialog>
    </div>
    <!--实时车辆弹窗结束-->
    <!--修改车牌号弹窗-->
    <div class="rolemanage">
      <el-dialog title="编辑车牌号" :visible.sync="dialogPlateVisible"
        :destroy-on-close="true" @close="dialogClose">
        <el-form :model="ruleForm" :rules="rules" ref="PlateForm" v-loading="loading">
          <el-form-item label="编辑车牌号:" prop="plate">
            <el-input v-model="ruleForm.plate" placeholder="请输入您的车牌号"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button class="exit" @click="dialogPlateVisible = false">取消</el-button>
          <el-button type="primary" class="save" @click="handlePlate">确定</el-button>
        </div>
      </el-dialog>
    </div>
    <!--修改车牌号弹窗结束-->
  </div>
</template>

<script>
import { swapInfo, swapRecord, alarmRecord,CarOnline,EditPlate} from '@/api/powerCharge'
import UserItem from './components/UserItem.vue'
import PannelItem from './components/PannelItem.vue'
import BinInfomation from './components/BinInfomation.vue'
import SubTitle from './components/SubTitle.vue'
import ProcessSymbol from './components/ProcessSymbol.vue'
import QuarterChange from './components/QuarterChange.vue'
import StatisticItem from './components/StatisticItem.vue'
import '../../utils/jsmpeg.min'
import { getToken } from '@/utils/auth'
import { isLicensePlateNumberNER } from '@/utils'
export default {
  name: 'PowerChangeMonitoring',
  components: {
    UserItem,
    PannelItem,
    BinInfomation,
    SubTitle,
    ProcessSymbol,
    QuarterChange,
    StatisticItem
  },
  data() {
    return {
      ws: null,
      // 司机信息
      driverInfo: {
        name: '—',
        mobile: '—',
        cardNum: '—',
        motorcade: '—'
      },
      // 车辆信息开始
      vehicleInfo: {
        vin: '—',
        plate: '—',
        lockState: '—',
        mileage: '—',
        batteryState: '—',
        swap: '—',
        conState: '—',//监控120秒,1已连接 0未连接
        sensorState:'—',//车辆到位状态,1已到位 0未到位
      },
      batteryInfo: {
        sn: '—',
        vehSoc: '—',
        space: '—',
        swapSoc: '—',
        swapCapacity: '—'
      },
      // 电池动画
      swapAnimationVo: {
        step: 0, // 动画步骤
        soc: 0, // 车上电池SOC
        transitCode: null, // 中转仓编号
        swapCode: 0, // 换电仓编号
        connectionState: 0, // 车站连接状态
        swapSoc: 0, // 绿电池缓存数据
        swapCurrent: 0 // 绿电池缓存数据
      },
      storeInfoList: [], // 电池列表和充电机状态列表
      // 电池动画结束
      // 第二部分动画开始
      swapProcess: {
        logInfo:'', 
        // 第一步
        validation: null,
        valPercentage: null,
        valAngle: null,
        // 第二步
        apply: null,
        applyPercentage: null,
        applyAngle: null,
        // 第三步
        begin: null,
        beginPercentage: null,
        beginAngle: null,
        // 第四步
        swap: null,
        swapPercentage: null,
        swapAngle: null,
        // 第五步
        end: null,
        endPercentage: null,
        endAngle: null
      },
      processtext: [
        '车辆验证',
        '发起换电申请',
        '卸载车辆电池',
        '安装满电电池',
        '换电完成'
      ],
      processImages: [
        'yewu1.png',
        'yewu2.png',
        'yewu3.png',
        'yewu4.png',
        'yewu5.png'
      ],
      processDone: [false, false, false, false, false],
      percent: [0, 0, 0, 0, 0],
      processDeg: [0, 0, 0, 0, 0],
      // 第二部分动画结束

      // 换电详情
      swapInfo: {
        capacity: '--',
        quantity: '--',
        swapFreq: '--',
        todayAlarmFreq: '--',
        todayCapacity: '--',
        todaySwapFreq: '--'
      },
      // 换电记录
      carRecord: [],
      // 告警记录
      alarmRecordList: [],
      swapTime:null,
      totalSecond:120,//车辆倒计时
      dialogCarlineVisible:false,//在线车辆弹窗
      tableheight: 0, // 表格高度设置
      CarlineList:[],//在线车辆列表
      queryParams: {
        page: 1, // 当前页
        pageSize: 10, // 每页条数
        orderByField: undefined, // 排序字段
        orderByWays: 'desc'// 排序方式
      },
      dialogPlateVisible:false,//车牌号弹窗
      loading: false,
      heightTimer: false,
      ruleForm:{
        plate:undefined,
      },
      rules:{
        plate: [
            { required: true, message: '请输入车牌号', trigger: 'blur' },
            { min: 6, max: 12, message: '格式错误', trigger: 'blur' }
          ],
      },//验证车牌号
      cloundState:0,//云端连接状态
      robotInfoVo:{},//机器人状态
      forbidLockState:0,//机器人锁止状态
    }
  },
  watch: {
    tableheight(val) {
      // 为了避免频繁触发resize函数导致页面卡顿，使用定时器
      if (!this.heightTimer) {
        // 一旦监听到的screenWidth值改变，就将其重新赋给data里的screenWidth
        this.screenHeight = val
        this.heightTimer = true
        setTimeout(function() {
          this.heightTimer = false
        }, 400)
      }
    },
    cloundState(val){
      this.$bus.$emit('CloudState',val)
    },
    'vehicleInfo.conState'(val){
      if(val==0){
        this.getTotalSecond()
        this.totalSecond=120
      }
    }
  },
  computed: {
    // 车辆链接状态
    Carlink() {
      if (this.vehicleInfo.conState != '—' && this.vehicleInfo.conState != null) {
        return this.vehicleInfo.conState ? '已链接' : '未链接'
      } else {
        return '—'
      }
    },
    // 解锁状态
    Carlock() {
      if (this.vehicleInfo.lockState != '—' && this.vehicleInfo.lockState != null) {
        return this.vehicleInfo.lockState ? '已解锁' : '未解锁'
      } else {
        return '—'
      }
    },
    // 上电状态
    Carbattery() {
      if (this.vehicleInfo.batteryState != '—' && this.vehicleInfo.batteryState != null) {
        return this.vehicleInfo.batteryState ? '已下电' : '未下电'
      } else {
        return '—'
      }
    },
    //车辆到位状态
    Carsensor(){
      if (this.vehicleInfo.sensorState != '—' && this.vehicleInfo.sensorState != null) {
        return this.vehicleInfo.sensorState ? '已到位' : '未到位'
      } else {
        return '—'
      }
    }
  },
  mounted() {
    // 监控视频
    const videoUrl = process.env.VUE_APP_VIDEO
    let canvas = document.getElementById("video-1");
    var player = new window.JSMpeg.Player(videoUrl, {
      canvas: canvas,
    });
    player.play();
    if (getToken()) {
      if (this.ws) {
        this.ws.close()
      }
      this.websocketConnect()
      // 清除定时器
      this.clearTimerList()
      // 检测websocket断开重连
      this.detectWebsocketConnection()
      // 开启定时器
      this.setTimerList()
    }
    this.getTotalSecond()//倒计时
    this.onLoadHeight()
    this.changeWindow()
  },
  destroyed() {
    this.websocketOnClose()
    this.clearTimerList()
  },
  methods: {
    /** 分页下一页 */
    handleSizeChange(val) {
      this.queryParams.pageSize = val
    },
    /** 分页选择页数 */
    handleCurrentChange(val) {
      this.queryParams.page = val
    },
    /* 设置初始视窗高度*/
    onLoadHeight() {
      this.$nextTick(() => {
        this.tableheight = document.body.clientHeight - 460
      })
    },
    /* 设置窗口变化高度*/
    changeWindow() {
      window.onresize = () => {
        return (() => {
          this.tableheight = document.body.clientHeight - 460
        })()
      }
    },
    //修改车牌号提交
    handlePlate(){
      if(this.ruleForm.plate==this.vehicleInfo.plate){
        // this.$message({
        //   type: 'warning',
        //   message: '提交成功！'
        // })
        this.dialogPlateVisible=false
      }else{
        if(!isLicensePlateNumberNER(this.ruleForm.plate)){
          this.$message({
            type: 'warning',
            message: '请填写新能源车牌号!'
          })
        }else{
          EditPlate(this.ruleForm.plate).then((rs) => {
            if(rs.code==0){
              this.dialogPlateVisible=false
              this.vehicleInfo.plate=this.ruleForm.plate
              this.$message({
                type: 'success',
                message: '修改成功!'
              })
            }else{
              this.$message({
                type: 'error',
                message: rs.msg
              })
            }
          })
          .catch(err => { console.error(err) })
        }
      }
    },
    // 清空表单数据车牌号
    dialogClose() { },
    //编辑车牌号弹窗
    HandleEditPlate(plate){
      this.dialogPlateVisible=true
      this.ruleForm.plate=plate
    },
    //实时车辆弹窗
    ShowCarline(){
      this.dialogCarlineVisible=true
      this.getCarOnline()
    },
    //车辆倒计时
    getTotalSecond() {
      if(this.vehicleInfo.conState==0){
        let clock =  window.setInterval(() => {
            this.totalSecond --;
            if(this.totalSecond == 0 || this.vehicleInfo.conState==1){
                window.clearInterval(clock);
            }
        }, 1000);       
      }
    },
    // 定时器列表
    setTimerList() {
      this.exchargeInfo()
      this.swapRecord()
      this.alarmRecord()
      this.exchargeTimer = setInterval(() => {
        this.exchargeInfo()
        this.swapRecord()
        this.alarmRecord()
      }, 5000)
    },
    // 清除定时器列表
    clearTimerList() {
      if (this.exchargeTimer) {
        clearInterval(this.exchargeTimer)
      }
      if (this.wsTimer) {
        clearInterval(this.wsTimer)
      }
    },
    //已连接站控车辆列表
    getCarOnline(){
      CarOnline().then((rs) => {
        this.CarlineList = rs.data
      })
    },
    // 换电信息
    exchargeInfo() {
      swapInfo().then((rs) => {
        this.swapInfo = rs.data
      })
    },
    // 换电记录
    swapRecord() {
      const params = {
        page: 1,
        pageSize: 2,
        orderByWays: 'desc',
        orderByField: 'swapBeginTime'
      }
      swapRecord(params).then((rs) => {
        this.carRecord = rs.data.records
      })
    },
    // 告警记录
    alarmRecord() {
      const params = {
        page: 1,
        pageSize: 2,
        orderByWays: 'desc',
        orderByField: 'beginTime'
      }
      alarmRecord(params).then((rs) => {
        this.alarmRecordList = rs.data.records
      })
    },
    websocketOnOpen() {
      console.log('socket连接成功')
      const wsMessage={
        type: 'page',
        payload: 'power-change-monitoring'
      }
      this.ws.send(JSON.stringify(wsMessage))
    },
    websocketOnMessage(m) {
      const d = JSON.parse(m.data)
      // console.log(d)
      //云端连接状态
      if(d.cloundState){
        this.cloundState=d.cloundState
      }
      if(d.forbidLockState<=1){
        this.forbidLockState=d.forbidLockState
      }
      //用户信息
      if (d.driverInfoVo) {
        this.driverInfo = d.driverInfoVo
      }
      // 车辆信息
      if (d.vehicleInfo) {
        this.vehicleInfo = d.vehicleInfo
      }
      // 电池信息
      if (d.batteryInfo) {
        this.batteryInfo = d.batteryInfo
      }
      //机器人状态
      if (d.robotInfoVo) {
        this.robotInfoVo = d.robotInfoVo
      }
      // 换电流程动画
      if (d.swapProcess) {
        this.swapProcess = d.swapProcess
        if (this.swapProcess.valAngle === null) {
          this.processDone = [false, false, false, false, false]
          this.percent = [0, 0, 0, 0, 0]
          this.processDeg = [0, 0, 0, 0, 0]
        }
        if (this.swapProcess.valAngle) {
          this.processDone.splice(0, 1, true)
          this.percent.splice(0, 1, this.swapProcess.valPercentage)
          this.processDeg.splice(0, 1, this.swapProcess.valAngle)
        }
        if (this.swapProcess.applyAngle) {
          this.processDone.splice(1, 1, true)
          this.percent.splice(1, 1, this.swapProcess.applyPercentage)
          this.processDeg.splice(1, 1, this.swapProcess.applyAngle)
        }
        if (this.swapProcess.beginAngle) {
          this.processDone.splice(2, 1, true)
          this.percent.splice(2, 1, this.swapProcess.beginPercentage)
          this.processDeg.splice(2, 1, this.swapProcess.beginAngle)
        }
        if (this.swapProcess.swapAngle) {
          this.processDone.splice(3, 1, true)
          this.percent.splice(3, 1, this.swapProcess.swapPercentage)
          this.processDeg.splice(3, 1, this.swapProcess.swapAngle)
        }
        if (this.swapProcess.endAngle) {
          this.processDone.splice(4, 1, true)
          this.percent.splice(4, 1, this.swapProcess.endPercentage)
          this.processDeg.splice(4, 1, this.swapProcess.endAngle)
        }
      }
      // 右上角电池动画
      if (d.swapAnimationVo) {
        this.swapAnimationVo = d.swapAnimationVo
      }
      //充电机列表
      if (d.storeInfoList) {
        this.storeInfoList = d.storeInfoList
        for (let i = 0; i < d.storeInfoList.length; i++) {
          this.$set(this.storeInfoList, i, d.storeInfoList[i])
        }
      }
      //换电时间
      if (d.robotInfoVo) {
        this.swapTime = d.robotInfoVo.swapTime
      }
    },
    websocketOnError(e) {
      console.log('socket错误', e)
    },
    websocketOnClose(e) {
      console.log('socket断开', e)
    },
    detectWebsocketConnection() {
      this.wsTimer = setInterval(() => {
        if (this.ws.readyState != 1) {
          this.ws.close()
          this.websocketConnect()
        }
      }, 3000)
    },
    websocketConnect() {
      const wstoken = getToken()
      this.ws = new WebSocket(process.env.VUE_APP_WS+'/'+wstoken)
      this.ws.onopen = this.websocketOnOpen
      this.ws.onerror = this.websocketOnError
      this.ws.onmessage = this.websocketOnMessage
      this.ws.onclose = this.websocketOnClose
    },
  }
}
</script>

<style lang="scss" scoped>
.box-first {
  display: flex;
  flex-direction: row;
  padding: 10px 20px;

  .video-box {
    width: 460px;
    height: 368px;
    #video-1 {
      flex: 1;
      width: 100%;
      margin-top: 0.6%;
      height: 100%;
    }
  }

  .infolist {
    flex: 1;
    height: 368px;
    .userlist {
      height: 100%;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      width: 100%;
      ul {
        width: 73%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        height: 100%;
        margin: 0;
        padding: 0;
        li:first-child {
          width: 30%;
          padding-left: 1.2%;
        }
        li:nth-child(2) {
          flex: 1;
          margin: 0 12px;
        }
        li:last-child {
          width: 29%;
        }
        li {
          list-style-type: none;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          .carVin {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            margin: 0;
            padding: 0;
            label{
              margin-bottom: 7px;
            }
            label:last-child {
              text-align: right;
              color: #86edab;
              font-weight: 500;
              margin-bottom: 0;
            }
            label:nth-child(2){
               margin-bottom: 0;
            }
          }
          label {
            display: block;
            font-size: 1rem;
            width: 95%;
            text-align: left;
            color: #788799;
            font-weight: 500;
            padding-left:12px;
            margin: 10px 0;
          }
          .linkeState{
            display: flex;
            justify-content: flex-end;
            align-items: center;
            margin:0;
            text-shadow: 0px 0px 4px rgba(39,69,201,0.5);
            img{
              padding-right: 3px;
            }
            .break{
              color: #F53F3F;
              font-weight: 500;
            }
          }
          .carinfo {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            p {
              margin: 0;
              padding: 0;
              width: 48%;
            }
          }
        }
      }
      .battery-info {
        width: 100%;
        display: flex;
        height: 80%;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
        margin-top: 5%;
      }
      .bin-info {
        width: 380px;
      }
    }
  }
}
.box-second {
  display: flex;
  padding: 20px;
  flex-direction: column;

  .process-details {
    display: flex;
    flex-direction: row;
    flex: 1;
    padding: 10px;
    align-items: center;
  }
  .detail {
    flex: 1;
    position: relative;
    height: 230px;
    margin-top: 15px;
  }
  .process-state {
    /* color:white; */
    font-size: 1rem;
    position: absolute;
    font-weight: 600;
    bottom: -10px;
    left: 40%;
    z-index: 1;
  }
}
.box-three {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 5px 20px;
  position: relative;
  .exchange-statistics {
    width: 34%;
    display: flex;
    flex-direction: column;
    .statistic-boxes {
      flex: 1;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      width: 100%;
      justify-content: space-between;
    }
  }
  .exchange-records {
    display: flex;
    flex-direction: column;
    width: 34%;
    margin: 0px 18px;
    .exchange-details {
      display: flex;
      flex-direction: column;
      padding: 0 0.5%;
      .header-row {
        height: 44px;
        line-height: 44px;
        color: #6e7987;
      }
      .record-row {
        height: 54px;
        line-height: 54px;
        color: #ecf6f7;
      }
      .record-row,
      .header-row {
        flex: 1;
        display: flex;
        flex-direction: row;
        text-indent: 15px;
        justify-content: space-between;
        align-items: center;
        font-size: 0.9rem;
        font-weight: 600;
        font-family: "微软雅黑";

        .v-plate {
          width: 20%;
        }
        .v-type {
          width: 22%;
        }
        .v-time {
          flex: 1;
        }
        .v-status {
          width: 15%;
        }
        .v-power {
          width: 25%;
        }
        .color-blue {
          color: rgb(20, 189, 243);
        }
      }
      .record-row:nth-child(2) {
        background: #0e182a;
        border: #0f244a solid 2px;
        border-radius: 0 0 1.2rem 0;
      }
    }
  }
  .gate-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    .recordlist {
      text-indent: 12px;
      .recordtilte {
        font-size: 0.9rem;
        color: #6e7987;
        font-weight: 600;
        display: flex;
        flex-direction: row;
        height: 48px;
        line-height: 48px;

        span:first-child {
          width: 88px;
        }
        span:nth-child(2) {
          width: 100px;
        }
        span:nth-child(3) {
          width: 190px;
          text-align: left;
          text-indent: 15px;
          overflow: hidden; 
          text-overflow: ellipsis;
          white-space: nowrap;
          cursor: pointer;
        }
        span:last-child {
          flex: 1;
        }
      }

      .recordinfo {
        display: flex;
        flex-direction: row;
        color: #ecf6f7;
        font-weight: 600;
        font-size: 0.9rem;
        height: 54px;
        line-height: 54px;
        span:first-child {
          width: 88px;
        }
        span:nth-child(2) {
          width: 100px;
        }
        span:nth-child(3) {
          width: 190px;
          text-align: left;
          text-indent: 15px;
          overflow: hidden; 
          text-overflow: ellipsis;
          white-space: nowrap;
          cursor: pointer;
        }
        span:last-child {
          flex: 1;
        }
      }
      .recordinfo:nth-child(2) {
        background: #0e182a;
        border: #0f244a solid 2px;
        border-radius: 0 0 1.2rem 0;
      }
    }
  }
}
.charge-table-bottom {
    width: 100%;
    min-height: 100%;
    background-color: #111827;
    .item{
      color: #86EDAB;
    }
    .disable{
      color: #FF6E6E;
    }
    .iscar{
      display: flex;
      width: 100%;
      align-items: center;
      span{
        padding-right: 8px;
      }
      img{
        width: 20px;
        height: 15px;
        vertical-align: middle;
      }
    }
}
.pageblock {
    padding: 15px 0px;
    font-size:15px;
    color: #C0C4CC;
    span{
      color: #86EDAB;
    }
}
</style>
