<!-- 检定数据管理详情 --> <script lang="ts" setup name="MeasureDataDetail"> import { ref } from 'vue' import { ElLoading, ElMessage } from 'element-plus' import FirstTemplateDetail from './components/first/templateDetail.vue' import SecondTemplateDetail from './components/second/templateDetail.vue' import ThirdTemplateDetail from './components/third/templateDetail.vue' import FourthTemplateDetail from './components/fourth/templateDetail.vue' import FifthTemplateDetail from './components/fifth/templateDetail.vue' import SixthTemplateDetail from './components/sixth/templateDetail.vue' import SeventhTemplateDetail from './components/seventh/templateDetail.vue' import EighthTemplateDetail from './components/eighth/templateDetail.vue' import NinthTemplateDetail from './components/ninth/templateDetail.vue' import TenthTemplateDetail from './components/tenth/templateDetail.vue' import EleventhTemplateDetail from './components/eleventh/templateDetail.vue' import ThirteenthTemplateDetail from './components/thirteenth/templateDetail.vue' import FifteenthTemplateDetail from './components/fifteenth/templateDetail.vue' import FourteenTemplateDetail from './components/fourteen/templateDetail.vue' import SixteenTemplateDetail from './components/sixteen/templateDetail.vue' import saveMeasureCertificateDialog from './dialog/saveMeasureCertificateDialog.vue' import useUserStore from '@/store/modules/user' import { clearSymbol } from '@/utils/String' import { addCertificate } from '@/api/business/taskMeasure/certificate' import { addMeasureData, updateMeasureData } from '@/api/business/taskMeasure/measureData' import Standard from '@/views/equipement/standard/book/components/standard.vue' import { base64toFile, exportCharts, getChartsFile } from '@/utils/download' import { UploadFile } from '@/api/file' const user = useUserStore() // 用户信息 const textMap: { [key: string]: string } = { edit: '编辑', add: '新建', detail: '详情', }// 字典 const $router = useRouter() // 关闭页面使用 const $route = useRoute() // 路由参数 const pageType = ref('add') // 页面类型: add, edit, detail const infoId = ref('') // 列表id const templateDetailRef = ref() // 详情组件ref const dataNo = ref('') // 检定数据编号 const saveMeasureCertificateRef = ref() // 生成原始记录和检定证书组件ref const belongStandardEquipment = ref('') // 检校标准装置 const belongStandardEquipmentName = ref('') // 检校标准装置名称 const itemCategoryName = ref('') // 检定项分类名称 const itemCategoryId = 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 close = () => { $router.back() } // 点击编辑按钮 const edit = () => { pageType.value = 'edit' } // 处理保存入参 const solveSaveParams = () => { let params if (belongStandardEquipment.value === '1') { // 第一套:多功能校准源 params = { ...templateDetailRef.value.form, ...templateDetailRef.value.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.sampleList[0].sampleModel, // 型号 equipmentDTOs: templateDetailRef.value.measureDataCalibratorList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), measureDataCalibratorList: templateDetailRef.value.list, // 检定数据 id: pageType.value === 'edit' ? infoId.value : '', itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 createTime: null, updateTime: null, } } else if (belongStandardEquipment.value === '2') { // // 第2套:直流稳压电源 params = { ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.form, belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 id: pageType.value === 'edit' ? infoId.value : '', measureDataDcPowerList: templateDetailRef.value.getList(), model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, // equipmentList equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '3') { // 第3套:多功能电气安全校准器 params = { ...templateDetailRef.value.templateFormAndTableRef.form, ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.templateFormAndTableRef.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), measureDataElectricalSafetyList: templateDetailRef.value.listTop.concat(templateDetailRef.value.listBottom), // 检定数据 id: pageType.value === 'edit' ? infoId.value : '', createTime: null, updateTime: null, } } else if (belongStandardEquipment.value === '4') { // 第四套:0.02级活塞式压力计 let tempMeasureDataPistonGaugeList = templateDetailRef.value.list.map((item: any) => { return { ...item, workLineEquation: templateDetailRef.value.itemFormData.workLineEquation, // 工作直线方程 // 数字压力计零位飘逸 zeroDriftOne: templateDetailRef.value.zeroDriftResultList.length ? templateDetailRef.value.zeroDriftResultList[0].zeroDriftOne : '', // 0 zeroDriftTwo: templateDetailRef.value.zeroDriftResultList.length ? templateDetailRef.value.zeroDriftResultList[0].zeroDriftTwo : '', // 15 zeroDriftThree: templateDetailRef.value.zeroDriftResultList.length ? templateDetailRef.value.zeroDriftResultList[0].zeroDriftThree : '', // 30 zeroDriftFour: templateDetailRef.value.zeroDriftResultList.length ? templateDetailRef.value.zeroDriftResultList[0].zeroDriftFour : '', // 45 zeroDriftFive: templateDetailRef.value.zeroDriftResultList.length ? templateDetailRef.value.zeroDriftResultList[0].zeroDriftFive : '', // 60 } }) // 检定数据 if (itemCategoryName.value === '电接点一般压力表') { tempMeasureDataPistonGaugeList = tempMeasureDataPistonGaugeList.concat(templateDetailRef.value.listElectricContact) } params = { ...templateDetailRef.value.templateFormAndTableRef.form, ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.templateFormAndTableRef.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), measureDataPistonGaugeList: tempMeasureDataPistonGaugeList, // 检定数据 id: pageType.value === 'edit' ? infoId.value : '', createTime: null, updateTime: null, } } else if (belongStandardEquipment.value === '5') { // 第5套:二等铂 let list = [] if (itemCategoryName.value === '恒温槽') { list = templateDetailRef.value.thermostaticBathWaveList.concat(templateDetailRef.value.thermostaticBathEvenList) } else if (itemCategoryName.value === '双金属温度计') { list = templateDetailRef.value.bimetalThermometerList } else if (itemCategoryName.value === '工业铂铜热电阻') { list = templateDetailRef.value.resistanceFranchiseList.concat(templateDetailRef.value.resistanceResultList) } params = { ...templateDetailRef.value.templateFormAndTableRef.form, ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.templateFormAndTableRef.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), measureDataResistanceThermometerList: list, // 检定数据 id: pageType.value === 'edit' ? infoId.value : '', createTime: null, updateTime: null, } } else if (belongStandardEquipment.value === '6') { // 第六套 安全阀 params = { ...templateDetailRef.value.itemFormData, measureDataSafetyValueList: templateDetailRef.value.list.map((item: any) => ({ ...item, allowValue: undefined })), id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '8') { // 第8套 E2等砝码 const list = templateDetailRef.value.solveParamsBeforeSave() params = { ...templateDetailRef.value.itemFormData, measureDataETwoList: list, id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '9') { // 第9套 频谱分析仪 params = { ...templateDetailRef.value.itemFormData, measureDataSpectrumAnalyzerList: templateDetailRef.value.getList().map((item: any) => ({ ...item, technicalIndexSymbol: item.technicalIndex.substring(0, 1), technicalIndex: clearSymbol(item.technicalIndex) })), id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '10') { // 第10套 信号发生器 params = { ...templateDetailRef.value.itemFormData, id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id measureDataSignalGeneratorList: templateDetailRef.value.solveParamsBeforeSave(), } } else if (belongStandardEquipment.value === '13') { // 第13套 示波器 params = { ...templateDetailRef.value.itemFormData, id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id measureDataOscilloscopeList: templateDetailRef.value.solveParamsBeforeSave(), } } else if (belongStandardEquipment.value === '14') { // 第14套 铯原子 params = { ...templateDetailRef.value.itemFormData, measureDataCesiumAtomList: templateDetailRef.value.getList().map((item: any) => ({ ...item, id: pageType.value === 'add' ? '' : item.id })), id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '15') { // 第15套 小功率 params = { ...templateDetailRef.value.itemFormData, id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id measureDataLowPowerList: templateDetailRef.value.list, } } else if (belongStandardEquipment.value === '16') { // 第16套 低频信号源 params = { ...templateDetailRef.value.itemFormData, measureDataLowFrequencySignalList: templateDetailRef.value.getList().map((item: any) => ({ ...item, id: pageType.value === 'add' ? '' : item.id })), id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standard: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } return params } // 校验 const check = () => { if (belongStandardEquipment.value === '1') { // 第一套:多功能校准源 return true // 保存不做校验 // return templateDetailRef.value.checkout() } else if (belongStandardEquipment.value === '2') { // 第二套 直流稳压电源 return templateDetailRef.value.checkAllList() && templateDetailRef.value.templateFormAndTableRef.checkout() } // 第3套:多功能电气安全校准器、第四套:0.02活塞式压力计、第5套:二等铂、第六套 安全阀 else if (belongStandardEquipment.value === '3' || belongStandardEquipment.value === '4' || belongStandardEquipment.value === '5' || belongStandardEquipment.value === '6') { // return templateDetailRef.value.checkout() && templateDetailRef.value.templateFormAndTableRef.checkout() return templateDetailRef.value.templateFormAndTableRef.checkout() } else if (belongStandardEquipment.value === '8') { // 第8套 E2等砝码 return templateDetailRef.value.templateFormAndTableRef.checkout() } else if (belongStandardEquipment.value === '9') { // 第9套 频谱分析仪 return true // 保存不做校验 } else if (belongStandardEquipment.value === '10') { // 第10套 信号发生器 return templateDetailRef.value.templateFormAndTableRef.checkout() // 保存不做校验 } else if (belongStandardEquipment.value === '13') { // 第13套 示波器 return templateDetailRef.value.templateFormAndTableRef.checkout() // 保存不做校验 } else if (belongStandardEquipment.value === '14') { // 第14套 铯原子 return true // 保存不做校验 } else if (belongStandardEquipment.value === '15') { // 第15套 小功率 return true // 保存不做校验 } else if (belongStandardEquipment.value === '16') { // 第16套 低频信号源 return true // 保存不做校验 } } // 保存 const save = () => { let formRef // 验证表单的ref if (belongStandardEquipment.value === '1') { formRef = templateDetailRef.value.ruleFormRef } else { formRef = templateDetailRef.value.templateFormAndTableRef.ruleFormRef } formRef!.validate((valid: boolean) => { // 表单校验 if (valid) { if (!check()) { return false } // 校验 const loading = ElLoading.service({ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) const params = solveSaveParams() // 处理入参 console.log(params, 'params') // 新建 if (pageType.value === 'add') { // 新建 addMeasureData(params).then((res) => { ElMessage.success('保存成功') pageType.value = 'detail' templateDetailRef.value.pageType = 'detail' if (belongStandardEquipment.value === '14') { templateDetailRef.value.templateDetailRef.pageType = 'detail' } dataNo.value = res.data.dataNo // 检定数据编号 infoId.value = res.data.id // id loading.close() }).catch(() => { loading.close() }) } // 保存 else if (pageType.value === 'edit') { // 编辑 updateMeasureData(params).then((res) => { ElMessage.success('保存成功') pageType.value = 'detail' templateDetailRef.value.pageType = 'detail' if (belongStandardEquipment.value === '14') { templateDetailRef.value.templateDetailRef.pageType = 'detail' } loading.close() }).catch(() => { loading.close() }) } } }) } // 点击标识打印 const labelPrinting = () => { $router.push({ path: '/taskMeasure/printList', }) } // 生成证书处理参数 const solveRecordParams = () => { let params: any const solvedParams = solveSaveParams() solvedParams.dataId = infoId.value if (user.bizLabCode === '') { // ElMessage.warning('此用户没有实验室代码,不允许生成证书') ElMessage.warning('此用户非计量人员,不允许生成证书') return false } if (user.groupNo === '') { // ElMessage.warning('此用户没有组别代码,不允许生成证书') ElMessage.warning('此用户非计量人员,不允许生成证书') return false } console.log('实验室代码', user.bizLabCode) console.log('组别代码', user.groupNo) if (belongStandardEquipment.value === '4') { // 0.02活塞需要添加配置项 if (itemCategoryName.value === '电接点一般压力表') { params = { ...solvedParams, labCode: user.bizLabCode, // 实验室代码 groupCode: user.groupNo, // 组别代码 certificateName: `${solvedParams.sampleName}-${solvedParams.traceDate}`, // 检定审批报告名称 dataId: solvedParams.dataId, // 检定数据管理基础信息表id id: '', measureItemConfigPistonGauge: templateDetailRef.value.measureItemConfigPistonGauge, // 检定项配置 measureDataPistonGaugeList: templateDetailRef.value.list.concat(templateDetailRef.value.resultList, templateDetailRef.value.listElectricContact, templateDetailRef.value.resultListElectricContact), } } else { params = { ...solvedParams, labCode: user.bizLabCode, // 实验室代码 groupCode: user.groupNo, // 组别代码 certificateName: `${solvedParams.sampleName}-${solvedParams.traceDate}`, // 检定审批报告名称 dataId: solvedParams.dataId, // 检定数据管理基础信息表id id: '', measureItemConfigPistonGauge: templateDetailRef.value.measureItemConfigPistonGauge, // 检定项配置 measureDataPistonGaugeList: templateDetailRef.value.list.concat(templateDetailRef.value.resultList), } } } else if (belongStandardEquipment.value === '5') { // 二等铂 params = { ...solvedParams, labCode: user.bizLabCode, // 实验室代码 groupCode: user.groupNo, // 组别代码 certificateName: `${solvedParams.sampleName}-${solvedParams.traceDate}`, // 检定审批报告名称 dataId: solvedParams.dataId, // 检定数据管理基础信息表id id: '', appearance: `${solvedParams.appearance}` === '1' ? '合格' : `${solvedParams.appearance}` === '0' ? '不合格' : '', equipmentList: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList, } } else { params = { ...solvedParams, labCode: user.bizLabCode, // 实验室代码 groupCode: user.groupNo, // 组别代码 certificateName: `${solvedParams.sampleName}-${solvedParams.traceDate}`, // 检定审批报告名称 dataId: solvedParams.dataId, // 检定数据管理基础信息表id id: '', equipmentList: belongStandardEquipment.value !== '1' ? templateDetailRef.value.templateFormAndTableRef.measureEquipmentList : templateDetailRef.value.measureDataCalibratorList, } } if (belongStandardEquipment.value === '6') { params.appearanceFunctionCheck = Number(params.appearanceFunctionCheck) === 1 ? '合格' : '不合格' params.sealingTest = Number(params.sealingTest) === 1 ? '合格' : '不合格' } return params } // 生成原始记录和检定证书 const createRecord = () => { const params = solveRecordParams() // 铯原子检定装置需要传递图片 if (belongStandardEquipment.value === '14' && document.getElementById('chart')) { if (document.getElementById('chart')?.querySelectorAll('canvas').length) { const file = base64toFile(getChartsFile(document.getElementById('chart')?.querySelectorAll('canvas')[0]), itemCategoryName.value, 'png') const fd = new FormData() fd.append('multipartFile', file) UploadFile(fd).then((res) => { params.lineChartImage = res.data[0] createRecordFun() }) } else { createRecordFun() } } else { createRecordFun() } function createRecordFun() { if (params) { const loading = ElLoading.service({ lock: true, text: '正在生成证书、请稍后', background: 'rgba(255, 255, 255, 0.8)', }) addCertificate(params).then((res) => { ElMessage.success('生成证书成功') $router.push({ path: `/businessCertificate/detail/${res.data.id}`, query: { certNo: res.data.certNo, // 检定证书报告 sampleName: params.sampleName, // 被检设备名称 model: params.sampleModel || params.model, // 被检设备名称 manufacturingNo: params.manufactureNo, // 被检设备名称 approvalStatusName: '草稿箱', measureDataId: params.dataId, }, }) loading.close() }).catch(() => { loading.close() }) } // saveMeasureCertificateRef.value.initDialog(params) // 弹窗输入组别代码、实验室代码、名称 } } const giveInfoId = (id: string) => { infoId.value = id } const changePageType = (type: string) => { pageType.value = type } // -------------------------------------------钩子-------------------------------------------------- const batchEditRow = ref([]) as any // 批量编辑数据 const isBatchEdit = ref(false) as any // 批量编辑数据 onMounted(async () => { isBatchEdit.value = `${$route.query.batchEdit}` console.log('isBatchEdit.value', isBatchEdit.value) if (isBatchEdit.value === 'true') { console.log('批量编辑从前一页获取的数据', JSON.parse($route.query.batchEditRow as string)) batchEditRow.value = JSON.parse($route.query.batchEditRow as string) } else { itemCategoryName.value = $route.query.itemCategoryName as string || '' // 检定项分类名称 itemCategoryId.value = $route.query.itemCategoryId as string || '' // 检定项分类id belongStandardEquipment.value = $route.query.belongStandardEquipment as string || ''// 标准装置code belongStandardEquipmentName.value = $route.query.belongStandardEquipmentName as string || ''// 标准装置名称 } }) </script> <template> <app-container class="measure-data"> <detail-page :title="`检定数据管理-${textMap[pageType]}`"> <template #btns> <el-button v-if="pageType === 'detail'" type="primary" @click="createRecord"> 生成原始记录和检定证书 </el-button> <el-button v-if="pageType === 'detail'" type="primary" @click="labelPrinting"> 标识打印 </el-button> <el-button v-if="pageType !== 'detail'" type="primary" @click="save"> 保存 </el-button> <!-- <el-button v-if="pageType === 'detail'" type="primary" @click="edit"> 编辑 </el-button> --> <el-button type="info" @click="close"> 关闭 </el-button> </template> </detail-page> <!-- 第一套:多功能校准源 --> <first-template-detail v-if="belongStandardEquipment === '1'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第2套:直流稳压电源标准装置 --> <second-template-detail v-if="belongStandardEquipment === '2'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第3套:多功能电气安全校准器标准装置 --> <third-template-detail v-if="belongStandardEquipment === '3'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第四套:0.02级活塞式压力计 --> <div v-if="isBatchEdit === 'true' && batchEditRow[0].belongStandardEquipment === '4'"> <fourth-template-detail v-for="item in batchEditRow" :key="item.id" ref="templateDetailRef" :info-id="item.id" @giveInfoId="giveInfoId" /> </div> <fourth-template-detail v-if="belongStandardEquipment === '4' && isBatchEdit !== 'true'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第5套:二等铂电阻温度计标准装置 --> <fifth-template-detail v-if="belongStandardEquipment === '5'" ref="templateDetailRef" :page-type="pageType" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" @change-page-type="changePageType" /> <!-- 第6套:安全阀标准装置 --> <sixth-template-detail v-if="belongStandardEquipment === '6'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第7套:精密露点仪标准装置 --> <seventh-template-detail v-if="belongStandardEquipment === '7'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第8套:E2等砝码标准装置 --> <eighth-template-detail v-if="belongStandardEquipment === '8'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第9套:频谱分析仪标准装置 --> <ninth-template-detail v-if="belongStandardEquipment === '9'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第10套:信号发生器标准装置 --> <tenth-template-detail v-if="belongStandardEquipment === '10'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第11套:衰减器装置 --> <eleventh-template-detail v-if="belongStandardEquipment === '11'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第13套:示波器检定装置 --> <thirteenth-template-detail v-if="belongStandardEquipment === '13'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第14套:铯原子标准装置 --> <fourteen-template-detail v-if="belongStandardEquipment === '14'" ref="templateDetailRef" :data-no="dataNo" :item-category-name="itemCategoryName" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第15套:小功率标准装置 --> <fifteenth-template-detail v-if="belongStandardEquipment === '15'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> <!-- 第16套:低频信号源 --> <sixteen-template-detail v-if="belongStandardEquipment === '16'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @giveInfoId="giveInfoId" /> </app-container> <save-measure-certificate-dialog ref="saveMeasureCertificateRef" /> </template> <style lang="scss" scoped> .step { line-height: 28px; font-size: 20px; color: #3d7eff; font-weight: bold; margin-bottom: 5px; width: fit-content; } </style> <style lang="scss"> .fieldtest-record-detail { .el-table thead.is-group th.el-table__cell { background: #f2f6ff; } } .measure-data { .el-radio__label { display: block !important; } } </style>