import CONFIG from "@/config";

export default function useColumns() {
  const TableColumns = [
    { item: { key: "year", title: "年度" }, attr: {} },
    { item: { key: "name", title: "模板名称" }, attr: {} },
    { item: { key: "startTime", title: "开始日期" }, attr: {} },
    { item: { key: "deadlineTime", title: "结束日期" }, attr: {} },
    {
      item: { key: "cycle", title: "周期" },
      attr: { is: "el-dict-tag", dictName: "mk_periodic_unit" },
    },
    {
      item: { key: "unfold", title: "按列展开" },
      attr: { is: "el-dict-tag", dictName: "mk_expansion_mode" },
    },
    { item: { key: "createByName", title: "创建人" }, attr: {} },
    { item: { key: "createTime", title: "创建时间" }, attr: {} },
    { item: { key: "updateByName", title: "修改人" }, attr: {} },
    { item: { key: "updateTime", title: "修改时间" }, attr: {} },
  ].map(({ item, attr }) => ({
    attr,
    item: { ...item, hidden: true, fixed: false },
  }));
  const SearchColumns = [
    { item: { key: "year", title: "年度",},attr: {
      is: "el-date-picker",
      type: "year",
      valueFormat: "yyyy-MM-dd",
    }, },
    { item: { key: "name", title: "模板名称"},attr: { is: "el-input" }, },
  ].map(({ item, attr }) => ({
    attr,
    item: { ...item, hidden: true, span: item.span || 6 },
  }));

  return { TableColumns, SearchColumns };
}
