import request from '@/config/axios'

// 供应商联系记录 VO
export interface ConnectRecordVO {
  id: number // 主键
  supplierId: number // 供应商id
  supplierName: string
  userId: number // 我方联系人id
  username: string // 我方联系人姓名
  contactId: number // 供应商联系人id
  contactName: string // 供应商联系人姓名
  reason: string // 联系原因
  content: string // 交流内容
  urls: string // 附件
}

// 供应商联系记录 API
export const ConnectRecordApi = {
  // 查询供应商联系记录分页
  getConnectRecordPage: async (params: any) => {
    return await request.get({ url: `/supplier/connect-record/page`, params })
  },

  // 查询供应商联系记录详情
  getConnectRecord: async (id: number) => {
    return await request.get({ url: `/supplier/connect-record/get?id=` + id })
  },

  // 新增供应商联系记录
  createConnectRecord: async (data: ConnectRecordVO) => {
    return await request.post({ url: `/supplier/connect-record/create`, data })
  },

  // 修改供应商联系记录
  updateConnectRecord: async (data: ConnectRecordVO) => {
    return await request.put({ url: `/supplier/connect-record/update`, data })
  },

  // 删除供应商联系记录
  deleteConnectRecord: async (id: number) => {
    return await request.delete({ url: `/supplier/connect-record/delete?id=` + id })
  },

  // 导出供应商联系记录 Excel
  exportConnectRecord: async (params) => {
    return await request.download({ url: `/supplier/connect-record/export-excel`, params })
  },
}
