<!-- 核查数据管理详情--核查项---第15套:小功率标准装置 -->
<script lang="ts" setup name="checkDataDetail">
import { ref, watch } from 'vue'
import { ElLoading, ElMessage } from 'element-plus'
import saveCheckRecord from '../../dialog/saveCheckRecord.vue'
import type { IList } from './fifteenth-interface'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import useUserStore from '@/store/modules/user'
import type { dictType } from '@/global'
import { getDictByCode } from '@/api/system/dict'
import multiTable from '@/components/MultiHeaderTable/index.vue'
// import { getCheckItemDetail, getJobInstructionList } from '@/api/equipment/standard/book'
// import { addCheckData, calculateHandle, getInfo, updateCheckData } from '@/api/equipment/standard/checkData'
const user = useUserStore() // 用户信息
const $router = useRouter() // 关闭页面使用
const $route = useRoute() // 路由参数
const pageType = ref('add') // 页面类型: add, edit, detail
const infoId = ref('')
const belongStandardEquipment = ref('15')
const itemCategoryId = ref('') // 核查项分类id
const itemCategoryName = ref('') // 核查项分类名称
// ----------------------------------路由参数------------------------------------------------
if ($route.params && $route.params.type) {
pageType.value = $route.params.type as string
console.log(pageType.value)
if ($route.params.id) {
infoId.value = $route.params.id as string
}
}
// ----------------------------------------核查数据----------------------------------------------
const radioMenus = ref([ // 标签内容
{ name: '重复性', value: 'repeatability' },
{ name: '稳定性', value: 'stability' },
])
const current = ref('repeatability') // 选择的tab 默认基本信息
const columns_repeatability = ref<TableColumn[]>([ // 重复性表头
{ text: '频率', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点单位', value: 'checkPoint', align: 'center', required: true, type: 'text' },
{ text: 'Kc/%', value: 'checkPoint', align: 'center', required: true, type: 'text' },
{
text: '第一次',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: 'Pcu/mW', value: 'Pcu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '示数Pbu/mW', value: '示数Pbu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '校准因子Ku/%', value: '校准因子Ku/%', align: 'center', required: true, type: 'inputNumber' },
],
},
{
text: '第二次',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: 'Pcu/mW', value: 'Pcu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '示数Pbu/mW', value: '示数Pbu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '校准因子Ku/%', value: '校准因子Ku/%', align: 'center', required: true, type: 'inputNumber' },
],
},
{
text: '第三次',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: 'Pcu/mW', value: 'Pcu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '示数Pbu/mW', value: '示数Pbu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '校准因子Ku/%', value: '校准因子Ku/%', align: 'center', required: true, type: 'inputNumber' },
],
},
{
text: '第四次',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: 'Pcu/mW', value: 'Pcu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '示数Pbu/mW', value: '示数Pbu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '校准因子Ku/%', value: '校准因子Ku/%', align: 'center', required: true, type: 'inputNumber' },
],
},
{
text: '第五次',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: 'Pcu/mW', value: 'Pcu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '示数Pbu/mW', value: '示数Pbu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '校准因子Ku/%', value: '校准因子Ku/%', align: 'center', required: true, type: 'inputNumber' },
],
},
{
text: '第六次',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: 'Pcu/mW', value: 'Pcu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '示数Pbu/mW', value: '示数Pbu/mW', align: 'center', required: true, type: 'inputNumber' },
{ text: '校准因子Ku/%', value: '校准因子Ku/%', align: 'center', required: true, type: 'inputNumber' },
],
},
{ text: '平均值(校准因子Ku/%)', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '标准偏差', value: 'averageValue', align: 'center', required: true, type: 'text' },
])
const columns_stability = ref<TableColumn[]>([ // 稳定性表头
{ text: '频率', value: 'params', align: 'center', required: true, type: 'text' },
{ text: '频率点单位', value: 'checkPoint', align: 'center', required: true, type: 'text' },
{
text: '校准因子Ku/%(平均值)',
value: 'indicatingValue',
align: 'center',
required: true,
width: '160',
children: [
{ text: '2022-12-12', value: '2022-12-12', align: 'center', required: true, type: 'text' },
{ text: '2022-12-13', value: '2022-12-13', align: 'center', required: true, type: 'text' },
{ text: '2022-12-14', value: '2022-12-14', align: 'center', required: true, type: 'text' },
{ text: '2022-12-15', value: '2022-12-15', align: 'center', required: true, type: 'text' },
{ text: '2022-12-16', value: '2022-12-16', align: 'center', required: true, type: 'text' },
{ text: '本次核查时间', value: '2022-12-17', align: 'center', required: true, type: 'text' },
],
},
{ text: '平均值', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '稳定性', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: 'U(k=2)', value: 'averageValue', align: 'center', required: true, type: 'text' },
{ text: '结论', value: 'averageValue', align: 'center', required: true, type: 'text' },
])
const listRepeatability = ref<IList[]>([]) // 重复性
const listStability = ref<IList[]>([]) // 稳定性
// 获取配置详情
function fetchCheckItemDetail(equipmentId: string, belongStandardEquipmentParam: string, itemCategoryIdParam: string, itemCategoryNameParam: string) {
belongStandardEquipment.value = belongStandardEquipmentParam // 检校标准装置
itemCategoryId.value = itemCategoryIdParam // 核查分类id
itemCategoryName.value = itemCategoryNameParam // 核查分类名称
const loading = ElLoading.service({
lock: true,
background: 'rgba(255, 255, 255, 0.8)',
})
const params = {
equipmentId, // 设备id
belongStandardEquipment: belongStandardEquipment.value, // 检校标准装置code
itemCategoryId: itemCategoryId.value, // 核查项分类id
itemCategoryName: itemCategoryName.value, // 核查项分类名称
}
// getCheckItemDetail(params).then((res) => {
// loading.close()
// handleData(res.data.checkItemDataCalibratorList)
// })
}
// 点击生成结果处理
const createResult = () => {
//
}
// ------------------------------------------------------------------------------------------
// 获取详情
function fetchInfo() {
// const loading = ElLoading.service({
// lock: true,
// background: 'rgba(255, 255, 255, 0.8)',
// })
// getInfo({ id: infoId.value }).then((res) => {
// form.value = { ...res.data }
// list.value = res.data.checkDataPistonGaugeList.map((item: any) => {
// return {
// ...item,
// editable: pageType.value !== 'detail',
// }
// })
// loading.close()
// })
}
// -------------------------------------钩子-----------------------------------------------------
onMounted(async () => {
if (pageType.value !== 'add') {
// fetchInfo()
}
})
defineExpose({ fetchCheckItemDetail })
</script>
<template>
<!-- 核查数据 -->
<detail-block title="核查数据">
<div style="display: flex;justify-content: space-between;">
<el-radio-group v-model="current" style="margin-bottom: 20px;">
<el-radio-button v-for="item in radioMenus" :key="item.value" :label="item.value">
{{ item.name }}
</el-radio-button>
</el-radio-group>
</div>
<div style="display: flex;justify-content: flex-end;align-items: center;margin-bottom: 10px;">
<el-button v-if="pageType !== 'detail'" type="primary" @click="createResult">
计算结果
</el-button>
</div>
<multi-table
:table-data="current === 'repeatability' ? listRepeatability : listStability"
:table-header="current === 'repeatability' ? columns_repeatability : columns_stability"
:merge-rows="[]"
:need-index="true"
/>
<!-- 保存核查记录 -->
<save-check-record ref="saveCheckRecordRef" />
</detail-block>
</template>
<style lang="scss" scoped>
.link {
text-decoration: underline;
color: #3d7eff;
cursor: pointer;
}
.file-area {
display: flex;
align-items: center;
font-size: 14px;
color: #60627f;
margin-bottom: 10px;
margin-left: 40px;
white-space: nowrap;
.tech-file {
display: flex;
align-items: center;
margin-left: 20px;
.file-text {
margin-right: 10px;
}
}
}
</style>