<!-- 第6套:安全阀标准装置 --> <!-- 检定数据管理详情模板 --> <script lang="ts" setup name="MeasureDataTemplateDetail"> import { ref } from 'vue' import { ElLoading, ElMessage } from 'element-plus' import dayjs from 'dayjs' import changeRecord from '../changeRecord.vue' import TemplateFormAndTable from '../templateFormAndTable.vue' import { useSolveFormData } from '../useSolveFormData' import type { IDetailMeasureList } from './fifth-interface' import useUserStore from '@/store/modules/user' import type { dictType } from '@/global' import { getDictByCode } from '@/api/system/dict' import type { TableColumn } from '@/components/NormalTable/table_interface' import { calculateHandle, getInfo } from '@/api/business/taskMeasure/measureData' import { getInfo as getItemInfo } from '@/api/business/measure/item' import { useCheckList } from '@/commonMethods/useCheckList' import multiTable from '@/components/MultiHeaderTable/index.vue' import { calc } from '@/utils/useCalc' const props = defineProps({ infoId: String, // id dataNo: String, // 检定数据编号 }) const emits = defineEmits(['giveInfoId']) const user = useUserStore() // 用户信息 const $router = useRouter() // 关闭页面使用 const $route = useRoute() // 路由参数 const ruleFormRef = ref() // 表单ref const templateFormAndTableRef = ref() // 表单和被检设备、测量设备表格公共组件ref const itemFormData = ref({ // 有关于检定项的数据 itemId: '', // 检定项id itemCategoryName: '', // 设备检定项分类名称 itemCategoryId: '', // 设备检定项分类名称id belongStandardEquipment: '', // 标准装置code belongStandardEquipmentName: '', // 标准装置名称 appearance: '1', // 外观检查 insulationResistance: '', // 绝缘电阻 jdtzwc: '1', // 角度调整误差(可调整角度仪表) conclusion: '', // 检验结论 remark: '', // 备注 }) // -------------------------------------------路由参数------------------------------------------ const pageType = ref('add') // 页面类型: add, edit, detail const infoId = ref('') // 列表id if ($route.params && $route.params.type) { pageType.value = $route.params.type as string if ($route.params.id) { infoId.value = $route.params.id as string } } // --------------------------------------------字典-------------------------------------- const conclusionList = ref<dictType[]>([])// 结论 async function getDict() { // 结论 getDictByCode('bizUltimateness').then((response) => { conclusionList.value = response.data }) } getDict() // ------------------------------------------标签---------------------------------------------------------- const radioMenus = ref([ // 标签内容 { name: '检定数据', value: 'measure-data' }, { name: '历史修改记录', value: 'change-record' }, ]) const current = ref('measure-data') // 选择的tab 默认基本信息 // ---------------------------------------检定项数据表格---------------------------------------------------- // ==============================恒温槽=============================== const thermostaticBathWaveList = ref<IDetailMeasureList[]>([]) // 恒温槽-波动性测试表格数据 const thermostaticBathEvenList = ref<IDetailMeasureList[]>([]) // 恒温槽-均匀性测试表格数据 const columns_thermostatic_bath_wave = ref([ // 恒温槽--波动性测试 { text: '下/上限点', value: 'params', align: 'center', required: true, type: 'text' }, { text: '单位', value: 'checkPoint', align: 'center', required: true, type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: true, width: '110', children: [ { text: '1', value: '1', align: 'center', required: true, type: 'text' }, { text: '2', value: '2', align: 'center', required: true, type: 'text' }, { text: '3', value: '3', align: 'center', required: true, type: 'text' }, { text: '4', value: '4', align: 'center', required: true, type: 'text' }, { text: '5', value: '5', align: 'center', required: true, type: 'text' }, { text: '6', value: '6', align: 'center', required: true, type: 'text' }, { text: '7', value: '7', align: 'center', required: true, type: 'text' }, { text: '8', value: '8', align: 'center', required: true, type: 'text' }, { text: '9', value: '9', align: 'center', required: true, type: 'text' }, { text: '10', value: '10', align: 'center', required: true, type: 'text' }, { text: '11', value: '11', align: 'center', required: true, type: 'text' }, { text: '12', value: '12', align: 'center', required: true, type: 'text' }, { text: '13', value: '13', align: 'center', required: true, type: 'text' }, { text: '14', value: '14', align: 'center', required: true, type: 'text' }, { text: '15', value: '15', align: 'center', required: true, type: 'text' }, ], }, { text: '最大值', value: 'averageValue', align: 'center', required: true, type: 'text' }, { text: '最小值', value: 'standardDeviation', align: 'center', required: true, type: 'text' }, { text: '波动性', value: 'relativeRepeatability', align: 'center', type: 'text' }, ]) const columns_thermostatic_bath_even = ref([ // 恒温槽--均匀性测试 { text: '下/上限点', value: 'params', align: 'center', required: true, type: 'text' }, { text: '单位', value: 'checkPoint', align: 'center', required: true, type: 'text' }, { text: '位置', value: 'checkPoint', align: 'center', required: true, type: 'text' }, { text: '示值', value: 'indicatingValue', align: 'center', required: true, width: '110', children: [ { text: 'ROA1', value: 'ROA1', align: 'center', required: true, type: 'text' }, { text: 'RA1', value: 'RA1', align: 'center', required: true, type: 'text' }, { text: 'RA2', value: 'RA2', align: 'center', required: true, type: 'text' }, { text: 'ROA2', value: 'ROA2', align: 'center', required: true, type: 'text' }, { text: 'ROA3', value: 'ROA3', align: 'center', required: true, type: 'text' }, { text: 'RA3', value: 'RA3', align: 'center', required: true, type: 'text' }, { text: 'RA4', value: 'RA4', align: 'center', required: true, type: 'text' }, { text: 'ROA4', value: 'ROA4', align: 'center', required: true, type: 'text' }, { text: 'ROA均值', value: 'ROA均值', align: 'center', required: true, type: 'text' }, { text: 'RA均值', value: 'RA均值', align: 'center', required: true, type: 'text' }, ], }, { text: '上水平面温差', value: 'averageValue', align: 'center', required: true, type: 'text' }, { text: '下水平面温差', value: 'standardDeviation', align: 'center', required: true, type: 'text' }, { text: '水平最大温差', value: 'relativeRepeatability', align: 'center', type: 'text' }, { text: '工作区域最大温差', value: 'relativeRepeatability', align: 'center', type: 'text' }, ]) // ===============================双金属温度计======================== const bimetalThermometerList = ref<IDetailMeasureList[]>([]) // 双金属温度计表格数据 const columns_bimetal_thermometer = ref([ // 双金属温度计表头 { text: '检定项目', value: 'indicatingValue', align: 'center', required: true, type: 'text' }, { text: '校准点', value: 'indicatingValue', align: 'center', required: true, type: 'text' }, { text: '标准器示值', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '正行程', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '反行程', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '被检示值', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '正行程', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '反行程', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '示值误差', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '正行程', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '反行程', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '最大允许误差', value: 'indicatingValue', align: 'center', required: true, type: 'text' }, { text: '扩展不确定度U', value: 'indicatingValue', align: 'center', required: true, type: 'text' }, ]) // ==============================工业铂铜热电阻======================= const resistanceFranchiseList = ref<IDetailMeasureList[]>([]) // 允差表格数据 const resistanceResultList = ref<IDetailMeasureList[]>([]) // 结果处理表格数据 const columns_resistance_franchise = ref([ // 允差表头 { text: '检定项目', value: 'indicatingValue', align: 'center', required: true, type: 'text' }, { text: '标称温度', value: 'indicatingValue', align: 'center', required: true, type: 'text' }, { text: '1', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '2', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '3', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '4', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '5', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '6', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, { text: '均值', value: 'beforeFrictionStroke', align: 'center', required: true, children: [ { text: '标准器示值(℃)', value: 'beforeFrictionForwardStroke', align: 'center', required: true, type: 'inputNumber' }, { text: '被检示值(Ω)', value: 'beforeFrictionReverseStroke', align: 'center', required: true, type: 'inputNumber' }, ], }, ]) // 结果处理表格 const columns_resistance_result = ref([ // 结果处理表头 { text: '项目', value: 'params', align: 'center', required: true }, { text: '允差下限', value: 'terminalVoltage', align: 'center', required: true }, { text: '允差上限', value: 'rangeRange', align: 'center', required: true }, { text: '测量值', value: 'nominalValue', align: 'center', required: true }, ]) // -------------------------------------------获取详情信息-------------------------------------------------- // 获取页面详情信息 const fetchInfo = () => { const loading = ElLoading.service({ lock: true, background: 'rgba(255, 255, 255, 0.8)', }) getInfo({ id: infoId.value, belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 我的任务跳转过来如果已经配置过检定项了,到编辑页面,且用一下三个字段替代传id请求详情 itemId: $route.query.itemId, // 检定项id orderId: $route.query.orderId, // 任务单id sampleId: $route.query.sampleId, // 被检设备id }).then((res) => { // 有关于检定项的数据 itemFormData.value.itemId = res.data.itemId // 检定项id itemFormData.value.itemCategoryName = res.data.itemCategoryName // 设备检定项分类名称 itemFormData.value.itemCategoryId = res.data.itemCategoryId ? res.data.itemCategoryId : itemFormData.value.itemCategoryId // 设备检定项分类名称id itemFormData.value.appearance = `${res.data.appearance}` // 外观(1/0) // =======================================表单公共组件数据处理======================================================= useSolveFormData(res, templateFormAndTableRef.value) // ==================================检定数据======================================================================== // list.value = res.data.measureDataPistonGaugeList.map((item: IDetailMeasureList) => { // return { // ...item, // editable: pageType.value !== 'detail', // } // }) // 检定数据 infoId.value = res.data.id emits('giveInfoId', infoId.value) loading.close() }) } // 初始化输入数据 const initInputData = (data: any) => { } /** * 新增的时候获取检定项输入数据(获取检定项分类详情) * @param itemId 检定项id * @param itemCategoryName 检定项分类名字 * @param belongStandardEquipment 检校标准装置字典 */ const fetchItemInfo = (itemId: string, itemCategoryName: string, belongStandardEquipment = '') => { const params = { id: itemId, itemCategoryName, // 检定项分类名字 belongStandardEquipment, // 检校标准装置字典code } getItemInfo(params).then((res) => { itemFormData.value.appearance = res.data.measureItemConfigPistonGauge.appearance ? '1' : '' // 外观及功能检查 1有外观,2没有外观 initInputData(res.data.measureItemDataPistonGaugeList) }) } // ----------------------------------------点击保存时校验--------------------------------------- // 校验 const checkout = () => { } // -----------------------------------------生成结果处理---------------------------------------- // 点击生成结果处理 const createResult = () => { // ElMessage.info('敬请期待') return false // if (!list.value.length) { // ElMessage.warning('没有检定项数据,无法生成结果') // return false // } // if (!useCheckList(list.value, measureColumns.value, '检定数据')) { // return false // } // const params = { // belongStandardEquipment: itemFormData.value.belongStandardEquipment, // 检校标准装置 // itemCategoryName: itemFormData.value.itemCategoryName, // 检定项分类名称 // measureDataCalibratorList: list.value, // } // calculateHandle(params).then((res) => { // if (res.data && res.data.length) { // resultList.value = res.data.map((item: IDetailMeasureList) => { // return { // ...item, // } // }) // 检定数据 // } // else { // list.value = res.data // } // }) } // -------------------------------------------处理表格函数--------------------------------------- // el-input-number组件值变化 const handleInputNumberChange = ({ row }: any) => { } // ------------------------------------------钩子---------------------------------------------- watch(() => props.infoId, (newValue) => { if (newValue) { infoId.value = newValue } }, { immediate: true }) onMounted(() => { if (pageType.value === 'add') { // 从我的任务跳转过来(新增) itemFormData.value.itemId = $route.query.itemId as string// 检定项id itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string// 设备检定项分类名称 itemFormData.value.itemCategoryId = $route.query.itemCategoryId as string// 设备检定项分类名称id itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 // 查输入值(查检定项管理的详情) // fetchItemInfo($route.query.itemId! as string, $route.query.itemCategoryName! as string, $route.query.belongStandardEquipment as string) } else { itemFormData.value.itemCategoryName = $route.query.itemCategoryName as string // 设备检定项分类名称 itemFormData.value.itemCategoryId = $route.query.itemCategoryId as string// 设备检定项分类名称id itemFormData.value.belongStandardEquipment = $route.query.belongStandardEquipment as string// 标准装置code itemFormData.value.belongStandardEquipmentName = $route.query.belongStandardEquipmentName as string// 标准装置名称 // fetchInfo() } }) defineExpose({ checkout, itemFormData, templateFormAndTableRef, pageType }) </script> <template> <template-form-and-table ref="templateFormAndTableRef" :page-type="pageType" /> <!-- 标签 --> <detail-block :title="pageType !== 'detail' ? '检定数据' : ''" :class="pageType === 'detail' ? 'setBottom' : ''"> <el-radio-group v-if="pageType === 'detail'" v-model="current"> <el-radio-button v-for="item in radioMenus" :key="item.value" :label="item.value"> {{ item.name }} </el-radio-button> </el-radio-group> <el-form v-if="current === 'measure-data'" ref="formRef" :model="itemFormData" label-width="140" label-position="right" style="margin-top: 20px;" > <el-row> <!-- 外观 --> <el-col :span="8"> <el-form-item label="外观检查:" prop="appearance"> <el-select v-model="itemFormData.appearance" :disabled="pageType === 'detail'" class="full-width-input"> <el-option v-for="i in conclusionList" :key="i.value" :label="i.name" :value="i.value" /> </el-select> </el-form-item> </el-col> <el-col v-if="itemFormData.itemCategoryName !== '恒温槽'" :span="8"> <el-form-item label="绝缘电阻(MΩ):" prop="insulationResistance"> <el-input v-model="itemFormData.insulationResistance" :disabled="pageType === 'detail'" :placeholder="pageType === 'detail' ? ' ' : '请输入绝缘电阻'" /> </el-form-item> </el-col> <el-col v-if="itemFormData.itemCategoryName === '双金属温度计'" :span="8"> <el-form-item label-width="250px" label="角度调整误差(可调整角度仪表):" prop="jdtzwc"> <el-select v-model="itemFormData.jdtzwc" :disabled="pageType === 'detail'" class="full-width-input"> <el-option v-for="i in [{ value: '1', name: '不可用' }]" :key="i.value" :label="i.name" :value="i.value" /> </el-select> </el-form-item> </el-col> </el-row> </el-form> <!-- 恒温槽 --> <detail-block v-if="current === 'measure-data' && itemFormData.itemCategoryName === '恒温槽'" title="波动性测试" style="margin-top: 0;padding: 0;"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary"> 计算结果 </el-button> </template> <multi-table :table-data="thermostaticBathWaveList" :table-header="columns_thermostatic_bath_wave" :merge-rows="[]" :need-index="true" @handle-input-number-change="handleInputNumberChange" /> </detail-block> <detail-block v-if="current === 'measure-data' && itemFormData.itemCategoryName === '恒温槽'" title="均匀性测试" style="margin-top: 0;padding: 0;"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary"> 计算结果 </el-button> </template> <multi-table :table-data="thermostaticBathEvenList" :table-header="columns_thermostatic_bath_even" :merge-rows="[]" :need-index="true" @handle-input-number-change="handleInputNumberChange" /> </detail-block> <!-- 双金属温度计 --> <detail-block v-if="current === 'measure-data' && itemFormData.itemCategoryName === '双金属温度计'" title="示值误差" style="margin-top: 0;padding: 0;"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary"> 计算结果 </el-button> </template> <multi-table :table-data="bimetalThermometerList" :table-header="columns_bimetal_thermometer" :merge-rows="[]" :need-index="true" @handle-input-number-change="handleInputNumberChange" /> </detail-block> <!-- 工业铂铜热电阻 --> <detail-block v-if="current === 'measure-data' && itemFormData.itemCategoryName === '工业铂铜热电阻'" title="允差" style="margin-top: 0;padding: 0;"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary"> 计算结果 </el-button> </template> <multi-table :table-data="resistanceFranchiseList" :table-header="columns_resistance_franchise" :merge-rows="[]" :need-index="true" @handle-input-number-change="handleInputNumberChange" /> </detail-block> <detail-block v-if="current === 'measure-data' && itemFormData.itemCategoryName === '工业铂铜热电阻'" title="结果处理" style="margin-top: 0;padding: 0;"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary"> 计算结果 </el-button> </template> <el-table ref="tableRef" :data="resistanceResultList" border style="width: 100%;" > <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns_resistance_result" :key="item.value" :prop="item.value" :label="item.text" align="center" > <template #header> <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span> </template> </el-table-column> </el-table> <el-form v-if="current === 'measure-data'" ref="formRef" :model="itemFormData" label-width="120" label-position="right" style="margin-top: 20px;" > <el-row> <!-- α --> <el-col :span="8"> <el-form-item label="α:" prop="a"> <el-input v-model="itemFormData.conclusion" autosize type="textarea" disabled :placeholder="pageType === 'detail' ? ' ' : 'α'" /> </el-form-item> </el-col> <!-- △t(0℃)/℃ --> <el-col :span="8"> <el-form-item label="△t(0℃)/℃:" prop="a"> <el-input v-model="itemFormData.conclusion" autosize type="textarea" disabled :placeholder="pageType === 'detail' ? ' ' : '△t(0℃)/℃'" /> </el-form-item> </el-col> <!-- α --> <el-col :span="8"> <el-form-item label="△t(100℃)/℃:" prop="a"> <el-input v-model="itemFormData.conclusion" autosize type="textarea" disabled :placeholder="pageType === 'detail' ? ' ' : '△t(100℃)/℃'" /> </el-form-item> </el-col> </el-row> </el-form> <el-table ref="tableRef" :data="resistanceResultList" border style="width: 100%;" > <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns_resistance_result" :key="item.value" :prop="item.value" :label="item.text" align="center" > <template #header> <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span> </template> </el-table-column> </el-table> </detail-block> <el-form v-if="current === 'measure-data'" ref="formRef" :model="itemFormData" label-width="140" label-position="right" style="margin-top: 20px;" > <el-row> <!-- 结论 --> <el-col v-if="itemFormData.itemCategoryName !== '恒温槽'" :span="12"> <el-form-item label="结论:" prop="conclusion"> <el-input v-model="itemFormData.conclusion" autosize type="textarea" disabled :placeholder="pageType === 'detail' ? ' ' : '结论'" /> </el-form-item> </el-col> <!-- 备注 --> <el-col :span="12"> <el-form-item label="备注:" prop="remark"> <el-input v-model="itemFormData.remark" autosize type="textarea" :disabled="pageType === 'detail'" :placeholder="pageType === 'detail' ? ' ' : '请输入备注'" /> </el-form-item> </el-col> </el-row> </el-form> <!-- 历史修改记录 --> <change-record v-show="pageType === 'detail' && current === 'change-record'" :info-id="infoId" /> </detail-block> </template> <style lang="scss" scoped> .setBottom { padding-bottom: 20px; } </style>