import { httpList, httpStatus } from "/@/api/serviceParam/supplier";

import { h } from "vue";
import dayjs from "dayjs";
import { ContentConfig } from "/@/components/PageContent";
import { ElImage, ElTag } from "element-plus";
import { renderIconLabelLeft } from "/@/utils/columnRenderHelper";
import { isUpgradeOptions, orcStatusOptions, statusOptions } from "./_options";

const columns = [
  {
    prop: "code",
    label: "编号",
    minWidth: "160",
  },
  {
    prop: "name",
    label: "供应商名称",
    minWidth: "200",
  },
  {
    prop: "status",
    label: "状态",
    minWidth: "60",
    cellRenderer({ row }){
      return h(ElTag,{
        type:  statusOptions.find(({ value }) => value === row.status)?.type || 'info'
      },{
        default:() => statusOptions.find(({ value }) => value === row.status)?.label || '--'        
      })
    }
  },
  {
    prop: "ocr_status",
    label: "营业执照识别状态",
    width: "120",
    cellRenderer({ row }){
      return h(ElTag,{
        type:  orcStatusOptions.find(({ value }) => value === row.ocr_status)?.type || 'info'
      },{
        default:() => orcStatusOptions.find(({ value }) => value === row.ocr_status)?.label || '--'        
      })
    }
  },
  {
    prop: "is_upgrade",
    label: "是否升级为业务公司",
    width: "130",
    cellRenderer({ row }){
      return h(ElTag,{
        type:  isUpgradeOptions.find(({ value }) => value === row.is_upgrade)?.type || 'info'
      },{
        default:() => isUpgradeOptions.find(({ value }) => value === row.is_upgrade)?.label || '--'        
      })
    }
  },
  {
    prop: "legaler",
    label: "法人",
    minWidth: "80",
  },
  {
    prop: "person",
    label: "负责人",
    minWidth: "100",
  },
  {
    prop: "creater",
    label: "创建人",
    minWidth: "80",
  },
  {
    prop: "addtime",
    label: "创建时间",
    width: "145",
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "140px",
    _noset_: true,
    slot: "operation",
  },
];

const contentConfig: ContentConfig = {
  title: "公司账号角色查询",
  columns,
  apis: {
    httpList,
    httpAdd: true,
    httpStatus,
    httpUpdate: true
  }
};

export default contentConfig;
