export default function useColumns() {
  const FormColumns = [
    {
      item: { key: "code", title: "单据编号", },
      attr: {
        is: "el-input",
        disabled: true,
      },
    },
    {
      item: { key: "date", title: "单据日期", required: true, },
      attr: {
        is: "el-date-picker",
        type: "date",
        valueFormat: "yyyy-MM-dd",
        clearable: true,

      },
    },
    {
      item: { key: "name", title: "目标名称", required: true, },
      attr: {
        is: "el-input",
      },
    },
    {
      item: { key: "templateName", title: "模板", required: true, },
      attr: {
        is: "el-popover-select-v2",
        referName: "MK_TARGET_TEMPLATE_PARAM",
        valueKey: "name",
        dataMapping: {
          template: 'id',
        }
      },
    },
  ].map(({ item, attr }) => ({
    attr,
    item: {
      ...item,
      span: item.span || 6
    },
  }));

  const DesColumns = [
    {
      item: { key: "year", 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: "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: "unfold", title: "展开方式" },
      attr: {
        is: "el-dict-tag",
        dictName: "mk_expansion_mode",
      },
    },
  ];
  return { FormColumns, DesColumns }
}