<!-- 检定数据管理详情表单和表格模板 --> <script lang="ts" setup name="MeasureDataTemplateDetail"> import { ref } from 'vue' import { ElLoading, ElMessage } from 'element-plus' import dayjs from 'dayjs' import selectStandard from '../dialog/selectStandardDialog.vue' import type { ITempelateForm } from '../measureData-interface' import categoryNameDict from '../../../../../../public/config/categoryNameDict.json' import { UploadFile, getPhotoUrl } from '@/api/file' import { getEquipmentList, getStandardList } from '@/api/equipment/standard/book' import filePreviewUrl from '@/components/filePreview/filePreviewUrl.vue' import useUserStore from '@/store/modules/user' import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' import type { TableColumn } from '@/components/NormalTable/table_interface' import { useUniqueArray } from '@/utils/useUniqueArray' import { getClassificationList } from '@/api/business/measure/classification' import { getLocationList, getRecentList } from '@/api/business/taskMeasure/measureData' import WordOreview from '@/components/filePreview/wordOreview.vue' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 batchIndex: Number, pageType: { // 页面类型 type: String, default: 'detail', }, }) const emits = defineEmits(['giveInfoId', 'measureEquipmentListChange', 'changeMeterIdentify']) const isNeverDefineItemCategory = ref(false) // 检定项分类是否是从未定义过的 const user = useUserStore() // 用户信息 const $router = useRouter() // 关闭页面使用 const $route = useRoute() // 路由参数 const ruleFormRef = ref() // 表单ref const helpInstruction = ref('') // 辅助字段 const helpFieldInstruction = ref('') // 辅助字段说明 const form = ref<ITempelateForm>({ dataNo: '', // 检定数据编号 measureCategory: '', // 检校类别 measureCategoryName: '', // 检校类别名称 customerName: '', // 委托单位 customerAddress: '', // 委托单位地址 traceDate: '', // 测试、校准或检定日期 measureValidDate: '', // 检定有效期 measureAddress: '', // 测试、校准或检定地点 temperature: '', // 温度 humidity: '', // 相对湿度 orderId: '', // 任务单id orderNo: '', // 任务单编号 technologyFile: '', // 依据的技术文件(编号、名称) createUserId: '', // 检定员id createUserName: '', // 检定员 dataSource: '', // 数据来源 conclusion: '', // 结论 restrictionInstruction: '', // 限用说明 meterIdentify: '', // 计量标识 itemCategoryName: '', // 检定项分类名称 itemCategoryId: '', // 检定项分类 humidityLower: '', // 湿度下限 humidityUpper: '', // 湿度上限 temperatureLower: '', // 温度下限 temperatureUpper: '', // 温度上限 labCode: '', // 实验室 groupCode: '', // 部门 constCertificateExcelData: '', // 检校证书 --const检定证书文件base64 / 非已定义检定项分类时上传的检定证书minio存储文件名 constRecordExcelData: '', // 原始记录 -- const原始记录文件base64 / 非已定义检定项分类时上传的原始记录minio存储文件名 remark: '', // 测试结果(用于第三套多功能电气安全) }) const validateHumidity = (rule: any, value: any, callback: any) => { const type = rule.field === 'humidity' ? '相对湿度' : '温度' const reg = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/ if (!reg.test(value)) { callback(new Error(`${type}只能为数字`)) } if (!value && value?.length) { callback(new Error(`${type}不能为空`)) } else { console.log('温度下限', form.value.temperatureLower) console.log('温度上限', form.value.temperatureUpper) console.log('湿度下限', form.value.humidityLower) console.log('湿度上限', form.value.humidityUpper) if (type === '温度' && (Number(value) < Number(form.value.temperatureLower) || Number(value) > Number(form.value.temperatureUpper))) { const temperatureLower = `${form.value.temperatureLower}` const temperatureUpper = `${form.value.temperatureUpper}` if (temperatureLower && temperatureUpper) { callback(new Error(`${type}范围为 ${temperatureLower} ~ ${temperatureUpper}`)) } else if (temperatureLower && !temperatureUpper && Number(value) < Number(form.value.temperatureLower)) { callback(new Error(`${type}下限为${temperatureLower}`)) } else if (!temperatureLower && temperatureUpper && Number(value) > Number(form.value.temperatureUpper)) { callback(new Error(`${type}上限为${temperatureUpper}`)) } } if (type === '相对湿度' && (Number(value) < Number(form.value.humidityLower) || Number(value) > Number(form.value.humidityUpper))) { const humidityLower = `${form.value.humidityLower}` const humidityUpper = `${form.value.humidityUpper}` if (humidityLower && humidityUpper) { callback(new Error(`${type}范围为 ${humidityLower} ~ ${humidityUpper}`)) } else if (humidityLower && !humidityUpper && Number(value) < Number(form.value.humidityLower)) { callback(new Error(`${type}下限为${humidityLower}`)) } else if (!humidityLower && humidityUpper && Number(value) > Number(form.value.humidityUpper)) { callback(new Error(`${type}上限为${humidityUpper}`)) } } if (Number(value) > 100) { callback(new Error(`${type}不能大于100`)) } callback() } } // 校验规则 const rules = ref({ measureCategory: [{ required: true, message: '检校类别不能为空', trigger: ['blur', 'change'] }], // customerName: [{ required: true, message: '委托单位不能为空', trigger: ['blur', 'change'] }], traceDate: [{ required: true, message: '测试、校准或检定日期不能为空', trigger: ['blur', 'change'] }], measureValidDate: [{ required: true, message: '检定有效期不能为空', trigger: ['blur', 'change'] }], measureAddress: [{ required: true, message: '测试、校准或检定地点不能为空', trigger: ['blur', 'change'] }], temperature: [{ required: true, validator: validateHumidity, trigger: ['blur', 'change'] }], humidity: [{ required: true, validator: validateHumidity, trigger: ['blur', 'change'] }], // orderNo: [{ required: true, message: '任务单编号不能为空', trigger: ['blur', 'change'] }], // technologyFile: [{ required: true, message: '依据的技术文件不能为空', trigger: ['blur', 'change'] }], createUserName: [{ required: true, message: '检定员不能为空', trigger: ['blur', 'change'] }], conclusion: [{ required: true, message: '结论不能为空', trigger: ['blur', 'change'] }], restrictionInstruction: [{ required: true, message: '限用说明不能为空', trigger: ['blur', 'change'] }], appearanceFunctionCheck: [{ required: true, message: '外观及功能性检查不能为空', trigger: ['blur', 'change'] }], meterIdentify: [{ required: true, message: '计量标识不能为空', trigger: ['blur', 'change'] }], labCode: [{ required: true, message: '实验室不能为空', trigger: ['blur', 'change'] }], groupCode: [{ required: true, message: '部门不能为空', trigger: ['blur', 'change'] }], remark: [{ required: true, message: '测试结果不能为空', trigger: ['blur', 'change'] }], constCertificateExcelData: [{ required: true, message: '检校证书不能为空', trigger: ['blur', 'change'] }], constRecordExcelData: [{ required: true, message: '原始记录不能为空', trigger: ['blur', 'change'] }], }) // -------------------------------------------字典---------------------------------------------+ const conclusionList = ref<dictType[]>([]) // 结论 const measureCategoryList = ref<dictType[]>([]) // 检校类别 const positionList = ref([]) as any // 测试、校准或检定地点 const meterIdentifyDict = ref<dictType[]>([]) // 计量标识 const labCodeList = ref<dictType[]>([]) // 实验室代码 const groupCodeList = ref<dictType[]>([]) // 组别代码 // 获取字典值 async function getDict() { getDictByCode('bizGroupCodeEquipment').then((response) => { labCodeList.value = response.data }) // 组别代码 getDictByCode('bizGroupCode').then((response) => { groupCodeList.value = response.data }) // 结论 getDictByCode('bizConclusion').then((response) => { conclusionList.value = response.data }) // 检校类别 getDictByCode('measureCategory').then((response) => { measureCategoryList.value = response.data }) // 测试、校准或检定地点 const res = await getLocationList({ locationName: '', // 地点名称 locationNo: '', // 地点编号 labName: user.bizLabCode === 'H' ? '海口实验室' : user.bizLabCode === 'X' ? '西昌实验室' : '', limit: 999999, offset: 1, }) positionList.value = res.data.rows.map((item: { id: string; locationName: string; temperature: string; humidity: string }) => { return { id: item.id, name: item.locationName, // 地点名称 temperature: `${item.temperature}` || '', // 温度 humidity: `${item.humidity}` || '', // 湿度 } }) // 计量标识 getDictByCode('eqptMeterIdentify').then((response) => { meterIdentifyDict.value = response.data }) } // --------------------------------------被检件信息-------------------------------------------------------- const sampleList = ref([]) as any // 被检件 const columns = ref<TableColumn[]>([ // 表头 { text: '智能模型名称', value: 'sampleName', align: 'center' }, { text: '规格型号', value: 'sampleModel', align: 'center' }, { text: '出厂编号', value: 'manufactureNo', align: 'center' }, { text: '制造厂家', value: 'manufacturer', align: 'center' }, { text: '辅助字段', value: 'helpInstruction', align: 'center' }, { text: '辅助字段说明', value: 'helpFieldInstruction', align: 'center' }, { text: '智能模型检定项分类', value: 'categoryName', align: 'center' }, ]) // --------------------------------------所使用的标准,主要测量智能模型-------------------------------------------------------- const measureEquipmentList = ref([]) as any // 列表 const selectStandardRef = ref() // 所使用的标准,主要测量智能模型组件ref const checkoutMeasureDataCalibratorList = ref([]) as any // 选中列表 const tableLoading = ref(false) // 表格loading const measureDataCalibratorColumns = ref<TableColumn[]>([ // 表头 { text: '标准装置名称', value: 'standardName', align: 'center' }, { text: '智能模型名称', value: 'equipmentName', align: 'center' }, { text: '规格型号', value: 'model', align: 'center' }, { text: '出厂编号', value: 'manufactureNo', align: 'center' }, { text: '不确定度或允许误差极限或准确度等级', value: 'uncertainty', align: 'center' }, { text: '证书有效期', value: 'measureValidDate', align: 'center' }, ]) // 用标准装置id获取标准配套智能模型查询条件 const listQuery = ref({ standardId: '', offset: 1, limit: 999999, }) // 批量增加 const multiFilesAdd = () => { selectStandardRef.value.initDialog() } // 根据数组中按照标准装置和智能模型id去重 function useUniqueArrayOnObject(arr: any) { for (let i = 0; i < arr.length; i++) { for (let j = i + 1; j < arr.length; j++) { if (arr[i].standardId == arr[j].standardId && arr[i].id == arr[j].id) { arr.splice(j, 1) j-- } } } return arr } // 选好标准库 const confirmSelectStandard = (val: any) => { if (val.length) { // const allRequest = [] as any // 所有的请求 // let tempEquipmentList = [] as any // 临时变量-选择的标准装置所对应的配套智能模型 // val.forEach((item: { id: string }) => { // tableLoading.value = true // 表格loading // listQuery.value.standardId = item.id // 标准库id // const request = getEquipmentList(listQuery.value).then((res) => { // 请求 // const tempArr = [] as any // res.data.rows.forEach((item: any) => { // if (!item.technicalTargetList.length) { // tempArr.push(item) // } // else { // let tempUncertainty = '' // item.technicalTargetList.forEach((i: any) => { // tempUncertainty = `${tempUncertainty}${i.uncertainty}; ` // }) // tempArr.push({ // ...item, // uncertainty: tempUncertainty, // }) // } // }) // tempEquipmentList = tempEquipmentList.concat(tempArr) // }) // allRequest.push(request) // 集合所有请求 // }) // Promise.all(allRequest).then(() => { // 等待所有请求完成 // let tempList = [] as any // 临时数组 // tempList = tempList.concat(tempEquipmentList) // measureEquipmentList.value = useUniqueArray(tempList) // 数组去重 // tableLoading.value = false // }) measureEquipmentList.value = useUniqueArrayOnObject(measureEquipmentList.value.concat(val)) } } // 表格多选 const handleSelectionChange = (e: any) => { checkoutMeasureDataCalibratorList.value = e } // 删除行 const delRow = () => { if (checkoutMeasureDataCalibratorList.value.length <= 0) { ElMessage({ message: '请选中要删除的行', type: 'warning', }) } else { checkoutMeasureDataCalibratorList.value.forEach((item: any) => { measureEquipmentList.value.forEach((element: any, index: number) => { if (element.equipmentNo === item.equipmentNo) { measureEquipmentList.value.splice(index, 1) } }) }) } } // ----------------------------------------查询依据的技术文件-------------------------------------- // 获取检定项分类的技术文件 // 查询条件 const fetchClassificationListQuery = ref({ belongStandardEquipment: '', // 检校标准库 categoryName: '', // 检定项分类名称 categoryNo: '', // 检定项分类编号 deviceType: '', // 智能模型分类 measureCategory: '', // 检校类别 limit: 20, offset: 1, }) // 删除依据的技术文件 const delFile = (index: number) => { if (Array.isArray(form.value.technologyFile)) { form.value.technologyFile.splice(index, 1) } } // 数据查询---查询依据的技术文件 function fetchClassificationData(isNowPage = false, categoryName = '', belongStandardEquipment = '') { if (!isNowPage) { // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } fetchClassificationListQuery.value.categoryName = categoryName // 智能模型分类型名称 fetchClassificationListQuery.value.belongStandardEquipment = belongStandardEquipment // 检校标准装置名称 getClassificationList(fetchClassificationListQuery.value).then((response) => { if (response.data.rows.length) { form.value.humidityLower = response.data.rows[0].humidityLower// 湿度下限 form.value.humidityUpper = response.data.rows[0].humidityUpper// 湿度上限 form.value.temperatureLower = response.data.rows[0].temperatureLower// 温度下限 form.value.temperatureUpper = response.data.rows[0].temperatureUpper// 温度上限 console.log('温度下限', form.value.temperatureLower) console.log('温度上限', form.value.temperatureUpper) console.log('湿度下限', form.value.humidityLower) console.log('湿度上限', form.value.temperatureLower) if (props.pageType === 'add') { if (user.bizLabCode === 'H') { // 当前用户是海口实验室的 form.value.measureAddress = response.data.rows[0].labH } else if (user.bizLabCode === 'X') { // 当前用户是西昌实验室的 form.value.measureAddress = response.data.rows[0].labX } if (form.value.measureAddress) { const index = positionList.value.findIndex((item: { name: string }) => item.name === form.value.measureAddress) if (index !== -1) { form.value.temperature = positionList.value[index].temperature form.value.humidity = positionList.value[index].humidity } } } if (props.pageType === 'add') { form.value.technologyFile = response.data.rows[0].technologyFile.split(';') if (props.pageType === 'add') { form.value.measureCategory = response.data.rows[0].measureCategory } // 检校类别 } } }) } // ----------------------------------------校验------------------------------------------------ const checkout = () => { if (!measureEquipmentList.value.length) { ElMessage.warning('所使用的标准,主要测量智能模型不能为空') return false } return true } // -------------------------------------地点变化事件-------------------------------------------- const handleChangeAddress = (name: string) => { if (name) { const index = positionList.value.findIndex((item: { name: string }) => item.name === name) if (index !== -1) { form.value.temperature = positionList.value[index].temperature form.value.humidity = positionList.value[index].humidity } } } // ---------------------------------------点击任务单编号事件--------------------------------------- // 点击任务单编号 const handleClickOrder = () => { $router.push({ path: `/manager/detail/${form.value.orderId}`, }) } // --------------------------------------计量标识变化----------------------------------------------- const changeMeterIdentify = (val: string) => { emits('changeMeterIdentify', val) } // --------------------------------------根据智能模型id查询此智能模型上次使用的标准,主要测量智能模型----------------------------------------------- // 查询标准装置下的配套智能模型 const fetchStandardEquipment = (list: any = []) => { const resultList = [] as any const allRequest = [] as any // 所有的请求 // 请求标准装置下的配套智能模型 list.forEach((e: any) => { const request = getEquipmentList({ standardId: e.standardId, // 标准库id standardName: e.standardName, // 选好的标准库name offset: 1, limit: 999999, }).then((res) => { if (res && res.data && res.data.rows && res.data.rows.length) { const solveResList = res.data.rows.map((item: any) => { if (!item.technicalTargetList.length) { return { ...item, standardId: e.standardId, // 标准库id standardName: e.standardName, // 标准库名称 } } else { let tempUncertainty = '' // 不确定度 let tempMeasureRange = '' // 测量范围 item.technicalTargetList.forEach((i: any) => { tempUncertainty = `${tempUncertainty}${i.uncertainty}; ` tempMeasureRange = `${tempMeasureRange}${i.measureRange}; ` }) return { ...item, uncertainty: tempUncertainty, measureRange: tempMeasureRange, standardId: e.standardId, // 标准库id standardName: e.standardName, // 标准库名称 } } }) // 从对应的标准装置中挑出上次存的所有的智能模型 const map = new Map() solveResList.forEach((item: { id: string }, index: number) => { map.set(item.id, item) }) e.standardEquipmentIds.forEach((id: string) => { resultList.push(map.get(id)) }) } }) allRequest.push(request) }) Promise.all(allRequest).then(() => { // 等待所有请求完成 measureEquipmentList.value = resultList }) } const fetchRecentEquipment = (id: string) => { if (!id) { return false } getRecentList({ id }).then((res) => { if (res && res.data && res.data.length) { fetchStandardEquipment(res.data) } }) } const checkoutCommonForm = () => { if (isNeverDefineItemCategory.value) { // 检定项是从未定义过的 console.log('校验从未定义过的检定项') // 在这里校验上传的证书 if (!form.value.constCertificateExcelData) { ElMessage.warning('请上传检校证书') return false } if (!form.value.constRecordExcelData) { ElMessage.warning('请上传原始记录') return false } } return true } // -------------------------------------------文件上传-------------------------------------- // 文件上传 const certificateFileRef = ref() const originalRecordFileRef = ref() const onCertificateFileChange = (event: any) => { if (isNeverDefineItemCategory.value) { // 新增检定项分类模式上传word if (event.target.files[0].type !== 'application/msword' && event.target.files[0].type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { ElMessage.warning('请上传doc、docx文件格式') return } } else { // 康斯特模式上传pdf if (event.target.files[0].type !== 'application/pdf') { ElMessage.warning('请上传pdf格式') return } } UploadFileFn(event, 'constCertificateExcelData', '文件上传成功') } const onOriginalRecordFileChange = (event: any) => { if (isNeverDefineItemCategory.value) { // 新增检定项分类模式上传word if (event.target.files[0].type !== 'application/msword' && event.target.files[0].type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { ElMessage.warning('请上传doc、docx文件格式') return } } else { // 康斯特模式上传pdf if (event.target.files[0].type !== 'application/pdf') { ElMessage.warning('请上传pdf格式') return } } UploadFileFn(event, 'constRecordExcelData', '文件上传成功') } // 上传文件操作 function UploadFileFn(event: any, prop: string, message: string) { if (event.target.files?.length !== 0) { // 创建formdata对象 const fd = new FormData() fd.append('multipartFile', event.target.files[0]) const loading = ElLoading.service({ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) UploadFile(fd).then((res) => { if (res.code === 200) { form.value[prop] = res.data[0] event.target.value = null // 重置当前验证 ElMessage.success(message) loading.close() } else { ElMessage.error(res.message) loading.close() } }) } } const upload = (fileRef: any) => { fileRef.click() } // -----------------------------------------钩子----------------------------------------------- // 检定结论变化 const changeConclusion = (val: string) => { if (val === '所检项目合格') { form.value.meterIdentify = '合格' } else { form.value.meterIdentify = '停用' } emits('changeMeterIdentify', form.value.meterIdentify) } watch(() => props.dataNo, (newValue) => { if (newValue) { form.value.dataNo = newValue } }, { immediate: true }) // 监听标准主要测量智能模型 watch(() => measureEquipmentList.value, (newValue) => { emits('measureEquipmentListChange', newValue) }) // const meterIdentifyDict = ref<dictType[]>([]) // 计量标识 // 计量标识 // getDictByCode('eqptMeterIdentify').then((response) => { // meterIdentifyDict.value = response.data // }) onMounted(async () => { getDict().then(() => { let data = $route.query if ($route.query.batchEdit) { // 批量编辑 从batchEditRow中取数据 data = JSON.parse($route.query.batchEditRow as string)[props.batchIndex as number] } if (props.pageType === 'add') { // 从我的任务跳转过来(新增) form.value.orderId = data.orderId as string // 任务单id form.value.orderNo = data.orderNo as string // 任务单编号 form.value.customerName = data.customerName as string // 委托单位 form.value.traceDate = dayjs().format('YYYY-MM-DD') // 测试校准检定日期默认今天 form.value.measureValidDate = `${dayjs().add(Number(data.checkCycle), 'month').subtract(1, 'day')}` // 检定有效期--今天 + 检定周期 - 1天 form.value.measureValidDate = dayjs(form.value.measureValidDate).format('YYYY-MM-DD') form.value.createUserName = user.name // 检定员 form.value.itemId = data.itemId as string// 检定项id form.value.itemCategoryName = data.itemCategoryName as string// 智能模型检定项分类名称 form.value.itemCategoryId = data.itemCategoryId as string// 智能模型检定项分类名称id form.value.belongStandardEquipment = data.belongStandardEquipment as string// 标准装置code form.value.belongStandardEquipmentName = data.belongStandardEquipmentName as string// 标准装置名称 sampleList.value = [{ // 被检智能模型 sampleId: data.sampleId, // 智能模型id sampleName: data.sampleName, // 智能模型名称 sampleModel: data.sampleModel, // 规格型号 manufactureNo: data.manufactureNo, // 出厂编号 manufacturer: data.manufacturer, // 制造厂家(厂商) categoryName: data.itemCategoryName, // 智能模型检定项分类 helpInstruction: data.helpInstruction, // 辅助字段 helpFieldInstruction: data.helpFieldInstruction, // 辅助字段说明 }] fetchRecentEquipment(data.sampleId as string) helpInstruction.value = $route.query.helpInstruction as string // 辅助字段 helpFieldInstruction.value = $route.query.helpFieldInstruction as string // 辅助字段说明 form.value.itemCategoryName = data.itemCategoryName as string // 智能模型检定项分类名称 // 查依据的技术文件(编号、名称) fetchClassificationData(false, data.itemCategoryName! as string, data.belongStandardEquipment as string) form.value.labCode = user.bizLabCode // 实验室 form.value.groupCode = user.groupNo // 部门名称 } else { helpInstruction.value = $route.query.helpInstruction as string // 辅助字段 form.value.itemCategoryName = $route.query.itemCategoryName as string // 智能模型检定项分类名称 form.value.itemCategoryName = data.itemCategoryName as string// 智能模型检定项分类名称 form.value.itemCategoryId = data.itemCategoryId as string// 智能模型检定项分类名称id form.value.belongStandardEquipment = data.belongStandardEquipment as string || ''// 标准装置code form.value.belongStandardEquipmentName = data.belongStandardEquipmentName as string || ''// 标准装置名称 } }) }) watch(() => form.value.itemCategoryName, (newValue) => { if (newValue) { // 判断是否是新增的检定项分类 const index = categoryNameDict.findIndex((item: any) => item === newValue) if (index === -1) { isNeverDefineItemCategory.value = true } else { isNeverDefineItemCategory.value = false } let data = $route.query if ($route.query.batchEdit) { // 批量编辑 从batchEditRow中取数据 data = JSON.parse($route.query.batchEditRow as string)[props.batchIndex as number] } // 查依据的技术文件(编号、名称) fetchClassificationData(false, data.itemCategoryName! as string, data.belongStandardEquipment as string) } }) defineExpose({ checkoutCommonForm, form, measureEquipmentList, ruleFormRef, sampleList, checkout, helpInstruction, helpFieldInstruction }) </script> <template> <div class="templateFormAndTable"> <!-- 表单 --> <detail-block title=""> <el-form ref="ruleFormRef" :model="form" label-width="180" label-position="right" :rules="rules" > <el-row :gutter="24"> <el-col :span="8"> <el-form-item label="检定数据编号:" prop="dataNo"> <el-input v-model="form.dataNo" disabled placeholder="系统自动生成" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="检校类别:" prop="measureCategory"> <el-select v-model="form.measureCategory" placeholder="检校类别" filterable :disabled="pageType === 'detail'" class="full-width-input" > <el-option v-for="item in measureCategoryList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="委托单位:" prop="customerName"> <el-input v-model="form.customerName" disabled :placeholder="pageType === 'detail' ? ' ' : '委托单位'" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="测试、校准或检定日期:" prop="traceDate"> <el-date-picker v-model="form.traceDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :placeholder="pageType === 'detail' ? ' ' : '请选择日期'" :disabled="pageType === 'detail'" class="full-width-input" @change="changeMeterIdentify" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="检定有效期:" prop="measureValidDate"> <el-date-picker v-model="form.measureValidDate" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :placeholder="pageType === 'detail' ? ' ' : '请选择日期'" :disabled="pageType === 'detail'" class="full-width-input" @change="changeMeterIdentify" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="测试、校准或检定地点:" prop="measureAddress"> <el-select v-model="form.measureAddress" placeholder="测试、校准或检定地点" filterable :disabled="pageType === 'detail'" class="full-width-input" @change="handleChangeAddress" > <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.name" /> </el-select> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="温度(℃):" prop="temperature"> <el-input v-model="form.temperature" :disabled="pageType === 'detail'" :placeholder="pageType === 'detail' ? ' ' : '请输入温度'" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="相对湿度(%RH):" prop="humidity"> <el-input v-model="form.humidity" :disabled="pageType === 'detail'" :placeholder="pageType === 'detail' ? ' ' : '请输入相对湿度'" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="任务单编号:" prop="orderNo"> <span class="link" @click="handleClickOrder">{{ form.orderNo }}</span> <!-- <el-input v-model="form.orderNo" disabled placeholder="任务单编号" /> --> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="实验室" prop="labCode"> <el-select v-model="form.labCode" :placeholder="pageType === 'detail' ? ' ' : '请选择实验室'" disabled class="full-width-input" > <el-option v-for="item in labCodeList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="部门" prop="groupCode"> <el-select v-model="form.groupCode" :placeholder="pageType === 'detail' ? ' ' : '请选择部门'" disabled class="full-width-input" > <el-option v-for="item in groupCodeList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="检定员:" prop="createUserName"> <el-input v-model="form.createUserName" disabled placeholder="检定员" /> </el-form-item> </el-col> <el-col v-if="pageType !== 'add'" :span="8"> <el-form-item label="数据来源:" prop="dataSource"> <el-input v-model="form.dataSource" disabled placeholder="数据来源" /> </el-form-item> </el-col> <el-col :span="8"> <el-form-item label="计量标识:" prop="meterIdentify"> <el-select v-model="form.meterIdentify" class="full-width-input" :disabled="pageType === 'detail'" placeholder="计量标识" @change="changeMeterIdentify" > <el-option v-for="item of meterIdentifyDict" :key="item.value" :label="item.name" :value="item.name" /> </el-select> </el-form-item> </el-col> <el-col v-if="form.measureCategory !== '2'" :span="8"> <el-form-item label="检定结论:" prop="conclusion"> <el-select v-model="form.conclusion" placeholder="请选择检定结论" filterable :disabled="pageType === 'detail'" class="full-width-input" @change="changeConclusion" > <el-option v-for="item in conclusionList" :key="item.id" :label="item.name" :value="item.name" /> </el-select> </el-form-item> </el-col> <el-col v-if="form.conclusion === '除*外其余所检项目合格'" :span="16"> <el-form-item label="限用说明:" prop="restrictionInstruction"> <el-input v-model="form.restrictionInstruction" type="textarea" autosize :disabled="pageType === 'detail'" placeholder="请输入限用说明" /> </el-form-item> </el-col> <!-- <el-col v-if="form.belongStandardEquipment === '9'" :span="8"> <el-form-item label="计量标识:" prop="meterIdentify"> <el-select v-model="form.meterIdentify" placeholder="请选择计量标识 " disabled class="full-width-input" > <el-option v-for="item of meterIdentifyDict" :key="item.value" :label="item.name" :value="item.value" /> </el-select> </el-form-item> </el-col> --> <el-col v-if="form.belongStandardEquipment === '3'" :span="16"> <el-form-item label="测试结果:" prop="remark"> <el-input v-model="form.remark" type="textarea" autosize :disabled="pageType === 'detail'" placeholder="请输入测试结果" /> </el-form-item> </el-col> </el-row> <el-row :gutter="24" class="marg"> <el-col :span="24"> <el-form-item label="依据的技术文件:" prop="technologyFile"> <div v-for="(item, index) in form.technologyFile" :key="index" style="display: flex;"> <show-photo :minio-file-name="item" style="margin-right: 10px;"> <span v-if="pageType !== 'detail'" class="photo-close" @click="delFile(index)">×</span> </show-photo> </div> <span v-if="pageType === 'detail' && !form.technologyFile">无</span> </el-form-item> </el-col> </el-row> </el-form> </detail-block> <!-- 被检件信息 --> <detail-block title="被检件信息"> <el-table :data="sampleList" border style="width: 100%;" > <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns" :key="item.value" :prop="item.value" :label="item.text" align="center" /> </el-table> </detail-block> <detail-block title="所使用的标准,主要测量智能模型"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary" @click="multiFilesAdd"> 批量添加 </el-button> <el-button type="info" @click="delRow"> 删除行 </el-button> </template> <el-table v-loading="tableLoading" :data="measureEquipmentList" border style="width: 100%;" @selection-change="handleSelectionChange" > <el-table-column v-if="pageType !== 'detail'" type="selection" width="38" /> <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in measureDataCalibratorColumns" :key="item.value" :prop="item.value" :label="item.text" :width="item.width" align="center" /> </el-table> </detail-block> </div> <!-- 从未定义过的检定项分类展示 --> <detail-block v-if="isNeverDefineItemCategory" title="检定数据" :class="pageType === 'detail' ? 'setBottom' : ''" content-background-color="transparent" background-color="transparent" > <el-form ref="ruleFormFileRef" :model="form" label-width="100" label-position="right" :rules="rules" > <el-row :gutter="24"> <el-col :span="12"> <el-form-item label="检校证书:" prop="constCertificateExcelData"> <show-photo v-if="form.constCertificateExcelData" :minio-file-name="form.constCertificateExcelData" /> <span v-if="!form.constCertificateExcelData && pageType === 'detail'" style="margin-right: 10px;">无</span> <input v-show="pageType === ''" ref="certificateFileRef" type="file" @change="onCertificateFileChange"> <el-button v-if="pageType !== 'detail'" id="file" type="primary" :style="{ 'margin-left': form.constCertificateExcelData === '' ? '0px' : '20px' }" @click="upload(certificateFileRef)"> {{ form.constCertificateExcelData === '' ? '上传' : '更换附件' }} </el-button> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="原始记录:" prop="constRecordExcelData"> <show-photo v-if="form.constRecordExcelData" :minio-file-name="form.constRecordExcelData" /> <span v-if="!form.constRecordExcelData && pageType === 'detail'" style="margin-right: 10px;">无</span> <input v-show="pageType === ''" ref="originalRecordFileRef" type="file" @change="onOriginalRecordFileChange"> <el-button v-if="pageType !== 'detail'" id="file" type="primary" :style="{ 'margin-left': form.constRecordExcelData === '' ? '0px' : '20px' }" @click="upload(originalRecordFileRef)"> {{ form.constRecordExcelData === '' ? '上传' : '更换附件' }} </el-button> </el-form-item> </el-col> </el-row> </el-form> <!-- 新增检定项分类预览word --> <div v-if="isNeverDefineItemCategory" style="display: flex; padding: 10px 10px 20px 0;box-sizing: border-box;"> <word-oreview v-if="form.constCertificateExcelData" style="flex: 1;margin-right: 10px;" :print-file-name="form.constCertificateExcelData" /> <word-oreview v-if="form.constRecordExcelData" style="flex: 1;" :print-file-name="form.constRecordExcelData" /> </div> </detail-block> <!-- 选择标准库组件 --> <select-standard ref="selectStandardRef" :is-multi="true" @confirm="confirmSelectStandard" /> </template> <style lang="scss" scoped> .link { text-decoration: underline; color: #3d7eff; cursor: pointer; } .setBottom { padding-bottom: 20px; } </style> <style lang="scss"> .templateFormAndTable { .el-radio__label { display: block !important; } } </style>