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

import { h } from "vue";
import { ContentConfig } from "/@/components/PageContent";
import { ElTag } from "element-plus";

const columns = [
  { type: "selection", fixed: "left", _noset_: true },
  {
    prop: "supplierNo",
    label: "供应商编号",
    minWidth: "140px",
  },
  {
    prop: "supplierName",
    label: "供应商名称",
    minWidth: "140px",
  },
  {
    prop: "cat",
    label: "分类名称",
    minWidth: "120px",
  },
  {
    label: "状态",
    prop: "status",
    width: 100,
    cellRenderer: ({ row }) => {
      return h(ElTag,
        { type: String(row.status) === "1" ? "success" : "danger" },
        { default: () => (String(row.status) === "1" ? "启用" : "禁用") }
      );
    }
  },
  {
    prop: "creater",
    label: "创建人",
    minWidth: "60px",
  },
  {
    prop: "addtime",
    label: "添加时间",
    minWidth: "145px",
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "50px",
    _noset_: true,
    slot: "operation",
  },
];

const contentConfig: ContentConfig = {
  title: "公司账号角色查询",
  columns,
  notPreview: true,
  apis: { httpList, httpStatus: ({ id, status }) => httpStatus({ id: [id], status }), httpAdd: true }
};

export default contentConfig;
