import Api from "@/api/product/vendor";
import type { IContentConfig } from "@/components/CURD/types";

const contentConfig: IContentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: true,
  },
  pagination: {
    background: true,
    layout: "prev,pager,next,jumper,total,sizes",
    pageSize: 20,
    pageSizes: [10, 20, 30, 50],
  },
  indexAction: function (params) {
    return Api.getList({
      ...params,
    });
  },
  deleteAction: function (id) {
    return Api.delete(id);
  },
  modifyAction: function (data) {
    return Api.edit(data);
  },
  pk: "id",
  toolbar: [
    {
      icon: "plus",
      text: "新增",
      type: "primary",
      name: "add",
      auth: "import",
    },
  ],
  defaultToolbar: ["refresh", "filter", "search"],
  cols: [
    // { type: "selection", width: 50, align: "center" },
    {
      label: "供应商",
      align: "center",
      prop: "name",
    },
    {
      label: "联系人",
      align: "center",
      prop: "contactName",
    },
    {
      label: "联系人电话",
      align: "center",
      prop: "telephone",
    },
    {
      label: "地址",
      align: "center",
      prop: "address",
    },
    {
      label: "备注",
      align: "center",
      prop: "remark",
    },
    {
      label: "创建时间",
      align: "center",
      prop: "createTime",
    },
    // {
    //   label: "状态",
    //   align: "center",
    //   prop: "status",
    //   templet: 'custom',
    //   slotName: 'switch'
    // },

    {
      label: "操作",
      align: "center",
      fixed: "right",
      width: 280,
      templet: "tool",
      operat: [{ text: "编辑", icon: 'edit', name: "edit" }, { text: "删除", icon: 'delete', type: 'danger', name: "delete" }],
    },
  ],
};

export default contentConfig;
