diff --git a/src/views/equipement/standard/checkData/components/first/checkDataCom.vue b/src/views/equipement/standard/checkData/components/first/checkDataCom.vue index 7eea999..62cb315 100644 --- a/src/views/equipement/standard/checkData/components/first/checkDataCom.vue +++ b/src/views/equipement/standard/checkData/components/first/checkDataCom.vue @@ -729,7 +729,6 @@ getHistoryIndication(params).then((res) => { if (date === '') { const num = props.pageType === 'edit' ? 5 : 4 - // 最佳点 bestListStability.value = bestListStability.value.map((item) => { clearDateValue(item) @@ -761,6 +760,7 @@ clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data, item, stabilityColumnsBestCheckDate.value, 5) stabilityColumnsBestCheckDate.value = columnsData + console.log(columnsData, 'columnsData') return item = itemData }) bestListStabilityCheckDate.value = handleSaveDateParams(stabilityColumnsBestCheckDate.value, bestListStabilityCheckDate.value) diff --git a/src/views/equipement/standard/checkData/components/first/checkDataCom.vue b/src/views/equipement/standard/checkData/components/first/checkDataCom.vue index 7eea999..62cb315 100644 --- a/src/views/equipement/standard/checkData/components/first/checkDataCom.vue +++ b/src/views/equipement/standard/checkData/components/first/checkDataCom.vue @@ -729,7 +729,6 @@ getHistoryIndication(params).then((res) => { if (date === '') { const num = props.pageType === 'edit' ? 5 : 4 - // 最佳点 bestListStability.value = bestListStability.value.map((item) => { clearDateValue(item) @@ -761,6 +760,7 @@ clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data, item, stabilityColumnsBestCheckDate.value, 5) stabilityColumnsBestCheckDate.value = columnsData + console.log(columnsData, 'columnsData') return item = itemData }) bestListStabilityCheckDate.value = handleSaveDateParams(stabilityColumnsBestCheckDate.value, bestListStabilityCheckDate.value) diff --git a/src/views/equipement/standard/checkData/components/second/checkDataCom.vue b/src/views/equipement/standard/checkData/components/second/checkDataCom.vue index 65a8349..52d06f2 100644 --- a/src/views/equipement/standard/checkData/components/second/checkDataCom.vue +++ b/src/views/equipement/standard/checkData/components/second/checkDataCom.vue @@ -32,9 +32,11 @@ const equipmentId = ref('') const ruleFormRef = ref() // 表单ref const form = ref({ - // conclusion: '', // 结论 - // remark: '/', // 备注 - flit: '', // 稳定性考核是否合格 + '1-flit': '', + '2-flit': '', + '3-flit': '', + '4-flit': '', + '5-flit': '', }) const belongStandardEquipment = ref('2') const itemCategoryId = ref('') // 核查项分类id @@ -74,7 +76,7 @@ const stabilityColumns = ref([]) // 稳定性表头 const stabilityColumnsCheckData = ref([]) // 稳定性表头 -- 查询历史日期 const columns_repeatability_voltage = ref([ // 重复性表头(直流电压、电源效应和负载效应,直接电流(直接测量)) - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, { @@ -98,7 +100,7 @@ ]) // 直接电流(间接测量) 重复性表头 const columns_repeatability_electricity_indirect = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -124,7 +126,7 @@ // 纹波电压 重复性表头 const columns_repeatability_ripple_voltage = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -154,7 +156,7 @@ // 稳定性表头,直流电压、电源效应和负载效应 const columns_stability_voltage = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, { @@ -164,12 +166,12 @@ required: true, width: '110', children: [ - { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' }, - { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' }, - { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' }, - { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' }, - { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' }, - { text: '2022-12-17', value: '2022-12-17', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -180,7 +182,7 @@ ]) // 稳定性表头,直流电压、电源效应和负载效应 -- 查询历史日期 const columns_stability_voltage_check_date = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, { @@ -190,12 +192,12 @@ required: true, width: '110', children: [ - { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' }, - { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' }, - { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' }, - { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' }, - { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' }, - { text: '2022-12-17', value: '2022-12-17', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -206,7 +208,7 @@ ]) // 稳定性表头,直接电流(直接测量)、直接电流(间接测量) const columns_stability_electricity_direct = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, { @@ -216,12 +218,12 @@ required: true, width: '110', children: [ - { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' }, - { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' }, - { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' }, - { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' }, - { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' }, - { text: '2022-12-17', value: '2022-12-17', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -232,7 +234,7 @@ ]) // 稳定性表头,直接电流(直接测量)、直接电流(间接测量) -- 查询历史日期 const columns_stability_electricity_direct_check_date = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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' }, { @@ -242,12 +244,12 @@ required: true, width: '110', children: [ - { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' }, - { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' }, - { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' }, - { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' }, - { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' }, - { text: '2022-12-17', value: '2022-12-17', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -258,10 +260,10 @@ ]) // 稳定性表头,纹波电压 const columns_stability_ripple_voltage = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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: 'unit', align: 'center', required: true, type: 'text' }, + { text: '频率', value: 'power', align: 'center', required: true, type: 'text' }, { text: '示值', value: 'indicatingValue', @@ -269,12 +271,12 @@ required: true, width: '110', children: [ - { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' }, - { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' }, - { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' }, - { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' }, - { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' }, - { text: '2022-12-17', value: '2022-12-17', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -284,10 +286,10 @@ ]) // 稳定性表头,纹波电压 -- 查询历史日期 const columns_stability_ripple_voltage_check_date = ref([ - { text: '核查项目', value: 'paramsName', align: 'center', required: true, type: 'text' }, + { 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: 'unit', align: 'center', required: true, type: 'text' }, + { text: '频率', value: 'power', align: 'center', required: true, type: 'text' }, { text: '示值', value: 'indicatingValue', @@ -295,12 +297,12 @@ required: true, width: '110', children: [ - { text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' }, - { text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' }, - { text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' }, - { text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' }, - { text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' }, - { text: '2022-12-17', value: '2022-12-17', align: 'center', required: true, type: 'text' }, + { 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' }, @@ -329,8 +331,8 @@ const electricityIndirectListRepeatabilityCheckDate = ref([]) // 直接电流(间接测量)重复性-- 查询历史日期 const electricityIndirectListStability = ref([]) // 直接电流(间接测量)稳定性 const electricityIndirectListStabilityCheckDate = ref([]) // 直接电流(间接测量)稳定性-- 查询历史日期 -const rippleVoltageListRepeatability = ref([]) // 纹波电压重复性-- 查询历史日期 -const rippleVoltageListRepeatabilityCheckDate = ref([]) // 纹波电压重复性 +const rippleVoltageListRepeatability = ref([]) // 纹波电压重复性 +const rippleVoltageListRepeatabilityCheckDate = ref([]) // 纹波电压重复性 -- 查询历史日期 const rippleVoltageListStability = ref([]) // 纹波电压稳定性 const rippleVoltageListStabilityCheckDate = ref([]) // 纹波电压稳定性-- 查询历史日期 watch(() => [voltageListRepeatability.value, voltageListStability.value, effectListRepeatability.value, effectListStability.value, electricityDirectListRepeatability.value, electricityDirectListStability.value, electricityIndirectListRepeatability.value, electricityIndirectListStability.value, rippleVoltageListRepeatability.value, rippleVoltageListStability.value], () => { @@ -366,7 +368,6 @@ // 处理数据 function handleData(data: any) { if (!data) { return } - console.log(data, 'data') // 控制tab const needShowTab = uniqueMultiArray(data, 'params').map((item: any) => item.params) radioMenus.value = radioMenus.value.filter((item: any) => needShowTab.includes(item.params)) @@ -380,9 +381,9 @@ averageValue: '', standardDeviation: '', relativeRepeatability: '', - paramsName: '直流电压', + checkParam: '直流电压', params: '1', - checkType: ['重复性'], + checkType: '重复性', testValueOne: '1', testValueTwo: '1', testValueThree: '1', @@ -399,7 +400,16 @@ lessThan: '', })) // 直流电压稳定性 - voltageListStability.value = voltageListRepeatability.value.map((item: any) => ({ ...item, checkType: '稳定性' })) + voltageListStability.value = voltageListRepeatability.value.map((item: any) => ({ + ...item, + checkType: '稳定性', + testValueOne: '', + testValueTwo: '', + testValueThree: '', + testValueFour: '', + testValueFive: '', + testValueSix: '', + })) // 电源效应和负载效应重复性 effectListRepeatability.value = data.filter((item: any) => item.params === '2').map((item: any) => ({ ...item, @@ -409,9 +419,9 @@ averageValue: '', standardDeviation: '', relativeRepeatability: '', - paramsName: '电源效应和负载效应', + checkParam: '电源效应和负载效应', params: '2', - checkType: ['重复性'], + checkType: '重复性', testValueOne: '1', testValueTwo: '1', testValueThree: '1', @@ -428,7 +438,16 @@ lessThan: '', })) // 电源效应和负载效应稳定性 - effectListStability.value = effectListRepeatability.value.map((item: any) => ({ ...item, checkType: '稳定性' })) + effectListStability.value = effectListRepeatability.value.map((item: any) => ({ + ...item, + checkType: '稳定性', + testValueOne: '', + testValueTwo: '', + testValueThree: '', + testValueFour: '', + testValueFive: '', + testValueSix: '', + })) // 直接电流(直接测量)重复性 electricityDirectListRepeatability.value = data.filter((item: any) => item.params === '2').map((item: any) => ({ ...item, @@ -438,9 +457,9 @@ averageValue: '', standardDeviation: '', relativeRepeatability: '', - paramsName: '直接电流(直接测量)', + checkParam: '直接电流(直接测量)', params: '3', - checkType: ['重复性'], + checkType: '重复性', testValueOne: '1', testValueTwo: '1', testValueThree: '1', @@ -457,7 +476,16 @@ lessThan: '', })) // 直接电流(直接测量)稳定性 - electricityDirectListStability.value = electricityDirectListRepeatability.value.map((item: any) => ({ ...item, checkType: '稳定性' })) + electricityDirectListStability.value = electricityDirectListRepeatability.value.map((item: any) => ({ + ...item, + checkType: '稳定性', + testValueOne: '', + testValueTwo: '', + testValueThree: '', + testValueFour: '', + testValueFive: '', + testValueSix: '', + })) // 直接电流(间接测量)重复性 electricityIndirectListRepeatability.value = data.filter((item: any) => item.params === '2').map((item: any) => ({ ...item, @@ -467,9 +495,9 @@ averageValue: '', standardDeviation: '', relativeRepeatability: '', - paramsName: '直接电流(间接测量)', + checkParam: '直接电流(间接测量)', params: '4', - checkType: ['重复性'], + checkType: '重复性', testValueOne: '1', testValueTwo: '1', testValueThree: '1', @@ -486,7 +514,16 @@ lessThan: '', })) // 直接电流(间接测量)稳定性 - electricityIndirectListStability.value = electricityIndirectListRepeatability.value.map((item: any) => ({ ...item, checkType: '稳定性' })) + electricityIndirectListStability.value = electricityIndirectListRepeatability.value.map((item: any) => ({ + ...item, + checkType: '稳定性', + testValueOne: '', + testValueTwo: '', + testValueThree: '', + testValueFour: '', + testValueFive: '', + testValueSix: '', + })) // 纹波电压重复性 rippleVoltageListRepeatability.value = data.filter((item: any) => item.params === '2').map((item: any) => ({ ...item, @@ -496,9 +533,9 @@ averageValue: '', standardDeviation: '', relativeRepeatability: '', - paramsName: '纹波电压', + checkParam: '纹波电压', params: '5', - checkType: ['重复性'], + checkType: '重复性', testValueOne: '1', testValueTwo: '1', testValueThree: '1', @@ -519,7 +556,16 @@ lessThan: '', })) // 纹波电压稳定性 - rippleVoltageListStability.value = rippleVoltageListRepeatability.value.map((item: any) => ({ ...item, checkType: '稳定性' })) + rippleVoltageListStability.value = rippleVoltageListRepeatability.value.map((item: any) => ({ + ...item, + checkType: '稳定性', + testValueOne: '', + testValueTwo: '', + testValueThree: '', + testValueFour: '', + testValueFive: '', + testValueSix: '', + })) } // 点击生成结果处理 @@ -573,6 +619,19 @@ ElMessage.warning('请先计算直流电压重复性') break } + handleResult( + voltageListStability.value.map((item: { lessThan: string }) => { + return { + ...item, + lessThan: item.lessThan === '是' ? '1' : item.lessThan === '否' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1) + } + }), (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 @@ -599,6 +658,19 @@ ElMessage.warning('请先计算电源效应和负载效应重复性') break } + handleResult( + effectListStability.value.map((item: { lessThan: string }) => { + return { + ...item, + lessThan: item.lessThan === '是' ? '1' : item.lessThan === '否' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1) + } + }), (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 @@ -625,6 +697,19 @@ ElMessage.warning('请先计算直接电流(直接测量)重复性') break } + handleResult( + electricityDirectListStability.value.map((item: { lessThan: string }) => { + return { + ...item, + lessThan: item.lessThan === '是' ? '1' : item.lessThan === '否' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1) + } + }), (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 @@ -651,6 +736,19 @@ ElMessage.warning('请先计算直接电流(间接测量)重复性') break } + handleResult( + electricityIndirectListStability.value.map((item: { lessThan: string }) => { + return { + ...item, + lessThan: item.lessThan === '是' ? '1' : item.lessThan === '否' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1) + } + }), (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 @@ -677,11 +775,120 @@ ElMessage.warning('请先计算纹波电压重复性') break } + handleResult( + rippleVoltageListStability.value.map((item: { lessThan: string }) => { + return { + ...item, + lessThan: item.lessThan === '是' ? '1' : item.lessThan === '否' ? '0' : '', // 是否小于相对扩展不确定度Urel(0/1) + } + }), (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.checkType === '重复性').map((item: any) => { + return { + // checkParam: '直流电压', + ...item, + editable: props.pageType !== 'detail', + } + }) + // 直流电压稳定性 + const voltageListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => item.params === '1' && item.checkType === '稳定性').map((item: any) => { + return { + // checkParam: '直流电压', + ...item, + lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, + } + }) + // 电源效应和负载效应重复性 + const effectListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => item.params === '2' && item.checkType === '重复性').map((item: any) => { + return { + // checkParam: '电源效应和负载效应', + ...item, + editable: props.pageType !== 'detail', + } + }) + // 电源效应和负载效应稳定性 + const effectListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => item.params === '2' && item.checkType === '稳定性').map((item: any) => { + return { + // checkParam: '电源效应和负载效应', + ...item, + lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, + } + }) + // 直接电流(直接测量)重复性 + const electricityDirectListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => item.params === '3' && item.checkType === '重复性').map((item: any) => { + return { + // checkParam: '直接电流(直接测量)', + ...item, + editable: props.pageType !== 'detail', + } + }) + // 直接电流(直接测量)稳定性 + const electricityDirectListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => item.params === '3' && item.checkType === '稳定性').map((item: any) => { + return { + // checkParam: '直接电流(直接测量)', + ...item, + lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, + } + }) + // 直接电流(间接测量)重复性 + const electricityIndirectListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => item.params === '4' && item.checkType === '重复性').map((item: any) => { + return { + // checkParam: '直接电流(间接测量)', + ...item, + editable: props.pageType !== 'detail', + } + }) + // 直接电流(间接测量)稳定性 + const electricityIndirectListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => item.params === '4' && item.checkType === '稳定性').map((item: any) => { + return { + // checkParam: '直接电流(间接测量)', + ...item, + lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, + } + }) + // 纹波电压重复性 + const rippleVoltageListRepeatabilityList = responseList.filter((item: { params: string; checkType: string }) => item.params === '5' && item.checkType === '重复性').map((item: any) => { + return { + // checkParam: '纹波电压', + ...item, + editable: props.pageType !== 'detail', + } + }) + // 纹波电压稳定性 + const rippleVoltageListStabilityList = responseList.filter((item: { params: string ; checkType: string }) => item.params === '5' && item.checkType === '稳定性').map((item: any) => { + return { + // checkParam: '纹波电压', + ...item, + lessThan: `${item.lessThan}` === '1' ? '是' : `${item.lessThan}` === '0' ? '否' : item.lessThan, + } + }) + return { + voltageListRepeatabilityList, + voltageListStabilityList, + effectListRepeatabilityList, + effectListStabilityList, + electricityDirectListRepeatabilityList, + electricityDirectListStabilityList, + electricityIndirectListRepeatabilityList, + electricityIndirectListStabilityList, + rippleVoltageListRepeatabilityList, + rippleVoltageListStabilityList, + + } +} // ------------------------------------------------------------------------------------------ // 保存之前的校验 // function checkList() { @@ -705,20 +912,84 @@ // } // 获取详情 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 } - // list.value = res.data.checkDataPistonGaugeList.map((item: any) => { - // return { - // ...item, - // editable: pageType.value !== 'detail', - // } - // }) - // loading.close() - // }) + 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) + 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 { // 详情制作表头 + columns_stability_voltage.value = handleDetailTableTableHead(columns_stability_voltage.value, voltageListStability.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, 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) + } + }) + 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') { + fetchHistoryIndication() // 重新拉取稳定性日期 + } + loading.close() + }) } /** * 获取稳定性示值 @@ -736,13 +1007,12 @@ standardEquipmentId: props.selectStandardId!, // 被核查标准装置id } if (props.selectStandardId && equipmentId.value) { - console.log(123) getHistoryIndication(params).then((res) => { if (date === '') { // 正常核查数据 const num = props.pageType === 'edit' ? 5 : 4 // 直流电压 voltageListStability.value = voltageListStability.value.map((item) => { - clearDateValue(item) + // clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data.data, item, columns_stability_voltage.value, num, 3) columns_stability_voltage.value = columnsData return item = itemData @@ -755,12 +1025,9 @@ clearDateValue(item) const { itemData, columnsData } = solveHistoryIndicationTableData(res.data, item, columns_stability_voltage_check_date.value, 5, 3) columns_stability_voltage_check_date.value = columnsData - // stabilityColumnsCheckData.value = columns_stability_voltage_check_date.value return item = itemData }) voltageListStabilityCheckDate.value = handleSaveDateParams(columns_stability_voltage_check_date.value, voltageListStabilityCheckDate.value, 3) - console.log(voltageListStabilityCheckDate.value, 'voltageListStabilityCheckDate.value') - console.log(columns_stability_voltage_check_date.value, 'columns_stability_voltage_check_date.value') } }) } @@ -776,7 +1043,133 @@ const handleChangeRadio = (date: string) => { currentDate.value = date } +// 监听核查日期变化 +watch(() => props.checkDate, (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! // 最后一列的表头日期 + } +} +// / 保存之前的校验 +function checkList() { + // 新建核查数据的时候,在保存之前要先校验一下本次核查日期有没有数据,没有不允许保存 + if (`${voltageListRepeatability.value[0].averageValue}` === '') { + ElMessage.warning('请计算直流电压重复性') + return false + } + if (`${effectListRepeatability.value[0].averageValue}` === '') { + ElMessage.warning('请计算电源效应和负载效应重复性') + return false + } + if (`${electricityDirectListRepeatability.value[0].averageValue}` === '') { + ElMessage.warning('请计算直接电流(直接测量)重复性') + return false + } + if (`${electricityIndirectListRepeatability.value[0].averageValue}` === '') { + ElMessage.warning('请计算直接电流(间接测量)重复性') + return false + } + if (`${rippleVoltageListRepeatability.value[0].averageValue}` === '') { + ElMessage.warning('请计算纹波电压重复性') + return false + } + return true +} // -------------------------------------钩子----------------------------------------------------- +// 统计日期 +const dateCount = (columns: TableColumn[]) => { + let dateNum = 0 // 稳定性表格有几个日期 + + // 统计有几个日期 + columns[5].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('监听稳定性表格') + + if (newValue[0] && newValue[0].length && newValue[0][0]?.averageValue) { // 直流电压 + const result = newValue[0].every((item: { lessThan: string }) => { + return item.lessThan === '是' + }) + const dateNum = dateCount(columns_stability_voltage.value) + form.value['1-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格' + } + if (newValue[1] && newValue[1].length && newValue[1][0]?.averageValue) { // 电源效应和负载效应 + const result = newValue[1].every((item: { lessThan: string }) => { + return item.lessThan === '是' + }) + const dateNum = dateCount(columns_stability_voltage.value) + form.value['2-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格' + } + if (newValue[2] && newValue[2].length && newValue[2][0]?.averageValue) { // 直流电流(直接测量) + const result = newValue[2].every((item: { lessThan: string }) => { + return item.lessThan === '是' + }) + const dateNum = dateCount(columns_stability_electricity_direct.value) + form.value['3-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格' + } + if (newValue[3] && newValue[3].length && newValue[3][0]?.averageValue) { // 直流电流(间接测量) + const result = newValue[3].every((item: { lessThan: string }) => { + return item.lessThan === '是' + }) + const dateNum = dateCount(columns_stability_electricity_direct.value) + form.value['4-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格' + } + if (newValue[4] && newValue[4].length && newValue[4][0]?.averageValue) { // 纹波电压 + const result = newValue[4].every((item: { lessThan: string }) => { + return item.lessThan === '是' + }) + const dateNum = dateCount(columns_stability_ripple_voltage.value) + form.value['5-flit'] = dateNum < 4 ? '合格' : result ? '合格' : '不合格' + } +}, { deep: true, immediate: true }) watch(() => current.value, (newValue) => { switch (newValue) { case 'voltage': // 直流电压 @@ -811,17 +1204,26 @@ break } }, { immediate: true }) - +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() + fetchInfo() } }) - -defineExpose({ fetchCheckItemDetail, form }) +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 })