Commit a51fe745 authored by renjintao's avatar renjintao

changeExcel

parent 51a0cf28
......@@ -27,6 +27,8 @@ export default {
rows: 10,
placeholder: "请从Excel复制一段表格数据,粘贴在这里",
},
columnsImport: [],
excelData: []
};
},
......@@ -77,6 +79,39 @@ export default {
}
}
},
//粘贴excel成功
handleSuccess(tableData) {
//初始化数据
this.excelData = [];
this.excelDataBack = [];
this.columnsImport = [];
this.sheetNames = [];
this.pageType = undefined;
//处理colum和data
let tabColum = tableData.columns
let tabData = tableData.data
let arrData = []
tabData.forEach(ele => {
let objData = {}
tabColum.forEach(el => {
objData[el.title] = ele[el.key]
})
arrData.push(objData)
})
//处理title和key一致
tabColum.forEach(el => {
el.key = el.title
})
this.columnsImport = tabColum;
this.excelData = arrData;
this.excelDataBack = arrData;
},
//粘贴excel失败
handleError(tableData, errorIndex) {
//console.log(tableData, errorIndex);
this.$Message.error("表格数据有误");
},
//粘贴excel相关end
l(key) {
key = "import_center" + "." + key;
return this.$t(key);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment