import type { TableColumnType, TableColumnsType } from "ant-design-vue";

const INDEX_COLUMN: TableColumnType = {
  key: "index",
  title: "序号",
  width: 60,
  fixed: true,
  align: "center",
} as const;

// 定义操作列配置
const ACTION_COLUMN: TableColumnType = {
  key: "action",
  title: "操作",
  width: 120,
  ellipsis: true,
  fixed: "right",
  align: "center",
} as const;

// 使用 Record 类型确保键值对的安全性
export const fields: Record<string, string> = {
  productStatus: "产品状态",
  goodFlag: "良品标记",
  processMemory: "加工记忆",
  functionSw: "功能SW",
  axisNumber: "轴号",
  plugTerminalPressure: "插端子压力值",
  plugTerminalHeight: "插端子高度值",
  resistance: "电阻值",
  inductorLs: "电感LS值",
  inductorQ: "电感Q值",
  pressureResistanceR: "耐压R值",
  pressureResistanceI: "耐压I值",
  visualResult: "视觉结果",
  createTime: "创建时间",
} as const;

// 导出完整的列配置
export const columns: TableColumnsType = [
  INDEX_COLUMN,
  ...Object.entries(fields).map(([key, title]) => ({
    key,
    title,
    ellipsis: true,
  })),
  ACTION_COLUMN,
];
