export interface RowData {
  id: string
  fromtaskname: string
  approvalnode: string
  states: number
  similarity: string
  fromuptime: string
  updatetime: string
  title: string
}

export interface ColumnEntity {
  title: string
  fixed: boolean// 固定显示，不可隐藏
  key: string
  fixLeft?: boolean// 列固定显示左侧
  width: number
}

// 表格列默认配置
export const ColumnsMap: Recordable<ColumnEntity> = {
  id: {
    title: '任务Id',
    fixed: true,
    fixLeft: true,
    key: 'id',
    width: 100,
  },
  name: {
    title: '任务名称',
    fixed: true,
    key: 'name',
    width: 200,
  },
  approvalnode: {
    title: '审批节点',
    fixed: true,
    key: 'approvalnode',
    width: 100,
  },
  approvalstatus: {
    title: '审批状态',
    fixed: true,
    key: 'approvalstatus',
    width: 100,
  },
  similarity: {
    title: '图片相似度',
    fixed: false,
    key: 'similarity',
    width: 100,
  },
  uptime: {
    title: '提报时间',
    fixed: false,
    key: 'uptime',
    width: 200,

  },
  updatetime: {
    title: '更新时间',
    fixed: false,
    key: 'updatetime',
    width: 200,
  },
}

export const headRules = ['任务Id', '任务名称', '审批节点', '审批状态', '图片相似度', '提报时间', '更新时间']

export function findKey(columns: any[], header: string) {
  const item = columns.find((column) => { return (column as any).title === header })
  return (item as any).key
}
