export default function useColumns() {

  const SearchColumns = [
    {
      item: { key: "status", title: "单据状态" },
      attr: {
        is: "el-select",
        dictName: "sys_status",
        clearable: true,
      },
    },
    {
      item: { key: "code", title: "单据编号" },
      attr: {
        is: "el-input",
        clearable: true,
      },
    },
    {
      item: { key: "name", title: "目标名称" },
      attr: {
        is: "el-input",
        clearable: true,
      },
    },
    {
      item: { key: "dateRange", title: "单据日期" },
      attr: {
        is: "el-date-picker",
        type: "daterange",
        rangeSeparator: "-",
        startPlaceholder: "开始",
        endPlaceholder: "结束",
        valueFormat: "yyyy-MM-dd",
        clearable: true,
      },
    },
    {
      item: { key: "templateName", title: "模板" },
      attr: {
        is: "el-popover-select-v2",
        referName: "MK_TARGET_TEMPLATE_PARAM",
        valueKey: "name",
        dataMapping: {
          template: 'id',
          templateName: 'name',
        },
        clearable: true,
      },
    },

  ];

  const TableColumns = [
    {
      item: { key: "code", title: "单据编号" },
      attr: {},
    },
    {
      item: { key: "date", title: "单据日期", width: 100, },
      attr: {},
    },
    {
      item: { key: "name", title: "目标名称" },
      attr: {},
    },
    {
      item: { key: "status", title: "状态", width: 100, },
      attr: {
        is: "el-dict-tag",
        dictName: "sys_status",
      },
    },
    {
      item: { key: "year", title: "年度", width: 60, },
      attr: {},
    },
    {
      item: { key: "name", title: "模板" },
      attr: {},
    },
    {
      item: { key: "startTime", title: "开始日期", width: 100, },
      attr: {},
    },
    {
      item: { key: "deadlineTime", title: "结束日期", width: 100, },
      attr: {},
    },
    {
      item: { key: "cycle", title: "周期", width: 100, },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_periodic_unit",
      },
    },
    {
      item: { key: "dimensionalitys", title: "维度" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_dimensionality",
      },
    },
    {
      item: { key: "indexs", title: "指标" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_index_type",
      },
    },
    {
      item: { key: "createByName", title: "创建人", width: 100, },
      attr: {},
    },
    {
      item: { key: "createTime", title: "创建时间" },
      attr: {},
    },
    {
      item: { key: "updateByName", title: "修改人", width: 100, },
      attr: {},
    },
    {
      item: { key: "updateTime", title: "修改时间" },
      attr: {},
    },

    // {
    //   item: { key: "", title: "" },
    //   attr: {},
    // },
  ].map(({ item, attr }) => ({
    attr,
    item: {
      ...item,
      sortabled: true,
      fixedabled: true,
      filterabled: true,
      hiddenabled: true,
    },
  }));
  return { SearchColumns, TableColumns }
}