Newer
Older
xc-business-system / src / views / equipement / standard / checkData / components / second / checkDataCom111.vue
<!-- 核查数据管理详情--核查项---第2套:直流稳压电源 -->
<script lang="ts" setup name="checkDataDetail">
import { ref, watch } from 'vue'
import { ElLoading, ElMessage } from 'element-plus'
import { clearDateValue, handleDetailTableTableHead, handleSaveDateParams, solveHistoryIndicationTableData } from '../useStabilityCaculate'
import saveCheckRecord from '../../dialog/saveCheckRecord.vue'
import type { IList } from './second-interface'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import useUserStore from '@/store/modules/user'
import type { dictType } from '@/global'
import { getDictByCode } from '@/api/system/dict'
import multiTable from '@/components/MultiHeaderTable/index.vue'
import { getCheckItemDetail, getJobInstructionList } from '@/api/equipment/standard/book'
import { addCheckData, calculateHandle, getHistoryIndication, getInfo, updateCheckData } from '@/api/equipment/standard/checkData'
import { uniqueMultiArray } from '@/utils/Array'
import { useScientificNotation } from '@/commonMethods/useScientificNotation'
const props = defineProps({
  selectStandardId: {
    type: String,
  },
  pageType: { // 页面类型
    type: String,
  },
  checkDate: { // 核查日期
    type: String,
  },
})

const emits = defineEmits(['isConfigCheck'])

const user = useUserStore() // 用户信息
const $router = useRouter() // 关闭页面使用
const $route = useRoute() // 路由参数
const pageType = ref('add') // 页面类型: add, edit, detail
const infoId = ref('')
const equipmentId = ref('')
const ruleFormRef = ref() // 表单ref
const form = ref({
  '1-flit': '',
  '2-flit': '',
  '3-flit': '',
  '4-flit': '',
  '5-flit': '',
})
const belongStandardEquipment = ref('2')
const itemCategoryId = ref('') // 核查项分类id
const itemCategoryName = ref('') // 核查项分类名称
const dateArrStability = ref<string[]>([]) // 稳定性日期数组
const currentDate = ref('') // 要查询历史稳定性的日期
// ----------------------------------路由参数------------------------------------------------
if ($route.params && $route.params.type) {
  pageType.value = $route.params.type as string
  console.log(pageType.value)

  if ($route.params.id) {
    infoId.value = $route.params.id as string
  }
}
// ------------------------------------------字典----------------------------------------------
const conclusionList = ref<dictType[]>([]) // 结论

function getDict() {
  // 结论
  getDictByCode('conclusion').then((response) => {
    conclusionList.value = response.data
  })
}
// getDict()

// ----------------------------------------核查数据----------------------------------------------
const radioMenus = ref([ // 标签内容
  { name: '直流电压', value: 'voltage', params: '直流电压' },
  { name: '电源效应和负载效应', value: 'effect', params: '电源效应和负载效应' },
  { name: '直流电流(直接测量)', value: 'electricity-direct', params: '直流电流(直接测量)' },
  { name: '直流电流(间接测量)', value: 'electricity-indirect', params: '直流电流(间接测量)' },
  { name: '纹波电压', value: 'ripple-voltage', params: '纹波电压' },
])
const current = ref('voltage') // 选择的tab 默认基本信息
const repeatabilityColumns = ref<TableColumn[]>([]) // 重复性表头
const stabilityColumns = ref<TableColumn[]>([]) // 稳定性表头
const stabilityColumnsCheckData = ref<TableColumn[]>([]) // 稳定性表头 -- 查询历史日期
const columns_repeatability_voltage = ref<TableColumn[]>([ // 重复性表头(直流电压、电源效应和负载效应,直流电流(直接测量))
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: '1', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '2', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '3', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '4', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '5', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '6', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对标准偏差', value: 'relativeRepeatability', align: 'center', type: 'text' },
])
// 直流电流(间接测量) 重复性表头
const columns_repeatability_electricity_indirect = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '核查参数', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: '1', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '2', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '3', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '4', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '5', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '6', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对标准偏差', value: 'relativeRepeatability', align: 'center', type: 'text' },
])

