<template>
  <el-dialog title="数据查询" :model-value='visible' @close="handleCancel" draggable height="650px" width="1165px">
    <div class="change-errsys-dialog">
      <div class="change-errsys-title">
        <el-form :model='formContent' label-width="auto" class="form-three">

          <el-form-item label="设备名称">
            <el-input v-model='deviceName' :disabled="true" />
          </el-form-item>
           <el-form-item label="检测脚本">
            <el-input v-model='testScriptName' :disabled="true" />
            </el-form-item>

            <el-form-item label="数据原则">
              <el-input v-model='dataRule' :disabled="true" />
            </el-form-item>


            <el-form-item label="误差体系">
              <el-select v-model="error_Sys_Id" autocomplete="off">
                <el-option v-for="plan in testErrSystDataList" :key="plan.id" :label="plan.label" :value="plan.id"
                  :disabled="plan.label === errorSysName">
                </el-option>
              </el-select>
            </el-form-item>


            <el-form-item  label=" ">
              <el-button type="primary" :icon="VideoPlay" @click="dealData">数据计算</el-button>
              <el-button type="primary" :icon="Postcard" :disabled="reportDisabled"
                @click="openReportDlg">报告生成</el-button>
            </el-form-item>

        </el-form>
      </div>
      <div class="change-errsys-content">
        <div class="tabs-title">
          <!-- <el-button type="primary" loading v-if="activeIndex > 0 && activeIndex < activeTotalNum">合格92项/共103项</el-button> 
                  <el-button type="primary" v-if="activeIndex >= activeTotalNum" disabled>合格92项/共103项</el-button>  -->
          <span style="  font-size: 18px;font-weight: 600;">
            数据已合格 <span style="color: #67C23A">{{ qualified }}</span> 项/共 <span style="color: green">{{ 103 }}</span>
            项
          </span>
        </div>
        <div class="dialog-content">
          <el-table :data="tableData" :cell-class-name="tableCell"  row-key="id" height="450px"
            :header-cell-style="{ background: '#003078', color: '#eee', textAlign: 'center' }" style="width: 100%"
            border>
            <el-table-column fixed prop="scriptItemName" label="检测项目" width="210px" />
            <el-table-column label="被检通道1" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道1</span>
                 <el-tooltip content = "240001被检通道1" placement="top" style="align-items: bottom;">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
              <template #default="scope">
              <!-- <el-tooltip content = "info" placement="top">
                <i class="el-icon-info"></i>
              </el-tooltip> -->
              <el-tooltip :content="scope.row.resultType1==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                <el-button
                :disabled = "scope.row.resultType1=='info'"
                :type="scope.row.resultType1"
                size="small"
                @click="handleClick(scope.row)"
              >
                {{ scope.row.resultValue1 }}
              </el-button>
            </el-tooltip>
              
            </template>
            </el-table-column>
            <el-table-column label="被检通道2" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道2</span>
                 <el-tooltip content = "240001被检通道2" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
              <template #default="scope">
                <el-tooltip :content="scope.row.resultType2==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                  <el-button
                  :disabled = "scope.row.resultType2=='info'"
                  :type="scope.row.resultType2"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue2 }}
                </el-button>
                </el-tooltip>

              </template>
            </el-table-column>
            <el-table-column label="被检通道3" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道3</span>
                 <el-tooltip content = "240001被检通道3" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
              <template #default="scope">
                <el-tooltip :content="scope.row.resultType3==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                  <el-button
                  :disabled = "scope.row.resultType3=='info'"
                  :type="scope.row.resultType3"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue3 }}
                </el-button>
                </el-tooltip>

              </template>
            </el-table-column>
            <el-table-column label="被检通道4" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道4</span>
                 <el-tooltip content = "240001被检通道4" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
                            <template #default="scope">
                              <el-tooltip :content="scope.row.resultType4==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                                <el-button
                  :disabled = "scope.row.resultType4=='info'"
                  :type="scope.row.resultType4"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue4 }}
                </el-button>
                              </el-tooltip>

              </template>
            </el-table-column>
            <el-table-column p label="被检通道5" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道5</span>
                 <el-tooltip content = "240002被检通道1" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
                            <template #default="scope">
                              <el-tooltip :content="scope.row.resultType5==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                                <el-button
                  :disabled = "scope.row.resultType5=='info'"
                  :type="scope.row.resultType5"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue5 }}
                </el-button>
                              </el-tooltip>

              </template>
            </el-table-column>
            <el-table-column label="被检通道6" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道6</span>
                 <el-tooltip content = "240002被检通道2" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
                            <template #default="scope">
                              <el-tooltip :content="scope.row.resultType6==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                                <el-button
                  tip
                  :disabled = "scope.row.resultType6=='info'"
                  :type="scope.row.resultType6"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue6 }}
                </el-button>
                              </el-tooltip>

              </template>
            </el-table-column>
            <el-table-column label="被检通道7" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道7</span>
                 <el-tooltip content = "240002被检通道3" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
                            <template #default="scope">
                              <el-tooltip :content="scope.row.resultType7==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                                <el-button
                  :disabled = "scope.row.resultType7=='info'"
                  :type="scope.row.resultType7"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue7 }}
                </el-button>
                              </el-tooltip>

              </template>
            </el-table-column>
            <el-table-column label="被检通道8" :min-width="minwidth" align="center">
              <template #header>
                <span>被检通道8</span>
                 <el-tooltip content = "240002被检通道4" placement="top">
                  <el-icon><InfoFilled  /></el-icon>
                </el-tooltip>
              </template>
                            <template #default="scope">
                              <el-tooltip :content="scope.row.resultType8==='info' ? '暂无数据' : '点击查看详情'" placement="top">
                                <el-button
                  :disabled = "scope.row.resultType8=='info'"
                  :type="scope.row.resultType8"
                  size="small"
                  @click="handleClick(scope.row)"
                >
                  {{ scope.row.resultValue8 }}
                </el-button>
                              </el-tooltip>

              </template>
            </el-table-column>

            <!-- <el-table-column  v-for="(item, index) in monitorList" :key="index"  :prop="item.prop" :label="item.label">
          </el-table-column> -->


          </el-table>
        </div>


        <!-- <el-table :data="testData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" border>
                <el-table-column fixed  prop="deviceName" label="检测项目" />
                <el-table-column prop="updataTime" label="被检通道1" />
                <el-table-column prop="ErrorValue" label="被检通道2" />
                <el-table-column prop="Result" label="被检通道3" />
                </el-table> -->
      </div>
    </div>
    <ReportPopup :visible="reportDialogVisible" @update:visible="reportDialogVisible = $event"></ReportPopup>
    <dataCheckSingleChannelSingleTestPopup :visible="dataCheckSingleChannelSingleTestDialogVisable"
      @update:visible="dataCheckSingleChannelSingleTestDialogVisable = $event"></dataCheckSingleChannelSingleTestPopup>
  </el-dialog>

