import { ref } from "vue";
import dayjs from "dayjs";
import { statusList } 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: "nickname"
    },
    // {
    //   label: "角色",
    //   prop: "role_name"
    // },
    {
      label: "用户名称",
      prop: "username"
    },
    {
      label: "状态",
      prop: "status",
      minWidth: 80,
      cellRenderer: ({ row, props }) => (
        <el-tag
          size="small"
          type={
            (statusList.find(item => item.value == row.status + "") || {})
              .type || "info"
          }
          effect="plain"
        >
          {(statusList.find(item => item.value == row.status + "") || {})
            .label || "--"}
        </el-tag>
      )
    },
    {
      label: "创建时间",
      width: 160,
      prop: "addtime",
      formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
    },
    {
      label: "操作",
      fixed: "right",
      width: 145,
      slot: "operation"
    }
  ]);

  return {
    columns
  };
}
