Skip to content

Commit

Permalink
Append export url at the link. #67
Browse files Browse the repository at this point in the history
  • Loading branch information
kelp404 committed Dec 20, 2018
1 parent c6fd710 commit d05fbf0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/pages/index/views/Site.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
class="search-content"
>
<a
:href="exportUrl"
class="btn btn-green-border btn-sm float-right"
v-tooltip.bottom="'將目前頁面或篩選範圍之資料輸出為 CSV 檔並下載'"
@click="exportCsv"
>
下載篩選結果
</a>
Expand Down Expand Up @@ -445,7 +445,6 @@ import ZoomDrag from '../components/ZoomDrag';
import CameraModal from '../components/CameraModal';
import YoutubeEmbed from '../components/YoutubeEmbed';
import IdleTimeoutDialog from '../components/IdleTimeoutDialog';
import downloadCSV from '../../../util/downloadCsv.js';
const project = createNamespacedHelpers('project');
const media = createNamespacedHelpers('media');
Expand Down Expand Up @@ -745,6 +744,13 @@ export default {
...media.mapGetters(['species']),
...cameraLocation.mapGetters(['cameraLocked']),
...media.mapState(['siteData']),
exportUrl() {
return `${process.env.VUE_APP_API_URL}/project/${
this.$route.params.id
}/multimedia-annotations.csv?site=${encodeURIComponent(
this.$route.params.site_id,
)}&subSite=${encodeURIComponent(this.$route.params.subsite_id)}`;
},
//計算目前筆數範圍
currentDataRange() {
const { currentPage, pageSize, siteData } = this;
Expand Down Expand Up @@ -873,9 +879,6 @@ export default {
revision_tokens: this.revision[idx].tokens,
});
},
exportCsv() {
downloadCSV([this.siteData.colHeaders, ...this.sheet.getData()]);
},
fetchCameraLocked() {
this.getCameraLocked({
projectId: this.$route.params.id,
Expand Down

0 comments on commit d05fbf0

Please sign in to comment.