</template>
<script setup lang='ts'>

import IPAddress from '@/components/IpAddress/index.vue'
import { dialogBig } from '@/utils/elementBind'
import { type Device } from '@/api/device/interface/device'
import { ElMessage, type FormItemRule } from 'element-plus'
import { addPqDev, updatePqDev } from '@/api/device/device'
import { computed, reactive, type Ref, ref } from 'vue'
import { useDictStore } from '@/stores/modules/dict'
import { CirclePlus, Delete, EditPen, Postcard, VideoPlay } from '@element-plus/icons-vue'
// 使用 dayjs 库格式化
import dayjs from 'dayjs'
import { getPqMonList } from '@/api/device/monitor'
import { type ColumnProps } from '@/components/ProTable/interface'
import { type Monitor } from '@/api/device/interface/monitor'
import { data } from "@/api/plan/autoTest.json";
import DataCheckResultTable from './dataCheckResultTable.vue'
import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import { dictPattern, dictTestState, dictReportState, dictResult, testPlanDataList, sourceDataList, deviceDataList, testSoureDataList, testScriptDataList, testErrSystDataList, planData, testFatherPlanList } from '@/api/plan/planData'
import ReportPopup from './reportPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'


const qualified = ref(0)
const reportDisabled = ref(true)
const reportDialogVisible = ref(false)
const deviceName = ref('240001');
const error_Sys_Id = ref('2');
const testScriptName = ref('Q/GDW 10650.4-2021 模拟式');
const errorSysName = ref('Q/GDW 10650.2 - 2021');
const dataRule = ref('所有值');
const scriptSwitch = ref(true);
const currentScriptDsc = ref('电压准确度检测：频率：42.5Hz Ua=46.192V 0° Ub=46.192V -120° Uc=46.192V 120° Ia=1A 0° Ib=1A -120° Ic=1A 120°');
const defaultProps = {
  children: "children",
  label: "name",
  pid: "pid",
};
const judge = (label: string) => {
  console.log(label, errorSysName.value)
  if (label === errorSysName.value)
    return true
  else
    return false
}
const testData = ref([
  {
    deviceName: '额定条件下频率检测42.5Hz',
    updataTime: '√',
    ErrorValue: '×',
    Result: '/',
  },
  {
    deviceName: '额定条件下频率检测50Hz',
    updataTime: '/',
    ErrorValue: '√',
    Result: '×',
  },
  {
    deviceName: '额定条件下频率检测50.05Hz',
    updataTime: '—',
    ErrorValue: '—',
    Result: '—',
  },
  {
    deviceName: '额定条件下频率检测57.5Hz',
    updataTime: '—',
    ErrorValue: '—',
    Result: '—',
  },
])

