/**
 * 导出excel的高级版本
 * luobang
 * 2022-05-09 有待进一步优化
 */
// 导出Excel全局组件
export function exportExcelAdvanced(tableTitle, tableColumnData, tableData) {
  let tHeader = []
  let filterVal = []
  tableColumnData.forEach(e => {
    if (tHeader.indexOf(e.label) === -1) {
      tHeader.push(e.label)
    }
    if (filterVal.indexOf(e.prop) === -1) {
      filterVal.push(e.prop)
    }
  })
  // this.downloadLoading = true;
  require.ensure([], () => {
    const { exportJsonToExcel } = require('@/assets/excel/Export2Excel.js')
    let data = tableData.map(v => filterVal.map(j => v[j]))
    exportJsonToExcel(tHeader, data, tableTitle)
  })
}
