Files
controller-wisetopvue/src/components/analysis/replay/toolbox/DownloadFile.vue
T
2022-03-04 16:38:49 +08:00

61 lines
1.5 KiB
Vue

<template>
<div>
<va-button flat small color="gray" icon="fa fa-download" @click.stop="downloadFile()"/>
</div>
</template>
<script>
// import { download } from '@/data/download/Download'
// import { exportData } from '@/data/export/export'
import api from '@/data/api/index'
import { mapFields } from 'vuex-map-fields'
export default {
name: 'download-file',
components: {
},
props: {
},
created () {
},
data () {
return {
}
},
computed: {
...mapFields('replay', [
'metaList',
]),
},
watch: {
},
methods: {
downloadFile: async function () {
const href = location.href.split('/')[2]
const connectCheck = await api.connection.check()
for (let i = 0; i < this.metaList.length; i++) {
const meta = this.metaList[i]
if (meta.device.library_name.indexOf('Elite') >= 0) {
if (connectCheck.status === 200) {
window.open('http://' + href + '/#/download/online/excel/' + meta.id)
} else {
window.open('http://' + href + '/#/download/offline/excel/' + meta.id)
}
} else if (meta.device.library_name.indexOf('Neulive') >= 0) {
if (connectCheck.status === 200) {
window.open('http://' + href + '/#/download/online/csv-edf/' + meta.id)
} else {
window.open('http://' + href + '/#/download/offline/csv-edf/' + meta.id)
}
}
}
},
},
mounted () {
},
destroyed () {
},
}
</script>