yeg
2026-08-29 151ed74d39ebc0b3d0c0f1ecbe76805fc7df8829
修复控制台真实绑定展示
2个文件已修改
37 ■■■■■ 已修改文件
src/api/tests.ts 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/TestConsole.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tests.ts
@@ -30,7 +30,8 @@
  groupId: number
  batteryNo: string
  collectorId: number
  binding: { bindingId?: number; channelId: number; expectedBarcode: string | null; claimStatus?: string }
  collectorName?: string | null
  binding: { bindingId?: number; channelId: number; expectedBarcode: string | null; claimStatus?: string; cabinetCode?: string | null; cabinetName?: string | null; displayNo?: string | null }
  collectorChannels: Array<{
    mappingId?: number
    measurementCode: string
src/views/TestConsole.vue
@@ -33,8 +33,10 @@
    purpose: record?.purpose || fallback?.purpose || '电池性能检测',
    startedAt: record && record.startedAt !== '-' ? `${record.startedAt}:00` : fallback?.startedAt || record?.createdAt || '2026-08-07 09:00:00',
    batteryGroup: record?.batteryGroup || fallback?.batteryGroup || '演示电池组',
    batteryCount: record?.batteryCount || fallback?.batteryCount || 4,
    batteryNos: record?.batteryNo.split('、').filter(Boolean) || [],
    batteryCount: backendDetail.value?.batteries.length || record?.batteryCount || fallback?.batteryCount || 4,
    batteryNos: backendDetail.value?.batteries.length
      ? backendDetail.value.batteries.map(item => item.batteryNo).filter(Boolean)
      : (record?.batteryNo && record.batteryNo !== '-' ? record.batteryNo.split('、').filter(Boolean) : []),
    abnormal: record?.status === '检测中(异常)' || fallback?.abnormal || false,
  }
})
@@ -83,17 +85,21 @@
  return [hours, minutes, seconds].map(value => String(value).padStart(2, '0')).join(':')
})
const cells = computed(() => Array.from({ length: profile.value.batteryCount }, (_, index) => ({
  no: profile.value.batteryNos[index] || `SP26-${214 + index}`,
  cabinet: `检测柜 A-${String(Math.floor(index / 4) + 1).padStart(2, '0')}`,
  channel: `通道 ${String(index + 1).padStart(2, '0')}`,
  voltage: (1.2952 + (index % 4) * 0.0011).toFixed(4),
  temperature: (32.6 + (index % 5) * 0.15).toFixed(1),
  positive: (1.2939 + (index % 4) * 0.001).toFixed(4),
  negative: (1.2946 + (index % 4) * 0.0009).toFixed(4),
  capacity: (1495.8 + (index % 6) * 0.48).toFixed(1),
  current: (-8170.6 + (index % 5) * 1.7).toFixed(1),
})))
const cells = computed(() => Array.from({ length: profile.value.batteryCount }, (_, index) => {
  const battery = backendDetail.value?.batteries[index]
  const binding = battery?.binding
  return {
    no: battery?.batteryNo || profile.value.batteryNos[index] || `SP26-${214 + index}`,
    cabinet: binding?.cabinetName || binding?.cabinetCode || `检测柜 A-${String(Math.floor(index / 4) + 1).padStart(2, '0')}`,
    channel: binding?.displayNo ? `通道 ${binding.displayNo}` : `通道 ${String(index + 1).padStart(2, '0')}`,
    voltage: (1.2952 + (index % 4) * 0.0011).toFixed(4),
    temperature: (32.6 + (index % 5) * 0.15).toFixed(1),
    positive: (1.2939 + (index % 4) * 0.001).toFixed(4),
    negative: (1.2946 + (index % 4) * 0.0009).toFixed(4),
    capacity: (1495.8 + (index % 6) * 0.48).toFixed(1),
    current: (-8170.6 + (index % 5) * 1.7).toFixed(1),
  }
}))
const steps = [
  { no: 1, name: '恒流充电', time: '-', voltage: '0.9000 V', state: '已完成' },
@@ -112,7 +118,7 @@
  ['测试目的', profile.value.purpose], ['备注', '自动采集,异常时通知负责人'],
]
const channels = computed(() => cells.value.map((cell, index) => ({ no: cell.no, cabinet: cell.cabinet, cabinetState: index === 2 && profile.value.abnormal ? '异常' : '在线', channel: cell.channel, collector: `采集器 COL-${String(Math.floor(index / 4) + 1).padStart(2, '0')}`, collectorState: '在线', temperature: `温度通道 ${index + 1}`, positive: `正电位通道 ${index + 1}`, negative: `负电位通道 ${index + 1}` })))
const channels = computed(() => cells.value.map((cell, index) => ({ no: cell.no, cabinet: cell.cabinet, cabinetState: index === 2 && profile.value.abnormal ? '异常' : '在线', channel: cell.channel, collector: backendDetail.value?.batteries[index]?.collectorName || `采集器 COL-${String(Math.floor(index / 4) + 1).padStart(2, '0')}`, collectorState: '在线', temperature: `温度通道 ${index + 1}`, positive: `正电位通道 ${index + 1}`, negative: `负电位通道 ${index + 1}` })))
function togglePause() {
  if (state.value === '已结束' || state.value === '未开始接收') return