diff --git a/src/utils/String.ts b/src/utils/String.ts index 6e940bd..ab1ed33 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -11,7 +11,7 @@ } let string = '' // 替换字符串中的所有特殊字符(包含空格) - const Exp = /[\-\_\,\!\/\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\±\<\≤\>\≥\<\>\+?]/g + const Exp = /[\-\_\,\!\/\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\±\"\L\<\>\±\<\≤\>\≥\<\>\+?]/g string = (!isNaN(str) && typeof str === 'number' ? String(str) : str ? String(str) : '').replace(Exp, '') return string } diff --git a/src/utils/String.ts b/src/utils/String.ts index 6e940bd..ab1ed33 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -11,7 +11,7 @@ } let string = '' // 替换字符串中的所有特殊字符(包含空格) - const Exp = /[\-\_\,\!\/\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\±\<\≤\>\≥\<\>\+?]/g + const Exp = /[\-\_\,\!\/\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\±\"\L\<\>\±\<\≤\>\≥\<\>\+?]/g string = (!isNaN(str) && typeof str === 'number' ? String(str) : str ? String(str) : '').replace(Exp, '') return string } diff --git a/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue index e3a6d48..55b4ccc 100644 --- a/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue @@ -21,6 +21,7 @@ import multiTable from '@/components/MultiHeaderTable/index.vue' import templateTable from '@/views/business/measure/item/components/second/templateTable.vue' import { useGroup } from '@/commonMethods/useGroup' +import { clearSymbol } from '@/utils/String' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 @@ -101,7 +102,7 @@ ], }, { text: '误差', value: 'errorValue', align: 'center', width: '120', required: false, type: 'text' }, - { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text' }, + { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text', needMark: true }, { text: '最大允许误差', value: 'maximumError', width: '120', align: 'center', required: false, type: 'text' }, ]) const columns_digital = ref([ // 数字式/外置探头式温湿度仪表 @@ -150,7 +151,7 @@ ], }, { text: '误差', value: 'errorValue', align: 'center', width: '120', required: false, type: 'text' }, - { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text' }, + { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text', needMark: true }, { text: '最大允许误差', value: 'maximumError', width: '120', align: 'center', required: false, type: 'text' }, { text: '不确定度', value: 'urel', align: 'center', width: '100', required: false, type: 'text' }, ]) @@ -249,11 +250,12 @@ useSolveFormData(res, templateFormAndTableRef.value) // ==================================检定数据======================================================================== - list.value = res.data.measureDataPointMeterList.map((item: IDetailMeasureList) => { + list.value = res.data.measureDataPointMeterList.map((item: any) => { return { ...item, editable: pageType.value !== 'detail', params: '示值测试', + maximumError: item.maximumError.includes('±') ? item.maximumError : `${item.maximumError === '0' ? '' : '±'}${item.maximumError}`, } }) // 检定数据 infoId.value = res.data.id @@ -281,6 +283,7 @@ maxError: '', editable: true, typeDesc: `${item.typeDesc}/${item.dimensionPointUnit}`, + maximumError: item.maximumError.includes('±') ? item.maximumError : `${item.maximumError === '0' ? '' : '±'}${item.maximumError}`, })) // 整理数据 温度 湿度 list.value = [...list.value.filter((item: any) => item.typeDesc.includes('温度')), ...list.value.filter((item: any) => item.typeDesc.includes('湿度'))] @@ -359,7 +362,7 @@ const params = { belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 - measureDataPointMeterList: list.value, + measureDataPointMeterList: list.value.map((item: any) => ({ ...item, maximumError: clearSymbol(item.maximumError) })), } calculateHandle(params).then((res) => { list.value = (res.data || list.value).map((item: any) => ({ @@ -367,17 +370,18 @@ params: '示值测试', editable: true, dimensionPointUnit: item.typeDesc.includes('温度') ? '℃' : '%RH', + maximumError: item.maximumError.includes('±') ? item.maximumError : `${item.maximumError === '0' ? '' : '±'}${item.maximumError}`, })) }) } // 结论 watch(() => [itemFormData.value.appearanceFunctionCheck, list.value], () => { - if (itemFormData.value.appearanceFunctionCheck === '1' && list.value.every((item: any) => Number(item.maxError) < Number(item.maximumError))) { - itemFormData.value.outcome = '合格' + if (itemFormData.value.appearanceFunctionCheck === '1' && list.value.every((item: any) => Number(item.maxError) < Number(clearSymbol(item.maximumError)))) { + itemFormData.value.outcome = '满足使用要求' } else { - itemFormData.value.outcome = '不合格' + itemFormData.value.outcome = '不满足使用要求,建议停用或修正使用' } }, { deep: true, @@ -453,8 +457,8 @@ diff --git a/src/utils/String.ts b/src/utils/String.ts index 6e940bd..ab1ed33 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -11,7 +11,7 @@ } let string = '' // 替换字符串中的所有特殊字符(包含空格) - const Exp = /[\-\_\,\!\/\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\"\L\<\>\±\<\≤\>\≥\<\>\+?]/g + const Exp = /[\-\_\,\!\/\|\~\`\(\)\#\$\%\^\&\*\{\}\:\;\±\"\L\<\>\±\<\≤\>\≥\<\>\+?]/g string = (!isNaN(str) && typeof str === 'number' ? String(str) : str ? String(str) : '').replace(Exp, '') return string } diff --git a/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue index e3a6d48..55b4ccc 100644 --- a/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue @@ -21,6 +21,7 @@ import multiTable from '@/components/MultiHeaderTable/index.vue' import templateTable from '@/views/business/measure/item/components/second/templateTable.vue' import { useGroup } from '@/commonMethods/useGroup' +import { clearSymbol } from '@/utils/String' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 @@ -101,7 +102,7 @@ ], }, { text: '误差', value: 'errorValue', align: 'center', width: '120', required: false, type: 'text' }, - { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text' }, + { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text', needMark: true }, { text: '最大允许误差', value: 'maximumError', width: '120', align: 'center', required: false, type: 'text' }, ]) const columns_digital = ref([ // 数字式/外置探头式温湿度仪表 @@ -150,7 +151,7 @@ ], }, { text: '误差', value: 'errorValue', align: 'center', width: '120', required: false, type: 'text' }, - { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text' }, + { text: '最大误差', value: 'maxError', width: '120', align: 'center', required: false, type: 'text', needMark: true }, { text: '最大允许误差', value: 'maximumError', width: '120', align: 'center', required: false, type: 'text' }, { text: '不确定度', value: 'urel', align: 'center', width: '100', required: false, type: 'text' }, ]) @@ -249,11 +250,12 @@ useSolveFormData(res, templateFormAndTableRef.value) // ==================================检定数据======================================================================== - list.value = res.data.measureDataPointMeterList.map((item: IDetailMeasureList) => { + list.value = res.data.measureDataPointMeterList.map((item: any) => { return { ...item, editable: pageType.value !== 'detail', params: '示值测试', + maximumError: item.maximumError.includes('±') ? item.maximumError : `${item.maximumError === '0' ? '' : '±'}${item.maximumError}`, } }) // 检定数据 infoId.value = res.data.id @@ -281,6 +283,7 @@ maxError: '', editable: true, typeDesc: `${item.typeDesc}/${item.dimensionPointUnit}`, + maximumError: item.maximumError.includes('±') ? item.maximumError : `${item.maximumError === '0' ? '' : '±'}${item.maximumError}`, })) // 整理数据 温度 湿度 list.value = [...list.value.filter((item: any) => item.typeDesc.includes('温度')), ...list.value.filter((item: any) => item.typeDesc.includes('湿度'))] @@ -359,7 +362,7 @@ const params = { belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 - measureDataPointMeterList: list.value, + measureDataPointMeterList: list.value.map((item: any) => ({ ...item, maximumError: clearSymbol(item.maximumError) })), } calculateHandle(params).then((res) => { list.value = (res.data || list.value).map((item: any) => ({ @@ -367,17 +370,18 @@ params: '示值测试', editable: true, dimensionPointUnit: item.typeDesc.includes('温度') ? '℃' : '%RH', + maximumError: item.maximumError.includes('±') ? item.maximumError : `${item.maximumError === '0' ? '' : '±'}${item.maximumError}`, })) }) } // 结论 watch(() => [itemFormData.value.appearanceFunctionCheck, list.value], () => { - if (itemFormData.value.appearanceFunctionCheck === '1' && list.value.every((item: any) => Number(item.maxError) < Number(item.maximumError))) { - itemFormData.value.outcome = '合格' + if (itemFormData.value.appearanceFunctionCheck === '1' && list.value.every((item: any) => Number(item.maxError) < Number(clearSymbol(item.maximumError)))) { + itemFormData.value.outcome = '满足使用要求' } else { - itemFormData.value.outcome = '不合格' + itemFormData.value.outcome = '不满足使用要求,建议停用或修正使用' } }, { deep: true, @@ -453,8 +457,8 @@ diff --git a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue index 9cd54d9..062b96f 100644 --- a/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/thirteenth/templateDetail.vue @@ -19,6 +19,7 @@ import { useCheckList } from '@/commonMethods/useCheckList' import { calc } from '@/utils/useCalc' import { useMergeTableRow } from '@/commonMethods/useMergeTableRow' +import { useScientificNotation } from '@/commonMethods/useScientificNotation' const props = defineProps({ infoId: String, // id @@ -313,7 +314,7 @@ // ==================================检定数据======================================================================== const data = res.data.measureDataOscilloscopeList if (itemFormData.value.itemCategoryName === '数字示波器') { - // 时基 + // 时基 timeBaseList.value = data.filter((item: any) => `${item.dataType}` === '1') timeBaseList.value = timeBaseList.value.map((item: any) => { return { @@ -1019,7 +1020,10 @@ conclusion: list[index].conclusion, exceedMark: list[index].exceedMark, } - }) + }).map((item: any) => ({ + ...item, + timeBaseRelativeError: useScientificNotation(Number(item.timeBaseRelativeError), 2, 2), + })) break case '直流增益': zeroFrequencyGainList.value = zeroFrequencyGainList.value.map((item, index) => { @@ -1321,7 +1325,10 @@