import { ContentConfig } from "/@/components/PageContent";
import {
  httpList,
  httpAdd,
  httpUpdate,
  httpStatus,
  httpDelete
} from "/@/api/interest/role";
import { renderStatus } from "/@/utils/column-helper";
import { STATUS_OPTIONS, LEVEL_OPTIONS } from "/@/config/status";

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

  {
    label: "角色名称",
    prop: "name"
  },

  {
    label: "状态",
    prop: "status",
    ...renderStatus(STATUS_OPTIONS)
    
  },
  {
    label: "角色等级",
    prop: "level",
    ...renderStatus(LEVEL_OPTIONS)
  },

  {
    label: "创建时间",
    width: 160,
    prop: "addtime"
  },
  {
    label: "操作",
    fixed: "right",
    width: 160,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "角色管理",
  columns,
  apis: {
    httpAdd,
    httpList,
    httpUpdate,
    httpStatus,
    httpDelete
  }
};

export default contentConfig;
