import request from '@/utils/request'

// 查询导入规则列表
export function listSuppliesrole(query) {
  return request({
    url: '/system/suppliesrole/list',
    method: 'get',
    params: query
  })
}

// 查询规则详情列表
export function listSuppliesroledetail(id) {
    return request({
        url: '/system/suppliesrole/lists/' + id,
        method: 'get',
    })
}

// 查询规则详情详细
export function getSuppliesroledetail(id) {
    return request({
        url: '/system/suppliesroledetail/' + id,
        method: 'get'
    })
}

//查询上级ID
export function saveSid() {
  return request({
    url: '/system/suppliesrole/savesid',
    method: 'get'
  })
}

// 查询导入规则详细
export function getSuppliesrole(id) {
  return request({
    url: '/system/suppliesrole/' + id,
    method: 'get'
  })
}

// 新增导入规则
export function addSuppliesrole(data) {
  return request({
    url: '/system/suppliesrole',
    method: 'post',
    data: data
  })
}

// 修改导入规则
export function updateSuppliesrole(data) {
  return request({
    url: '/system/suppliesrole',
    method: 'put',
    data: data
  })
}

// 修改规则详情
export function updateSuppliesroledetail(id) {
    return request({
        url: '/system/suppliesroledetail/edit' + id,
        method: 'put',
    })
}

// 删除导入规则
export function delSuppliesrole(id) {
  return request({
    url: '/system/suppliesrole/' + id,
    method: 'delete'
  })
}

// 导出导入规则
export function exportSuppliesrole(query) {
  return request({
    url: '/system/suppliesrole/export',
    method: 'get',
    params: query
  })
}

//启用
export function toggleEnable(id) {
    return request({
        url: `/system/suppliesrole/${id}/enable?status=0`,
        method: 'put',
    })
}

//禁用
export function toggleDisable(id) {
    return request({
        url: `/system/suppliesrole/${id}/disable?status=1`,
        method: 'put',
    })
}

//发布
export function releaseRoleStatus(ids,tempids) {
    return request({
        url: '/system/suppliesrole/releaseRS/' + ids+'/' + tempids,
        method: 'get',
    })
}

//下架
export function offShelfRoleStatus(ids) {
    return request({
        url: '/system/suppliesrole/offShelfRS/' + ids,
        method: 'get',

    })
}