const handleNodeClick = (data) => {
  console.log(data);
};
const MonIsShow = ref(false)
const DevIsShow = ref(false)
const IsPasswordShow = ref(false)
const dictStore = useDictStore()
// 定义弹出组件元信息
const dialogFormRef = ref()
const disabledDate = (time: Date) => {
  return time.getTime() > Date.now()
}

const props = defineProps<{
  visible: boolean;
}>();

const emit = defineEmits<{
  (e: 'update:visible', value: boolean): void;
  (e: 'submit', data: any): void;
}>();

function clear() {
  activeIndex.value = 0;
}

const handleCancel = () => {
  emit('update:visible', false); // 关闭对话框
  //clearInterval(timer.value);
  reportDisabled.value = true;
  activeIndex.value = 0;
  qualified.value = 0;
  tableData.value.length = 0;
  columnList.value.length = 0;
  tableData.value = JSON.parse(JSON.stringify(operatorTableData.value));
};

const openReportDlg = () => {
  reportDialogVisible.value = true
}

const dealData = () => {
  startTimer()
}


const activeIndex = ref(0)
const activeTotalNum = ref(12)

const currentRow = ref<{ id: number; scriptItemName: string; name: string; address: string; hasChildren?: boolean; children?: User[] } | null>(null);
// const currentRow = ref(null); // 用于存储当前选中的行

