研发图纸文件管理系统-前端项目
longyvfengyun
2023-11-30 84d71524cca35c0f0ddb73f3e8bef7a82703746a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { export_json_to_excel } from "./excel/Export2Excel";
 
function ExportFile(headers, list, name) {
    let tHeader = [];
    let filterVal = [];
    headers.map((item, index) => {
        tHeader.push(item.title);
        filterVal.push(item.dataIndex);
    });
    let excelData = formatJson(filterVal, list);
 
    export_json_to_excel(tHeader, excelData, name);
}
 
function formatJson(filterVal, jsonData) {
    return jsonData.map(v => filterVal.map(j => v[j]));
}
 
export {ExportFile, formatJson, export_json_to_excel};