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> = {
  flag: "标志位",
  processFlag: "加工标志",
  qualifiedFlag: "良品标志",
  barcode: "二维码",
  pressure1: "压力1",
  height1: "高度1",
  value19Dcr: "数値19#Dcr",
  value39LcrLs: "数値39#LcrLs",
  value49LcrQ: "数値49#LcrQ",
  value79IrR: "数値79#IrR",
  value89IrI: "数値89#IrI",
  skeletonCcdCheck: "骨架Ccd检查结果",
  assemblyCcdCheck: "组立Ccd检查结果",
  reserve1: "补充字段1",
  reserve2: "补充字段2",
  recordTime: "记录数据的时间",
  createTime: "创建时间",
  createBy: "创建人",
  updateTime: "修改时间",
  updateBy: "修改人",
} as const;

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