import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: request.apiModule.rpfm + '/information',
    method: 'get',
    params: query
  })
}

export function createFMEA(data) {
  return request({
    url: request.apiModule.rpfm + '/information/fmea',
    method: 'post',
    data
  })
}
//查询语言是否翻译完成
export function checkTranslationProgress(query) {
  return request({
    url: request.apiModule.rpfm + '/information/language',
    method: 'get',
    params: query
  })
}
export function updateFMEA(data) {
  return request({
    url: request.apiModule.rpfm + '/information',
    method: 'put',
    data
  })
}
//获取fmea当前显示语言信息
export function getLanguage(fmeaId) {
  return request({
    url: request.apiModule.rpfm + '/information/language/' + fmeaId,
    method: 'get'
  })
}
//基本管理信息，语言下拉框，改变的时候
export function updateLanguage(fmeaId, languageKey) {
  return request({
    url: request.apiModule.rpfm + '/information/language',
    method: 'put',
    data: { fmeaId: fmeaId, languageKey: languageKey }
  })
}
export function deleteFMEA(data) {
  return request({
    url: request.apiModule.rpfm + '/information',
    method: 'delete',
    data: data
  })
}
//翻译多语言
export function postLanguageBase(data) {
  return request({
    url: request.apiModule.rpfm + '/information/translation',
    method: 'post',
    data
  })
}
//获取fmea管理基本信息
export function getBasicInfo(fmeaId) {
  return request({
    url: request.apiModule.rpfm + '/information/info/' + fmeaId,
    method: 'get'
  })
}
//更新fmea管理基本信息
export function updateBasicInfo(data) {
  return request({
    url: request.apiModule.rpfm + '/information',
    method: 'put',
    data
  })
}
// 还原删除的FMea
export function revertFmea(data) {
  return request({
    url: request.apiModule.rpfm + '/information/reduction',
    method: 'put',
    data: data
  })
}

//xml导入
export function xmlImport(data) {
  return request({
    url: request.apiModule.rpfm + '/import/import-xml',
    method: 'upload',
    data
  })
}
