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