export default function useColumns() {
  const FormColumns = [
    {
      item: { key: "year", title: "年份", required: true, },
      attr: {
        is: "el-date-picker",
        type: "year",
        valueFormat: "yyyy-MM-dd",
        clearable: true,
      },
    },
    {
      item: { key: "name", title: "模板名称", required: true, },
      attr: {
        is: "el-input",
        clearable: true,
      },
    },
    {
      item: { key: "startTime", title: "开始日期", required: true, },
      attr: {
        is: "el-date-picker",
        type: "date",
        valueFormat: "yyyy-MM-dd",
        clearable: true,
      },
    },
    {
      item: { key: "deadlineTime", title: "结束日期", required: true, },
      attr: {
        is: "el-date-picker",
        type: "date",
        valueFormat: "yyyy-MM-dd",
        clearable: true,
      },
    },
    {
      item: { key: "cycle", title: "周期", required: true, },
      attr: {
        is: "el-select",
        dictName: "mk_periodic_unit",
      },
    },
    {
      item: { key: "unfold", title: "按列展开" },
      attr: {
        is: "el-select",
        dictName: "mk_expansion_mode",
      },
    },

  ].map(({ item, attr }) => ({
    item: {
      ...item,
      span: item.span || 6,
    },
    attr,
  }));

  const TabColumns = [
    {
      item: {
        key: 'indexs',
        title: '指标',
      },
      attr: {
        value: []
      },
      TableColumns: [
        {
          item: { key: 'target', title: '指标', },
          attr: {
            is: "el-select",
            dictName: "mk_index_type",
          },
        },
      ],
    },
    {
      item: {
        key: 'dimensionalitys',
        title: '维度',
      },
      attr: {
        value: []
      },
      TableColumns: [
        {
          item: { key: 'dimensionality', title: '维度', },
          attr: {
            is: "el-select",
            dictName: "mk_dimensionality",
          },
        },
      ],
    },
    {
      item: {
        key: 'cycles',
        title: '周期',
      },
      attr: {
        value: []
      },
      TableColumns: [
        {
          item: { key: 'name', title: '周期', },
          attr: {
            is: "el-input",
            clearable: true,
          },
        },
        {
          item: { key: 'startTime', title: '开始日期', },
          attr: {
            is: "el-date-picker",
            clearable: true,
            type: "date",
            valueFormat: "yyyy-MM-dd",
          },
        },
        {
          item: { key: 'deadlineTime', title: '结束日期', },
          attr: {
            is: "el-date-picker",
            clearable: true,
            type: "date",
            valueFormat: "yyyy-MM-dd",
          },
        },
      ],
    },
  ];
  return { FormColumns, TabColumns }
}