|
|
@ -248,20 +248,27 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async parseAndExtractData(type, val, name) { |
|
|
|
async parseAndExtractData(type, val, name) { |
|
|
|
let templateGenerator |
|
|
|
try { |
|
|
|
switch (type) { |
|
|
|
let templateGenerator |
|
|
|
case 'file': |
|
|
|
this.templateData = null |
|
|
|
templateGenerator = new ExcelTemplateAdapter(name, val, this.parserConfig) |
|
|
|
this.importData = null |
|
|
|
break |
|
|
|
switch (type) { |
|
|
|
case 'url': |
|
|
|
case 'file': |
|
|
|
templateGenerator = new ExcelUrlTemplateAdapter(val, this.$store, this.parserConfig) |
|
|
|
templateGenerator = new ExcelTemplateAdapter(name, val, this.parserConfig) |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
case 'url': |
|
|
|
|
|
|
|
templateGenerator = new ExcelUrlTemplateAdapter(val, this.$store, this.parserConfig) |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await templateGenerator.init() |
|
|
|
|
|
|
|
templateGenerator.parse() |
|
|
|
|
|
|
|
this.templateData = templateGenerator.getTemplate() |
|
|
|
|
|
|
|
this.importData = templateGenerator.getData() |
|
|
|
|
|
|
|
this.templateEditorModal = true |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
console.log(e) |
|
|
|
|
|
|
|
this.$toast.error(e.message).goAway(3000) |
|
|
|
} |
|
|
|
} |
|
|
|
await templateGenerator.init() |
|
|
|
|
|
|
|
templateGenerator.parse() |
|
|
|
|
|
|
|
this.templateData = templateGenerator.getTemplate() |
|
|
|
|
|
|
|
this.importData = templateGenerator.getData() |
|
|
|
|
|
|
|
this.templateEditorModal = true |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
dropHandler(ev) { |
|
|
|
dropHandler(ev) { |
|
|
|