<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          size="mini"
          @click="testAgingCabinetAndPowerCheck"
        >测试老化柜状态获取
        </el-button>
      </el-col>
    </el-row>
    <el-input
      type="textarea"
      :rows="25"
      placeholder="返回内容信息"
      v-model="textarea">
    </el-input>
  </div>
</template>

<script>

import {getAgingCabinetAndPowerCheck} from "@/api/testScheduledTasks/testTasks";

export default {
  name: "TestScheduledTasks",
  data() {
    return {
      textarea: null
    };
  },
  created() {
  },
  methods: {
    testAgingCabinetAndPowerCheck() {
      getAgingCabinetAndPowerCheck().then(response => {
        this.textarea = "";
          if (response.length > 0) {
            for (let i = 0; i < response.length; i++) {
              let item = response[i];
              let deviceCode = item.deviceCode;
              let registerValues = item.registerValues;
              let deviceStatus = item.deviceStatus;
              for (let i = 0; i < 10; i++) {
                let registerValue = registerValues[i];
                this.textarea += "设备编号：" + deviceCode + "状态是：" + deviceStatus + "  寄存器编号：" + i + "  寄存器值：" + registerValue + "\n";
              }
            }
          }
        }
      );
    }
  }
};
</script>
