yeg
2026-09-05 03d8a2efcd7eec1a7afa18dcaf5c1e3dbc0f6531
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { request, type ApiResponse } from './request'
 
export type ConsoleDataType = 'REALTIME' | 'STEP' | 'CYCLE'
export type ConsoleDataOperation = 'EDIT' | 'IMPORT' | 'DELETE'
 
export const consoleImportColumns = {
  REALTIME: { recordNo: '记录编号', batteryNo: '电池号', recordedAt: '设备时间', cycleNo: '循环序号', stepNo: '工步序号', stepName: '工步名称', sequenceId: '记录序号', voltage: '电压(V)', current: '电流(A)', capacity: '容量(Ah)', energy: '能量(Wh)', temperature: '温度(℃)', positivePotential: '正电位(V)', negativePotential: '负电位(V)' },
  STEP: { recordNo: '记录编号', batteryNo: '电池号', recordedAt: '设备时间', cycleNo: '循环序号', stepNo: '工步序号', stepName: '工步', stepDuration: '工步时间', capacity: '容量(Ah)', energy: '能量(Wh)', startVoltage: '起始电压(V)', endVoltage: '终止电压(V)', chargePeakVoltage: '充电峰值电压(V)', dischargeValleyVoltage: '放电谷值电压(V)' },
  CYCLE: { recordNo: '记录编号', batteryNo: '电池号', recordedAt: '设备时间', cycleNo: '循环序号', chargeCapacity: '充电容量(Ah)', dischargeCapacity: '放电容量(Ah)', efficiency: '充放电效率(%)', chargeEnergy: '充电能量(Wh)', dischargeEnergy: '放电能量(Wh)' },
} satisfies Record<ConsoleDataType, Record<string, string>>
 
export interface ConsoleDataActionPayload {
  dataType: ConsoleDataType
  operationType: ConsoleDataOperation
  scopeSummary: string
  identitySummary: string
  changesSummary: string | null
  reason: string
  overrides?: Array<{
    stableIdentity: string
    fieldValues: string | null
    deleted: boolean
  }>
}
 
interface ActionResponse extends ApiResponse { actionId: number }
 
export async function submitConsoleDataAction(testId: number, payload: ConsoleDataActionPayload) {
  return request<ActionResponse>(`/system/test/${testId}/console-data/actions`, {
    method: 'POST',
    body: JSON.stringify(payload),
  })
}