import { ref } from "vue";
import dayjs from "dayjs";
import { statusList, levelList } from "/@/utils/status";
export function useColumns() {
  const columns = ref([
    {
      type: "selection",
      width: 40,
      align: "center",
      hide: ({ checkList }) => !checkList.includes("勾选列")
    },
    {
      label: "序号",
      type: "index",
      width: 70,
      hide: ({ checkList }) => !checkList.includes("序号列")
    },

    {
      label: "角色名称",
      prop: "role_name"
    },
    {
      label: "业务公司",
      prop: "companyName"
    },
    // {
    //   label: "等级",
    //   prop: "level",
    //   cellRenderer: ({ row, props }) => (
    //     <el-tag
    //       size={props.size}
    //       type={
    //         (levelList.find(item => item.value == row.level + "") || {}).type ||
    //         "info"
    //       }
    //       effect="plain"
    //     >
    //       {(levelList.find(item => item.value == row.level + "") || {}).label ||
    //         "--"}
    //     </el-tag>
    //   )
    // },
    {
      label: "状态",
      prop: "status",
      cellRenderer: ({ row, props }) => (
        <el-tag
          size={props.size}
          type={
            (statusList.find(item => item.value == row.status + "") || {})
              .type || "info"
          }
          effect="plain"
        >
          {(statusList.find(item => item.value == row.status + "") || {})
            .label || "--"}
        </el-tag>
      )
    },

    {
      label: "创建时间",
      prop: "createTime",
      formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
    },
    {
      label: "操作",
      fixed: "right",
      width: 145,
      slot: "operation"
    }
  ]);

  return {
    columns
  };
}
