Files
pqs-9100_client/frontend/src/views/home/components/dataCheckResultTable.vue
2025-01-09 15:49:32 +08:00

157 lines
6.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="table-main">
<el-table v-if="tableData.length > 0" :data="tableData" height="335px" :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }">
<!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
<!-- <template #default="{row}">-->
<!-- {{ '通道' + row.chnNum }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<template v-if="phaseT === 0">
<el-table-column :label="`A${unit}`">
<el-table-column prop="stdA" width="100" label="标准值"/>
<el-table-column prop="dataA" width="100" label="被检值"/>
<el-table-column prop="isDataA" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
最大误差{{ maxErrorStr }}<br/>
误差值{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataA === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataA === 4">/</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column :label="`B${unit}`">
<el-table-column prop="stdB" width="100" label="标准值"/>
<el-table-column prop="dataB" width="100" label="被检值"/>
<el-table-column prop="isDataB" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
最大误差{{ maxErrorStr }}<br/>
误差值{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataB === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataB === 4">/</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<el-table-column :label="`C${unit}`">
<el-table-column prop="stdC" width="100" label="标准值"/>
<el-table-column prop="dataC" width="100" label="被检值"/>
<el-table-column prop="isDataC" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
最大误差 {{ maxErrorStr }}<br/>
误差值{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataC === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataC === 4">/</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
</template>
<template v-if="phaseT === 1">
<el-table-column :label="`T${unit}`">
<el-table-column prop="stdT" label="标准值"/>
<el-table-column prop="dataT" label="被检值"/>
<el-table-column prop="isDataT" label="检测结果">
<template #default="scope">
<el-tooltip effect="dark" placement="bottom">
<template #content>
最大误差 {{ maxErrorStr }}<br/>
误差值{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
</template>
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
<el-tag type="danger" v-if="scope.row.isDataT === 2">不符合</el-tag>
<el-tag type="warning" v-if="scope.row.isDataT === 4">/</el-tag>
</el-tooltip>
</template>
</el-table-column>
</el-table-column>
<!-- <el-table-column prop="maxError" label="最大误差"/>-->
<!-- <el-table-column prop="result" label="检测结果">-->
<!-- <template #default="scope">-->
<!-- <span v-if="scope.row.result === 1">符合</span>-->
<!-- <el-tag type="danger" v-if="scope.row.result === 2">不符合</el-tag>-->
<!-- <span v-if="scope.row.result === 4">/</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
</template>
</el-table>
</div>
</template>
<script lang="tsx" setup>
import {defineProps} from 'vue';
import {CheckData} from "@/api/check/interface";
const {tableData} = defineProps<{
tableData: CheckData.CheckResult[],
}>();
const unit = computed(() => {
return tableData.length > 0 ? tableData[0].unit : '';
})
const phaseT = computed(() => {
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
})
const maxErrorStr = computed((data) => {
let result = tableData[0].maxError ?? '/'
let idx = result.indexOf('~');
if (idx > 0) {
result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
}
return result;
})
</script>
<style scoped>
.form-grid {
display: flex;
flex-direction: row; /* 横向排列 */
flex-wrap: wrap; /* 允许换行 */
}
.form-grid .el-form-item {
flex: 1 1 30%; /* 控件宽度 */
margin-right: 20px; /* 控件间距 */
}
.form-grid .el-form-item:last-child {
margin-right: 0; /* 最后一个控件不需要右边距 */
}
.dialog-footer {
display: flex;
justify-content: flex-start;
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
}
.el-tabs {
margin-bottom: 20px; /* 添加底部边距 */
}
.el-table th, .el-table td {
text-align: center; /* 所有单元格文字居中 */
}
</style>