import request from '@/utils/request'
import { downFile } from '@/utils/index'

export function exportAiagd(params, filename) {
  var url =
    process.env.VUE_APP_BASE_API +
    request.apiModule.rdfm +
    '/table/export-aiagd' +
    '?fmeaId=' +
    params.fmeaId +
    '&outFlag=2&pageIndex=1&display_nls=1' +
    (params.struId ? '&struId=' + params.struId : '') +
    (params.effectDisplayOption
      ? '&effectDisplayOption=' + params.effectDisplayOption
      : '') +
    (params.causeDisplayOption
      ? '&causeDisplayOption=' + params.causeDisplayOption
      : '') +
    (params.twoLanguage ? '&twoLanguage=' + params.twoLanguage : '')
  downFile(url, filename)
}

export function exportVdan(params, filename) {
  var url =
    process.env.VUE_APP_BASE_API +
    request.apiModule.rdfm +
    '/table/export-vdan' +
    '?fmeaId=' +
    params.fmeaId +
    '&outFlag=2&pageIndex=1&display_nls=1' +
    (params.struId ? '&struId=' + params.struId : '') +
    (params.effectDisplayOption
      ? '&effectDisplayOption=' + params.effectDisplayOption
      : '') +
    (params.causeDisplayOption
      ? '&causeDisplayOption=' + params.causeDisplayOption
      : '') +
    (params.twoLanguage ? '&twoLanguage=' + params.twoLanguage : '')
  downFile(url, filename)
}