// 纹波电压 重复性表头
const columns_repeatability_ripple_voltage = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  { text: '频率', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '160',
    children: [
      { text: '1', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '2', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '3', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '4', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '5', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '6', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '7', value: 'testValueSeven', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '8', value: 'testValueEight', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '9', value: 'testValueNine', align: 'center', required: true, width: '180', type: 'inputNumber' },
      { text: '10', value: 'testValueTen', align: 'center', required: true, width: '180', type: 'inputNumber' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对标准偏差', value: 'relativeRepeatability', align: 'center', type: 'text' },
])

// 稳定性表头,直流电压、电源效应和负载效应
const columns_stability_voltage = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '110',
    children: [
      { text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对标准偏差', value: 'relativeRepeatability', align: 'center', type: 'text' },
  { text: '相对扩展不确定度Urel', value: 'urel', align: 'center', type: 'text' },
  { text: '相对标准偏差是否小于相对扩展不确定度Urel', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头,直流电压、电源效应和负载效应 -- 查询历史日期
const columns_stability_voltage_check_date = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '110',
    children: [
      { text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对标准偏差', value: 'relativeRepeatability', align: 'center', type: 'text' },
  { text: '相对扩展不确定度Urel', value: 'urel', align: 'center', type: 'text' },
  { text: '相对标准偏差是否小于相对扩展不确定度Urel', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头,直流电流(直接测量)、直流电流(间接测量)
const columns_stability_electricity_direct = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '110',
    children: [
      { text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对重复性', value: 'relativeRepeatability', align: 'center', type: 'text' },
  { text: '相对扩展不确定度Urel', value: 'urel', align: 'center', type: 'text' },
  { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头,直流电流(直接测量)、直流电流(间接测量) -- 查询历史日期
const columns_stability_electricity_direct_check_date = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '110',
    children: [
      { text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对重复性', value: 'relativeRepeatability', align: 'center', type: 'text' },
  { text: '相对扩展不确定度Urel', value: 'urel', align: 'center', type: 'text' },
  { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头,纹波电压
const columns_stability_ripple_voltage = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  { text: '频率', value: 'power', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '110',
    children: [
      { text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对扩展不确定度Urel', value: 'urel', align: 'center', type: 'text' },
  { text: '标准偏差是否小于相对扩展不确定度Urel', value: 'lessThanValue', align: 'center', type: 'text' },
])
// 稳定性表头,纹波电压 -- 查询历史日期
const columns_stability_ripple_voltage_check_date = ref<TableColumn[]>([
  { text: '核查项目', value: 'checkParam', align: 'center', required: true, type: 'text' },
  { text: '核查点', value: 'checkPoint', align: 'center', required: true, type: 'text' },
  { text: '单位', value: 'unit', align: 'center', required: true, type: 'text' },
  { text: '频率', value: 'power', align: 'center', required: true, type: 'text' },
  {
    text: '示值',
    value: 'indicatingValue',
    align: 'center',
    required: true,
    width: '110',
    children: [
      { text: '-', value: 'testValueOneDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueTwoDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueThreeDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFourDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueFiveDate', align: 'center', required: true, type: 'text' },
      { text: '-', value: 'testValueSixDate', align: 'center', required: true, type: 'text' },
    ],
  },
  { text: '算数平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
  { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: true, type: 'text' },
  { text: '相对扩展不确定度Urel', value: 'urel', align: 'center', type: 'text' },
  { text: '标准偏差是否小于相对扩展不确定度Urel', value: 'lessThanValue', align: 'center', type: 'text' },
])
const listRepeatability = ref<any[]>([]) // 重复性数据
const listRepeatabilityCheckDate = ref<any[]>([]) // 重复性数据-- 查询历史日期
const listStability = ref<any[]>([]) // 稳定性数据
const listStabilityCheckDate = ref<any[]>([]) // 稳定性数据-- 查询历史日期
const repeatabilityColumnsCheckData = ref()
const voltageListRepeatability = ref<any[]>([]) // 直流电压重复性
const voltageListRepeatabilityCheckDate = ref<any[]>([]) // 直流电压重复性 -- 查询历史日期
const voltageListStability = ref<any[]>([]) // 直流电压稳定性
const voltageListStabilityCheckDate = ref<any[]>([]) // 直流电压稳定性-- 查询历史日期
const effectListRepeatability = ref<any[]>([]) // 电源效应和负载效应重复性
const effectListRepeatabilityCheckDate = ref<any[]>([]) // 电源效应和负载效应重复性-- 查询历史日期
const effectListStability = ref<any[]>([]) // 电源效应和负载效应稳定性
const effectListStabilityCheckDate = ref<any[]>([]) // 电源效应和负载效应稳定性-- 查询历史日期
const electricityDirectListRepeatability = ref<any[]>([]) // 直流电流(直接测量)重复性
const electricityDirectListRepeatabilityCheckDate = ref<any[]>([]) // 直流电流(直接测量)重复性-- 查询历史日期
const electricityDirectListStability = ref<any[]>([]) // 直流电流(直接测量)稳定性/
const electricityDirectListStabilityCheckDate = ref<any[]>([]) // 直流电流(直接测量)稳定性-- 查询历史日期
const electricityIndirectListRepeatability = ref<any[]>([]) // 直流电流(间接测量)重复性
const electricityIndirectListRepeatabilityCheckDate = ref<any[]>([]) // 直流电流(间接测量)重复性-- 查询历史日期
const electricityIndirectListStability = ref<any[]>([]) // 直流电流(间接测量)稳定性
const electricityIndirectListStabilityCheckDate = ref<any[]>([]) // 直流电流(间接测量)稳定性-- 查询历史日期
const rippleVoltageListRepeatability = ref<any[]>([]) // 纹波电压重复性
const rippleVoltageListRepeatabilityCheckDate = ref<any[]>([]) // 纹波电压重复性 -- 查询历史日期
const rippleVoltageListStability = ref<any[]>([]) // 纹波电压稳定性
const rippleVoltageListStabilityCheckDate = ref<any[]>([]) // 纹波电压稳定性-- 查询历史日期
watch(() => [voltageListRepeatability.value, voltageListStability.value, effectListRepeatability.value, effectListStability.value, electricityDirectListRepeatability.value, electricityDirectListStability.value, electricityIndirectListRepeatability.value, electricityIndirectListStability.value, rippleVoltageListRepeatability.value, rippleVoltageListStability.value], () => {
  const variable = current.value
  current.value = ''
  setTimeout(() => {
    current.value = variable
  })
})
// 获取配置详情
function fetchCheckItemDetail(cequipmentId: string, belongStandardEquipmentParam: string, itemCategoryIdParam: string, itemCategoryNameParam: string) {
  belongStandardEquipment.value = belongStandardEquipmentParam // 检校标准库
  itemCategoryId.value = itemCategoryIdParam // 核查分类id
  itemCategoryName.value = itemCategoryNameParam // 核查分类名称
  equipmentId.value = cequipmentId
  const loading = ElLoading.service({
    lock: true,
    background: 'rgba(255, 255, 255, 0.8)',
  })
  const params = {
    equipmentId: cequipmentId, // 设备id
    belongStandardEquipment: belongStandardEquipment.value, // 检校标准库code
    itemCategoryId: itemCategoryId.value, // 核查项分类id
    itemCategoryName: itemCategoryName.value, // 核查项分类名称
  }
  getCheckItemDetail(params).then((res) => {
    console.log(res.data, '详情')
    loading.close()
    if (!res.data) {
      emits('isConfigCheck', false)
    }
    else {
      handleData(res.data.checkItemDataDcPowerList || [])
      setTimeout(() => {
        fetchHistoryIndication() // 获取稳定性
      })
    }
  })
}
// 处理数据
function handleData(data: any) {
  if (!data) { return }
  // 控制tab
  const dict = {
    1: '直流电压',
    2: '电源效应和负载效应',
    3: '直流电流(直接测量)',
    4: '直流电流(间接测量)',
    5: '纹波电压',
  } as { [key: string]: string }
  const needShowTab = uniqueMultiArray(data.map((item: any) => ({ ...item, params: Number(item.params) ? dict[item.params] : item.params })), 'params').map((item: any) => item.params)
  radioMenus.value = radioMenus.value.filter((item: any) => needShowTab.includes(Number(item.params) ? dict[item.params] : item.params))
  current.value = radioMenus.value[0]?.value
  // 直流电压重复性
  voltageListRepeatability.value = data.filter((item: any) => item.params === '1' || item.params === '直流电压').map((item: any) => ({
    ...item,
    editable: true,
    checkPoint: item.checkPoint,
    unit: item.unit,
    averageValue: '',
    standardDeviation: '',
    relativeRepeatability: '',
    checkParam: '直流电压',
    params: '直流电压',
    checkType: '重复性',
    testValueOne: '1',
    testValueTwo: '1',
    testValueThree: '1',
    testValueFour: '1',
    testValueFive: '1',
    testValueSix: '1',
    testValueOneDate: '',
    testValueTwoDate: '',
    testValueThreeDate: '',
    testValueFourDate: '',
    testValueFiveDate: '',
    testValueSixDate: '',
    urel: item.urel,
    lessThan: item.lessThan,
    lessThanValue: item.lessThanValue,
  }))
  // 直流电压稳定性
  voltageListStability.value = voltageListRepeatability.value.map((item: any) => ({
    ...item,
    checkType: '稳定性',
    testValueOne: '',
    testValueTwo: '',
    testValueThree: '',
    testValueFour: '',
    testValueFive: '',
    testValueSix: '',
  }))
  // 电源效应和负载效应重复性
  effectListRepeatability.value = data.filter((item: any) => item.params === '2' || item.params === '电源效应和负载效应').map((item: any) => ({
    ...item,
    editable: true,
    checkPoint: item.checkPoint,
    unit: item.unit,
    averageValue: '',
    standardDeviation: '',
    relativeRepeatability: '',
    checkParam: '电源效应和负载效应',
    params: '电源效应和负载效应',
    checkType: '重复性',
    testValueOne: '1',
    testValueTwo: '1',
    testValueThree: '1',
    testValueFour: '1',
    testValueFive: '1',
    testValueSix: '1',
    testValueOneDate: '',
    testValueTwoDate: '',
    testValueThreeDate: '',
    testValueFourDate: '',
    testValueFiveDate: '',
    testValueSixDate: '',
    urel: item.urel,
    lessThan: item.lessThan,
    lessThanValue: item.lessThanValue,
  }))
  // 电源效应和负载效应稳定性
  effectListStability.value = effectListRepeatability.value.map((item: any) => ({
    ...item,
    checkType: '稳定性',
    testValueOne: '',
    testValueTwo: '',
    testValueThree: '',
    testValueFour: '',
    testValueFive: '',
    testValueSix: '',
  }))
  // 直流电流(直接测量)重复性
  electricityDirectListRepeatability.value = data.filter((item: any) => item.params === '3' || item.params === '直流电流(直接测量)').map((item: any) => ({
    ...item,
    editable: true,
    checkPoint: item.checkPoint,
    unit: item.unit,
    averageValue: '',
    standardDeviation: '',
    relativeRepeatability: '',
    checkParam: '直流电流(直接测量)',
    params: '直流电流(直接测量)',
    checkType: '重复性',
    testValueOne: '1',
    testValueTwo: '1',
    testValueThree: '1',
    testValueFour: '1',
    testValueFive: '1',
    testValueSix: '1',
    testValueOneDate: '',
    testValueTwoDate: '',
    testValueThreeDate: '',
    testValueFourDate: '',
    testValueFiveDate: '',
    testValueSixDate: '',
    urel: item.urel,
    lessThan: item.lessThan,
    lessThanValue: item.lessThanValue,
  }))
  // 直流电流(直接测量)稳定性
  electricityDirectListStability.value = electricityDirectListRepeatability.value.map((item: any) => ({
    ...item,
    checkType: '稳定性',
    testValueOne: '',
    testValueTwo: '',
    testValueThree: '',
    testValueFour: '',
    testValueFive: '',
    testValueSix: '',
  }))
  //  直流电流(间接测量)重复性
  electricityIndirectListRepeatability.value = data.filter((item: any) => item.params === '4' || item.params === '直流电流(间接测量)').map((item: any) => ({
    ...item,
    editable: true,
    checkPoint: item.checkPoint,
    unit: item.unit,
    averageValue: '',
    standardDeviation: '',
    relativeRepeatability: '',
    checkParam: '直流电流(间接测量)',
    params: '直流电流(间接测量)',
    checkType: '重复性',
    testValueOne: '1',
    testValueTwo: '1',
    testValueThree: '1',
    testValueFour: '1',
    testValueFive: '1',
    testValueSix: '1',
    testValueOneDate: '',
    testValueTwoDate: '',
    testValueThreeDate: '',
    testValueFourDate: '',
    testValueFiveDate: '',
    testValueSixDate: '',
    urel: item.urel,
    lessThan: item.lessThan,
    lessThanValue: item.lessThanValue,
  }))
  // 直流电流(间接测量)稳定性
  electricityIndirectListStability.value = electricityIndirectListRepeatability.value.map((item: any) => ({
    ...item,
    checkType: '稳定性',
    testValueOne: '',
    testValueTwo: '',
    testValueThree: '',
    testValueFour: '',
    testValueFive: '',
    testValueSix: '',
  }))
  // 纹波电压重复性
  rippleVoltageListRepeatability.value = data.filter((item: any) => item.params === '5' || item.params === '纹波电压').map((item: any) => ({
    ...item,
    editable: true,
    checkPoint: item.checkPoint,
    unit: item.unit,
    averageValue: '',
    standardDeviation: '',
    relativeRepeatability: '',
    checkParam: '纹波电压',
    params: '纹波电压',
    checkType: '重复性',
    testValueOne: '1',
    testValueTwo: '1',
    testValueThree: '1',
    testValueFour: '1',
    testValueFive: '1',
    testValueSix: '1',
    testValueOneDate: '',
    testValueTwoDate: '',
    testValueThreeDate: '',
    testValueFourDate: '',
    testValueFiveDate: '',
    testValueSixDate: '',
    testValueSeven: '',
    testValueEight: '',
    testValueNine: '',
    testValueTen: '',
    urel: item.urel,
    lessThan: item.lessThan,
    lessThanValue: item.lessThanValue,
  }))
  // 纹波电压稳定性
  rippleVoltageListStability.value = rippleVoltageListRepeatability.value.map((item: any) => ({
    ...item,
    checkType: '稳定性',
    testValueOne: '',
    testValueTwo: '',
    testValueThree: '',
    testValueFour: '',
    testValueFive: '',
    testValueSix: '',
  }))
}

// 点击生成结果处理
const createResult = (params: string, type: string) => {
  // 公共请求函数
  const handleResult = (list: any, fun: any) => {
    const data = {
      belongStandardEquipment: belongStandardEquipment.value, // 检校标准库
      checkDataDcPowerList: [],
      itemCategoryId: itemCategoryId.value, // 核查项分类id
      itemCategoryName: itemCategoryName.value, // 核查项分类id
    }
    data.checkDataDcPowerList = list
    calculateHandle(data).then((res) => {
      fun(res.data)
    })
  }
  // 公共处理结果函数
  const handeData = (initData: any, handleData: any) => {
    return handleData.map((item: any, index: number) => {
      return {
        ...item,
        averageValue: initData[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
        standardDeviation: useScientificNotation(initData[index].standardDeviation), //	标准偏差S(X)
        relativeRepeatability: useScientificNotation(initData[index].relativeRepeatability), //	相对标准偏差
        testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
      }
    })
  }
  switch (params) {
    case 'voltage':
      // 直流电压
      if (!voltageListRepeatability.value.length) {
        ElMessage.warning('直流电压未配置重复性,请检查')
        break
      }
      switch (type) {
        case '重复性':
          handleResult(
            voltageListRepeatability.value.map((item: { lessThanValue: string }) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
              }
            }), (data: any) => {
              voltageListRepeatability.value = handeData(data, voltageListRepeatability.value)
            })
          break
        case '稳定性':
          if (!voltageListRepeatability.value[0].averageValue) {
            ElMessage.warning('请先计算直流电压重复性')
            break
          }
          handleResult(
            voltageListStability.value.map((item: { lessThanValue: string }, index) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
                testValueSix: voltageListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }
            }), (data: any) => {
              voltageListStability.value = handeData(data, voltageListStability.value).map((item: any, index: number) => ({
                ...item,
                testValueSix: voltageListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }))
            })
          break
      }
      break
    case 'effect':
      // 电源效应和负载效应
      if (!effectListRepeatability.value.length) {
        ElMessage.warning('电源效应和负载效应未配置重复性,请检查')
        break
      }
      switch (type) {
        case '重复性':
          handleResult(
            effectListRepeatability.value.map((item: { lessThanValue: string }) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
              }
            }), (data: any) => {
              effectListRepeatability.value = handeData(data, effectListRepeatability.value)
            })
          break
        case '稳定性':
          if (!effectListRepeatability.value[0].averageValue) {
            ElMessage.warning('请先计算电源效应和负载效应重复性')
            break
          }
          handleResult(
            effectListStability.value.map((item: { lessThanValue: string }, index) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
                testValueSix: effectListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }
            }), (data: any) => {
              effectListStability.value = handeData(data, effectListStability.value).map((item: any, index: number) => ({
                ...item,
                testValueSix: effectListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }))
            })
          break
      }
      break
    case 'electricity-direct':
      // 直流电流(直接测量)
      if (!electricityDirectListRepeatability.value.length) {
        ElMessage.warning('直流电流(直接测量)未配置重复性,请检查')
        break
      }
      switch (type) {
        case '重复性':
          handleResult(
            electricityDirectListRepeatability.value.map((item: { lessThanValue: string }) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
              }
            }), (data: any) => {
              electricityDirectListRepeatability.value = handeData(data, electricityDirectListRepeatability.value)
            })
          break
        case '稳定性':
          if (!electricityDirectListRepeatability.value[0].averageValue) {
            ElMessage.warning('请先计算直流电流(直接测量)重复性')
            break
          }
          handleResult(
            electricityDirectListStability.value.map((item: { lessThanValue: string }, index) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
                testValueSix: electricityDirectListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }
            }), (data: any) => {
              electricityDirectListStability.value = handeData(data, electricityDirectListStability.value).map((item: any, index: number) => ({
                ...item,
                testValueSix: electricityDirectListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }))
            })
          break
      }
      break
    case 'electricity-indirect':
      // 直流电流(间接测量)
      if (!electricityIndirectListRepeatability.value.length) {
        ElMessage.warning('直流电流(间接测量)未配置重复性,请检查')
        break
      }
      switch (type) {
        case '重复性':
          handleResult(
            electricityIndirectListRepeatability.value.map((item: { lessThanValue: string }) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
              }
            }), (data: any) => {
              electricityIndirectListRepeatability.value = handeData(data, electricityIndirectListRepeatability.value)
            })
          break
        case '稳定性':
          if (!electricityIndirectListRepeatability.value[0].averageValue) {
            ElMessage.warning('请先计算直流电流(间接测量)重复性')
            break
          }
          handleResult(
            electricityIndirectListStability.value.map((item: { lessThanValue: string }, index) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
                testValueSix: electricityIndirectListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }
            }), (data: any) => {
              electricityIndirectListStability.value = handeData(data, electricityIndirectListStability.value).map((item: any, index: number) => ({
                ...item,
                testValueSix: electricityIndirectListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }))
            })
          break
      }
      break
    case 'ripple-voltage':
      // 纹波电压
      if (!rippleVoltageListRepeatability.value.length) {
        ElMessage.warning('纹波电压未配置重复性,请检查')
        break
      }
      switch (type) {
        case '重复性':
          handleResult(
            rippleVoltageListRepeatability.value.map((item: { lessThanValue: string }) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
              }
            }), (data: any) => {
              rippleVoltageListRepeatability.value = handeData(data, rippleVoltageListRepeatability.value)
            })
          break
        case '稳定性':
          if (!rippleVoltageListRepeatability.value[0].averageValue) {
            ElMessage.warning('请先计算纹波电压重复性')
            break
          }
          handleResult(
            rippleVoltageListStability.value.map((item: { lessThanValue: string }, index) => {
              return {
                ...item,
                lessThan: item.lessThanValue === '是' || item.lessThanValue === '合格' ? '1' : item.lessThanValue === '否' || item.lessThanValue === '不合格' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1)
                testValueSix: rippleVoltageListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }
            }), (data: any) => {
              rippleVoltageListStability.value = handeData(data, rippleVoltageListStability.value).map((item: any, index: number) => ({
                ...item,
                testValueSix: rippleVoltageListRepeatability.value[index].averageValue, //	核查读数6(本次重复性示值算术平均值)
                testValueSixDate: props.checkDate, //	核查读数6日期(本次核查日期)
              }))
            })
          break
      }
      break
  }
}
// 处理详情数据
const solveGetDetailData = (responseList: any) => {
  // 直流电压重复性
  const voltageListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => (item.params === '1' || item.params === '直流电压') && item.checkType === '重复性').map((item: any) => {
    return {
      // checkParam: '直流电压',
      ...item,
      params: '直流电压',
      editable: props.pageType !== 'detail',
    }
  })
  // 直流电压稳定性
  const voltageListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => (item.params === '1' || item.params === '直流电压') && item.checkType === '稳定性').map((item: any) => {
    return {
      // checkParam: '直流电压',
      ...item,
      params: '直流电压',
      lessThanValue: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : '',
    }
  })
  // 电源效应和负载效应重复性
  const effectListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => (item.params === '2' || item.params === '电源效应和负载效应') && item.checkType === '重复性').map((item: any) => {
    return {
      // checkParam: '电源效应和负载效应',
      ...item,
      params: '电源效应和负载效应',
      editable: props.pageType !== 'detail',
    }
  })
  // 电源效应和负载效应稳定性
  const effectListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => (item.params === '2' || item.params === '电源效应和负载效应') && item.checkType === '稳定性').map((item: any) => {
    return {
      // checkParam: '电源效应和负载效应',
      ...item,
      params: '电源效应和负载效应',
      lessThanValue: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : '',
    }
  })
  // 直流电流(直接测量)重复性
  const electricityDirectListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => (item.params === '3' || item.params === '直流电流(直接测量)') && item.checkType === '重复性').map((item: any) => {
    return {
      // checkParam: '直流电流(直接测量)',
      ...item,
      params: '直流电流(直接测量)',
      editable: props.pageType !== 'detail',
    }
  })
  // 直流电流(直接测量)稳定性
  const electricityDirectListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => (item.params === '3' || item.params === '直流电流(直接测量)') && item.checkType === '稳定性').map((item: any) => {
    return {
      // checkParam: '直流电流(直接测量)',
      ...item,
      params: '直流电流(直接测量)',
      lessThanValue: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : '',
    }
  })
  // 直流电流(间接测量)重复性
  const electricityIndirectListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => (item.params === '4' || item.params === '直流电流(间接测量)') && item.checkType === '重复性').map((item: any) => {
    return {
      // checkParam: '直流电流(间接测量)',
      ...item,
      params: '直流电流(间接测量)',
      editable: props.pageType !== 'detail',
    }
  })
  // 直流电流(间接测量)稳定性
  const electricityIndirectListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => (item.params === '4' || item.params === '直流电流(间接测量)') && item.checkType === '稳定性').map((item: any) => {
    return {
      // checkParam: '直流电流(间接测量)',
      ...item,
      params: '直流电流(间接测量)',
      lessThanValue: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : '',
    }
  })
  // 纹波电压重复性
  const rippleVoltageListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => (item.params === '5' || item.params === '纹波电压') && item.checkType === '重复性').map((item: any) => {
    return {
      // checkParam: '纹波电压',
      ...item,
      params: '纹波电压',
      editable: props.pageType !== 'detail',
    }
  })
  // 纹波电压稳定性
  const rippleVoltageListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => (item.params === '5' || item.params === '纹波电压') && item.checkType === '稳定性').map((item: any) => {
    return {
      // checkParam: '纹波电压',
      ...item,
      params: '纹波电压',
      lessThanValue: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : '',
    }
  })
  return {
    voltageListRepeatabilityList,
    voltageListStabilityList,
    effectListRepeatabilityList,
    effectListStabilityList,
    electricityDirectListRepeatabilityList,
    electricityDirectListStabilityList,
    electricityIndirectListRepeatabilityList,
    electricityIndirectListStabilityList,
    rippleVoltageListRepeatabilityList,
    rippleVoltageListStabilityList,

  }
}
// ------------------------------------------------------------------------------------------
// 保存之前的校验
// function checkList() {
//   if (current.value === 'voltage' && `${voltageListRepeatability.value[0].averageValue}` === '') { // 直流电压
//     ElMessage.warning('请计算直流电压重复性')
//     return false
//   }
//   if (current.value === 'effect' && `${effectListRepeatability.value[0].averageValue}` === '') { // 电源效应和负载效应
//     ElMessage.warning('请计算电源效应和负载效应重复性')
//     return false
//   }
//   if (current.value === 'voltage' && `${voltageListStability.value[0].lessThan}` === '') { // 直流电压
//     ElMessage.warning('请计算直流电压稳定性')
//     return false
//   }
//   if (current.value === 'resistance' && `${resistanceListStability.value[0].lessThan}` === '') { // 电阻测量
//     ElMessage.warning('请计算电阻测量稳定性')
//     return false
//   }
//   return true
// }
// 获取详情
function fetchInfo(id = '') {
  const loading = ElLoading.service({
    lock: true,
    background: 'rgba(255, 255, 255, 0.8)',
  })
  getInfo({ id: infoId.value }).then((res) => {
    form.value = { ...res.data }
    equipmentId.value = res.data.equipmentId
    const { voltageListStabilityList, effectListStabilityList, electricityDirectListStabilityList, electricityIndirectListStabilityList, rippleVoltageListStabilityList, voltageListRepeatabilityList, effectListRepeatabilityList, electricityDirectListRepeatabilityList, electricityIndirectListRepeatabilityList, rippleVoltageListRepeatabilityList } = solveGetDetailData(res.data.checkDataDcPowerList || [])
    // 控制tab
    const dict = {
      1: '直流电压',
      2: '电源效应和负载效应',
      3: '直流电流(直接测量)',
      4: '直流电流(间接测量)',
      5: '纹波电压',
    } as { [key: string]: string }
    const needShowTab = uniqueMultiArray((res.data.checkDataDcPowerList || []).map((item: any) => ({ ...item, params: Number(item.params) ? dict[item.params] : item.params })), 'params').map((item: any) => item.params)
    radioMenus.value = radioMenus.value.filter((item: any) => needShowTab.includes(Number(item.params) ? dict[item.params] : item.params))
    current.value = radioMenus.value[0]?.value
    if (id !== '') { // 查询的日期获得的数据
      voltageListRepeatabilityCheckDate.value = voltageListRepeatabilityList
      voltageListStabilityCheckDate.value = voltageListStabilityList
      effectListRepeatabilityCheckDate.value = effectListRepeatabilityList
      effectListStabilityCheckDate.value = effectListStabilityList
      electricityDirectListStabilityCheckDate.value = electricityDirectListStabilityList
      electricityIndirectListStabilityCheckDate.value = electricityIndirectListStabilityList
      rippleVoltageListStabilityCheckDate.value = rippleVoltageListStabilityList
      electricityDirectListRepeatabilityCheckDate.value = electricityDirectListRepeatabilityList
      electricityIndirectListRepeatabilityCheckDate.value = electricityIndirectListRepeatabilityList
      rippleVoltageListRepeatabilityCheckDate.value = rippleVoltageListRepeatabilityList
    }
    else {
      voltageListRepeatability.value = voltageListRepeatabilityList
      voltageListStability.value = voltageListStabilityList
      effectListRepeatability.value = effectListRepeatabilityList
      effectListStability.value = effectListStabilityList
      electricityDirectListStability.value = electricityDirectListStabilityList
      electricityIndirectListStability.value = electricityIndirectListStabilityList
      rippleVoltageListStability.value = rippleVoltageListStabilityList
      electricityDirectListRepeatability.value = electricityDirectListRepeatabilityList
      electricityIndirectListRepeatability.value = electricityIndirectListRepeatabilityList
      rippleVoltageListRepeatability.value = rippleVoltageListRepeatabilityList
    }
    nextTick(() => {
      if (id !== '') { // 稳定性表头---查询历史的稳定性日期数据
        columns_stability_voltage.value[3].children = [
          { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
        ]
        columns_stability_electricity_direct.value[3].children = [
          { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
        ]
        columns_stability_ripple_voltage.value[4].children = [
          { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
          { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
        ]
        fetchHistoryIndication(currentDate.value) // 获取稳定性
      }
      else { // 详情制作表头
        // if (props.pageType === 'detail') { return }
        columns_stability_voltage.value = handleDetailTableTableHead(columns_stability_voltage.value, voltageListStability.value || effectListStability.value || [], 3)
        // columns_stability_voltage.value = handleDetailTableTableHead(columns_stability_voltage.value, effectListStability.value, 3)
        columns_stability_electricity_direct.value = handleDetailTableTableHead(columns_stability_electricity_direct.value, electricityDirectListStability.value || electricityIndirectListStability.value || [], 3)
        // columns_stability_electricity_direct.value = handleDetailTableTableHead(columns_stability_electricity_direct.value, electricityIndirectListStability.value, 3)
        columns_stability_ripple_voltage.value = handleDetailTableTableHead(columns_stability_ripple_voltage.value, rippleVoltageListStability.value || [], 4)
      }
    })
    console.log(columns_stability_voltage.value[3], ' columns_stability_voltage.value[3] columns_stability_voltage.value[3]')
    form.value['1-flit'] = `${voltageListStability.value[0]?.qualified}` === '1' ? '合格' : '不合格'
    form.value['2-flit'] = `${effectListStability.value[0]?.qualified}` === '1' ? '合格' : '不合格'
    form.value['3-flit'] = `${electricityDirectListStability.value[0]?.qualified}` === '1' ? '合格' : '不合格'
    form.value['4-flit'] = `${electricityIndirectListStability.value[0]?.qualified}` === '1' ? '合格' : '不合格'
    form.value['5-flit'] = `${rippleVoltageListStability.value[0]?.qualified}` === '1' ? '合格' : '不合格'
    if (props.pageType === 'edit' || props.pageType === 'detail') {
      fetchHistoryIndication() // 重新拉取稳定性日期
    }
    loading.close()
  })
}
/**
 * 获取稳定性示值
 * @param date 查询日期
 */
function fetchHistoryIndication(date = '') {
  const params = {
    belongStandardEquipment: belongStandardEquipment.value,	// 检校标准库(字典code)
    checkDate: date || props.checkDate!,	// 核查日期
    checkParam: '',	// 核查参数((直流稳压电源-直流电流(间接测量))
    conclusion: '合格',	// 结论
    equipmentId: equipmentId.value,	// 被核查设备id
    params: radioMenus.value.filter(item => item.value === current.value)[0].params,	// 核查项目
    stabilityExamine: '1',	// 是否用于稳定性考核(1/0)
    standardEquipmentId: props.selectStandardId!,	// 被核查标准库id
  }
  if (props.selectStandardId && equipmentId.value) {
    getHistoryIndication(params).then((res) => {
      if (date === '') { // 正常核查数据
        const num = (props.pageType === 'edit' || props.pageType === 'detail') ? 5 : 4
        // 直流电压
        voltageListStability.value = (voltageListStability.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '1' || item.params === '直流电压'), item, columns_stability_voltage.value, num, 3, '2')
          columns_stability_voltage.value = columnsData
          return item = itemData
        })
        voltageListStability.value = handleSaveDateParams(columns_stability_voltage.value, voltageListStability.value, 3)
        // 电源效应和负载效应
        effectListStability.value = (effectListStability.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '2' || item.params === '电源效应和负载效应'), item, columns_stability_voltage.value, num, 3, '2')
          columns_stability_voltage.value = columnsData
          return item = itemData
        })
        effectListStability.value = handleSaveDateParams(columns_stability_voltage.value, effectListStability.value, 3)
        // 直流电流(直接测量)
        electricityDirectListStability.value = (electricityDirectListStability.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '3' || item.params === '直流电流(直接测量)'), item, columns_stability_electricity_direct.value, num, 3, '2')
          columns_stability_electricity_direct.value = columnsData
          return item = itemData
        })
        electricityDirectListStability.value = handleSaveDateParams(columns_stability_electricity_direct.value, electricityDirectListStability.value, 3)

        // 直流电流(间接测量)
        electricityIndirectListStability.value = (electricityIndirectListStability.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '4' || item.params === '直流电流(间接测量)'), item, columns_stability_electricity_direct.value, num, 3, '2')
          columns_stability_electricity_direct.value = columnsData
          return item = itemData
        })
        electricityIndirectListStability.value = handleSaveDateParams(columns_stability_electricity_direct.value, electricityIndirectListStability.value, 3)
        // 纹波电压
        rippleVoltageListStability.value = (rippleVoltageListStability.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '5' || item.params === '纹波电压'), item, columns_stability_ripple_voltage.value, num, 4, '2')
          columns_stability_ripple_voltage.value = columnsData
          return item = itemData
        })
        rippleVoltageListStability.value = handleSaveDateParams(columns_stability_ripple_voltage.value, rippleVoltageListStability.value, 4)
      }
      else {
        initColumnsCheckDate()
        // 直流电压
        if (radioMenus.value.filter((item: { name: string }) => item.name === '直流电压').length) {
          voltageListStabilityCheckDate.value = (voltageListStabilityCheckDate.value || []).map((item) => {
            clearDateValue(item)
            const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '1' || item.params === '直流电压'), item, columns_stability_voltage_check_date.value, 5, 3, '2')
            columns_stability_voltage_check_date.value = columnsData
            return item = itemData
          })
          voltageListStabilityCheckDate.value = handleSaveDateParams(columns_stability_voltage_check_date.value, voltageListStabilityCheckDate.value, 3)
        }
        //  电源效应和负载效应
        effectListStabilityCheckDate.value = (effectListStabilityCheckDate.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '2' || item.params === '电源效应和负载效应'), item, columns_stability_voltage_check_date.value, 5, 3, '2')
          columns_stability_voltage_check_date.value = columnsData
          return item = itemData
        })
        // 直流电流(直接测量)
        electricityDirectListStabilityCheckDate.value = (electricityDirectListStabilityCheckDate.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '3' || item.params === '直流电流(直接测量)'), item, columns_stability_electricity_direct_check_date.value, 5, 3, '2')
          columns_stability_electricity_direct_check_date.value = columnsData
          return item = itemData
        })
        // 直流电流(间接测量)
        electricityIndirectListStabilityCheckDate.value = (electricityIndirectListStabilityCheckDate.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '4' || item.params === '直流电流(间接测量)'), item, columns_stability_electricity_direct_check_date.value, 5, 3, '2')
          columns_stability_electricity_direct_check_date.value = columnsData
          return item = itemData
        })
        // 纹波电压
        rippleVoltageListStabilityCheckDate.value = (rippleVoltageListStabilityCheckDate.value || []).map((item) => {
          clearDateValue(item)
          const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data.filter((item: any) => item.params === '5' || item.params === '纹波电压'), item, columns_stability_ripple_voltage_check_date.value, 5, 4, '2')
          columns_stability_ripple_voltage_check_date.value = columnsData
          return item = itemData
        })
      }
    })
  }
}
// =======================点击表头日期查询历史稳定性数据===================
// 点击表头
const handleClickHeader = (val: any, checkDateDetailId: string) => {
  dateArrStability.value = ['核查数据', val.label]
  fetchInfo(checkDateDetailId) // 获取此次历史日期的详情
}

