import request from '@/utils/request'

// 查询配件列表
export function listAccessory(query) {
  return request({
    url: '/system/accessory/list',
    method: 'get',
    params: query
  })
}

// 查询配件详细
export function getAccessory(accessoryId) {
  return request({
    url: '/system/accessory/' + accessoryId,
    method: 'get'
  })
}

// 配件状态修改
export function changeAccessoryStatus(accessoryId, status) {
  const data = {
    accessoryId,
    status
  }
  return request({
    url: '/system/accessory/changeStatus',
    method: 'put',
    data: data
  })
}

// 新增配件
export function addAccessory(data) {
  return request({
    url: '/system/accessory',
    method: 'post',
    data: data
  })
}

// 修改配件
export function updateAccessory(data) {
  return request({
    url: '/system/accessory',
    method: 'put',
    data: data
  })
}

// 删除配件
export function delAccessory(accessoryId) {
  return request({
    url: '/system/accessory/' + accessoryId,
    method: 'delete'
  })
}
