import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/jobslink-api/system/produce/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/jobslink-api/system/produce/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/jobslink-api/system/produce/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/jobslink-api/system/produce/submit',
    method: 'post',
    data: row
  })
}

export const grantTree = () => {
  return request({
    url: '/api/jobslink-api/system/menu/grant-produce-tree',
    method: 'get',
  })
}

export const getProduceTree = (produceIds) => {
  return request({
    url: '/api/jobslink-api/system/menu/produce-tree-keys',
    method: 'get',
    params: {
      produceIds,
    }
  })
}

export const grant = (produceIds, menuIds) => {
  return request({
    url: '/api/jobslink-api/system/produce/grant',
    method: 'post',
    params: {
      produceIds,
      menuIds,
    }
  })
}
