<template>
  <el-container class="device-data">
    <div class="card-container">
      <el-card
        v-for="(item, index) in srmList"
        :key="item.code"
        class="box-card"
      >
        <div class="container">
          <el-row class="row-root">
            <span class="big-span">{{ item.name }}</span> 一
            <span>{{
              item.disable == false
                ? $t("main.device.enable")
                : $t("main.device.disable")
            }}</span>
          </el-row>
          <el-divider />
          <el-descriptions :column="3" size="mini" border>
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.operatingMode')"
              ><el-tag
                size="small"
                :type="getEnumOperationModel(item.operationModel).color"
                >{{ getEnumOperationModel(item.operationModel).text }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.horizontalDistance')"
              ><el-tag
                size="small"
                :type="item.horizontalDistance == null ? itemColor : ''"
                >{{ getEnumText(item.horizontalDistance) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.verticalDistance')"
              ><el-tag
                size="small"
                :type="item.verticalDistance == null ? itemColor : ''"
                >{{ getEnumText(item.verticalDistance) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.transitionMode')"
              ><el-tag
                size="small"
                :type="getEnumExpendMode(item.expendMode).color"
                >{{ getEnumExpendMode(item.expendMode).text }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.maximumColumn')"
              ><el-tag
                size="small"
                :type="item.manageMaxColumn == null ? itemColor : ''"
                >{{ getEnumText(item.manageMaxColumn) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.minimumColumn')"
              ><el-tag
                size="small"
                :type="item.manageSmallColumn == null ? itemColor : ''"
                >{{ getEnumText(item.manageSmallColumn) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.forkFlag')"
              ><el-tag
                size="small"
                :type="getEnumWCSForkFlag(item.wcsForkFlag).color"
                >{{ getEnumWCSForkFlag(item.wcsForkFlag).text }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.totalError')"
              span="2"
              ><el-tag
                size="small"
                :type="getEnumTotalError(item.totalError).color"
                >{{ getEnumTotalError(item.totalError).text }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.deviceWalking')"
              span="3"
            >
              <el-row>
                <el-col :span="9">
                  {{ $t("main.device.column") }}:<el-input-number
                    v-model="colValues[index]"
                    size="mini"
                    :min="1"
                    :max="9999"
                    style="width: 100px"
                  />
                </el-col>
                <el-col :span="9">
                  {{ $t("main.device.layer") }}:<el-input-number
                    v-model="rowValues[index]"
                    size="mini"
                    :min="1"
                    :max="999"
                    style="width: 100px"
                  />
                </el-col>
                <el-col :span="6" style="display: flex; align-items: center">
                  <el-button
                    type="warning"
                    size="mini"
                    @click="
                      btnWalkTask(colValues[index], rowValues[index], item.code)
                    "
                    >{{ $t("main.device.walkingTask") }}</el-button
                  >
                </el-col>
              </el-row>
            </el-descriptions-item>
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.operate')"
              span="3"
            >
              <el-button
                type="warning"
                size="mini"
                @click="btnTaskResend(item.code)"
                >{{ $t("main.device.resend") }}</el-button
              >
              <el-button
                type="warning"
                size="mini"
                @click="btnSRMEmptyOut(item.code)"
                >{{ $t("main.device.emptyOut") }}</el-button
              >
              <el-button
                type="warning"
                size="mini"
                @click="btnSRMReIn(item.code)"
                >{{ $t("main.device.reIn") }}</el-button
              >
              <el-button
                type="warning"
                size="mini"
                @click="btnSRMForkError(item.code)"
                >{{ $t("main.device.pickError") }}</el-button
              >
            </el-descriptions-item>
            <el-descriptions-item
              label-class-name="descriptions-label"
              label=""
            >
              <el-button
                type="danger"
                size="mini"
                @click="btnSRMTaskDelete(item.code, 1)"
                >{{ $t("main.device.fork1TaskDelete") }}</el-button
              >
              <el-button
                v-if="
                  item.equipmentTypeCode != null
                    ? item.equipmentTypeCode.indexOf('Double') >= 0
                    : false
                "
                type="danger"
                size="mini"
                @click="btnSRMTaskDelete(item.code, 2)"
                >{{ $t("main.device.fork2TaskDelete") }}</el-button
              >
            </el-descriptions-item>
          </el-descriptions>
          <el-tabs
            :active-name="srmList.length > 0 ? 'one' + srmList[0].name : ''"
            type="card"
            class="mar10"
          >
            <el-tab-pane
              :label="$t('main.device.alarm')"
              :name="'one' + item.name"
            >
              <div style="overflow-y: auto; height: 35.7vh">
                <el-alert
                  v-for="text in alarmSRMList[index]"
                  :key="text"
                  :title="text"
                  type="error"
                  show-icon
                  :closable="false"
                  style="margin-bottom: 5px"
                />
              </div>
            </el-tab-pane>
            <el-tab-pane
              :label="$t('main.device.fork1Data')"
              :name="'two' + item.name"
            >
              <el-divider content-position="center">PLC</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.ranging')"
                  ><el-tag
                    size="small"
                    :type="item.fork1Distance == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1Distance) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isInTheStock')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkHasPallet(item.fork1HasPallet).color"
                    >{{
                      getEnumForkHasPallet(item.fork1HasPallet).text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isInTheCenter')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkCenter(item.fork1Center).color"
                    >{{ getEnumForkCenter(item.fork1Center).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.row')"
                  ><el-tag
                    size="small"
                    :type="item.fork1ZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1ZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.columns')"
                  ><el-tag
                    size="small"
                    :type="item.fork1XPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1XPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.storey')"
                  ><el-tag
                    size="small"
                    :type="item.fork1YPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1YPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskStatus')"
                  ><el-tag
                    size="small"
                    :type="
                      getEnumForkTaskExcuteStatus(item.fork1TaskExcuteStatus)
                        .color
                    "
                    >{{
                      getEnumForkTaskExcuteStatus(item.fork1TaskExcuteStatus)
                        .text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.fork1TaskType).color"
                    >{{ getEnumForkTaskType(item.fork1TaskType).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  ><el-tag
                    size="small"
                    :type="item.fork1TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PickZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PickZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PickXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PickXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PickYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PickYPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PutZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PutZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PutXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PutXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PutYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PutYPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isFault')"
                  ><el-tag
                    size="small"
                    :type="getEnumTotalError(item.fork1TotalError).color"
                    >{{ getEnumTotalError(item.fork1TotalError).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.shield')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkBlock(item.fork1Block).color"
                    >{{ getEnumForkBlock(item.fork1Block).text }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
              <el-divider content-position="center">WCS</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.wcsFork1Action).color"
                    >{{ getEnumForkTaskType(item.wcsFork1Action).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.stackedDiskIndex')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1FoldIndex == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1FoldIndex) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PickZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PickZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PickXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PickXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PickYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PickYPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PutZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PutZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PutXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PutXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PutYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PutYPosition) }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
            </el-tab-pane>
            <el-tab-pane
              v-if="
                item.equipmentTypeCode != null
                  ? item.equipmentTypeCode.indexOf('Double') >= 0
                  : false
              "
              :label="$t('main.device.fork2Data')"
              :name="'three' + item.name"
            >
              <el-divider content-position="center">PLC</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.ranging')"
                  ><el-tag
                    size="small"
                    :type="item.fork2Distance == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2Distance) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isInTheStock')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkHasPallet(item.fork2HasPallet).color"
                    >{{
                      getEnumForkHasPallet(item.fork2HasPallet).text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isInTheCenter')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkCenter(item.fork2Center).color"
                    >{{ getEnumForkCenter(item.fork2Center).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.row')"
                  ><el-tag
                    size="small"
                    :type="item.fork2ZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2ZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.columns')"
                  ><el-tag
                    size="small"
                    :type="item.fork2XPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2XPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.storey')"
                  ><el-tag
                    size="small"
                    :type="item.fork2YPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2YPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskStatus')"
                  ><el-tag
                    size="small"
                    :type="
                      getEnumForkTaskExcuteStatus(item.fork2TaskExcuteStatus)
                        .color
                    "
                    >{{
                      getEnumForkTaskExcuteStatus(item.fork2TaskExcuteStatus)
                        .text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.fork2TaskType).color"
                    >{{ getEnumForkTaskType(item.fork2TaskType).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  ><el-tag
                    size="small"
                    :type="item.fork2TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PickZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PickZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PickXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PickXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PickYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PickYPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PutZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PutZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PutXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PutXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PutYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PutYPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isFault')"
                  ><el-tag
                    size="small"
                    :type="getEnumTotalError(item.fork2TotalError).color"
                    >{{ getEnumTotalError(item.fork2TotalError).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.shield')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkBlock(item.fork2Block).color"
                    >{{ getEnumForkBlock(item.fork2Block).text }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
              <el-divider content-position="center">WCS</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.wcsFork2Action).color"
                    >{{ getEnumForkTaskType(item.wcsFork2Action).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.stackedDiskIndex')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2FoldIndex == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2FoldIndex) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PickZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PickZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PickXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PickXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PickYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PickYPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PutZPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PutZPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PutXPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PutXPosition) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PutYPosition == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PutYPosition) }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
            </el-tab-pane>
          </el-tabs>
        </div>
      </el-card>
      <el-card
        v-for="(item, index) in rgvList"
        :key="item.code"
        class="box-card"
      >
        <div class="container">
          <el-row class="row-root">
            <span class="big-span">{{ item.name }}</span> 一
            <span>{{
              item.disable == false
                ? $t("main.device.enable")
                : $t("main.device.disable")
            }}</span>
          </el-row>
          <el-divider />
          <el-descriptions :column="3" size="mini" border>
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.operatingMode')"
              ><el-tag
                size="small"
                :type="getEnumOperationModel(item.operationModel).color"
                >{{ getEnumOperationModel(item.operationModel).text }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.horizontalDistance')"
              ><el-tag
                size="small"
                :type="item.horizontalDistance == null ? itemColor : ''"
                >{{ getEnumText(item.horizontalDistance) }}</el-tag
              ></el-descriptions-item
            >

            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.dData.currentLocation')"
              ><el-tag
                size="small"
                :type="item.currentStation == null ? itemColor : ''"
                >{{ getEnumText(item.currentStation) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.totalError')"
              ><el-tag
                size="small"
                :type="getEnumTotalError(item.totalError).color"
                >{{ getEnumTotalError(item.totalError).text }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.dData.minimumPosition')"
              ><el-tag
                size="small"
                :type="item.minStation == null ? itemColor : ''"
                >{{ getEnumText(item.minStation) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.dData.maximumPosition')"
              ><el-tag
                size="small"
                :type="item.maxStation == null ? itemColor : ''"
                >{{ getEnumText(item.maxStation) }}</el-tag
              ></el-descriptions-item
            >
            <el-descriptions-item
              label-class-name="descriptions-label"
              :label="$t('main.device.operate')"
              span="3"
            >
              <el-button
                type="warning"
                size="mini"
                @click="btnRGVTaskResend(item.code)"
                >{{ $t("main.device.resend") }}</el-button
              >
            </el-descriptions-item>
            <el-descriptions-item
              label-class-name="descriptions-label"
              label=""
            >
              <el-button
                type="danger"
                size="mini"
                @click="btnRGVTaskDelete(item.code, 1)"
                >{{ $t("main.device.fork1TaskDelete") }}</el-button
              >
              <el-button
                v-if="
                  item.equipmentTypeCode != null
                    ? item.equipmentTypeCode.indexOf('Double') >= 0
                    : false
                "
                type="danger"
                size="mini"
                @click="btnRGVTaskDelete(item.code, 2)"
                >{{ $t("main.device.fork2TaskDelete") }}</el-button
              >
            </el-descriptions-item>
          </el-descriptions>
          <el-tabs
            :active-name="rgvList.length > 0 ? 'one' + rgvList[0].name : ''"
            type="card"
            class="mar10"
          >
            <el-tab-pane
              :label="$t('main.device.alarm')"
              :name="'one' + item.name"
            >
              <div style="overflow-y: auto; height: 42.5vh">
                <el-alert
                  v-for="text in alarmRGVList[index]"
                  :key="text"
                  :title="text"
                  type="error"
                  show-icon
                  :closable="false"
                  style="margin-bottom: 5px"
                />
              </div>
            </el-tab-pane>
            <el-tab-pane
              :label="$t('main.device.fork1Data')"
              :name="'two' + item.name"
            >
              <el-divider content-position="center">PLC</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isInTheStock')"
                  span="3"
                  ><el-tag
                    size="small"
                    :type="getEnumForkHasPallet(item.fork1HasPallet).color"
                    >{{
                      getEnumForkHasPallet(item.fork1HasPallet).text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskStatus')"
                  ><el-tag
                    size="small"
                    :type="
                      getEnumForkTaskExcuteStatus(item.fork1TaskExcuteStatus)
                        .color
                    "
                    >{{
                      getEnumForkTaskExcuteStatus(item.fork1TaskExcuteStatus)
                        .text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.fork1TaskType).color"
                    >{{ getEnumForkTaskType(item.fork1TaskType).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  ><el-tag
                    size="small"
                    :type="item.fork1TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PickZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PickZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PickXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PickXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PickYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PickYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PutZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PutZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PutXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PutXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork1PutYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1PutYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.length')"
                  ><el-tag
                    size="small"
                    :type="item.fork1GoodsLength == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1GoodsLength) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.width')"
                  ><el-tag
                    size="small"
                    :type="item.fork1GoodsWidth == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1GoodsWidth) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.height')"
                  ><el-tag
                    size="small"
                    :type="item.fork1GoodsHeight == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1GoodsHeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.weight')"
                  ><el-tag
                    size="small"
                    :type="item.fork1GoodsWeight == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1GoodsWeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.typeOfGoods')"
                  ><el-tag
                    size="small"
                    :type="item.fork1GoodsType == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1GoodsType) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.barCode')"
                  ><el-tag
                    size="small"
                    :type="item.fork1GoodsBarcode == null ? itemColor : ''"
                    >{{ getEnumText(item.fork1GoodsBarcode) }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
              <el-divider content-position="center">WCS</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.wcsFork1Action).color"
                    >{{ getEnumForkTaskType(item.wcsFork1Action).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  span="2"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PickZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PickZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PickXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PickXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PickYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PickYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PutZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PutZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PutXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PutXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1PutYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1PutYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.length')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1GoodsLength == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1GoodsLength) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.width')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1GoodsWidth == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1GoodsWidth) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.height')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1GoodsHeight == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1GoodsHeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.weight')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1GoodsWeight == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1GoodsWeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.typeOfGoods')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1GoodsType == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1GoodsType) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.barCode')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork1GoodsBarcode == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork1GoodsBarcode) }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
            </el-tab-pane>
            <el-tab-pane
              v-if="
                item.equipmentTypeCode != null
                  ? item.equipmentTypeCode.indexOf('Double') >= 0
                  : false
              "
              :label="$t('main.device.fork2Data')"
              :name="'three' + item.name"
            >
              <el-divider content-position="center">PLC</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.isInTheStock')"
                  span="3"
                  ><el-tag
                    size="small"
                    :type="getEnumForkHasPallet(item.fork2HasPallet).color"
                    >{{
                      getEnumForkHasPallet(item.fork2HasPallet).text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskStatus')"
                  ><el-tag
                    size="small"
                    :type="
                      getEnumForkTaskExcuteStatus(item.fork2TaskExcuteStatus)
                        .color
                    "
                    >{{
                      getEnumForkTaskExcuteStatus(item.fork2TaskExcuteStatus)
                        .text
                    }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.fork2TaskType).color"
                    >{{ getEnumForkTaskType(item.fork2TaskType).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  ><el-tag
                    size="small"
                    :type="item.fork2TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PickZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PickZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PickXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PickXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PickYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PickYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PutZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PutZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PutXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PutXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.fork2PutYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2PutYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.length')"
                  ><el-tag
                    size="small"
                    :type="item.fork2GoodsLength == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2GoodsLength) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.width')"
                  ><el-tag
                    size="small"
                    :type="item.fork2GoodsWidth == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2GoodsWidth) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.height')"
                  ><el-tag
                    size="small"
                    :type="item.fork2GoodsHeight == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2GoodsHeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.weight')"
                  ><el-tag
                    size="small"
                    :type="item.fork2GoodsWeight == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2GoodsWeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.typeOfGoods')"
                  ><el-tag
                    size="small"
                    :type="item.fork2GoodsType == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2GoodsType) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.barCode')"
                  ><el-tag
                    size="small"
                    :type="item.fork2GoodsBarcode == null ? itemColor : ''"
                    >{{ getEnumText(item.fork2GoodsBarcode) }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
              <el-divider content-position="center">WCS</el-divider>
              <el-descriptions :column="3" size="mini" border>
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskType')"
                  ><el-tag
                    size="small"
                    :type="getEnumForkTaskType(item.wcsFork2Action).color"
                    >{{ getEnumForkTaskType(item.wcsFork2Action).text }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.taskNumber')"
                  span="2"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2TaskNo == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2TaskNo) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PickZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PickZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PickXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PickXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.pickUpStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PickYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PickYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownRow')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PutZStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PutZStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownColumn')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PutXStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PutXStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.putDownStorey')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2PutYStation == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2PutYStation) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.length')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2GoodsLength == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2GoodsLength) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.width')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2GoodsWidth == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2GoodsWidth) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.height')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2GoodsHeight == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2GoodsHeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.weight')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2GoodsWeight == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2GoodsWeight) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.typeOfGoods')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2GoodsType == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2GoodsType) }}</el-tag
                  ></el-descriptions-item
                >
                <el-descriptions-item
                  label-class-name="descriptions-label"
                  :label="$t('main.dData.barCode')"
                  ><el-tag
                    size="small"
                    :type="item.wcsFork2GoodsBarcode == null ? itemColor : ''"
                    >{{ getEnumText(item.wcsFork2GoodsBarcode) }}</el-tag
                  ></el-descriptions-item
                >
              </el-descriptions>
            </el-tab-pane>
          </el-tabs>
        </div>
      </el-card>
      <el-divider />
    </div>
  </el-container>
</template>

<script>
import {
  createSRMWalkTask,
  getRGVInfo,
  getSRMInfo,
  rgvTaskDelete,
  rgvTaskResend,
  srmEmptyOut,
  srmForkError,
  srmReIn,
  srmTaskDelete,
  srmTaskResend,
} from "@/api/main";
import {
  getEnumExpendMode,
  getEnumForkBlock,
  getEnumForkCenter,
  getEnumForkHasPallet,
  getEnumForkTaskExcuteStatus,
  getEnumForkTaskType,
  getEnumOperationModel,
  getEnumText,
  getEnumTotalError,
  getEnumWCSForkFlag,
} from "@/utils/enums.js";
import { formatTime, openConfirm, showMsg } from "@/utils/index.js";

export default {
  name: "DeviceData",
  props: {
    // 定义接收的 startDeal 变量
    startDeal: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      // 堆垛机列表
      srmList: [],
      // rgv列表
      rgvList: [],
      // 定时器
      interval: null,
      // 列集合
      colValues: [],
      // 行集合
      rowValues: [],
      // 堆垛机报警列表
      alarmSRMList: [],
      // rgv报警列表
      alarmRGVList: [],
      isCurrentTab: false,
      isOpenServer: false,
      itemColor: "danger",
    };
  },
  watch: {
    // 监听 startDeal 变量的变化
    startDeal(newValue, oldValue) {
      // console.log('处理状态发生变化:', newValue);
      this.isOpenServer = newValue;
      if (this.isCurrentTab) {
        if (newValue) {
          this.start();
        } else {
          this.stop();
        }
      }
    },
  },
  beforeDestroy() {
    clearInterval(this.interval);
  },
  mounted() {},
  methods: {
    getEnumExpendMode,
    getEnumOperationModel,
    getEnumWCSForkFlag,
    getEnumTotalError,
    getEnumForkHasPallet,
    getEnumForkCenter,
    getEnumForkTaskExcuteStatus,
    getEnumForkTaskType,
    getEnumForkBlock,
    srmEmptyOut,
    srmReIn,
    srmForkError,
    srmTaskDelete,
    getEnumText,

    // 开始刷新数据
    start() {
      this.isCurrentTab = true;
      if (this.isOpenServer) {
        this.loadData();
        this.interval = setInterval(() => {
          this.loadData();
        }, 3000);
      }
    },
    // 停止刷新数据
    stop() {
      this.isCurrentTab = false;
      clearInterval(this.interval);
    },
    //加载数据
    loadData() {
      getSRMInfo().then((response) => {
        this.srmList = response.data;
        // this.srmList = [...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList,...this.srmList];
        if (this.colValues.length != this.srmList.length) {
          this.colValues = new Array(this.srmList.length).fill("");
        }
        if (this.rowValues.length != this.srmList.length) {
          this.rowValues = new Array(this.srmList.length).fill("");
        }
        if (this.alarmSRMList.length != this.srmList.length) {
          this.alarmSRMList = new Array(this.srmList.length);
        }
        this.loadAlarms(this.srmList, this.alarmSRMList);
      });
      if (window.appConfig.isExistRGV) {
        getRGVInfo().then((response) => {
          this.rgvList = response.data;
          // this.rgvList = [...this.rgvList,...this.rgvList,...this.rgvList,...this.rgvList];
          if (this.alarmRGVList.length != this.rgvList.length) {
            this.alarmRGVList = new Array(this.rgvList.length);
          }
          this.loadAlarms(this.rgvList, this.alarmRGVList);
        });
      }
    },
    // 加载报警信息
    loadAlarms(list, alarms) {
      list.forEach((item, index) => {
        item.equipmentAlarms.forEach((alarm) => {
          if (!alarms[index]) {
            alarms[index] = [];
          }
          if (alarm.value === alarm.comparisonValue) {
            // console.log(alarm);
            // console.log(this.$dict);
            if (!alarms[index].some((x) => x.indexOf(alarm.alarmCode) >= 0)) {
              var text = "";
              if (this.$dict != null) {
                this.$dict.find((x) => {
                  if (x.code == alarm.alarmCode) {
                    text = x.name;
                  }
                });
              }
              alarms[index].unshift(
                formatTime(new Date(alarm.created), "{h}:{i}:{s}") +
                  this.$t("main.msg.callPolice") +
                  text
              );
            }
          }
        });
      });
    },

    // 行走任务按钮
    btnWalkTask(col, row, code) {
      // console.log(col, row, code);
      if (col == null) {
        showMsg(this.$t("main.msg.enterColumns"), false);
      } else if (row == null) {
        showMsg(this.$t("main.msg.enterLayers"), false);
      } else {
        var self = this;
        openConfirm(self, this.$t("main.msg.generateStackerTask"), () => {
          createSRMWalkTask({ Layer: row, Column: col, SRMCode: code }).then(
            (response) => {
              showMsg(this.$t("main.msg.taskSuccess"), true);
            }
          );
        });
      }
    },

    // 任务重新下发
    btnTaskResend(code) {
      var self = this;
      openConfirm(self, this.$t("main.msg.reissueTask"), () => {
        srmTaskResend({ SRMCode: code }).then((response) => {
          showMsg(this.$t("main.msg.taskReissuedSuccess"), true);
        });
      });
    },

    // 空取
    btnSRMEmptyOut(code) {
      var self = this;
      openConfirm(self, this.$t("main.msg.nullExtraction"), () => {
        srmEmptyOut({ SRMCode: code }).then((response) => {
          showMsg(this.$t("main.msg.emptyExtractionSuccess"), true);
        });
      });
    },

    // 重入
    btnSRMReIn(code) {
      var self = this;
      openConfirm(self, this.$t("main.msg.reEntry"), () => {
        srmReIn({ SRMCode: code }).then((response) => {
          showMsg(this.$t("main.msg.reEntrySuccess"), true);
        });
      });
    },

    // 取货错误
    btnSRMForkError(code) {
      var self = this;
      openConfirm(self, this.$t("main.msg.pickupErrors"), () => {
        srmForkError({ SRMCode: code }).then((response) => {
          showMsg(this.$t("main.msg.errorHandlingSuccess"), true);
        });
      });
    },

    // 任务强制删除
    btnSRMTaskDelete(code, flag) {
      var self = this;
      openConfirm(self, this.$t("main.msg.deleteFork1"), () => {
        srmTaskDelete({ SRMCode: code, ForkFlag: flag }).then((response) => {
          showMsg(this.$t("main.msg.deleteSuccess"), true);
        });
      });
    },

    // RGV重新下发
    btnRGVTaskResend(code) {
      var self = this;
      openConfirm(self, this.$t("main.msg.reissueTask"), () => {
        rgvTaskResend({ Code: code }).then((response) => {
          showMsg(this.$t("main.msg.taskReissuedSuccess"), true);
        });
      });
    },

    // RGV删除任务
    btnRGVTaskDelete(code, flag) {
      var self = this;
      openConfirm(self, this.$t("main.msg.deleteFork1"), () => {
        rgvTaskDelete({ Code: code, ForkFlag: flag }).then((response) => {
          showMsg(this.$t("main.msg.deleteSuccess"), true);
        });
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.box-card {
  width: 30vw;
  // height: 72vh;
  margin-left: 10px;
  margin-bottom: 10px;
  overflow-y: auto;
}
// 新增的容器样式
.card-container {
  display: flex;
  flex-wrap: wrap; // 允许元素换行
  max-height: 75vh; // 设置最大高度,超出显示滚动条
  overflow-y: auto; // 超出最大高度时显示纵向滚动条
}

.container {
  text-align: center;
}
.row-root {
  color: blue;
  font-weight: bolder;
  margin-bottom: -10px;
}
.big-span {
  font-size: 16pt;
}
.mar10 {
  margin-top: 10px;
}
</style>
<style>
.device-data {
  .descriptions-label {
    text-align: right !important;
    /* color:black !important; */
  }
  .el-divider--horizontal {
    margin: 12px 0px;
  }
}
</style>