批量导入成本

This commit is contained in:
wuteng 2025-11-17 16:46:52 +08:00
parent eceabb1e70
commit a7b061e975

View File

@ -265,18 +265,21 @@ export default {
// const header = this.getHeaderRow(worksheet) // 标题
const results = XLSX.utils.sheet_to_json(worksheet)
// 标题头
that.dynamicCol=[];
for (var key in results[0]) {
that.dynamicCol.push(
{
label:key,
prop:key
}
);
that.dynamicCol = [];
const keysSet = new Set(); // 用Set存储key,自动去重
// 遍历所有results中的对象
for (const item of results) {
// 遍历当前对象的每个key
for (const key in item) {
// 添加到Set(重复的key会被自动忽略)
keysSet.add(key);
}
}
// 将Set转换为数组,并映射为目标格式
that.dynamicCol = Array.from(keysSet).map(key => ({
label: key,
prop: key
}));
// 转换费用类型
that.feeItemMap=new Map();;
for(let i=0;i<that.dict.type.emis_cost_fee_type.length;i++){