Files
pqs-9100_client/frontend/src/views/home/components/dataCheckResultTable.vue

131 lines
4.7 KiB
Vue
Raw Normal View History

<template>
2024-12-18 15:56:59 +08:00
<div class="table-main">
2025-01-06 08:51:14 +08:00
<el-table v-if="info.length <= 0" :data="tableData" height="335px" :header-cell-style="{ textAlign: 'center' } "
2024-12-18 15:56:59 +08:00
:cell-style="{ textAlign: 'center' }">
2025-01-06 08:51:14 +08:00
<!-- <el-table-column prop="chnNum" label="通道号" width="80">-->
<!-- <template #default="{row}">-->
<!-- {{ '通道' + row.chnNum }}-->
<!-- </template>-->
<!-- </el-table-column>-->
2024-12-31 14:27:36 +08:00
<template v-if="phaseFlag === 0">
<el-table-column :label="`A${unit}`">
2025-01-06 08:51:14 +08:00
<el-table-column prop="aStd" width="79" label="标准值"/>
<el-table-column prop="aData" width="79" label="被检值"/>
<el-table-column prop="aError" width="79" label="误差值"/>
2024-12-18 15:56:59 +08:00
</el-table-column>
2024-12-31 14:27:36 +08:00
<el-table-column :label="`B${unit}`">
2025-01-06 08:51:14 +08:00
<el-table-column prop="bStd" width="79" label="标准值"/>
<el-table-column prop="bData" width="79" label="被检值"/>
<el-table-column prop="bError" width="79" label="误差值"/>
2024-12-18 15:56:59 +08:00
</el-table-column>
2024-12-31 14:27:36 +08:00
<el-table-column :label="`C${unit}`">
2025-01-06 08:51:14 +08:00
<el-table-column prop="cStd" width="79" label="标准值"/>
<el-table-column prop="cData" width="79" label="被检值"/>
<el-table-column prop="cError" width="79" label="误差值"/>
2024-12-18 15:56:59 +08:00
</el-table-column>
2025-01-06 08:51:14 +08:00
<el-table-column prop="maxError" :label="`最大误差(${unit}`"/>
2024-12-31 14:27:36 +08:00
<el-table-column prop="result" label="检测结果" width="70">
<template #default="scope">
2025-01-06 08:51:14 +08:00
<el-tag type="danger" v-if="scope.row.result === '不符合'">{{ scope.row.result }}</el-tag>
<span v-if="scope.row.result != '不符合'">{{ scope.row.result }}</span>
2024-12-31 14:27:36 +08:00
</template>
</el-table-column>
</template>
2025-01-06 08:51:14 +08:00
2024-12-31 14:27:36 +08:00
<template v-if="phaseFlag === 1">
<el-table-column :label="`T${unit}`">
2025-01-06 08:51:14 +08:00
<el-table-column prop="tStd" label="标准值V"/>
<el-table-column prop="tData" label="被检值"/>
<el-table-column prop="tError" label="误差值"/>
2024-12-18 15:56:59 +08:00
</el-table-column>
2025-01-06 08:51:14 +08:00
<el-table-column prop="maxError" label="最大误差V"/>
2024-12-31 14:27:36 +08:00
<el-table-column prop="result" label="检测结果">
<template #default="scope">
2025-01-06 08:51:14 +08:00
<el-tag type="danger" v-if="scope.row.result === '不符合'">{{ scope.row.result }}</el-tag>
<span v-if="scope.row.result != '不符合'">{{ scope.row.result }}</span>
2024-12-31 14:27:36 +08:00
</template>
</el-table-column>
</template>
2024-12-18 15:56:59 +08:00
</el-table>
2025-01-06 08:51:14 +08:00
<el-collapse v-else v-model="activeNames">
<el-collapse-item v-for="(item, index) in info" :key="index" :title="item.title" :name="item.name">
<el-table :data="[tableData[index]]" :header-cell-style="{ textAlign: 'center' } "
:cell-style="{ textAlign: 'center' }">
<el-table-column :label="`T${unit}`">
<el-table-column prop="tStd" label="标准值V"/>
<el-table-column prop="tData" label="被检值"/>
<el-table-column prop="tError" label="误差值"/>
</el-table-column>
<el-table-column prop="maxError" label="最大误差V"/>
<el-table-column prop="result" label="检测结果">
<template #default="scope">
<el-tag type="danger" v-if="scope.row.result === '不符合'">{{ scope.row.result }}</el-tag>
<span v-if="scope.row.result != '不符合'">{{ scope.row.result }}</span>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
</el-collapse>
2024-12-18 15:56:59 +08:00
</div>
</template>
<script lang="tsx" setup>
2024-12-31 14:27:36 +08:00
import {defineProps} from 'vue';
2024-12-25 18:04:16 +08:00
import {CheckData} from "@/api/check/interface";
2024-12-18 15:56:59 +08:00
2024-12-31 14:27:36 +08:00
const {tableData} = defineProps<{
2025-01-06 08:51:14 +08:00
info: { title: string, name: string }[],
2024-12-31 14:27:36 +08:00
tableData: CheckData.CheckResult[],
2024-12-18 15:56:59 +08:00
}>();
2025-01-06 08:51:14 +08:00
const activeNames = ref(["Voltage"])
2024-12-31 14:27:36 +08:00
const unit = computed(() => {
return "V"
})
const phaseFlag = computed(() => {
let result = 0;
if (tableData.length > 0) {
2025-01-06 08:51:14 +08:00
result = !tableData[0].tData ? 0 : 1;
2024-12-31 14:27:36 +08:00
}
return result;
})
</script>
<style scoped>
.form-grid {
2024-12-31 14:27:36 +08:00
display: flex;
flex-direction: row; /* 横向排列 */
flex-wrap: wrap; /* 允许换行 */
}
2024-12-31 14:27:36 +08:00
.form-grid .el-form-item {
2024-12-31 14:27:36 +08:00
flex: 1 1 30%; /* 控件宽度 */
margin-right: 20px; /* 控件间距 */
}
2024-12-31 14:27:36 +08:00
.form-grid .el-form-item:last-child {
2024-12-31 14:27:36 +08:00
margin-right: 0; /* 最后一个控件不需要右边距 */
}
2024-12-31 14:27:36 +08:00
.dialog-footer {
2024-12-31 14:27:36 +08:00
display: flex;
justify-content: flex-start;
margin-bottom: 10px; /* 调整这里的值以增加或减少间距 */
}
2024-12-31 14:27:36 +08:00
.el-tabs {
2024-12-31 14:27:36 +08:00
margin-bottom: 20px; /* 添加底部边距 */
}
.el-table th, .el-table td {
2024-12-31 14:27:36 +08:00
text-align: center; /* 所有单元格文字居中 */
}
</style>