|
@@ -296,30 +296,35 @@ export default {
|
|
|
if (file) {
|
|
|
await new Promise((resolve) => {
|
|
|
luckyexcel.transformExcelToLucky(file, (export_json) => {
|
|
|
- window.luckysheet.destroy();
|
|
|
let name = export_json.info.name;
|
|
|
- let endsWith = name.endsWith(".xlsx") || name.endsWith(".xls");
|
|
|
- if (endsWith){
|
|
|
+ if(!name.endsWith(".xlsx")){
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: '导入失败!只支持.xlsx格式文件',
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ this.fileListName = name;
|
|
|
let lastIndexOf = export_json.info.name.lastIndexOf('.');
|
|
|
name = name.substring(0, lastIndexOf);
|
|
|
- }
|
|
|
- window.luckysheet.create({
|
|
|
- container: "luckysheet",
|
|
|
- lang: "zh",
|
|
|
- showsheetbar: false,
|
|
|
- data:export_json.sheets,
|
|
|
- title:name,
|
|
|
- userInfo:export_json.info.name.creater
|
|
|
+ window.luckysheet.destroy();
|
|
|
+ window.luckysheet.create({
|
|
|
+ container: "luckysheet",
|
|
|
+ lang: "zh",
|
|
|
+ showsheetbar: false,
|
|
|
+ data:export_json.sheets,
|
|
|
+ title:name,
|
|
|
+ userInfo:export_json.info.name.creater
|
|
|
|
|
|
- })
|
|
|
- if (!this.fullscreen){
|
|
|
- let interval = setInterval(()=>{
|
|
|
- let elementById = document.getElementById("luckysheet-icon-morebtn-div");
|
|
|
- if (elementById){
|
|
|
- elementById.style.width = '55%'
|
|
|
- clearInterval(interval)
|
|
|
- }
|
|
|
- },300)
|
|
|
+ })
|
|
|
+ if (!this.fullscreen){
|
|
|
+ let interval = setInterval(()=>{
|
|
|
+ let elementById = document.getElementById("luckysheet-icon-morebtn-div");
|
|
|
+ if (elementById){
|
|
|
+ elementById.style.width = '55%'
|
|
|
+ clearInterval(interval)
|
|
|
+ }
|
|
|
+ },300)
|
|
|
+ }
|
|
|
}
|
|
|
resolve();
|
|
|
});
|
|
@@ -397,7 +402,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async handleChange(response, fileList) {
|
|
|
- this.fileListName = fileList.slice(-1)[0].name;
|
|
|
this.handleCreate({ file: response.raw, type: "file" });
|
|
|
},
|
|
|
handleDownload() {
|