import { ContentConfig } from "/@/components/PageContent";
import { httpList, httpAdd } from "/@/api/operate/batchCreatUser";
import { renderStatus, timeInterval } from "/@/utils/column-helper";
import { BATCH_USER_OPTIONS } from "/@/config/status";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },

  {
    prop: "id",
    label: "ID",
    width: "90px"
  },
  {
    prop: "status",
    label: "状态",
    ...renderStatus(BATCH_USER_OPTIONS),
    width: "100px"
  },
  {
    prop: "company_title",
    label: "公司名称",
    minWidth: "150px"
  },

  {
    prop: "card_title",
    label: "卡类型",
    width: "120px"
  },
  {
    prop: "contacts",
    label: "字母段-年份段",
    ...timeInterval(["username_prefix", "username_year"], "-"),

    width: "120px"
  },
  {
    prop: "starttime",
    label: "有效日期",
    ...timeInterval(["starttime", "expiretime"], "~"),
    width: "200px"
  },

  {
    prop: "addtime",
    label: "创建时间",
    sortable: true,
    width: "160px"
  },

  {
    label: "操作",
    fixed: "right",
    width: 60,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "批量创建账号",
  columns,
  apis: {
    httpAdd,
    httpList
  }
};

export default contentConfig;