const monitorList = ref([
  {
    deviceID: '1',
    deviceName: '被检设备1',
    monitorIdx: 1,
    label: '被检设备1通道1',
    prop: 'Result1',
  },
  {
    deviceID: '1',
    deviceName: '被检设备1',
    monitorIdx: 2,
    label: '被检设备1通道2',
    prop: 'Result2',
  },
  {
    deviceID: '2',
    deviceName: '被检设备2',
    monitorIdx: 1,
    label: '被检设备2通道1',
    prop: 'Result3',
  },
  {
    deviceID: '2',
    deviceName: '被检设备2',
    monitorIdx: 2,
    label: '被检设备2通道2',
    prop: 'Result4',
  }
])
const tableData1 = [
  {
    date: '2016-05-03',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-02',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-04',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
  {
    date: '2016-05-01',
    name: 'Tom',
    address: 'No. 189, Grove St, Los Angeles',
  },
]
const scrollContainer = ref<HTMLElement | null>(null); // 声明 scrollContainer

const scrollToBottom = () => {
  if (scrollContainer.value) {
    console.log(scrollContainer.value)
    scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
    console.log(scrollContainer.value)
  }
};

function getRandomInt(max: number): number {
  return Math.floor(Math.random() * max);
}
const updateLog = () => {
  const currentTime = ref(new Date().toLocaleString());

  switch (activeIndex.value) {
    case 1:
      testLogList.value.length = 0; // 清空数组
      testLogList.value.push({
        type: 'info',
        log: currentTime.value + '：频率准确度检测开始',
      })

      break;
    case 2:

      testLogList.value.push({
        type: 'info',
        log: currentTime.value + '：频率准确度检测完成',
      })
      testLogList.value.push({
        type: 'info',
        log: currentTime.value + '：电压准确度检测开始',
      })
      break;
    case 3:
      testLogList.value.push({
        type: 'error',
        log: currentTime.value + '：电压准确度检测不合格',
      })
      testLogList.value.push({
        type: 'info',
        log: currentTime.value + '：谐波电压准确度检测开始',
      })
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:
    case 10:
    case 11:
    case 12:
      updateTableData(activeIndex.value.toString())
      break;

  }

  scrollToBottom();
}
const testLogList = ref([
  {
    type: 'info',
    log: '暂无数据，等待检测开始',
  },
])
const columnList = ref([]);
const tableKey = ref(0);
function tableCell ({row,columnIndex}){
  let items = columnList?.value.filter((item) => item === row.id)

if(columnIndex === 0 && items.length > 0)
{
    // console.log(row.id,items.length,columnList?.value)
  return 'warning-row'
}

  if(columnIndex === 0)
  {
    return 'header-row'
  }

}
const tableRowClassName = ({
  row,
  rowIndex,
}: {
  row: any
  rowIndex: number
}) => {
  //  console.log(activeIndex.value,rowIndex,row)

  if (row.id === activeIndex.value.toString()) {
    return 'warning-row'
  }
  // else if (rowIndex === 3) {
  //   return 'success-row'
  // }
  return ''
}
const percentage = ref(0);
const customColors = [
  { color: "#5cb87a", percentage: 100 }, //绿
];
//暂停检测
const isPause = ref<boolean>(false);
const resultDialogVisible = ref(false)
const dataCheckSingleChannelSingleTestDialogVisable = ref(false);


function traverseTableData(data: any[], id: string): void {
  data.forEach(item => {
    // 处理当前节点的数据
    if (item.id === id) {
      for (let i = 1; i <= 8; i++) {
        let field1 = "resultType" + i
        let field2 = "resultValue" + i

        if (getRandomInt(10) > 8 && activeIndex.value > 2) {
          item[field1] = "danger";
          item[field2] = "×";
          columnList.value.push(activeIndex.value.toString());
          console.log(id,activeIndex.value,columnList.value)
        }
        else {
          item[field1] = "success";
          item[field2] = "√";
        }
      }
      return;
    }

    // 如果当前节点有 children，并且 children 是一个数组，则递归遍历
    if (Array.isArray(item.children)) {
      traverseTableData(item.children, id);
    }
  });
}

const updateTableData = (id: string) => {

  traverseTableData(tableData.value, id);
  console.log(id)
};

let timer: any = ref("");
const handlePauseTest = () => {


  if (!isPause.value) {
    pauseTimer()
  } else {
    resumeTimer()
  }
  isPause.value = !isPause.value;
};
//完成检测
const handleFinishTest = () => {
  resultDialogVisible.value = true
  ElMessage.success("完成检测");
};

const handleClick = (row: any) => {
  console.log(111, row)
  dataCheckSingleChannelSingleTestDialogVisable.value = true;
};

interface User {
  id: number
  scriptItemName: string
  name: string
  address: string
  hasChildren?: boolean
  children?: User[]
}
//resultType2: 'success',
//   resultValue2:'√',
//   resultType3: 'danger',
//   resultValue3:'×',

const operatorTableData = ref([
  {
    id: '1',
    scriptItemName: '频率',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
    children: [
      {
        id: '1-1',
        scriptItemName: '额定条件下的测量',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '1-1-1',
            scriptItemName: '频率：42.5Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '1-1-2',
            scriptItemName: '频率：50Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '1-1-3',
            scriptItemName: '频率：50.5Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '1-1-4',
            scriptItemName: '频率：57.5Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '1-2',
        scriptItemName: '电压对频率测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '1-2-1',
            scriptItemName: '频率：50.5Hz 电压：10%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '1-3',
        scriptItemName: '谐波对频率测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '1-3-1',
            scriptItemName: '频率：50.5Hz 谐波电压：h3 10%Un;h7 10%Un;h11 10%Un;h15 4%Un; h19 5%Un; h23 5%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
    ],
  },
  {
    id: '2',
    scriptItemName: '电压',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
    children: [
      {
        id: '2-1',
        scriptItemName: '额定条件下的测量',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '2-1-1',
            scriptItemName: '频率：50Hz 电压：10%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-2',
            scriptItemName: '频率：50Hz 电压：45%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-3',
            scriptItemName: '频率：50Hz 电压：80%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-4',
            scriptItemName: '频率：50Hz 电压：115%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-5',
            scriptItemName: '频率：50Hz 电压：150%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '2-2',
        scriptItemName: '频率对电压测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '2-2-1',
            scriptItemName: '频率：42.5Hz 电压：80%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '2-3',
        scriptItemName: '谐波对电压测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '2-3-1',
            scriptItemName: '频率：50Hz 电压：80%Un 谐波电压：h3 10%Un;h7 10%Un;h11 10%Un;h15 4%Un; h19 5%Un; h23 5%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
    ],
  },
  {
    id: '3',
    scriptItemName: '谐波电压',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '4',
    scriptItemName: '谐波电流',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '5',
    scriptItemName: '谐波有功功率',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '6',
    scriptItemName: '间谐波电压',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '7',
    scriptItemName: '间谐波电流',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '8',
    scriptItemName: '暂态',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '9',
    scriptItemName: '电流',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '10',
    scriptItemName: '电压不平衡度',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '11',
    scriptItemName: '电流不平衡度',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '12',
    scriptItemName: '短时闪变',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
])

const tableData = ref([
  {
    id: '1',
    scriptItemName: '频率',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
    children: [
      {
        id: '1-1',
        scriptItemName: '额定条件下的测量',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '1-1-1',
            scriptItemName: '频率：42.5Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '1-1-2',
            scriptItemName: '频率：50Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '1-1-3',
            scriptItemName: '频率：50.5Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '1-1-4',
            scriptItemName: '频率：57.5Hz',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '1-2',
        scriptItemName: '电压对频率测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '1-2-1',
            scriptItemName: '频率：50.5Hz 电压：10%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '1-3',
        scriptItemName: '谐波对频率测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '1-3-1',
            scriptItemName: '频率：50.5Hz 谐波电压：h3 10%Un;h7 10%Un;h11 10%Un;h15 4%Un; h19 5%Un; h23 5%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
    ],
  },
  {
    id: '2',
    scriptItemName: '电压',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
    children: [
      {
        id: '2-1',
        scriptItemName: '额定条件下的测量',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '2-1-1',
            scriptItemName: '频率：50Hz 电压：10%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-2',
            scriptItemName: '频率：50Hz 电压：45%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-3',
            scriptItemName: '频率：50Hz 电压：80%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-4',
            scriptItemName: '频率：50Hz 电压：115%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
          {
            id: '2-1-5',
            scriptItemName: '频率：50Hz 电压：150%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '2-2',
        scriptItemName: '频率对电压测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '2-2-1',
            scriptItemName: '频率：42.5Hz 电压：80%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
      {
        id: '2-3',
        scriptItemName: '谐波对电压测量的影响',
        resultType1: 'info',
        resultValue1: '-',
        resultType2: 'info',
        resultValue2: '-',
        resultType3: 'info',
        resultValue3: '-',
        resultType4: 'info',
        resultValue4: '-',
        resultType5: 'info',
        resultValue5: '-',
        resultType6: 'info',
        resultValue6: '-',
        resultType7: 'info',
        resultValue7: '-',
        resultType8: 'info',
        resultValue8: '-',
        children: [
          {
            id: '2-3-1',
            scriptItemName: '频率：50Hz 电压：80%Un 谐波电压：h3 10%Un;h7 10%Un;h11 10%Un;h15 4%Un; h19 5%Un; h23 5%Un',
            resultType1: 'info',
            resultValue1: '-',
            resultType2: 'info',
            resultValue2: '-',
            resultType3: 'info',
            resultValue3: '-',
            resultType4: 'info',
            resultValue4: '-',
            resultType5: 'info',
            resultValue5: '-',
            resultType6: 'info',
            resultValue6: '-',
            resultType7: 'info',
            resultValue7: '-',
            resultType8: 'info',
            resultValue8: '-',
          },
        ],
      },
    ],
  },
  {
    id: '3',
    scriptItemName: '谐波电压',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '4',
    scriptItemName: '谐波电流',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '5',
    scriptItemName: '谐波有功功率',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '6',
    scriptItemName: '间谐波电压',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '7',
    scriptItemName: '间谐波电流',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '8',
    scriptItemName: '暂态',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '9',
    scriptItemName: '电流',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '10',
    scriptItemName: '电压不平衡度',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '11',
    scriptItemName: '电流不平衡度',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
  {
    id: '12',
    scriptItemName: '短时闪变',
    resultType1: 'info',
    resultValue1: '-',
    resultType2: 'info',
    resultValue2: '-',
    resultType3: 'info',
    resultValue3: '-',
    resultType4: 'info',
    resultValue4: '-',
    resultType5: 'info',
    resultValue5: '-',
    resultType6: 'info',
    resultValue6: '-',
    resultType7: 'info',
    resultValue7: '-',
    resultType8: 'info',
    resultValue8: '-',
  },
])

const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');

const ts = ref('');

const startTimer = () => {
  //if (timer.value !== null) return; // 如果定时器已经启动，则不再重复启动
  timer.value = setInterval(() => {

    console.log(activeIndex.value, 111)
    if (activeIndex.value <= activeTotalNum.value) {
      activeIndex.value++;

      switch (activeIndex.value) {
        case 1:
          updateTableData("1-1-1")
          updateTableData("1-1-2")
          updateTableData("1-1-3")
          updateTableData("1-1-4")
          updateTableData("1-1")
          updateTableData("1-2-1")
          updateTableData("1-2")
          updateTableData("1-3-1")
          updateTableData("1-3")
          updateTableData("1")
          break;
        case 2:
          updateTableData("2-1-1")
          updateTableData("2-1-2")
          updateTableData("2-1-3")
          updateTableData("2-1-4")
          updateTableData("2-1-5")
          updateTableData("2-1")
          updateTableData("2-2-1")
          updateTableData("2-2")
          updateTableData("2-3-1")
          updateTableData("2-3")
          updateTableData("2")
          break;
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
          updateTableData(activeIndex.value.toString())
          break;

      }

      //   if (percentage.value < 100) {
      //   percentage.value = Math.trunc(activeIndex.value/activeTotalNum.value * 100);

      // } else {
      //   percentage.value = 100;
      //   clearInterval(timer)

      //   reportDisabled.value = false;

      // }

    }
    else {
      console.log(activeIndex.value, 222)
      clearInterval(timer.value)
      reportDisabled.value = false;
      console.log(activeIndex.value, 333)
    }
    qualified.value = 92
  }, 100);
};

const pauseTimer = () => {
  if (timer.value !== null) {
    clearInterval(timer.value);
    timer.value = null;
  }
};

const resumeTimer = () => {
  if (timer.value === null) {
    startTimer();
  }
};


</script>
<style scoped lang="scss">
:deep(.el-table .header-row) {
  // background-color:var(--el-color-warning-light-9);
  background-color:#f5f7fa;
  // color:red;
  // font-size:30px;
  // --el-table-tr-bg-color: var(--el-color-warning-light-9);
}
:deep(.el-table .warning-row) {
  // background-color:var(--el-color-warning-light-9);
  //background-color:#bed96557;
   color:red;
  // font-size:30px;
  // --el-table-tr-bg-color: var(--el-color-warning-light-9);
}

.change-errsys-dialog {
  display: flex;
  flex-direction: column;
}

.change-errsys-title {
  display: flex;
  flex-direction: row;
  margin-top: 10px;
}

.change-errsys-content {
  display: flex;
  flex-direction: column;
}

.tabs-title {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
</style>
<style lang="scss" scoped>
:deep(.el-button--small) {
  height: 20px !important;
  width: 20px !important;
}

:deep(.el-table--default td) {
  padding: 5px 0 !important;
}
</style>