<!-- 核查数据管理详情--核查项 --> <script lang="ts" setup name="checkDataDetail"> import { ref } from 'vue' import { ElLoading, ElMessage, dayjs } from 'element-plus' import { columns } from 'element-plus/es/components/table-v2/src/common' import saveCheckRecord from '../../dialog/saveCheckRecord.vue' import { clearDateValue, handleDetailTableTableHead, handleSaveDateParams, solveHistoryIndicationTableData } from '../useStabilityCaculate' import type { TableColumn } from '@/components/NormalTable/table_interface' import useUserStore from '@/store/modules/user' import multiTable from '@/components/MultiHeaderTable/index.vue' import { useUniqueArray } from '@/utils/useUniqueArray' import { getCheckItemDetail, getJobInstructionList } from '@/api/equipment/standard/book' import { addCheckData, calculateHandle, getHistoryIndication, getInfo, updateCheckData } from '@/api/equipment/standard/checkData' import { deepCopy } from '@/utils/deepCopy' import { useCheckList } from '@/commonMethods/useCheckList' import { caculateDecimalDigits } from '@/views/business/measure/item/useCalculateResolution' const props = defineProps({ selectStandardId: { type: String, }, pageType: { // 页面类型 type: String, }, checkDate: { // 核查日期 type: String, }, }) const emits = defineEmits(['isConfigCheck']) const $route = useRoute() // 路由参数 const infoId = ref('') const form = ref({ bestQualified: '合格', // 稳定性考核是否合格_最佳点 worstQualified: '合格', // 稳定性考核是否合格_最差点 modelQualified: '合格', // 稳定性考核是否合格_典型点 }) const belongStandardEquipment = ref('1') const itemCategoryId = ref('') const itemCategoryName = ref('') const equipmentId = ref('') // 智能模型id const dateArrStability = ref<string[]>([]) // 稳定性日期数组 const currentDate = ref('') // 要查询历史稳定性的日期 // ----------------------------------路由参数------------------------------------------------ if ($route.params && $route.params.type) { if ($route.params.id) { infoId.value = $route.params.id as string } } // ----------------------------------------核查数据---------------------------------------------- const radioMenus = ref([ // 标签内容 { name: '最佳点', value: 'best' }, { name: '最差点', value: 'worst' }, { name: '典型点', value: 'model' }, ]) const current = ref('') // 选择的tab 默认基本信息 const repeatabilityTableLoading = ref(false) // 重复性表格loading const stabilityTableLoading = ref(false) // 稳定性表格loading const repeatabilityColumns = ref<TableColumn[]>([ // 重复性表头 { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', children: [ { text: '1', value: 'testValueOne', align: 'center', required: true, width: '180', type: 'inputNumber', customHeader: false }, { text: '2', value: 'testValueTwo', align: 'center', required: true, width: '180', type: 'inputNumber', customHeader: false }, { text: '3', value: 'testValueThree', align: 'center', required: true, width: '180', type: 'inputNumber', customHeader: false }, { text: '4', value: 'testValueFour', align: 'center', required: true, width: '180', type: 'inputNumber', customHeader: false }, { text: '5', value: 'testValueFive', align: 'center', required: true, width: '180', type: 'inputNumber', customHeader: false }, { text: '6', value: 'testValueSix', align: 'center', required: true, width: '180', type: 'inputNumber', customHeader: false }, ], }, { text: '算数平均值', value: 'averageValue', align: 'center', required: false, type: 'text' }, { text: '标准偏差S(X)', value: 'standardDeviation', align: 'center', required: false, type: 'text' }, { text: '相对重复性', value: 'relativeRepeatability', align: 'center', type: 'text', required: false }, ]) const stabilityColumnsBest = ref<TableColumn[]>([ { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', 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 }, ], }, { 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: '历次核查Sn(x)', value: 'previousCheck', align: 'center' }, { text: 'Urel', value: 'urel', align: 'center', type: 'text' }, { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThan', align: 'center', type: 'text' }, // { text: '稳定性考核是否合格', value: 'flit', align: 'center' }, ]) // 稳定性表头最佳点 const stabilityColumnsWorst = ref<TableColumn[]>([ { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', 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 }, ], }, { 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: '历次核查Sn(x)', value: 'previousCheck', align: 'center' }, { text: 'Urel', value: 'urel', align: 'center', type: 'text' }, { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThan', align: 'center', type: 'text' }, // { text: '稳定性考核是否合格', value: 'flit', align: 'center' }, ]) // 最差点稳定性 const stabilityColumnsModel = ref<TableColumn[]>([ { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', 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 }, ], }, { 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: '历次核查Sn(x)', value: 'previousCheck', align: 'center' }, { text: 'Urel', value: 'urel', align: 'center', type: 'text' }, { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThan', align: 'center', type: 'text' }, // { text: '稳定性考核是否合格', value: 'flit', align: 'center' }, ]) // 典型点稳定性 const stabilityColumnsBestCheckDate = ref<TableColumn[]>([ { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', 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 }, ], }, { 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: '历次核查Sn(x)', value: 'previousCheck', align: 'center' }, { text: 'Urel', value: 'urel', align: 'center', type: 'text' }, { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThan', align: 'center', type: 'text' }, // { text: '稳定性考核是否合格', value: 'flit', align: 'center' }, ]) // 稳定性表头最佳点--查询历史日期 const stabilityColumnsWorstCheckDate = ref<TableColumn[]>([ { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', 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 }, ], }, { 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: '历次核查Sn(x)', value: 'previousCheck', align: 'center' }, { text: 'Urel', value: 'urel', align: 'center', type: 'text' }, { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThan', align: 'center', type: 'text' }, // { text: '稳定性考核是否合格', value: 'flit', align: 'center' }, ]) // 最差点稳定性--查询历史日期 const stabilityColumnsModelCheckDate = ref<TableColumn[]>([ { text: '核查项目', value: 'params', 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: 'frequency', align: 'center', type: 'text' }, { text: '单位', value: 'frequencyUnit', align: 'center', type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: false, width: '180', 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 }, ], }, { 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: '历次核查Sn(x)', value: 'previousCheck', align: 'center' }, { text: 'Urel', value: 'urel', align: 'center', type: 'text' }, { text: '相对重复性是否小于相对扩展不确定度Urel', value: 'lessThan', align: 'center', type: 'text' }, // { text: '稳定性考核是否合格', value: 'flit', align: 'center' }, ]) // 典型点稳定性--查询历史日期 const bestListCheckDate = ref<any[]>([]) // 最佳点重复性查询数据 const bestListStabilityCheckDate = ref<any[]>([]) // 最佳点稳定性查询数据 const worstListCheckDate = ref<any[]>([]) // 最差点重复性查询数据 const worstListStabilityCheckDate = ref<any[]>([]) // 最差点稳定性查询数据 const modelListCheckDate = ref<any[]>([]) // 典型点重复性查询数据 const modelListStabilityCheckDate = ref<any[]>([]) // 典型点稳定性查询数据 const bestList = ref<any[]>([]) // 最佳点重复性 const bestListStability = ref<any[]>([]) // 最佳点稳定性 const worstList = ref<any[]>([]) // 最差点重复性 const worstListStability = ref<any[]>([]) // 最差点稳定性 const modelList = ref<any[]>([]) // 典型点重复性 const modelListStability = ref<any[]>([]) // 典型点稳定性 // 获取配置详情 function fetchCheckItemDetail(equipmentIdParam: string, belongStandardEquipmentParam: string, itemCategoryIdParam: string, itemCategoryNameParam: string) { belongStandardEquipment.value = belongStandardEquipmentParam // 检校标准库 itemCategoryId.value = itemCategoryIdParam // 核查分类id itemCategoryName.value = itemCategoryNameParam // 核查分类名称 equipmentId.value = equipmentIdParam // 智能模型id const loading = ElLoading.service({ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) const params = { equipmentId: equipmentIdParam, // 智能模型id belongStandardEquipment: belongStandardEquipment.value, // 检校标准装置code itemCategoryId: itemCategoryId.value, // 核查项分类id itemCategoryName: itemCategoryName.value, // 核查项分类名称 } getCheckItemDetail(params).then((res) => { loading.close() if (!res.data) { emits('isConfigCheck', false) } else { handleData(res.data.checkItemDataCalibratorList) fetchHistoryIndication() // 获取稳定性 } }) } // 根据通道生成多条核查数据 const solveDataByThoroughfare = (list: any) => { const tempList = [] as any // 根据通道制作成多通道数据 list.forEach((item: any) => { if (item.thoroughfare === '') { tempList.push(item) } else { const tempThoroughfare = item.thoroughfare.split(',') tempThoroughfare.forEach((i: string) => { tempList.push({ ...item, checkPoint: `${item.checkPoint}(${i})`, }) }) } }) return tempList } // 处理数据 function handleData(list: any, type = 'edit') { // 最佳点 bestList.value = list.filter((item: { testType: string }) => item.testType === '最佳点') console.log('最佳点数据', bestList.value) bestList.value = solveDataByThoroughfare(bestList.value) // 最佳点重复性 bestList.value = bestList.value.map((e: any) => { return { ...e, frequency: !e.frequency ? '/' : e.frequency, // 频率 frequencyUnit: !e.frequencyUnit ? '/' : e.frequencyUnit, // 频率单位 editable: type === 'edit', checkType: '重复性', averageValue: '', // 核查读数平均值(算数平均值) dataId: e.id, // 核查数据管理基础信息表id id: '', // id,更新/删除使用参数 lessThan: '', // 是否小于相对扩展不确定度Urel(0/1) previousCheck: '', // 历次核查Sn(x)(历次核查的标准偏差)(只稳定性有该值) qualified: '', // 稳定性考核是否合格 relativeRepeatability: '', // Sn(x)/核查读数平均值(相对重复性) standardDeviation: '', // Sn(x)(标准偏差) testType: e.testType, // 核查点类型(直接存字典value) testValueFive: undefined, // 核查读数5(示值) testValueFiveDate: '', // 核查读数5日期(稳定性) testValueFour: undefined, // 核查读数4(示值) testValueFourDate: '', // 核查读数4日期(稳定性) testValueOne: undefined, // 核查读数1(示值) testValueOneDate: '', // 核查读数1日期(稳定性) testValueSix: undefined, // 核查读数6(本次示值) testValueSixDate: '', // 核查读数6日期(稳定性) testValueThree: undefined, // 核查读数3(示值) testValueThreeDate: '', // 核查读数3日期(稳定性) testValueTwo: undefined, // 核查读数2(示值) testValueTwoDate: '', // 核查读数2日期(稳定性) unit: e.unit, // 单位(直接存字典value) urel: e.urel, // UREL resolution: e.resolution, // 分辨力 useRowPrecisionData: caculateDecimalDigits(e.resolution), } }) // 稳定性 bestListStability.value = bestList.value.map((e) => { return { frequency: !e.frequency ? '/' : e.frequency, // 频率 frequencyUnit: !e.frequencyUnit ? '/' : e.frequencyUnit, // 频率单位 editable: props.pageType !== 'detail', averageValue: '', // 核查读数平均值(算数平均值) dataId: e.id, // 核查数据管理基础信息表id id: '', // id,更新/删除使用参数 params: e.params, // 核查项目 checkPoint: e.checkPoint, // 核查点 unit: e.unit, // 单位 checkType: '稳定性', testType: e.testType, // 核查点类型 urel: e.urel, resolution: e.resolution, // 分辨力 } }) // 最差点 worstList.value = list.filter((item: { testType: string }) => item.testType === '最差点') worstList.value = solveDataByThoroughfare(worstList.value) // 最差点重复性 worstList.value = worstList.value.map((e: any) => { return { ...e, frequency: !e.frequency ? '/' : e.frequency, // 频率 frequencyUnit: !e.frequencyUnit ? '/' : e.frequencyUnit, // 频率单位 editable: type === 'edit', checkType: '重复性', averageValue: '', // 核查读数平均值(算数平均值) dataId: e.id, // 核查数据管理基础信息表id id: '', // id,更新/删除使用参数 lessThan: '', // 是否小于相对扩展不确定度Urel(0/1) previousCheck: '', // 历次核查Sn(x)(历次核查的标准偏差)(只稳定性有该值) qualified: '', // 稳定性考核是否合格 relativeRepeatability: '', // Sn(x)/核查读数平均值(相对重复性) standardDeviation: '', // Sn(x)(标准偏差) testType: e.testType, // 核查点类型(直接存字典value) testValueFive: undefined, // 核查读数5(示值) testValueFiveDate: '', // 核查读数5日期(稳定性) testValueFour: undefined, // 核查读数4(示值) testValueFourDate: '', // 核查读数4日期(稳定性) testValueOne: undefined, // 核查读数1(示值) testValueOneDate: '', // 核查读数1日期(稳定性) testValueSix: undefined, // 核查读数6(本次示值) testValueSixDate: '', // 核查读数6日期(稳定性) testValueThree: undefined, // 核查读数3(示值) testValueThreeDate: '', // 核查读数3日期(稳定性) testValueTwo: undefined, // 核查读数2(示值) testValueTwoDate: '', // 核查读数2日期(稳定性) unit: e.unit, // 单位(直接存字典value) urel: e.urel, // UREL resolution: e.resolution, // 分辨力 useRowPrecisionData: caculateDecimalDigits(e.resolution), } }) // 稳定性 worstListStability.value = worstList.value.map((e) => { return { frequency: !e.frequency ? '/' : e.frequency, // 频率 frequencyUnit: !e.frequencyUnit ? '/' : e.frequencyUnit, // 频率单位 editable: props.pageType !== 'detail', averageValue: '', // 核查读数平均值(算数平均值) dataId: e.id, // 核查数据管理基础信息表id id: '', // id,更新/删除使用参数 params: e.params, // 核查项目 checkPoint: e.checkPoint, // 核查点 unit: e.unit, // 单位 checkType: '稳定性', testType: e.testType, urel: e.urel, resolution: e.resolution, // 分辨力 } }) // 典型点 modelList.value = list.filter((item: { testType: string }) => item.testType === '典型点') modelList.value = solveDataByThoroughfare(modelList.value) // 典型点重复性 modelList.value = modelList.value.map((e: any) => { return { ...e, frequency: !e.frequency ? '/' : e.frequency, // 频率 frequencyUnit: !e.frequencyUnit ? '/' : e.frequencyUnit, // 频率单位 editable: type === 'edit', checkType: '重复性', averageValue: '', // 核查读数平均值(算数平均值) dataId: e.id, // 核查数据管理基础信息表id id: '', // id,更新/删除使用参数 lessThan: '', // 是否小于相对扩展不确定度Urel(0/1) previousCheck: '', // 历次核查Sn(x)(历次核查的标准偏差)(只稳定性有该值) qualified: '', // 稳定性考核是否合格 relativeRepeatability: '', // Sn(x)/核查读数平均值(相对重复性) standardDeviation: '', // Sn(x)(标准偏差) testType: e.testType, // 核查点类型(直接存字典value) testValueFive: undefined, // 核查读数5(示值) testValueFiveDate: '', // 核查读数5日期(稳定性) testValueFour: undefined, // 核查读数4(示值) testValueFourDate: '', // 核查读数4日期(稳定性) testValueOne: undefined, // 核查读数1(示值) testValueOneDate: '', // 核查读数1日期(稳定性) testValueSix: undefined, // 核查读数6(本次示值) testValueSixDate: '', // 核查读数6日期(稳定性) testValueThree: undefined, // 核查读数3(示值) testValueThreeDate: '', // 核查读数3日期(稳定性) testValueTwo: undefined, // 核查读数2(示值) testValueTwoDate: '', // 核查读数2日期(稳定性) unit: e.unit, // 单位(直接存字典value) urel: e.urel, // UREL resolution: e.resolution, // 分辨力 useRowPrecisionData: caculateDecimalDigits(e.resolution), } }) // 稳定性 modelListStability.value = modelList.value.map((e) => { return { frequency: !e.frequency ? '/' : e.frequency, // 频率 frequencyUnit: !e.frequencyUnit ? '/' : e.frequencyUnit, // 频率单位 editable: props.pageType !== 'detail', averageValue: '', // 核查读数平均值(算数平均值) dataId: e.id, // 核查数据管理基础信息表id id: '', // id,更新/删除使用参数 params: e.params, // 核查项目 checkPoint: e.checkPoint, // 核查点 unit: e.unit, // 单位 checkType: '稳定性', testType: e.testType, urel: e.urel, resolution: e.resolution, // 分辨力 } }) solveRadioMenus(bestList.value, worstList.value, modelList.value) } // 处理tab function solveRadioMenus(bestList: Array<any>, worstList: Array<any>, modelList: Array<any>) { if (!bestList.length) { const index = radioMenus.value.findIndex(item => item.value === 'best') if (index !== -1) { radioMenus.value.splice(index, 1) } } if (!worstList.length) { const index = radioMenus.value.findIndex(item => item.value === 'worst') if (index !== -1) { radioMenus.value.splice(index, 1) } } if (!modelList.length) { const index = radioMenus.value.findIndex(item => item.value === 'model') if (index !== -1) { radioMenus.value.splice(index, 1) } } current.value = radioMenus.value.length > 0 ? radioMenus.value[0].value : '' } // 点击生成结果处理 const createResult = (type: 'repeatability' | 'stability') => { if (current.value === 'best' && !bestList.value.length) { // 最佳点 ElMessage.warning('最佳点未配置重复性,请检查') return false } if (current.value === 'worst' && !worstList.value.length) { // 最佳点 ElMessage.warning('最差点未配置重复性,请检查') return false } if (current.value === 'model' && !modelList.value.length) { // 最佳点 ElMessage.warning('典型点未配置重复性,请检查') return false } // 校验重复性计算表格数值 if (type === 'repeatability') { if (current.value === 'best' && !useCheckList(bestList.value, repeatabilityColumns.value, '最佳点重复性表格')) { return false } if (current.value === 'worst' && !useCheckList(worstList.value, repeatabilityColumns.value, '最差点重复性表格')) { return false } if (current.value === 'model' && !useCheckList(modelList.value, repeatabilityColumns.value, '典型点重复性表格')) { return false } } if (type === 'stability') { if (current.value === 'best' && `${bestList.value[0].averageValue}` === '') { // 最佳点 ElMessage.warning('请先计算最佳点重复性') return false } if (current.value === 'worst' && `${worstList.value[0].averageValue}` === '') { // 最差点 ElMessage.warning('请先计算最差点重复性') return false } if (current.value === 'model' && `${modelList.value[0].averageValue}` === '') { // 典型点 ElMessage.warning('请先计算典型点重复性') return false } } let checkDataCalibratorListParam // 要传的重复或者稳定性参数 if (current.value === 'best') { // 最佳点 checkDataCalibratorListParam = type === 'repeatability' ? bestList.value : bestListStability.value } else if (current.value === 'worst') { // 最差点 checkDataCalibratorListParam = type === 'repeatability' ? worstList.value : worstListStability.value } else { // 典型点 checkDataCalibratorListParam = type === 'repeatability' ? modelList.value : modelListStability.value } const params = { belongStandardEquipment: belongStandardEquipment.value, // 检校标准库 checkDataCalibratorList: checkDataCalibratorListParam.map((item) => { return { ...item, lessThan: item.lessThan === '是' ? '1' : item.lessThan === '否' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1) } }), itemCategoryId: itemCategoryId.value, // 核查项分类id itemCategoryName: itemCategoryName.value, // 核查项分类id } repeatabilityTableLoading.value = type === 'repeatability' // 重复性表loading stabilityTableLoading.value = type === 'stability' // 稳定性表loading calculateHandle(params).then((res) => { if (current.value === 'best') { // 最佳点 const result = res.data.map((item: any) => { return { ...item, editable: props.pageType !== 'detail', } }) if (type === 'repeatability') { // 重复性 bestList.value = bestList.value.map((item, index: number) => { return { ...item, averageValue: result[index].averageValue, // 算数平均值 standardDeviation: result[index].standardDeviation, // 标准偏差S(X) relativeRepeatability: result[index].relativeRepeatability, // 相对重复性 } }) bestListStability.value = bestListStability.value.map((item, index: number) => { return { ...item, testValueSix: bestList.value[index].averageValue, // 核查读数6(本次重复性示值算术平均值) testValueSixDate: props.checkDate, // 核查读数6日期(本次核查日期) } }) } else { // 稳定性 bestListStability.value = result.map((item: { lessThan: number | string }) => { return { ...item, lessThan: `${item.lessThan}` === '1' ? '是' : '否', } }) } } else if (current.value === 'worst') { // 最差点 const result = res.data.map((item: any) => { return { ...item, editable: props.pageType !== 'detail', } }) if (type === 'repeatability') { // 重复性 worstList.value = worstList.value.map((item, index: number) => { return { ...item, averageValue: result[index].averageValue, // 算数平均值 standardDeviation: result[index].standardDeviation, // 标准偏差S(X) relativeRepeatability: result[index].relativeRepeatability, // 相对重复性 } }) worstListStability.value = worstListStability.value.map((item, index: number) => { return { ...item, testValueSix: worstList.value[index].averageValue, // 核查读数6(本次重复性示值算术平均值) testValueSixDate: props.checkDate, // 核查读数6日期(本次核查日期) } }) } else { worstListStability.value = result.map((item: { lessThan: string | number }) => { return { ...item, lessThan: `${item.lessThan}` === '1' ? '是' : '否', } }) } } else { // 典型点 const result = res.data.map((item: any) => { return { ...item, editable: props.pageType !== 'detail', } }) if (type === 'repeatability') { // 重复性 modelList.value = modelList.value.map((item, index: number) => { return { ...item, averageValue: result[index].averageValue, // 算数平均值 standardDeviation: result[index].standardDeviation, // 标准偏差S(X) relativeRepeatability: result[index].relativeRepeatability, // 相对重复性 } }) // 重复性计算完,填充稳定性数据 modelListStability.value = modelListStability.value.map((item, index: number) => { return { ...item, testValueSix: modelList.value[index].averageValue, // 核查读数6(本次重复性示值算术平均值) testValueSixDate: props.checkDate, // 核查读数6日期(本次核查日期) } }) } else { // 稳定性 modelListStability.value = result.map((item: { lessThan: string | number }) => { return { ...item, lessThan: `${item.lessThan}` === '1' ? '是' : '否', } }) } } repeatabilityTableLoading.value = false stabilityTableLoading.value = false }) } // ------------------------------------------------------------------------------------------ // 处理详情数据 const solveGetDetailData = (responseListParams: any) => { const responseList = responseListParams.map((item: any) => { return { ...item, testValueOne: `${item.testValueOne}` === '' ? undefined : item.testValueOne, // 核查标准示值1(温度值-重复性) testValueTwo: `${item.testValueTwo}` === '' ? undefined : item.testValueTwo, // 核查标准示值2(温度值-重复性) testValueThree: `${item.testValueThree}` === '' ? undefined : item.testValueThree, // 核查标准示值3(温度值-重复性) testValueFour: `${item.testValueFour}` === '' ? undefined : item.testValueFour, // 核查标准示值4(温度值-重复性) testValueFive: `${item.testValueFive}` === '' ? undefined : item.testValueFive, // 核查标准示值5(温度值-重复性) testValueSix: `${item.testValueSix}` === '' ? undefined : item.testValueSix, // 核查标准示值6(温度值-重复性) } }) const bestList = responseList.filter((item: { testType: string; checkType: string }) => item.testType === '最佳点' && item.checkType === '重复性').map((item: any) => { return { ...item, editable: props.pageType !== 'detail', resolution: item.resolution, // 分辨力 useRowPrecisionData: caculateDecimalDigits(item.resolution), } }) const worstList = responseList.filter((item: { testType: string ; checkType: string }) => item.testType === '最差点' && item.checkType === '重复性').map((item: any) => { return { ...item, editable: props.pageType !== 'detail', resolution: item.resolution, // 分辨力 useRowPrecisionData: caculateDecimalDigits(item.resolution), } }) const modelList = responseList.filter((item: { testType: string ; checkType: string }) => item.testType === '典型点' && item.checkType === '重复性').map((item: any) => { return { ...item, editable: props.pageType !== 'detail', resolution: item.resolution, // 分辨力 useRowPrecisionData: caculateDecimalDigits(item.resolution), } }) const bestListStability = responseList.filter((item: { testType: string ; checkType: string }) => item.testType === '最佳点' && item.checkType === '稳定性').map((item: any) => { return { ...item, lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, } }) const worstListStability = responseList.filter((item: { testType: string; checkType: string }) => item.testType === '最差点' && item.checkType === '稳定性').map((item: any) => { return { ...item, lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, } }) const modelListStability = responseList.filter((item: { testType: string; checkType: string }) => item.testType === '典型点' && item.checkType === '稳定性').map((item: any) => { return { ...item, lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, } }) solveRadioMenus(bestList, worstList, modelList) // 控制tab return { tempBestList: bestList, tempWorstList: worstList, tempModelList: modelList, tempBestListStability: bestListStability, tempWorstListStability: worstListStability, tempModelListStability: modelListStability, } } // 获取详情 function fetchInfo(id = '') { const loading = ElLoading.service({ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) getInfo({ id: id || infoId.value }).then((res) => { form.value = { ...res.data } equipmentId.value = res.data.equipmentId const { tempBestList, tempWorstList, tempModelList, tempBestListStability, tempWorstListStability, tempModelListStability } = solveGetDetailData(res.data.checkDataCalibratorList) if (id !== '') { // 查询的日期获得的数据 bestListCheckDate.value = tempBestList// 最佳点重复性查询数据 bestListStabilityCheckDate.value = tempBestListStability // 最佳点稳定性查询数据 worstListCheckDate.value = tempWorstList// 最差点重复性查询数据 worstListStabilityCheckDate.value = tempWorstListStability// 最差点稳定性查询数据 modelListCheckDate.value = tempModelList// 典型点重复性查询数据 modelListStabilityCheckDate.value = tempModelListStability// 典型点稳定性查询数据 } else { console.log('详情,详情详情') bestList.value = tempBestList worstList.value = tempWorstList modelList.value = tempModelList bestListStability.value = tempBestListStability worstListStability.value = tempWorstListStability modelListStability.value = tempModelListStability console.log('bestList.value', bestList.value) } nextTick(() => { if (id !== '') { // 稳定性表头---查询历史的稳定性日期数据 stabilityColumnsBestCheckDate.value[5].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 }, ] stabilityColumnsWorstCheckDate.value[5].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 }, ] stabilityColumnsModelCheckDate.value[5].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 { // 详情制作表头 stabilityColumnsBest.value = handleDetailTableTableHead(stabilityColumnsBest.value, bestListStability.value) stabilityColumnsWorst.value = handleDetailTableTableHead(stabilityColumnsWorst.value, worstListStability.value) stabilityColumnsModel.value = handleDetailTableTableHead(stabilityColumnsModel.value, modelListStability.value) } }) form.value.bestQualified = `${res.data.checkDataCalibratorList[0].qualified}` === '1' ? '合格' : '不合格' form.value.worstQualified = `${res.data.checkDataCalibratorList[0].qualified}` === '1' ? '合格' : '不合格' form.value.modelQualified = `${res.data.checkDataCalibratorList[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: current.value === 'best' ? '最佳点' : current.value === 'worst' ? '最差点' : '典型点', // 核查项目 stabilityExamine: '1', // 是否用于稳定性考核(1/0) standardEquipmentId: props.selectStandardId!, // 被核查标准库id } if (props.selectStandardId && equipmentId.value) { stabilityTableLoading.value = true getHistoryIndication(params).then((res) => { if (date === '') { // 正常核查数据 const num = (props.pageType === 'edit' || props.pageType === 'detail') ? 5 : 4 // 最佳点 bestListStability.value = bestListStability.value.map((item) => { clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, stabilityColumnsBest.value, num, 5, '1') stabilityColumnsBest.value = columnsData return item = itemData }) bestListStability.value = handleSaveDateParams(stabilityColumnsBest.value, bestListStability.value) // 最差点 worstListStability.value = worstListStability.value.map((item) => { clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, stabilityColumnsWorst.value, num, 5, '1') stabilityColumnsWorst.value = columnsData return item = itemData }) worstListStability.value = handleSaveDateParams(stabilityColumnsWorst.value, worstListStability.value) // 典型点 modelListStability.value = modelListStability.value.map((item) => { clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, stabilityColumnsModel.value, num, 5, '1') stabilityColumnsModel.value = columnsData return item = itemData }) modelListStability.value = handleSaveDateParams(stabilityColumnsModel.value, modelListStability.value) } else { // 历史日期数据 console.log('处理历史日期数据') initColumnsCheckDate() if (bestList.value && bestList.value.length) { // 最佳点 bestListStabilityCheckDate.value = bestListStabilityCheckDate.value.map((item) => { clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, stabilityColumnsBestCheckDate.value, 5, 5, '1') stabilityColumnsBestCheckDate.value = columnsData console.log(columnsData, '最佳点columnsData') return item = itemData }) bestListStabilityCheckDate.value = handleSaveDateParams(stabilityColumnsBestCheckDate.value, bestListStabilityCheckDate.value) } if (worstList.value && worstList.value.length) { // 最差点 worstListStabilityCheckDate.value = worstListStabilityCheckDate.value.map((item) => { clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, stabilityColumnsWorstCheckDate.value, 5, 5, '1') stabilityColumnsWorstCheckDate.value = columnsData return item = itemData }) worstListStabilityCheckDate.value = handleSaveDateParams(stabilityColumnsWorstCheckDate.value, worstListStabilityCheckDate.value) } if (worstList.value && worstList.value.length) { // 典型点 modelListStabilityCheckDate.value = modelListStabilityCheckDate.value.map((item) => { clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, stabilityColumnsModelCheckDate.value, 5, 5, '1') stabilityColumnsModelCheckDate.value = columnsData return item = itemData }) modelListStabilityCheckDate.value = handleSaveDateParams(stabilityColumnsModelCheckDate.value, modelListStabilityCheckDate.value) } } stabilityTableLoading.value = false }).catch(() => { stabilityTableLoading.value = false }) } } // 需求逻辑:时间数据少于4条则默认合格(这里跟3比较是因为其中有一条是本次核查日期) // 保存之前的校验 function checkList() { if (!bestList.value.length && !worstList.value.length && !modelList.value.length) { ElMessage.warning('未配置核查项,不允许保存') return false } // 新建核查数据的时候,在保存之前要先校验一下本次核查日期有没有数据,没有不允许保存 if (bestList.value.length && `${bestList.value[0].averageValue}` === '') { // 最佳点 ElMessage.warning('请计算最佳点重复性') return false } if (worstList.value.length && `${worstList.value[0].averageValue}` === '') { // 最差点 ElMessage.warning('请计算最差点重复性') return false } if (modelList.value.length && `${modelList.value[0].averageValue}` === '') { // 典型点 ElMessage.warning('请计算典型点重复性') return false } // if (current.value === 'best' && `${bestListStability.value[0].lessThan}` === '') { // 最佳点 // ElMessage.warning('请计算最佳点稳定性') // return false // } // if (current.value === 'worst' && `${worstListStability.value[0].lessThan}` === '') { // 最差点 // ElMessage.warning('请计算最差点稳定性') // return false // } // if (current.value === 'model' && `${modelListStability.value[0].lessThan}` === '') { // 典型点 // ElMessage.warning('请计算典型点稳定性') // return false // } return true } // =======================点击表头日期查询历史稳定性数据=================== // 点击表头 const handleClickHeader = (val: any, checkDateDetailId: string) => { dateArrStability.value = ['核查数据', val.label] fetchInfo(checkDateDetailId) // 获取此次历史日期的详情 } // 日期变化 const handleChangeRadio = (date: string) => { currentDate.value = date } // ====================================================================== // -------------------------------------钩子----------------------------------------------------- // 统计日期 const dateCount = (columns: TableColumn[]) => { let dateNum = 0 // 稳定性表格有几个日期 // 统计有几个日期 columns[5].children?.forEach((item) => { if (item.text !== '-' && item.text !== '') { dateNum += 1 } }) return dateNum } // 监听稳定性表格--判断稳定性考核是否合格 watch([() => bestListStability.value, () => worstListStability.value, () => modelListStability.value], (newValue: any) => { console.log('监听稳定性表格') if (newValue[0] && newValue[0].length && newValue[0].averageValue) { // 最佳点 const result = newValue[0].every((item: { lessThan: string }) => { return item.lessThan === '是' }) const dateNum = dateCount(stabilityColumnsBest.value) form.value.bestQualified = dateNum < 4 ? '合格' : result ? '合格' : '不合格' } if (newValue[1] && newValue[1].length && newValue[0].averageValue) { // 最差点 const result = newValue[1].every((item: { lessThan: string }) => { return item.lessThan === '是' }) const dateNum = dateCount(stabilityColumnsWorst.value) form.value.worstQualified = dateNum < 4 ? '合格' : result ? '合格' : '不合格' } if (newValue[2] && newValue[2].length && newValue[0].averageValue) { // 典型点 const result = newValue[2].every((item: { lessThan: string }) => { return item.lessThan === '是' }) const dateNum = dateCount(stabilityColumnsModel.value) form.value.modelQualified = dateNum < 4 ? '合格' : result ? '合格' : '不合格' } }, { deep: true, immediate: true }) /** * 初始化表头 * @param soveLastColumnDate 是否处理最后一列 */ function initColumns() { if (bestList.value && bestList.value.length) { stabilityColumnsBest.value[5].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 }, ] } if (worstList.value && worstList.value.length) { stabilityColumnsWorst.value[5].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 }, ] } if (modelList.value && modelList.value.length) { stabilityColumnsModel.value[5].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 }, ] } if (props.pageType === 'add') { const index = stabilityColumnsBest.value.findIndex(item => item.text === '示值') if (index !== -1) { stabilityColumnsBest.value[index].children![5].text = props.checkDate! // 最后一列的表头日期 } const indexWorst = stabilityColumnsWorst.value.findIndex(item => item.text === '示值') if (index !== -1) { stabilityColumnsWorst.value[indexWorst].children![5].text = props.checkDate! // 最后一列的表头日期 } const indexModel = stabilityColumnsModel.value.findIndex(item => item.text === '示值') if (index !== -1) { stabilityColumnsModel.value[indexModel].children![5].text = props.checkDate! // 最后一列的表头日期 } } } /** * 初始化CheckDate表头 */ function initColumnsCheckDate() { const tempColumn = [ { 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 }, ] as any if (bestList.value.length) { stabilityColumnsBestCheckDate.value[5].children = [...tempColumn] } if (worstList.value.length) { stabilityColumnsWorstCheckDate.value[5].children = [...tempColumn] } if (modelList.value.length) { stabilityColumnsModelCheckDate.value[5].children = [...tempColumn] } } // 监听核查日期变化 watch(() => props.checkDate, (newValue) => { initColumns() nextTick(() => { fetchHistoryIndication() // 重新拉取稳定性日期 }) }, { immediate: true }) watch(() => props.pageType, (newValue) => { if (bestList.value.length) { bestList.value = bestList.value.map((item) => { return { ...item, editable: newValue !== 'detail' } }) bestListStability.value = bestListStability.value.map((item) => { return { ...item, editable: newValue !== 'detail' } }) } if (worstList.value.length) { worstList.value = worstList.value.map((item) => { return { ...item, editable: newValue !== 'detail' } }) worstListStability.value = worstListStability.value.map((item) => { return { ...item, editable: newValue !== 'detail' } }) } if (modelList.value.length) { modelList.value = modelList.value.map((item) => { return { ...item, editable: newValue !== 'detail' } }) modelListStability.value = modelListStability.value.map((item) => { return { ...item, editable: newValue !== '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 (props.pageType !== 'add') { fetchInfo() } }) defineExpose({ checkList, fetchCheckItemDetail, form, bestList, bestListStability, worstList, worstListStability, modelList, modelListStability }) </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="props.pageType !== 'detail'" type="primary" @click="createResult('repeatability')"> 生成结果处理 </el-button> </div> <multi-table v-show="currentDate === '核查数据' || currentDate === ''" v-loading="repeatabilityTableLoading" :table-data="current === 'best' ? bestList : current === 'worst' ? worstList : modelList" :table-header="repeatabilityColumns" :merge-rows="[]" :need-index="true" max-height="300" /> <!-- 历史日期重复性数据 --> <multi-table v-show="currentDate !== '核查数据' && currentDate !== ''" v-loading="repeatabilityTableLoading" :table-data="current === 'best' ? bestListCheckDate : current === 'worst' ? worstListCheckDate : modelListCheckDate" :table-header="repeatabilityColumns" :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('stability')"> 生成结果处理 </el-button> </div> <multi-table v-show="currentDate === '核查数据' || currentDate === ''" v-loading="stabilityTableLoading" :table-data="current === 'best' ? bestListStability : current === 'worst' ? worstListStability : modelListStability" :table-header="current === 'best' ? stabilityColumnsBest : current === 'worst' ? stabilityColumnsWorst : stabilityColumnsModel" :merge-rows="[]" :need-index="true" max-height="500" @handle-click-header="handleClickHeader" /> <!-- 历史日期稳定性数据 --> <multi-table v-show="currentDate !== '核查数据' && currentDate !== ''" v-loading="stabilityTableLoading" :table-data="current === 'best' ? bestListStabilityCheckDate : current === 'worst' ? worstListStabilityCheckDate : modelListStabilityCheckDate" :table-header="current === 'best' ? stabilityColumnsBestCheckDate : current === 'worst' ? stabilityColumnsWorstCheckDate : stabilityColumnsModelCheckDate" :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 === 'best'" label="稳定性考核是否合格(最佳点):"> <el-input v-model="form.bestQualified" class="full-width-input" disabled placeholder="稳定性考核是否合格" /> </el-form-item> <el-form-item v-if="current === 'worst'" label="稳定性考核是否合格(最差点):"> <el-input v-model="form.worstQualified" class="full-width-input" disabled placeholder="稳定性考核是否合格" /> </el-form-item> <el-form-item v-if="current === 'model'" label="稳定性考核是否合格(典型点):"> <el-input v-model="form.modelQualified" class="full-width-input" disabled placeholder="稳定性考核是否合格" /> </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>