<!-- 第三套:多功能电气安全校准器标准装置 --> <!-- 检定数据管理详情模板 --> <script lang="ts" setup name="MeasureDataTemplateDetail"> import { ref } from 'vue' import { ElLoading, ElMessage } from 'element-plus' import changeRecord from '../changeRecord.vue' import TemplateFormAndTable from '../templateFormAndTable.vue' import { useSolveFormData } from '../useSolveFormData' import type { IDetailMeasureList } from './third-interface' import { suggestions, suggestions_number } from './input-suggestions' import useUserStore from '@/store/modules/user' import { calculateHandle, getInfo } from '@/api/business/taskMeasure/measureData' import { getInfo as getItemInfo } from '@/api/business/measure/item' import { useCheckList } from '@/commonMethods/useCheckList' import { caculateDecimalDigits } from '@/views/business/measure/item/useCalculateResolution' import { calc } from '@/utils/useCalc' import { getDataNum } from '@/utils/validate' import { useRound } from '@/commonMethods/useRound' import { initTableRow, mergeTableRow, useMergeTableRow } from '@/commonMethods/useMergeTableRow' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 }) const emits = defineEmits(['giveInfoId']) const $route = useRoute() // 路由参数 const templateFormAndTableRef = ref() // 表单和被检设备、测量设备表格公共组件ref const itemFormData = ref({ // 有关于检定项的数据 itemId: '', // 检定项id itemCategoryName: '', // 设备检定项分类名称 itemCategoryId: '', // 设备检定项分类名称id belongStandardEquipment: '', // 标准装置code belongStandardEquipmentName: '', // 标准装置名称 appearanceFunctionCheck: '外观完好,工作正常', // 外观(1/0) }) const tableTopLoading = ref(false) // 上面表格loading const tableBottomLoading = ref(false) // 下面表格loading // -------------------------------------------路由参数------------------------------------------ const pageType = ref('add') // 页面类型: add, edit, detail const infoId = ref('') // 列表id if ($route.params && $route.params.type) { pageType.value = $route.params.type as string if ($route.params.id) { infoId.value = $route.params.id as string } } // ------------------------------------------标签---------------------------------------------------------- const radioMenus = ref([ // 标签内容 { name: '检定数据', value: 'measure-data' }, { name: '历史修改记录', value: 'change-record' }, ]) const current = ref('measure-data') // 选择的tab 默认基本信息 // ---------------------------------------检定项数据表格---------------------------------------------------- const listTop = ref<IDetailMeasureList[]>([]) // 表格数据(上面表格) const listBottom = ref<IDetailMeasureList[]>([]) // 表格数据(下面表格) const columns_top = ref([]) as any // 表头数据--上面表格 const columns_bottom = ref([]) as any // 表头数据--下面表格 const columns_top_voltage_insulation_megger = ref([ // 开路电压(电子式绝缘电阻表(数字式)、电子式绝缘电阻表(指针式)、兆欧表)上面表格 { text: '标称值(V)', value: 'nominalValue', align: 'center', required: false }, { text: '标准值(V)', value: 'standardValue', align: 'center', required: true }, { text: '最小允许值(V)', value: 'minimumAllowValue', align: 'center', required: false }, { text: '最大允许值(V)', value: 'maximumAllowValue', align: 'center', required: false }, ]) const columns_top_earth_resistanc_meter_number = ref([ // 示值误差(数字式接地电阻表)上面表格 { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '单位', value: 'unit', align: 'center', required: true }, { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, width: '220' }, { text: '消除零位误差后被检表示值', value: 'zeroRemoveMeasureIndicationValue', align: 'center', required: false }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: false }, { text: '绝对误差', value: 'absoluteError', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: true }, ]) const columns_top_earth_resistanc_meter_simulation = ref([ // 示值误差(模拟式接地电阻表)上面表格 { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '被检表示值(Ω)', value: 'measureIndicationValue', align: 'center', required: true }, { text: '标准值(Ω)', value: 'standardValue', align: 'center', required: true, width: '220' }, { text: '消除零位误差后的标准值(Ω)', value: 'zeroRemoveMeasureStandardValue', align: 'center', required: false }, { text: '最大允许误差(Ω)', value: 'maximumError', align: 'center', required: true }, { text: '绝对误差(Ω)', value: 'absoluteError', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: false }, ]) const columns_bottom_Electronic_insulation_resistance_meter_number = ref([ // 电子式绝缘电阻表(数字式)--下面表格示值误差 { text: '端钮电压(V)', value: 'terminalVoltage', align: 'center', required: true }, { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '单位', value: 'unit', align: 'center', required: true }, { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true, width: '180' }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: false }, { text: '绝对误差', value: 'absoluteError', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: true }, ]) const columns_bottom_Electronic_insulation_resistance_meter_pointer = ref([ // // 电子式绝缘电阻表(指针式)--下面表格示值误差 { text: '端钮电压(V)', value: 'terminalVoltage', align: 'center', required: true }, { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true }, { text: '单位', value: 'unit', align: 'center', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true }, { text: '绝对误差', value: 'absoluteError', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: true }, ]) const columns_bottom_megger = ref([ // 兆欧表--下面表格示值误差 { text: '被检表示值', value: 'measureIndicationValue', align: 'center', required: true }, { text: '单位', value: 'unit', align: 'center', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true }, { text: '绝对误差', value: 'absoluteError', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: true }, ]) const columns_bottom_earth_resistanc_meter_number = ref([ // 数字式接地电阻--下面表格(辅助接地电阻试验) { text: '标准值(Ω)', value: 'standardValue', align: 'center', required: true }, { text: '辅助地阻(Ω)', value: 'auxiliaryGroundResistance', align: 'center', required: true }, { text: '消除零位误差后被检表示值(Ω)', value: 'zeroRemoveMeasureIndicationValue', align: 'center', required: true }, { text: '最大允许差值(Ω)', value: 'maximumAllowValue', align: 'center', required: false }, { text: '差值大小(Ω)', value: 'differenceSize', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: true }, ]) const columns_bottom_earth_resistanc_meter_pointer = ref([ // 模拟式接地电阻--下面表格(辅助接地电阻试验) { text: '被检表示值(Ω)', value: 'measureIndicationValue', align: 'center', required: true }, { text: '辅助地阻(Ω)', value: 'auxiliaryGroundResistance', align: 'center', required: true }, { text: '标准值(Ω)', value: 'standardValue', align: 'center', required: true }, { text: '最大允许差值(Ω)', value: 'maximumAllowValue', align: 'center', required: false }, { text: '差值大小(Ω)', value: 'differenceSize', align: 'center', required: false }, { text: '分辨力', value: 'resolution', align: 'center', required: true }, ]) const originTopList = ref([]) as any // 上面表格检定项原始数据 // -------------------------------------------获取详情信息-------------------------------------------------- // 获取页面详情信息 const fetchInfo = () => { const loading = ElLoading.service({ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) getInfo({ id: infoId.value, belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 我的任务跳转过来如果已经配置过检定项了,到编辑页面,且用一下三个字段替代传id请求详情 itemId: $route.query.itemId, // 检定项id orderId: $route.query.orderId, // 任务单id sampleId: $route.query.sampleId, // 被检设备id }).then((res) => { // 有关于检定项的数据 itemFormData.value.itemId = res.data.itemId // 检定项id itemFormData.value.itemCategoryName = res.data.itemCategoryName // 设备检定项分类名称 itemFormData.value.itemCategoryId = res.data.itemCategoryId ? res.data.itemCategoryId : itemFormData.value.itemCategoryId // 设备检定项分类名称id itemFormData.value.appearanceFunctionCheck = `${res.data.appearanceFunctionCheck}` // 外观 // =======================================表单公共组件数据处理======================================================= useSolveFormData(res, templateFormAndTableRef.value) // ==================================检定数据======================================================================== const topData = res.data.measureDataElectricalSafetyList.filter((item: { dataType: string }) => item.dataType === '1') listTop.value = topData.map((item: IDetailMeasureList, index: number) => { return { ...item, editable: pageType.value !== 'detail', resolution: Number(item.resolution), // 分辨率 redStar: `${item.absoluteError}` !== '' && `${item.maximumError}` !== '' && Math.abs(Number(item.absoluteError)) <= Math.abs(Number(getDataNum(item.maximumError))) ? 'normal' : 'error', standardValueRedStar: Number(item.standardValue) < Number(item.minimumAllowValue) || Number(item.standardValue) > Number(item.maximumAllowValue) ? 'error' : 'normal', // 开路电压标准值标* MaximumErrorFormula: originTopList.value[index].maximumError, } }) // 检定数据上面表格数据 const bottomData = res.data.measureDataElectricalSafetyList.filter((item: { dataType: string }) => item.dataType === '2') listBottom.value = bottomData.map((item: IDetailMeasureList) => { return { ...item, editable: pageType.value !== 'detail', resolution: Number(item.resolution), // 分辨率 maximumError: item.maximumError.slice(0, 1) !== '±' ? `±${item.maximumError}` : item.maximumError, // 最大允许误差添加一个正负号 redStar: `${item.absoluteError}` !== '' && `${item.maximumError}` !== '' && Math.abs(Number(item.absoluteError)) <= Math.abs(Number(getDataNum(item.maximumError))) ? 'normal' : 'error', // 差值大小标* differenceSizeRedStar: `${item.maximumAllowValue}` !== `${item.differenceSize}` ? Number(item.differenceSize) <= Number(item.maximumAllowValue) ? 'normal' : 'error' : 'normal', } }) // 检定数据下面表格数据 useMergeTableRow(listTop.value, ['rangeRange']) // 合并单元格 useMergeTableRow(listBottom.value, ['terminalVoltage']) // 合并单元格--端钮电压 infoId.value = res.data.id emits('giveInfoId', infoId.value) loading.close() }) } // 计算消除零位误差 const casulateZeroRemoveMeasure = (list: any, index: number) => { if (itemFormData.value.itemCategoryName === '数字式接地电阻表') { if (index % 10 === 0) { return '/' } // else { // return useRound(calc(Number(list[index].measureIndicationValue), Number(list[index - 1].measureIndicationValue), '-'), caculateDecimalDigits(list[index].resolution) as number) // } } else if (itemFormData.value.itemCategoryName === '模拟式接地电阻表') { if (index % 11 === 0) { return '/' } // else { // return useRound(calc(Number(list[index].standardValue), Number(list[index - 1].standardValue), '-'), caculateDecimalDigits(list[index].resolution) as number) // } } } // 初始化输入数据 const initInputData = (data: any) => { if (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(数字式)' || itemFormData.value.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.value.itemCategoryName === '兆欧表(指针式)') { const topData = data.filter((item: { dataType: string }) => item.dataType === '1') listTop.value = topData.map((item: IDetailMeasureList) => { return { ...item, id: '', dataType: item.dataType, nominalValue: item.nominalValue, // 标称值 standardValue: '', // 标准值 minimumAllowValue: item.minimumAllowValue, // 最小允许值 maximumAllowValue: item.maximumAllowValue, // 最大允许值 editable: pageType.value !== 'detail', } }) // 检定项表格 const bottomData = data.filter((item: { dataType: string }) => item.dataType === '2') listBottom.value = bottomData.map((item: IDetailMeasureList) => { return { ...item, id: '', dataType: item.dataType, terminalVoltage: item.terminalVoltage, // 端钮电压 rangeRange: item.rangeRange, // 量程 standardValue: item.standardValue, // 标准值 unit: item.unit, // 单位 measureIndicationValue: (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.value.itemCategoryName === '兆欧表(指针式)') ? item.measureIndicationValue : '', // 被检表示值 maximumError: (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.value.itemCategoryName === '兆欧表(指针式)') ? item.maximumError : '', // 最大允许误差 maximumErrorFormula: item.maximumError, // 最大允许误差公式 absoluteError: '', // 绝对误差 absoluteErrorUnit: item.unit, // 绝对误差单位 resolution: Number(item.resolution), // 分辨力 editable: pageType.value !== 'detail', } }) // 检定项表格 } else { const topData = data.filter((item: { dataType: string }) => item.dataType === '1') // listTop.value = topData listTop.value = topData.map((item: IDetailMeasureList, index: number) => { return { ...item, id: '', dataType: item.dataType, rangeRange: item.rangeRange, // 量程 standardValue: itemFormData.value.itemCategoryName === '模拟式接地电阻表' ? undefined : item.standardValue, // 标准值 unit: item.unit, // 单位 measureIndicationValue: itemFormData.value.itemCategoryName === '数字式接地电阻表' ? item.standardValue : item.measureIndicationValue, // 被检表示值 zeroRemoveMeasureIndicationValue: casulateZeroRemoveMeasure(topData, index), // 消除零位误差后被检表示值 // zeroRemoveMeasureIndicationValue: '', // 消除零位误差后被检表示值 indicationValueUnit: '', // 消除零位误差后被检表示值单位 zeroRemoveMeasureStandardValue: casulateZeroRemoveMeasure(topData, index), // 消除零位误差后标准值 // zeroRemoveMeasureStandardValue: '', // 消除零位误差后标准值 standardValueUnit: item.unit, // 消除零位误差后标准值单位 maximumError: item.maximumError, // 最大允许误差 maximumErrorFormula: item.maximumError, // 最大允许误差公式 absoluteError: '', // 绝对误差 resolution: Number(item.resolution), // 分辨力 editable: pageType.value !== 'detail', } }) // 检定项表格 const bottomData = data.filter((item: { dataType: string }) => item.dataType === '2') listBottom.value = bottomData.map((item: IDetailMeasureList, index: number) => { return { ...item, id: '', dataType: item.dataType, measureIndicationValue: item.measureIndicationValue, // 被检表示值 standardValue: itemFormData.value.itemCategoryName === '模拟式接地电阻表' ? undefined : item.standardValue, // 标准值, // 标准值 unit: item.unit, // 标准值单位 auxiliaryGroundResistance: item.auxiliaryGroundResistance, // 辅助地阻 resistanceUnit: item.unit, // 辅助地阻单位 zeroRemoveMeasureIndicationValue: '', // 消除零位误差后被检表示值 indicationValueUnit: item.unit, // 消除零位误差后被检表示值单位 zeroRemoveMeasureStandardValue: '', // 消除零位误差后标准值 standardValueUnit: item.unit, // 消除零位误差后标准值单位 maximumError: '', // 最大允许误差 maximumErrorFormula: item.maximumError, // 最大允许误差公式 maximumErrorUnit: item.unit, // 最大允许误差单位 differenceSize: '', // 差值大小 differenceSizeUnit: item.unit, // 差值大小单位 resolution: Number(item.resolution), // 分辨力 editable: pageType.value !== 'detail', } }) // 检定项表格 useMergeTableRow(listTop.value, ['rangeRange']) // 合并单元格 } } /** * 新增的时候获取检定项输入数据(获取检定项分类详情) * @param itemId 检定项id * @param itemCategoryName 检定项分类名字 * @param belongStandardEquipment 检校标准装置字典 */ const fetchItemInfo = async (itemId: string, itemCategoryName: string, belongStandardEquipment = '', solveData = true) => { const params = { id: itemId, itemCategoryName, // 检定项分类名字 belongStandardEquipment, // 检校标准装置字典code } const res = await getItemInfo(params) itemFormData.value.appearanceFunctionCheck = `${res.data.appearanceFunctionCheck}` === '1' ? '外观完好,工作正常' : '' // 外观及功能检查 1有外观,2没有外观 originTopList.value = res.data.measureItemDataElectricalSafetyList.filter((item: { dataType: string }) => item.dataType === '1') if (solveData) { initInputData(res.data.measureItemDataElectricalSafetyList) } } // ----------------------------------------点击保存时校验--------------------------------------- // 校验 const checkout = (checkTopTable = true, checkBottomTable = true) => { let titleTop = '开路电压' // 校验名称上面表格 let titleBottom = '示值误差' // 校验名称下面表格 if (itemFormData.value.itemCategoryName === '数字式接地电阻表' || itemFormData.value.itemCategoryName === '模拟式接地电阻表') { titleTop = '示值误差' // 校验名称上面表格 titleBottom = '辅助接地电阻试验' // 校验名称下面表格 } if (checkTopTable && !useCheckList(listTop.value, columns_top.value, titleTop)) { return false } if (checkBottomTable && !useCheckList(listBottom.value, columns_bottom.value, titleBottom)) { return false } if (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.value.itemCategoryName === '兆欧表(指针式)') { if (listTop.value && listTop.value.length) { for (let i = 0; i < listTop.value.length; i++) { if (isNaN(Number(listTop.value[i].standardValue)) && listTop.value[i].standardValue !== '∞' && listTop.value[i].standardValue !== '超出量程' && listTop.value[i].standardValue !== '/' && listTop.value[i].standardValue !== '指针偏离标度中心线位置超过1mm') { ElMessage.warning(`第${i + 1}行 标准值只允许输入数字或选择列表其中一项`) return false } } } if (listBottom.value && listBottom.value.length) { for (let i = 0; i < listBottom.value.length; i++) { if (isNaN(Number(listBottom.value[i].standardValue)) && listBottom.value[i].standardValue !== '∞' && listBottom.value[i].standardValue !== '超出量程' && listBottom.value[i].standardValue !== '/' && listBottom.value[i].standardValue !== '指针偏离标度中心线位置超过1mm') { ElMessage.warning(`第${i + 1}行 标准值只允许输入数字或选择列表其中一项`) return false } } } } if (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(数字式)') { if (listTop.value && listTop.value.length) { for (let i = 0; i < listTop.value.length; i++) { if (isNaN(Number(listTop.value[i].standardValue)) && listTop.value[i].standardValue !== '超出量程' && listTop.value[i].standardValue !== '/' && listTop.value[i].standardValue !== '无法显示') { ElMessage.warning(`第${i + 1}行 标准值只允许输入数字或选择列表其中一项`) return false } } } } return true } // -----------------------------------------生成结果处理---------------------------------------- // 点击生成结果处理 const caculate = (type: 'top' | 'bottom') => { if (type === 'top') { if (!checkout(true, false)) { return false } } else if (type === 'bottom') { if (!checkout(false, true)) { return false } } // 计算电子式绝缘电阻表(数字式)、电子式绝缘电阻表(指针式)、兆欧表计算标准值范围,标*使用 if (itemFormData.value.itemCategoryName !== '数字式接地电阻表' && itemFormData.value.itemCategoryName !== '模拟式接地电阻表' && type === 'top') { listTop.value = listTop.value.map((item: any) => { let standardValueRedStar = 'normal' if (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.value.itemCategoryName === '兆欧表(指针式)') { if (isNaN(Number(item.standardValue))) { // 非数值, 说明是选的四种 if ((item.standardValue === '∞' && item.nominalValue !== '∞') || item.standardValue === '超出量程' || item.standardValue === '/' || item.standardValue === '指针偏离标度中心线位置超过1mm') { standardValueRedStar = 'error' } } else if (Number(item.standardValue) < Number(item.minimumAllowValue) || Number(item.standardValue) > Number(item.maximumAllowValue)) { standardValueRedStar = 'error' } } if (itemFormData.value.itemCategoryName === '电子式绝缘电阻表(数字式)') { if (isNaN(Number(item.standardValue))) { // 非数值, 说明是选的四种 if (item.standardValue === '超出量程' || item.standardValue === '/' || item.standardValue === '无法显示') { standardValueRedStar = 'error' } } else if (Number(item.standardValue) < Number(item.minimumAllowValue) || Number(item.standardValue) > Number(item.maximumAllowValue)) { standardValueRedStar = 'error' } } return { ...item, standardValueRedStar, } }) } else { if (itemFormData.value.itemCategoryName === '数字式接地电阻表' || itemFormData.value.itemCategoryName === '模拟式接地电阻表') { listTop.value = listTop.value.map((item: any, index: number) => { return { ...item, zeroRemoveMeasureIndicationValue: casulateZeroRemoveMeasure(listTop.value, index), // 消除零位误差后被检表示值 zeroRemoveMeasureStandardValue: casulateZeroRemoveMeasure(listTop.value, index), // 消除零位误差后标准值 } }) } else { // 电子式绝缘电阻表(数字、指针)、兆欧表 listBottom.value = listBottom.value.map((item: any, index: number) => { return { ...item, // 根据分辨力修约,先保留几位小数再四舍五入 standardValue: useRound(item.standardValue, caculateDecimalDigits(item.resolution) as number), } }) } let list if (type === 'bottom' && (itemFormData.value.itemCategoryName === '数字式接地电阻表' || itemFormData.value.itemCategoryName === '模拟式接地电阻表')) { list = listTop.value.concat(listBottom.value) } else { list = type === 'top' ? listTop.value : listBottom.value } tableTopLoading.value = type === 'top'// 上面表格loading tableBottomLoading.value = type === 'bottom'// 下面表格loading const params = { belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 measureDataElectricalSafetyList: list, } calculateHandle(params).then((res) => { tableTopLoading.value = false // 上面表格loading tableBottomLoading.value = false // 下面表格loading if (res.data && res.data.length) { if (type === 'top') { listTop.value = res.data.map((item: any) => { return { ...item, redStar: `${item.absoluteError}` !== '' && `${item.maximumError}` !== '' && Math.abs(Number(item.absoluteError)) <= Math.abs(Number(getDataNum(item.maximumError))) ? 'normal' : 'error', } }) } else { if (type === 'bottom' && (itemFormData.value.itemCategoryName === '数字式接地电阻表' || itemFormData.value.itemCategoryName === '模拟式接地电阻表')) { listBottom.value = res.data.filter((item: { dataType: string }) => item.dataType === '2') listBottom.value = listBottom.value.map((item: any) => { return { ...item, // 差值大小标* differenceSizeRedStar: `${item.maximumAllowValue}` !== `${item.differenceSize}` ? Number(item.differenceSize) <= Number(item.maximumAllowValue) ? 'normal' : 'error' : 'normal', } }) } else { listBottom.value = res.data.map((item: any) => { return { ...item, redStar: `${item.absoluteError}` !== '' && `${item.maximumError}` !== '' && Math.abs(Number(item.absoluteError)) <= Math.abs(Number(getDataNum(item.maximumError))) ? 'normal' : 'error', } }) } } } }).catch(() => { tableTopLoading.value = false // 上面表格loading tableBottomLoading.value = false // 下面表格loading }) } } // ------------------------------------------钩子---------------------------------------------- watch(() => itemFormData.value.itemCategoryName, (newValue) => { console.log(newValue, 'itemCategoryName.value') if (newValue) { switch (newValue) { case '电子式绝缘电阻表(数字式)': columns_top.value = columns_top_voltage_insulation_megger.value columns_bottom.value = columns_bottom_Electronic_insulation_resistance_meter_number.value break case '电子式绝缘电阻表(指针式)': columns_top.value = columns_top_voltage_insulation_megger.value columns_bottom.value = columns_bottom_Electronic_insulation_resistance_meter_pointer.value break case '兆欧表(指针式)': columns_top.value = columns_top_voltage_insulation_megger.value columns_bottom.value = columns_bottom_megger.value break case '数字式接地电阻表': columns_top.value = columns_top_earth_resistanc_meter_number.value columns_bottom.value = columns_bottom_earth_resistanc_meter_number.value break case '模拟式接地电阻表': columns_top.value = columns_top_earth_resistanc_meter_simulation.value columns_bottom.value = columns_bottom_earth_resistanc_meter_pointer.value break } } }, { immediate: true, deep: true }) watch(() => props.infoId, (newValue) => { if (newValue) { infoId.value = newValue } }, { immediate: true }) onMounted(() => { itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string // 设备检定项分类名称 itemFormData.value.itemCategoryId = $route.query.itemCategoryId as string// 设备检定项分类名称id itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 if (pageType.value === 'add') { // 从我的任务跳转过来(新增) itemFormData.value.itemId = $route.query.itemId as string// 检定项id // 查输入值(查检定项管理的详情) fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) } else { fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string).then(() => { // fetchInfo() }) } }) defineExpose({ checkout, itemFormData, listTop, listBottom, templateFormAndTableRef, pageType }) </script> <template> <div class="measure-data-template-detail"> <template-form-and-table ref="templateFormAndTableRef" :page-type="pageType" /> <!-- 标签 --> <detail-block :title="pageType !== 'detail' ? '检定数据' : ''" :class="pageType === 'detail' ? 'setBottom' : ''"> <el-radio-group v-if="pageType === 'detail'" v-model="current"> <el-radio-button v-for="item in radioMenus" :key="item.value" :label="item.value"> {{ item.name }} </el-radio-button> </el-radio-group> <el-form v-if="current === 'measure-data'" ref="formRef" :model="itemFormData" label-width="140" label-position="right" style="margin-top: 20px;" > <el-row> <!-- 外观 --> <el-col :span="12"> <el-form-item label="外观及功能性检查:" prop="appearanceFunctionCheck"> <el-input v-model="itemFormData.appearanceFunctionCheck" class="full-width-input" autosize type="textarea" :disabled="pageType === 'detail'" /> </el-form-item> </el-col> </el-row> </el-form> <!-- <div v-if="current === 'measure-data'" style="padding: 0 10px;display: flex;justify-content: space-between;"> <el-checkbox v-if="itemFormData.itemCategoryName === '电子式绝缘电阻表(数字式)' || itemFormData.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.itemCategoryName === '兆欧表(指针式)'" :checked="true" :disabled="pageType === 'detail'"> 开路电压 </el-checkbox> <el-checkbox v-if="itemFormData.itemCategoryName === '数字式接地电阻表' || itemFormData.itemCategoryName === '模拟式接地电阻表'" :checked="true" :disabled="pageType === 'detail'"> 示值误差 </el-checkbox> </div> --> <!-- 上面表格 --> <detail-block v-if="current === 'measure-data'" :title="pageType !== 'detail' && (itemFormData.itemCategoryName === '数字式接地电阻表' || itemFormData.itemCategoryName === '模拟式接地电阻表') ? '示值误差' : '开路电压'" style="margin-top: 0;"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary" @click="caculate('top')"> 计算结果 </el-button> </template> <el-table ref="tableRef" v-loading="tableTopLoading" :data="listTop" border stripe style="width: 100%;" max-height="400" :span-method="mergeTableRow" > <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns_top" :key="item.value" :prop="item.value" :label="item.text" :width="item.width" align="center" > <template #header> <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span> </template> <template #default="scope"> <!-- 被检表示值 --> <el-input-number v-if="pageType !== 'detail' && (item.value === 'measureIndicationValue') && itemFormData.itemCategoryName !== '模拟式接地电阻表'" v-model="scope.row[item.value]" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" :precision="caculateDecimalDigits(scope.row.resolution) as number" /> <!-- 标准值 --> <el-input-number v-if="pageType !== 'detail' && (item.value === 'standardValue') && itemFormData.itemCategoryName === '模拟式接地电阻表'" v-model="scope.row[item.value]" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" :precision="caculateDecimalDigits(scope.row.resolution)" /> <!-- 前三种设备的标准值 --> <div v-if="item.value === 'standardValue' && (itemFormData.itemCategoryName !== '数字式接地电阻表' && itemFormData.itemCategoryName !== '模拟式接地电阻表')"> <span v-if="pageType === 'detail'">{{ scope.row.standardValue }}</span> <!-- <el-input-number v-if="pageType !== 'detail'" v-model="scope.row[item.value]" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" style="width: 90%;" :precision="caculateDecimalDigits(scope.row.resolution)" /> --> <!-- 电子式绝缘电阻表(数字式) --> <el-autocomplete v-if="pageType !== 'detail' && (item.value === 'standardValue' && itemFormData.itemCategoryName === '电子式绝缘电阻表(数字式)')" v-model="scope.row[item.value]" :fetch-suggestions="suggestions_number" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" style="width: 90%;" clearable /> <!-- 兆欧表标准值、电子式绝缘电阻表(指针式)标准值特殊处理: --> <el-autocomplete v-if="pageType !== 'detail' && (item.value === 'standardValue') && (itemFormData.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.itemCategoryName === '兆欧表(指针式)')" v-model="scope.row[item.value]" :fetch-suggestions="suggestions" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" style="width: 90%;" clearable /> <span v-if="scope.row.standardValueRedStar === 'error'" style="color: red;" > * </span> </div> <!-- 绝对误差不在最大允许误差范围内标* --> <div v-if="item.value === 'absoluteError'"> <span>{{ scope.row.absoluteError }}</span> <span v-if="scope.row.redStar === 'error' && `${scope.row.absoluteError}` !== ''" style="color: red;" > * </span> </div> </template> </el-table-column> </el-table> </detail-block> <!-- <div v-if="current === 'measure-data'" style="padding: 0 10px;display: flex;justify-content: space-between;"> <el-checkbox v-if="itemFormData.itemCategoryName === '电子式绝缘电阻表(数字式)' || itemFormData.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.itemCategoryName === '兆欧表(指针式)'" :checked="true" :disabled="pageType === 'detail'"> 示值误差 </el-checkbox> <el-checkbox v-if="itemFormData.itemCategoryName === '数字式接地电阻表' || itemFormData.itemCategoryName === '模拟式接地电阻表'" :checked="true" :disabled="pageType === 'detail'"> 辅助接地电阻试验 </el-checkbox> </div> --> <!-- 下面表格 --> <detail-block v-if="current === 'measure-data'" :title="pageType !== 'detail' && (itemFormData.itemCategoryName === '数字式接地电阻表' || itemFormData.itemCategoryName === '模拟式接地电阻表') ? '辅助接地电阻试验' : '示值误差'"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary" @click="caculate('bottom')"> 计算结果 </el-button> </template> <el-table ref="tableRef" v-loading="tableBottomLoading" :data="listBottom" border stripe style="width: 100%;" :span-method="mergeTableRow" > <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns_bottom" :key="item.value" :prop="item.value" :label="item.text" :width="item.width" align="center" > <template #header> <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span> </template> <template #default="scope"> <!-- 被检表示值 --> <el-input-number v-if="pageType !== 'detail' && itemFormData.itemCategoryName === '电子式绝缘电阻表(数字式)' && item.value === 'measureIndicationValue'" v-model="scope.row[item.value]" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" :precision="caculateDecimalDigits(scope.row.resolution)" /> <!-- <el-autocomplete v-if="pageType !== 'detail' && itemFormData.itemCategoryName === '电子式绝缘电阻表(数字式)' && item.value === 'measureIndicationValue'" v-model="scope.row[item.value]" :fetch-suggestions="suggestions_number" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" ></el-autocomplete> --> <!-- 标准值 --> <el-input-number v-if="pageType !== 'detail' && (itemFormData.itemCategoryName === '模拟式接地电阻表') && item.value === 'standardValue'" v-model="scope.row[item.value]" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" :precision="caculateDecimalDigits(scope.row.resolution)" /> <el-autocomplete v-if="pageType !== 'detail' && (item.value === 'standardValue') && (itemFormData.itemCategoryName === '电子式绝缘电阻表(指针式)' || itemFormData.itemCategoryName === '兆欧表(指针式)')" v-model="scope.row[item.value]" :fetch-suggestions="suggestions" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" clearable /> <!-- 消除零位误差后被检表示值 --> <el-input-number v-if="pageType !== 'detail' && item.value === 'zeroRemoveMeasureIndicationValue'" v-model="scope.row[item.value]" :placeholder="pageType === 'detail' ? '' : `${item.text}`" :disabled="pageType === 'detail'" class="full-width-input" :precision="caculateDecimalDigits(scope.row.resolution)" /> <!-- 绝对误差不在最大允许误差范围内标* --> <div v-if="item.value === 'absoluteError'"> <span>{{ scope.row.absoluteError }}</span> <span v-if="scope.row.redStar === 'error' && `${scope.row.absoluteError}` !== ''" style="color: red;"> * </span> </div> <!-- 差值大小不在最大允许差值范围内标* --> <div v-if="item.value === 'differenceSize'"> <span>{{ scope.row.differenceSize }}</span> <span v-if="scope.row.differenceSizeRedStar === 'error' && `${scope.row.differenceSize}` !== ''" style="color: red;"> * </span> </div> </template> </el-table-column> </el-table> </detail-block> <!-- 历史修改记录 --> <change-record v-show="pageType === 'detail' && current === 'change-record'" :info-id="infoId" /> </detail-block> </div> </template> <style lang="scss"> .measure-data-template-detail { .el-radio__label { display: block !important; } } </style>