预见测

This commit is contained in:
sjl
2025-08-08 13:18:01 +08:00
parent 88f1876ef0
commit 5cd8fea60c
14 changed files with 1142 additions and 149 deletions

View File

@@ -30,6 +30,9 @@
:value="`通道${channel.devNum}`">
</el-option>
</el-select>
<span style="margin-left: 20px; font-size: 14px; color: var(--el-color-primary);">
被检设备{{ deviceName }}-{{ selectedChannels[deviceName] }} ---> 标准设备{{ formatStandardChannelLabel(getMappedStandardChannel(deviceName, selectedChannels[deviceName])) }}
</span>
</el-form-item>
<el-button type="primary" @click="exportData">导出数据</el-button>
</div>
@@ -48,7 +51,7 @@
<el-table-column prop="Uc1" label="C相(V)">
</el-table-column>
</el-table-column>
<el-table-column :label="`${getMappedStandardChannel(deviceName, selectedChannels[deviceName])}`">
<el-table-column :label="formatStandardChannelLabel(getMappedStandardChannel(deviceName, selectedChannels[deviceName]))">
<el-table-column prop="Ua2" label="A相(V)">
</el-table-column>
<el-table-column prop="Ub2" label="B相(V)">
@@ -64,16 +67,17 @@
<script setup lang='tsx' name='realTimeDataAlign'>
import { dialogBig } from "@/utils/elementBind";
import { ref } from "vue";
import { PropType, ref } from "vue";
import { ElMessage } from "element-plus";
import { CircleCheck, CircleClose } from '@element-plus/icons-vue';
const dialogVisible = ref(false);
const activeTab = ref('channel1');
// 重构后的 testDataStructure
const testDataStructure = ref({
"被检设备1": {
"被检1": {
devName: "被检设备1",
channelDataList: [
{
@@ -150,7 +154,7 @@ const testDataStructure = ref({
}
]
},
"被检设备2": {
"被检2": {
devName: "被检设备2",
channelDataList: [
{
@@ -234,13 +238,13 @@ const selectedChannels = ref<Record<string, string>>({});
// 通道映射关系:被检设备通道 -> 标准设备通道
const channelMapping = ref<Record<string, Record<string, string>>>({
'被检设备1': {
'通道1': '标准设备1通道1',
'被检1': {
'通道1': '标准设备1通道2',
'通道2': '标准设备2通道4',
},
'被检设备2': {
'通道1': '标准设备1通道1',
'通道3': '标准设备2通道4'
'被检2': {
'通道1': '标准设备1通道3',
'通道3': '标准设备2通道1'
}
});
@@ -264,13 +268,17 @@ const hasIncompleteData = (deviceName: string) => {
// 获取映射的标准设备通道
const getMappedStandardChannel = (deviceName: string, dutChannel: string) => {
if (!channelMapping.value[deviceName]) {
// 默认值
return dutChannel === '通道1' ? '标准设备1通道1' : '标准设备2通道4';
}
return channelMapping.value[deviceName][dutChannel] || '标准设备1通道1';
return channelMapping.value[deviceName][dutChannel];
};
// 格式化标准设备通道标签,将设备名称和通道号用"-"连接
const formatStandardChannelLabel = (standardChannel: string) => {
// 如果是"标准设备X通道Y"格式,则转换为"标准设备X-通道Y"
return standardChannel.replace(/(标准设备\d+)(通道\d+)/, '$1-$2');
};
// 处理被检设备通道切换
const handleDutChannelChange = (deviceName: string) => {
// 更新指定设备的表格数据但不改变tab图标状态
@@ -331,7 +339,10 @@ const initAllTableData = () => {
});
};
const open = async () => {
const open = async (mapping : Record<string, Record<string, string>>) => {
console.log('mapping11111111:', mapping);
console.log('mapping22222222:',channelMapping);
//channelMapping.value = mapping;
dialogVisible.value = true;
// 初始化数据和状态
initAllTableData();