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> = {
  processInfoId: "加工信息ID",
  pltNo: "PLT No",
  processF1: "加工F1",
  processF2: "加工F2",
  goodProductF1: "良品F1",
  goodProductF2: "良品F2",
  electricalResult: "电气检测结果",
  engraveResult: "印字检测结果",
  qrCode: "二维码",
  qrCodeLevel: "二维码等级",
  pressure15Riveting: "压力1_5#_铆接",
  height15Riveting: "高度1_5#_铆接",
  pressure25Magnet1: "压力2_5#_磁石1",
  height25Magnet1: "高度2_5#_磁石1",
  pressure36Magnet2: "压力3_6#_磁石2",
  height36Magnet2: "高度3_6#_磁石2",
  torque47AxisInsert: "扭矩4_7#_轴旋入",
  height47AxisInsert: "高度4_7#_轴旋入",
  pressure58LowerCase: "压力5_8#_下壳装入",
  height58LowerCase: "高度5_8#_下壳装入",
  pressure69UpperCase: "压力6_9#_上壳装入",
  height69UpperCase: "高度6_9#_上壳装入",
  height79HeightCheck: "高度7_9#_高度检测",
  pressure79Laser: "压力7_9#_激光",
  height89Laser: "高度8_9#_激光",
  value19DcrUpper: "数値1_9#_DCR(上)",
  value29DcrLower: "数値2_9#_DCR(下)",
  value39LcrUpperLs: "数値3_9#_LCR(上)LS",
  value49LcrLowerQ: "数値4_9#_LCR(下)Q",
  value59LcrLowerLs: "数値5_9#_LCR(下)LS",
  value69LcrLowerQ: "数値6_9#_LCR(下)Q",
  value79IrR: "数値7_9#_IR R",
  value89IrI: "数値8_9#_IR I",
  createTime: "创建时间"
} as const;

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