import request from '@/config/axios'

// 供应商 VO
export interface SupplierVO {
  id: number // 主键ID
  supplierName: string // 供应商名称
  supplierCode: string // 供应商编码
}

// 供应商 API
export const SupplierApi = {
  // 查询供应商分页
  getSupplierPage: async (params: any) => {
    return await request.get({ url: `/contract/supplier/page`, params })
  },

  // 查询供应商详情
  getSupplier: async (id: number) => {
    return await request.get({ url: `/contract/supplier/get?id=` + id })
  },

  // 新增供应商
  createSupplier: async (data: SupplierVO) => {
    return await request.post({ url: `/contract/supplier/create`, data })
  },

  // 修改供应商
  updateSupplier: async (data: SupplierVO) => {
    return await request.put({ url: `/contract/supplier/update`, data })
  },

  // 删除供应商
  deleteSupplier: async (id: number) => {
    return await request.delete({ url: `/contract/supplier/delete?id=` + id })
  },

  // 导出供应商 Excel
  exportSupplier: async (params) => {
    return await request.download({ url: `/contract/supplier/export-excel`, params })
  }
}