import { ref } from "vue";
import dayjs from "dayjs";
import { statusList } from "/@/utils/status";
export function useColumns() {
  const columns = ref([
    {
      label: "编号",
      prop: "id"
    },
    {
      label: "名称",
      prop: "action_name"
    },
    {
      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
  };
}
