<!-- 检定数据管理详情 --> <script lang="ts" setup name="MeasureDataDetail"> import { ref } from 'vue' import categoryNameDict from '/public/config/categoryNameDict.json' 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 SeventeenthTemplateDetail from './components/seventeenth/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, getInfo, recentUpdate, 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' import CanvasCom from '@/views/business/taskMeasure/print/components/canvas/canvas.vue' import CanvasComLimit from '@/views/business/taskMeasure/print/components/canvas/limitInstructionCanvas.vue' import { printHtml, printImage } from '@/utils/printUtils' import selectPrintType from '@/views/business/taskMeasure/measureData/dialog/selectPrintType.vue' import printThreeInfo from '@/views/business/taskMeasure/print/components/label/printThreeInfo.vue' import { useGroup } from '@/commonMethods/useGroup' // 批量修改时使用 const $props = defineProps({ // 标识第几个(用来取路由数组里面的数据) batchIndex: { type: Number, default: 0, }, }) const user = useUserStore() // 用户信息 const textMap: { [key: string]: string } = { edit: '编辑', add: '新建', detail: '详情', }// 字典 const $router = useRouter() // 关闭页面使用 const isNeverDefineItemCategory = ref(false) // 检定项分类是否是从未定义过的 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 const printForm = ref<{ [key: string]: string }>({ manufactureNo: '', year: '', month: '', day: '', personName: '', equipmentId: '', // 设备id userId: '', // 检定员id restrictionInstruction: '', // 限用说明 }) const printType = ref('1') // 打印类型 1合格种类标签 2限用说明 // ----------------------------------路由参数-------------------------------------------- if ($route.params && $route.params.type) { pageType.value = $route.params.type as string if ($route.params.id) { infoId.value = $route.params.id as string } } // 批量编辑 if ($route.query.batchEdit) { // 鉴定数据-批量编辑 pageType.value = 'edit' infoId.value = JSON.parse($route.query.batchEditRow as string)[$props.batchIndex].id // 我的任务-批量编辑 if (JSON.parse($route.query.batchEditRow as string)[$props.batchIndex].pageType) { console.log(JSON.parse($route.query.batchEditRow as string)[$props.batchIndex].pageType, '我的任务-页面类型') pageType.value = JSON.parse($route.query.batchEditRow as string)[$props.batchIndex].pageType } } // -------------------------------------------按钮---------------------------------------------- // 关闭新增页面的回调 const close = () => { $router.back() } // 点击编辑按钮 const edit = () => { pageType.value = 'edit' } // 保存此设备配置的【所使用的标准,主要测量设备】,在下一次新建检定数据的时候默认带出 const saveStandardEquipmentByEqptEquipment = (eqptEquipmentId: string, standardEquipmentList: any = []) => { if (!standardEquipmentList.length) { return false } // 根据不同的标准装置将数据进行分组 const tempGroupArr = useGroup(standardEquipmentList, 'standardId', false) const params = tempGroupArr.map((group: any) => { group = { equipmentId: eqptEquipmentId, standardEquipmentIds: group.map((i: { id: string }) => i.id), standardId: group[0].standardId, standardName: group[0].standardName, } return group }) recentUpdate(params).then((res) => { console.log('【所使用的标准,主要测量设备】保存成功') }).catch(() => console.log('【所使用的标准,主要测量设备】保存失败')) } // 处理保存入参 const solveSaveParams = () => { let params if (belongStandardEquipment.value === '1') { // 第一套:多功能校准源 params = { ...templateDetailRef.value.form, technologyFile: Array.isArray(templateDetailRef.value.form.technologyFile) ? templateDetailRef.value.form.technologyFile.join(',') : templateDetailRef.value.form.technologyFile, // 依据的技术文件 ...templateDetailRef.value.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.sampleList[0].sampleModel, // 型号 manufacturer: templateDetailRef.value.sampleList[0].manufacturer, // 生产厂家 sampleId: templateDetailRef.value.sampleList[0].sampleId, sampleName: templateDetailRef.value.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.sampleList[0].manufactureNo, equipmentDTOs: templateDetailRef.value.measureDataCalibratorList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: 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, } saveStandardEquipmentByEqptEquipment(templateDetailRef.value.sampleList[0].sampleId, templateDetailRef.value.measureDataCalibratorList) } else if (belongStandardEquipment.value === '2') { // // 第2套:直流稳压电源 params = { ...templateDetailRef.value.itemFormData, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 ...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, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 // equipmentList equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: item.standardId, standardName: item.standardName, } }), itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } saveStandardEquipmentByEqptEquipment(templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, templateDetailRef.value.templateFormAndTableRef.measureEquipmentList) } else if (belongStandardEquipment.value === '3') { // 第3套:多功能电气安全校准器 params = { ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.templateFormAndTableRef.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: 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, templateDetailRef.value.resultListElectricContact) } tempMeasureDataPistonGaugeList = tempMeasureDataPistonGaugeList.concat(templateDetailRef.value.resultList) params = { ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.templateFormAndTableRef.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, itemCategoryName: itemCategoryName.value, // 检定项分类名称 equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: 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, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 ...templateDetailRef.value.itemFormData, ...templateDetailRef.value.templateFormAndTableRef.sampleList[0], // 被检件信息 customerName: pageType.value === 'add' ? '' : templateDetailRef.value.templateFormAndTableRef.form.customerName, // 委托单位系统生成,在此置空(原有数据是从我的任务列表页带来,仅做展示) model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '7') { // 第七套 精密漏点仪 params = { ...templateDetailRef.value.itemFormData, measureDataPointMeterList: templateDetailRef.value.list, id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '11') { // 第11套 微波衰减装置 params = { ...templateDetailRef.value.itemFormData, measureDataMicrowaveAttenuationList: templateDetailRef.value.list, id: pageType.value === 'edit' ? infoId.value : '', equipmentDTOs: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList.map((item: { id: string; standardId: string; standardName: string }) => { return { equipmentId: item.id, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, // manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id measureDataOscilloscopeList: templateDetailRef.value.solveParamsBeforeSave(), } } else if (belongStandardEquipment.value === '14') { // 第14套 铯原子 console.log(templateDetailRef.value.itemFormData, 'templateDetailRef.value.itemFormData') params = { 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id ...templateDetailRef.value.itemFormData, } } 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id } } else if (belongStandardEquipment.value === '17') { // 第17套 S参数 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, standardId: item.standardId, standardName: item.standardName, } }), belongStandardEquipment: belongStandardEquipment.value, // 标准装置code belongStandardEquipmentName: belongStandardEquipmentName.value, // 标准装置名称 model: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleModel, // 型号 ...templateDetailRef.value.templateFormAndTableRef.form, technologyFile: Array.isArray(templateDetailRef.value.templateFormAndTableRef.form.technologyFile) ? templateDetailRef.value.templateFormAndTableRef.form.technologyFile.join(',') : templateDetailRef.value.templateFormAndTableRef.form.technologyFile, // 依据的技术文件 sampleId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, sampleName: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleName, manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufactureNo, manufacturer: templateDetailRef.value.templateFormAndTableRef.sampleList[0].manufacturer, // 生产厂家 itemCategoryName: itemCategoryName.value, // 检定项分类名称 itemCategoryId: itemCategoryId.value, // 检定项分类id measureDataSParamList: templateDetailRef.value.solveParamsBeforeSave(), } } if (belongStandardEquipment.value !== '1') { saveStandardEquipmentByEqptEquipment(templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, templateDetailRef.value.templateFormAndTableRef.measureEquipmentList) } return params } // 校验 const check = () => { if (belongStandardEquipment.value === '1') { // 第一套:多功能校准源 // return true // 保存不做校验 // return templateDetailRef.value.checkout() return templateDetailRef.value.checkoutCommonForm() } else if (belongStandardEquipment.value === '2') { // 第二套 直流稳压电源 return templateDetailRef.value.checkAllList() && templateDetailRef.value.templateFormAndTableRef.checkout() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() } // 第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() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() } else if (belongStandardEquipment.value === '7') { // 第7套 精密漏点仪 return templateDetailRef.value.templateFormAndTableRef.checkout() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() } else if (belongStandardEquipment.value === '8') { // 第8套 E2等砝码 return templateDetailRef.value.templateFormAndTableRef.checkout() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() } else if (belongStandardEquipment.value === '9') { // 第9套 频谱分析仪 // return true // 保存不做校验 return templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() } else if (belongStandardEquipment.value === '10') { // 第10套 信号发生器 return templateDetailRef.value.templateFormAndTableRef.checkout() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // 保存不做校验 } else if (belongStandardEquipment.value === '11') { // 第11套 微波衰减装置 return templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // return true // 保存不做校验 } else if (belongStandardEquipment.value === '13') { // 第13套 示波器 return templateDetailRef.value.templateFormAndTableRef.checkout() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // 保存不做校验 } else if (belongStandardEquipment.value === '14') { // 第14套 铯原子 return templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // return true // 保存不做校验 } else if (belongStandardEquipment.value === '15') { // 第15套 小功率 return templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // return true // 保存不做校验 } else if (belongStandardEquipment.value === '16') { // 第16套 低频信号源 return templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // return true // 保存不做校验 } else if (belongStandardEquipment.value === '17') { // 第17套 S参数 return templateDetailRef.value.templateFormAndTableRef.checkout() && templateDetailRef.value.templateFormAndTableRef.checkoutCommonForm() // 保存不做校验 } } // 保存 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' } if (belongStandardEquipment.value === '17') { templateDetailRef.value.pageType = 'detail' } dataNo.value = res.data.dataNo // 检定数据编号 infoId.value = res.data.id // id templateDetailRef.value.fetchInfo() 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' } if (belongStandardEquipment.value === '17') { templateDetailRef.value.pageType = 'detail' } loading.close() }).catch(() => { loading.close() }) } } }) } const getFormRef = () => { return templateDetailRef.value.templateFormAndTableRef.ruleFormRef } const setDetail = () => { pageType.value = 'detail' templateDetailRef.value.pageType = 'detail' } // 生成证书处理参数 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.itemFormData, // 检定项配置 measureDataPistonGaugeList: templateDetailRef.value.list.concat(templateDetailRef.value.resultList, templateDetailRef.value.listElectricContact, templateDetailRef.value.resultListElectricContact), equipmentList: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList, } } 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), dataProcessing: templateDetailRef.value.itemFormData, // 压力传感器数据处理数据 equipmentList: templateDetailRef.value.templateFormAndTableRef.measureEquipmentList, } } } 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) => { if (!isNeverDefineItemCategory.value) { const message = isNeverDefineItemCategory.value ? '即将跳转审批模块,请点击提交进入审批流程' : '生成证书成功' ElMessage.success(message) } $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 setPrintForm = () => { if (belongStandardEquipment.value === '1') { printForm.value = { manufactureNo: templateDetailRef.value.sampleList[0].manufactureNo, year: (templateDetailRef.value.form.meterIdentify === '合格' || templateDetailRef.value.form.meterIdentify === '限用') ? templateDetailRef.value.form.measureValidDate.slice(0, 4) : templateDetailRef.value.form.traceDate.slice(0, 4), month: (templateDetailRef.value.form.meterIdentify === '合格' || templateDetailRef.value.form.meterIdentify === '限用') ? templateDetailRef.value.form.measureValidDate.slice(5, 7) : templateDetailRef.value.form.traceDate.slice(5, 7), day: (templateDetailRef.value.form.meterIdentify === '合格' || templateDetailRef.value.form.meterIdentify === '限用') ? templateDetailRef.value.form.measureValidDate.slice(8, 10) : templateDetailRef.value.form.traceDate.slice(8, 10), personName: templateDetailRef.value.form.createUserName, userId: templateDetailRef.value.form.createUserId, equipmentId: templateDetailRef.value.sampleList[0].sampleId, restrictionInstruction: templateDetailRef.value.form.restrictionInstruction, } } else { printForm.value = { manufactureNo: templateDetailRef.value.templateFormAndTableRef.sampleList[0]?.manufactureNo, year: (templateDetailRef.value.templateFormAndTableRef.form.meterIdentify === '合格' || templateDetailRef.value.templateFormAndTableRef.form.meterIdentify === '限用') ? templateDetailRef.value.templateFormAndTableRef.form.measureValidDate.slice(0, 4) : templateDetailRef.value.templateFormAndTableRef.form.traceDate.slice(0, 4), month: (templateDetailRef.value.templateFormAndTableRef.form.meterIdentify === '合格' || templateDetailRef.value.templateFormAndTableRef.form.meterIdentify === '限用') ? templateDetailRef.value.templateFormAndTableRef.form.measureValidDate.slice(5, 7) : templateDetailRef.value.templateFormAndTableRef.form.traceDate.slice(5, 7), day: (templateDetailRef.value.templateFormAndTableRef.form.meterIdentify === '合格' || templateDetailRef.value.templateFormAndTableRef.form.meterIdentify === '限用') ? templateDetailRef.value.templateFormAndTableRef.form.measureValidDate.slice(8, 10) : templateDetailRef.value.templateFormAndTableRef.form.traceDate.slice(8, 10), personName: templateDetailRef.value.templateFormAndTableRef.form.createUserName, userId: templateDetailRef.value.templateFormAndTableRef.form.createUserId, equipmentId: templateDetailRef.value.templateFormAndTableRef.sampleList[0].sampleId, restrictionInstruction: templateDetailRef.value.templateFormAndTableRef.form.restrictionInstruction, } } console.log('打印内容', printForm.value) } const dataSource = ref('') // 数据来源 // 详情请求成功 const giveInfoId = (id: string) => { infoId.value = id nextTick(() => { setPrintForm() if (belongStandardEquipment.value === '1') { dataSource.value = templateDetailRef.value.form.dataSource // 数据来源 } else { dataSource.value = templateDetailRef.value.templateFormAndTableRef.form.dataSource } }) } const changePageType = (type: string) => { pageType.value = type } // 选择打印标签类型 const selectPrintTypeRef = ref() const threeInfoRef = ref() const printLabel = () => { if (belongStandardEquipment.value === '1' && templateDetailRef.value.form.conclusion === '除*外其余所检项目合格') { selectPrintTypeRef.value.initDialog(templateDetailRef.value.form.meterIdentify) } else if (belongStandardEquipment.value !== '1' && templateDetailRef.value.templateFormAndTableRef.form.conclusion === '除*外其余所检项目合格') { selectPrintTypeRef.value.initDialog(templateDetailRef.value.templateFormAndTableRef.form.meterIdentify) } else { downloadImage() } } // 点击确认 const confirmSelectPrintType = (value: string) => { printType.value = value downloadImage() } // 监听到计量标识变化 const changeMeterIdentify = () => { setPrintForm() } // ----------------------------------------------------------------------------------------- watch(() => itemCategoryName.value, (newValue) => { if (newValue) { // 判断是否是新增的检定项分类 const index = categoryNameDict.findIndex((item: any) => item === newValue) if (index === -1) { isNeverDefineItemCategory.value = true } else { isNeverDefineItemCategory.value = false } } }) // -------------------------------------------钩子-------------------------------------------------- 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) itemCategoryName.value = batchEditRow.value[$props.batchIndex].itemCategoryName as string || '' // 检定项分类名称 itemCategoryId.value = batchEditRow.value[$props.batchIndex].itemCategoryId as string || '' // 检定项分类id belongStandardEquipment.value = batchEditRow.value[$props.batchIndex].belongStandardEquipment as string || ''// 标准装置code belongStandardEquipmentName.value = batchEditRow.value[$props.batchIndex].belongStandardEquipmentName 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 || ''// 标准装置名称 } }) const canvasComponent = ref(null) as any const canvasComponent1 = ref(null) as any const canvasLimitInstructionRef = ref(null) as any const imageUrl = ref('') const imageUrl2 = ref('') function downloadImage() { if (printType.value === '1') { // 合格种类 imageUrl.value = canvasComponent.value!.toImage() imageUrl2.value = canvasComponent1.value!.toImage() } else if (printType.value === '2') { // 限用说明 imageUrl.value = canvasLimitInstructionRef.value!.toImage() } // printImage([imageUrl.value, imageUrl2.value]) printImage(imageUrl.value) } defineExpose({ save, getFormRef, check, solveSaveParams, setDetail, }) </script> <template> <app-container class="measure-data"> <!-- 合格类型打印 --> <canvas-com v-show="false" ref="canvasComponent" :width="600" :height="200" :print-form="printForm" /> <!-- 合格类型打印----这里用来测试批量打印 --> <canvas-com v-show="false" ref="canvasComponent1" :width="600" :height="200" :print-form="printForm" /> <!-- 限用说明标签 --> <canvas-com-limit v-show="false" ref="canvasLimitInstructionRef" :width="600" :height="200" :print-form="printForm" /> <detail-page v-if="!isBatchEdit" :title="`检定数据管理-${textMap[pageType]}`"> <template #btns> <el-button v-if="pageType === 'detail'" type="primary" @click="createRecord"> {{ isNeverDefineItemCategory ? '原始记录和检定证书审批' : '生成原始记录和检定证书' }} </el-button> <el-button v-if="pageType === 'detail'" type="primary" @click="printLabel"> 标识打印 </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> <detail-page v-if="isBatchEdit" :title="`${belongStandardEquipmentName}-${itemCategoryName}-${$props.batchIndex + 1}`" /> <!-- 第一套:多功能校准源 --> <first-template-detail v-if="belongStandardEquipment === '1'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第2套:直流稳压电源标准装置 --> <second-template-detail v-if="belongStandardEquipment === '2'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第3套:多功能电气安全校准器标准装置 --> <third-template-detail v-if="belongStandardEquipment === '3'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第四套:0.02级活塞式压力计 --> <fourth-template-detail v-if="belongStandardEquipment === '4'" ref="templateDetailRef" :batch-index="$props.batchIndex" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第5套:二等铂电阻温度计标准装置 --> <fifth-template-detail v-if="belongStandardEquipment === '5'" ref="templateDetailRef" :page-type="pageType" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-page-type="changePageType" @change-meter-identify="changeMeterIdentify" /> <!-- 第6套:安全阀标准装置 --> <sixth-template-detail v-if="belongStandardEquipment === '6'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第7套:精密露点仪标准装置 --> <seventh-template-detail v-if="belongStandardEquipment === '7'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第8套:E2等砝码标准装置 --> <eighth-template-detail v-if="belongStandardEquipment === '8'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第9套:频谱分析仪标准装置 --> <ninth-template-detail v-if="belongStandardEquipment === '9'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第10套:信号发生器标准装置 --> <tenth-template-detail v-if="belongStandardEquipment === '10'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第11套:衰减器装置 --> <eleventh-template-detail v-if="belongStandardEquipment === '11'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第13套:示波器检定装置 --> <thirteenth-template-detail v-if="belongStandardEquipment === '13'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第14套:铯原子标准装置 --> <fourteen-template-detail v-if="belongStandardEquipment === '14'" ref="templateDetailRef" :data-no="dataNo" :item-category-name="itemCategoryName" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第15套:小功率标准装置 --> <fifteenth-template-detail v-if="belongStandardEquipment === '15'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第16套:低频信号源 --> <sixteen-template-detail v-if="belongStandardEquipment === '16'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> <!-- 第17套:S参数 --> <seventeenth-template-detail v-if="belongStandardEquipment === '17'" ref="templateDetailRef" :data-no="dataNo" :info-id="infoId" @give-info-id="giveInfoId" @change-meter-identify="changeMeterIdentify" /> </app-container> <save-measure-certificate-dialog ref="saveMeasureCertificateRef" /> <!-- 选择打印类型标签 --> <select-print-type ref="selectPrintTypeRef" @confirm="confirmSelectPrintType" /> </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>