Merge pull request '批量导入成本' (#143) from master-dev into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-frontend/pulls/143
This commit is contained in:
commit
dcf55e2757
@ -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++){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user