accessList.vue
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template lang="html">
<v-flex>
<v-toolbar flat>
<v-toolbar-title>빠른 액세스</v-toolbar-title>
</v-toolbar>
<v-simple-table>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">File ID</th>
<th class="text-left">Name</th>
<th class="text-left">Dir</th>
<th class="text-left">Date</th>
</tr>
</thead>
<tbody>
<tr v-for="item in recent_list" :key="item.name" @click.right="
showMenuF=true; x=$event.clientX; y=$event.clientY; download_file(item.file_name, item.location); "
@contextmenu.prevent>
<td>{{ item.file_id }}</td>
<td>{{ item.file_name }}</td>
<td>{{ item.location }}</td>
<td>{{ item.date }}</td>
</tr>
</tbody>
</template>
</v-simple-table>
<v-divider></v-divider>
<v-menu
v-model="showMenuF"
:position-x="x"
:position-y="y"
absolute
offset-y
>
<v-list dense>
<a :href="currentDLpath">
<v-list-item >
<v-list-item-icon>
<v-icon>mdi-download</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>다운로드</v-list-item-title>
</v-list-item-content>
</v-list-item>
</a>
</v-list>
</v-menu>
<v-dialog
v-model="dialog"
max-width="290"
>
<v-card>
<v-card-title class="headline">알림</v-card-title>
<v-card-text>
다운로드에 성공했습니다!
</v-card-text>
</v-card>
</v-dialog>
</v-flex>
</template>
<script>
import { accessedList, downloadFile } from '../api/index';
import Axios from 'axios';
export default {
data() {
return {
recent_list: [],
dialog :false,
showMenuF : false,
currentDLpath :null,
x:0,
y:0
};
},
async created() {
try {
const curData = {
id: this.$store.state.id,
};
console.log(curData);
const list_reponse = await accessedList(curData);
this.$store.commit('setRecentList', list_reponse.data);
this.recent_list = this.$store.getters.recentL;
console.log(this.$store.getters.recentL);
} catch (error) {
console.log('에러');
console.log(error);
}
},
methods: {
showF(fileObj, e) {
e.preventDefault();
this.showMenuF = false;
this.x = e.clientX;
this.y = e.clientY;
this.$nextTick(() => {
this.showMenuF = true;
});
console.log(this.showMenuF);
},
async download_file(name, dir) {
try {
const currentData = {
fileName: name,
id: this.$store.state.id,
cur: dir
};
const result = await downloadFile(currentData);
this.currentDLpath = result.data;
console.log(this.currentDLpath);
} catch (error) {
console.log('에러');
console.log(error);
}
},
},
};
</script>
<style lang="css" scoped></style>