|
@@ -211,7 +211,6 @@ export default (options={}) => { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
export(options={}) { |
|
|
export(options={}) { |
|
|
options.filename = options.filename || _configs.endpoint |
|
|
|
|
|
let _data = this.data() |
|
|
let _data = this.data() |
|
|
|
|
|
|
|
|
if (options.type == 'csv') { |
|
|
if (options.type == 'csv') { |
|
@@ -226,16 +225,25 @@ export default (options={}) => { |
|
|
let blob = new Blob([_data], {type: options.type}) |
|
|
let blob = new Blob([_data], {type: options.type}) |
|
|
let url = URL.createObjectURL(blob) |
|
|
let url = URL.createObjectURL(blob) |
|
|
|
|
|
|
|
|
if (options.timestamp) |
|
|
|
|
|
options.filename = options.filename + (new Date()).toLocaleTimeString(undefined, { |
|
|
|
|
|
year: "numeric", |
|
|
|
|
|
month: "2-digit", |
|
|
|
|
|
day: "2-digit", |
|
|
|
|
|
hour: "2-digit", |
|
|
|
|
|
minute: "2-digit", |
|
|
|
|
|
second: "2-digit", |
|
|
|
|
|
hour12: false |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
options.filename = options.filename || _configs.endpoint |
|
|
|
|
|
if (options.filename_suffix) { |
|
|
|
|
|
if (options.filename_suffix == 'datetime') |
|
|
|
|
|
options.filename = options.filename + (new Date()).toLocaleTimeString(undefined, { |
|
|
|
|
|
year: "numeric", |
|
|
|
|
|
month: "2-digit", |
|
|
|
|
|
day: "2-digit", |
|
|
|
|
|
hour: "2-digit", |
|
|
|
|
|
minute: "2-digit", |
|
|
|
|
|
second: "2-digit", |
|
|
|
|
|
hour12: false |
|
|
|
|
|
}) |
|
|
|
|
|
else if (options.filename_suffix == 'date') |
|
|
|
|
|
options.filename = options.filename + (new Date()).toLocaleDateString(undefined, { |
|
|
|
|
|
year: "numeric", |
|
|
|
|
|
month: "2-digit", |
|
|
|
|
|
day: "2-digit" |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let anchor = document.createElement('a') |
|
|
let anchor = document.createElement('a') |
|
|
anchor.href = url |
|
|
anchor.href = url |
|
|