微调误差体系

This commit is contained in:
sjl
2024-10-28 13:41:14 +08:00
parent e0fe44c6e4
commit e1bc2f4fb4
3 changed files with 151 additions and 21 deletions

View File

@@ -1,8 +1,9 @@
<template>
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogBig">
<el-table :data="errorData" style="width: 100%" :span-method="spanMethod" border>
<el-table :data="errorData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" :span-method="spanMethod" border class="custom-table">
<el-table-column prop="measured" label="被测量" />
<el-table-column prop="deviceLevel" label="检测装置级别" />
<el-table-column prop="measurementType" label="测量类型" />
<el-table-column prop="condition" label="测量条件" />
<el-table-column prop="maxErrorValue" label="最大误差" />
</el-table>
@@ -15,6 +16,8 @@
import type { ColumnProps } from '@/components/ProTable/interface'
import type { ErrorSystem } from '@/api/error/interface'
import errorDataList from '@/api/error/errorData'
import type { TableColumnCtx } from 'element-plus'
const errorData = errorDataList.errordetail
// 表格配置项
@@ -31,6 +34,10 @@ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([
prop: 'condition',
label: '测量条件',
},
{
prop: 'measurementType',
label: '测量类型',
},
{
prop: 'maxErrorValue',
label: '最大误差',
@@ -38,6 +45,72 @@ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([
])
interface SpanMethodProps {
row: ErrorSystem.ErrorSystemDetail
column: TableColumnCtx<ErrorSystem.ErrorSystemDetail>
rowIndex: number
columnIndex: number
}
const spanMethod = ({
row,
column,
rowIndex,
columnIndex,
}: SpanMethodProps) => {
if (columnIndex === 0 ) { // 检查是否为第一列
if (rowIndex === 2 || rowIndex === 21) { // 检查是否为第三行
return {
rowspan: 2, // 合并行数
colspan: 1, // 单元格列数
};
}else if (rowIndex === 8) { //
return {
rowspan: 8,
colspan: 1,
};
}
else if (rowIndex === 16) { //
return {
rowspan: 4,
colspan: 1,
};
}
else if (rowIndex === 3 || rowIndex === 9 || rowIndex === 10|| rowIndex === 11
|| rowIndex === 12|| rowIndex === 13|| rowIndex === 14|| rowIndex === 15
|| rowIndex === 17 || rowIndex === 18|| rowIndex === 19
|| rowIndex === 22) { // 检查是否为第四行
return {
rowspan: 0, // 不显示该单元格
colspan: 0,
};
}
}
else if(columnIndex === 2) { // 检查是否为第三列
if (rowIndex === 2
|| rowIndex === 8|| rowIndex === 10|| rowIndex === 12|| rowIndex === 14
|| rowIndex === 16|| rowIndex === 18
|| rowIndex === 21) {
return {
rowspan: 2,
colspan: 1,
};
}
else if (rowIndex === 3
|| rowIndex === 9|| rowIndex === 11|| rowIndex === 13|| rowIndex === 15
|| rowIndex === 17|| rowIndex === 19
|| rowIndex === 22) { // 检查是否为第四行
return {
rowspan: 0, // 不显示该单元格
colspan: 0,
};
}
}
};
const props = defineProps<{
visible: boolean;
dialogTitle: string;
@@ -72,4 +145,6 @@ const columns = reactive<ColumnProps<ErrorSystem.ErrorSystemDetail>[]>([
</script>
<style>
</style>