// 日期变化
const handleChangeRadio = (date: string) => {
  currentDate.value = date
}
// 监听核查日期变化
watch(() => props.checkDate, (newValue) => {
  console.log(newValue, 'props.checkDate')
  if (newValue) {
    initColumns()
    nextTick(() => {
      fetchHistoryIndication() // 重新拉取稳定性日期
    })
  }
}, { immediate: true })
/**
 * 初始化表头
 * @param soveLastColumnDate 是否处理最后一列
 */
function initColumns() {
  (columns_stability_voltage.value[3] || {}).children = [
    { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
  ];
  (columns_stability_electricity_direct.value[3] || {}).children = [
    { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
  ];
  (columns_stability_ripple_voltage.value[4] || {}).children = [
    { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
  ]
  const index = (columns_stability_voltage.value || []).findIndex(item => item.text === '示值')
  if (index !== -1) {
    columns_stability_voltage.value[index].children![5].text = props.checkDate! // 最后一列的表头日期
  }
  const indexWorst = columns_stability_electricity_direct.value.findIndex(item => item.text === '示值')
  if (index !== -1) {
    columns_stability_electricity_direct.value[indexWorst].children![5].text = props.checkDate! // 最后一列的表头日期
  }
  const indexModel = columns_stability_ripple_voltage.value.findIndex(item => item.text === '示值')
  if (index !== -1) {
    columns_stability_ripple_voltage.value[indexModel].children![5].text = props.checkDate! // 最后一列的表头日期
  }
}

/**
 * 初始化CheckDate表头
 * @param soveLastColumnDate 是否处理最后一列
 */
function initColumnsCheckDate() {
  columns_stability_voltage_check_date.value[3].children = [
    { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
  ]
  columns_stability_electricity_direct_check_date.value[3].children = [
    { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
  ]
  columns_stability_ripple_voltage_check_date.value[4].children = [
    { width: '180', text: '-', value: 'testValueOne', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueTwo', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueThree', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFour', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueFive', align: 'center', required: false, type: 'text', customHeader: true },
    { width: '180', text: '-', value: 'testValueSix', align: 'center', required: false, type: 'text', customHeader: true },
  ]
}
// / 保存之前的校验
function checkList() {
  // 新建核查数据的时候,在保存之前要先校验一下本次核查日期有没有数据,没有不允许保存
  if (voltageListRepeatability.value.length && `${voltageListRepeatability.value[0]?.averageValue}` === '') {
    ElMessage.warning('请计算直流电压重复性')
    return false
  }
  if (effectListRepeatability.value.length && `${effectListRepeatability.value[0]?.averageValue}` === '') {
    ElMessage.warning('请计算电源效应和负载效应重复性')
    return false
  }
  if (electricityDirectListRepeatability.value.length && `${electricityDirectListRepeatability.value[0]?.averageValue}` === '') {
    ElMessage.warning('请计算直流电流(直接测量)重复性')
    return false
  }
  if (electricityIndirectListRepeatability.value.length && `${electricityIndirectListRepeatability.value[0]?.averageValue}` === '') {
    ElMessage.warning('请计算直流电流(间接测量)重复性')
    return false
  }
  if (rippleVoltageListRepeatability.value.length && `${rippleVoltageListRepeatability.value[0]?.averageValue}` === '') {
    ElMessage.warning('请计算纹波电压重复性')
    return false
  }
  return true
}
// -------------------------------------钩子-----------------------------------------------------
// 统计日期
const dateCount = (columns: TableColumn[], index: number) => {
  let dateNum = 0 // 稳定性表格有几个日期

  // 统计有几个日期
  columns[index].children?.forEach((item) => {
    if (item.text !== '-' && item.text !== '') {
      dateNum += 1
    }
  })
  return dateNum
}
// 监听稳定性表格--判断稳定性考核是否合格
watch([() => voltageListStability.value, () => effectListStability.value, () => electricityDirectListStability.value, () => electricityIndirectListStability.value, () => rippleVoltageListStability.value], (newValue: any) => {
  console.log(newValue[0], 'newValue[0]')
  if (newValue[0] && newValue[0].length) { // 直流电压
    const result = newValue[0].every((item: { lessThanValue: string }) => {
      return item.lessThanValue === '是' || item.lessThanValue === '合格'
    })
    const dateNum = dateCount(columns_stability_voltage.value, 3)
    form.value['1-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格'
    console.log(form.value, 'form.value')
  }
  if (newValue[1] && newValue[1].length) { // 电源效应和负载效应
    const result = newValue[1].every((item: { lessThanValue: string }) => {
      return item.lessThanValue === '是' || item.lessThanValue === '合格'
    })
    const dateNum = dateCount(columns_stability_voltage.value, 3)
    form.value['2-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格'
  }
  if (newValue[2] && newValue[2].length) { // 直流电流(直接测量)
    const result = newValue[2].every((item: { lessThanValue: string }) => {
      return item.lessThanValue === '是' || item.lessThanValue === '合格'
    })
    const dateNum = dateCount(columns_stability_electricity_direct.value, 3)
    form.value['3-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格'
  }
  if (newValue[3] && newValue[3].length) { // 直流电流(间接测量)
    const result = newValue[3].every((item: { lessThanValue: string }) => {
      return item.lessThanValue === '是' || item.lessThanValue === '合格'
    })
    const dateNum = dateCount(columns_stability_electricity_direct.value, 3)
    form.value['4-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格'
  }
  if (newValue[4] && newValue[4].length) { // 纹波电压
    const result = newValue[4].every((item: { lessThanValue: string }) => {
      return item.lessThanValue === '是' || item.lessThanValue === '合格'
    })
    const dateNum = dateCount(columns_stability_ripple_voltage.value, 4)
    form.value['5-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格'
  }
}, { deep: true, immediate: true })
watch(() => current.value, (newValue) => {
  if (currentDate.value.includes('-')) { return }
  switch (newValue) {
    case 'voltage': // 直流电压
      repeatabilityColumns.value = columns_repeatability_voltage.value // 重复性表头
      stabilityColumns.value = columns_stability_voltage.value // 稳定性表头
      listRepeatability.value = voltageListRepeatability.value // 重复性数据
      listStability.value = voltageListStability.value // 稳定性数据
      break
    case 'effect': // 电源效应和负载效应
      repeatabilityColumns.value = columns_repeatability_voltage.value // 重复性表头
      stabilityColumns.value = columns_stability_voltage.value // 稳定性表头
      listRepeatability.value = effectListRepeatability.value // 重复性数据
      listStability.value = effectListStability.value // 稳定性数据
      break
    case 'electricity-direct': // 直流电流(直接测量)
      repeatabilityColumns.value = columns_repeatability_voltage.value // 重复性表头
      stabilityColumns.value = columns_stability_electricity_direct.value // 稳定性表头
      listRepeatability.value = electricityDirectListRepeatability.value // 重复性数据
      listStability.value = electricityDirectListStability.value // 稳定性数据
      break
    case 'electricity-indirect': // 直流电流(间接测量)
      repeatabilityColumns.value = columns_repeatability_electricity_indirect.value // 重复性表头
      stabilityColumns.value = columns_stability_electricity_direct.value // 稳定性表头
      listRepeatability.value = electricityIndirectListRepeatability.value // 重复性数据
      listStability.value = electricityIndirectListStability.value // 稳定性数据
      break
    case 'ripple-voltage': // 纹波电压
      repeatabilityColumns.value = columns_repeatability_ripple_voltage.value // 重复性表头
      stabilityColumns.value = columns_stability_ripple_voltage.value // 稳定性表头
      listRepeatability.value = rippleVoltageListRepeatability.value // 重复性数据
      listStability.value = rippleVoltageListStability.value // 稳定性数据
      break
  }
}, { immediate: true })
watch(() => [currentDate.value, current.value], (newValue) => {
  if (newValue[0] === '核查数据') { return }
  switch (newValue[1]) {
    case 'voltage': // 直流电压
      listRepeatabilityCheckDate.value = voltageListRepeatabilityCheckDate.value
      repeatabilityColumnsCheckData.value = columns_repeatability_voltage.value
      listStabilityCheckDate.value = voltageListStabilityCheckDate.value
      stabilityColumnsCheckData.value = columns_stability_voltage_check_date.value
      break
    case 'effect': // 电源效应和负载效应
      listRepeatabilityCheckDate.value = effectListRepeatabilityCheckDate.value
      repeatabilityColumnsCheckData.value = columns_repeatability_voltage.value
      listStabilityCheckDate.value = effectListStabilityCheckDate.value
      stabilityColumnsCheckData.value = columns_stability_voltage_check_date.value
      break
    case 'electricity-direct': // 直流电流(直接测量)
      listRepeatabilityCheckDate.value = electricityDirectListRepeatabilityCheckDate.value
      repeatabilityColumnsCheckData.value = columns_repeatability_voltage.value
      listStabilityCheckDate.value = electricityDirectListStabilityCheckDate.value
      stabilityColumnsCheckData.value = columns_stability_electricity_direct_check_date.value
      break
    case 'electricity-indirect': // 直流电流(间接测量)
      listRepeatabilityCheckDate.value = electricityIndirectListRepeatabilityCheckDate.value
      repeatabilityColumnsCheckData.value = columns_repeatability_electricity_indirect.value
      listStabilityCheckDate.value = electricityIndirectListStabilityCheckDate.value
      stabilityColumnsCheckData.value = columns_stability_electricity_direct_check_date.value
      break
    case 'ripple-voltage': // 纹波电压
      listRepeatabilityCheckDate.value = rippleVoltageListRepeatabilityCheckDate.value
      repeatabilityColumnsCheckData.value = columns_repeatability_ripple_voltage.value
      listStabilityCheckDate.value = rippleVoltageListStabilityCheckDate.value
      stabilityColumnsCheckData.value = columns_stability_ripple_voltage_check_date.value
      break
  }
})
watch(() => props.pageType, (newVal) => {
  voltageListRepeatability.value = voltageListRepeatability.value.map((item: any) => ({ ...item, editable: props.pageType !== 'detail' }))
  effectListRepeatability.value = effectListRepeatability.value.map((item: any) => ({ ...item, editable: props.pageType !== 'detail' }))
  electricityDirectListRepeatability.value = electricityDirectListRepeatability.value.map((item: any) => ({ ...item, editable: props.pageType !== 'detail' }))
  electricityIndirectListRepeatability.value = electricityIndirectListRepeatability.value.map((item: any) => ({ ...item, editable: props.pageType !== 'detail' }))
  rippleVoltageListRepeatability.value = rippleVoltageListRepeatability.value.map((item: any) => ({ ...item, editable: props.pageType !== 'detail' }))
})
onMounted(async () => {
  belongStandardEquipment.value = $route.query.belongStandardEquipment as string // 检校标准库
  itemCategoryId.value = $route.query.itemCategoryId as string // 核查项分类id
  itemCategoryName.value = $route.query.itemCategoryName as string // 核查项分类名称
  if (pageType.value !== 'add') {
    fetchInfo()
  }
})
const getList = () => {
  const arr = [...voltageListRepeatability.value || [], ...voltageListStability.value || [], ...effectListRepeatability.value || [], ...effectListStability.value || [], ...electricityDirectListRepeatability.value || [], ...electricityDirectListStability.value || [], ...electricityIndirectListRepeatability.value || [], ...electricityIndirectListStability.value || [], ...rippleVoltageListRepeatability.value || [], ...rippleVoltageListStability.value || []] as any[]
  return arr
}
defineExpose({ fetchCheckItemDetail, form, checkList, getList })
</script>

<template>
  <!-- 核查数据 -->
  <detail-block :title="dateArrStability.length > 1 ? ' ' : '核查数据'" :title-menus="dateArrStability" @handle-change-radio="handleChangeRadio">
    <div style="display: flex;justify-content: space-between;">
      <el-radio-group v-model="current" style="margin-bottom: 20px;">
        <el-radio-button v-for="item in radioMenus" :key="item.value" :label="item.value">
          {{ item.name }}
        </el-radio-button>
      </el-radio-group>
    </div>
    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>核查类型--重复性</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult(current, '重复性')">
        生成结果处理
      </el-button>
    </div>
    <multi-table
      v-show="currentDate === '核查数据' || currentDate === ''"
      :table-data="listRepeatability"
      :table-header="repeatabilityColumns"
      :merge-rows="[]"
      :need-index="true"
    />
    <!-- 历史日期重复性数据 -->
    <multi-table
      v-show="currentDate !== '核查数据' && currentDate !== ''"
      :table-data="listRepeatabilityCheckDate"
      :table-header="repeatabilityColumnsCheckData"
      :merge-rows="[]"
      :need-index="true"
      max-height="300"
    />

    <div style="display: flex;justify-content: space-between;align-items: center;">
      <h5>核查类型--稳定性</h5>
      <el-button v-if="pageType !== 'detail'" type="primary" @click="createResult(current, '稳定性')">
        生成结果处理
      </el-button>
    </div>

    <multi-table
      v-show="currentDate === '核查数据' || currentDate === ''"
      :table-data="listStability"
      :table-header="stabilityColumns"
      :merge-rows="[]"
      :need-index="true"
      max-height="500"
      @handle-click-header="handleClickHeader"
    />
    <multi-table
      v-show="currentDate !== '核查数据' && currentDate !== ''"
      :table-data="listStabilityCheckDate"
      :table-header="stabilityColumnsCheckData"
      :merge-rows="[]"
      :need-index="true"
      max-height="500"
      @handle-click-header="handleClickHeader"
    />
    <!-- 稳定性考核是否合格 -->
    <el-form
      style="margin-top: 20px;"
      :model="form"
      label-width="160"
      label-position="right"
    >
      <el-row :gutter="24">
        <el-col :span="12">
          <el-form-item v-if="current === 'voltage'" label="稳定性考核是否合格:" prop="flit">
            <el-input v-model="form['1-flit']" class="full-width-input" disabled :placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'" />
          </el-form-item>
          <el-form-item v-if="current === 'effect'" label="稳定性考核是否合格:" prop="flit">
            <el-input v-model="form['2-flit']" class="full-width-input" disabled :placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'" />
          </el-form-item>
          <el-form-item v-if="current === 'electricity-direct'" label="稳定性考核是否合格:" prop="flit">
            <el-input v-model="form['3-flit']" class="full-width-input" disabled :placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'" />
          </el-form-item>
          <el-form-item v-if="current === 'electricity-indirect'" label="稳定性考核是否合格:" prop="flit">
            <el-input v-model="form['4-flit']" class="full-width-input" disabled :placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'" />
          </el-form-item>
          <el-form-item v-if="current === 'ripple-voltage'" label="稳定性考核是否合格:" prop="flit">
            <el-input v-model="form['5-flit']" class="full-width-input" disabled :placeholder="pageType === 'detail' ? ' ' : '稳定性考核是否合格'" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </detail-block>

  <!-- 保存核查记录  -->
  <save-check-record ref="saveCheckRecordRef" />
</template>

<style lang="scss" scoped>
.link {
  text-decoration: underline;
  color: #3d7eff;
  cursor: pointer;
}

.file-area {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #60627f;
  margin-bottom: 10px;
  margin-left: 40px;
  white-space: nowrap;

  .tech-file {
    display: flex;
    align-items: center;
    margin-left: 20px;

    .file-text {
      margin-right: 10px;
    }
  }
}
</style>