// 导出表格数据
import ExportJsonExcel from "js-export-excel";
/**
 * 导出excel
 * @param {导出的表头名信息} tHeader
 * @param {导出的表头字段名，需要导出表格字段名} filterVal
 * @param {导出数据} list
 * @param {导出文件名称} fileName
 */
export const exportExcel = (tHeader, filterVal, list, fileName) => {
  let option = {
    fileName,
    datas: [
      {
        sheetData: list,
        sheetName: "sheet",
        sheetFilter: filterVal,
        sheetHeader: tHeader,
        // columnWidths: columnWidths, // 列宽
      },
    ],
  };
  let toExcel = new ExportJsonExcel(option);
  toExcel.saveExcel(); //保存
};
