Hong

파일이동v2

...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 v-for="item in this.$store.getters.folderL" 19 v-for="item in this.$store.getters.folderL"
20 :key="item.title" 20 :key="item.title"
21 :search="search" 21 :search="search"
22 - @click.right="show" 22 + @click.right="show(item.folder_name,$event)"
23 @click.left="moveF(item.folder_name)" 23 @click.left="moveF(item.folder_name)"
24 > 24 >
25 <v-list-item-avatar > 25 <v-list-item-avatar >
...@@ -29,7 +29,26 @@ ...@@ -29,7 +29,26 @@
29 <v-list-item-title v-text="item.folder_name"></v-list-item-title> 29 <v-list-item-title v-text="item.folder_name"></v-list-item-title>
30 </v-list-item-content> 30 </v-list-item-content>
31 31
32 - <v-dialog 32 +
33 +
34 + <v-menu
35 + v-model="showMenu"
36 + :position-x="x"
37 + :position-y="y"
38 + absolute
39 + offset-y
40 + >
41 + <v-list dense>
42 + <v-list-item @click.prevent="dialog2 = !dialog2">
43 + <v-list-item-title>이동</v-list-item-title>
44 + </v-list-item>
45 + <v-list-item @click.prevent="deleteF">
46 + <v-list-item-title>삭제</v-list-item-title>
47 + </v-list-item>
48 + </v-list>
49 + </v-menu>
50 + </v-list-item>
51 +<v-dialog
33 v-model="dialog2" 52 v-model="dialog2"
34 width="500px" 53 width="500px"
35 > 54 >
...@@ -38,48 +57,33 @@ ...@@ -38,48 +57,33 @@
38 Move Folder 57 Move Folder
39 </v-card-title> 58 </v-card-title>
40 <v-container> 59 <v-container>
41 - <v-list-item 60 + <v-list-item-group
42 - v-for="item2 in fMove" 61 + v-for="item2 in folders"
43 - :key="item2.title" 62 + :key="item2.folder_id"
44 - @click.prevent="transferF(item.folder_name, item2.folder_name)"
45 > 63 >
64 + <template v-if="!(item2.folder_name === curfName)">
65 + <v-hover @click.left="transferF(item2.folder_name)">
46 <v-list-item-avatar> 66 <v-list-item-avatar>
47 <v-icon>mdi-folder</v-icon> 67 <v-icon>mdi-folder</v-icon>
48 </v-list-item-avatar> 68 </v-list-item-avatar>
49 <v-list-item-content> 69 <v-list-item-content>
50 <v-list-item-title v-text="item2.folder_name"></v-list-item-title> 70 <v-list-item-title v-text="item2.folder_name"></v-list-item-title>
51 </v-list-item-content> 71 </v-list-item-content>
52 - </v-list-item> 72 + </v-hover>
73 + </template>
74 + <!-- <template v-else></template> -->
75 + </v-list-item-group>
53 </v-container> 76 </v-container>
54 <v-card-actions> 77 <v-card-actions>
55 <v-spacer></v-spacer> 78 <v-spacer></v-spacer>
56 <v-btn 79 <v-btn
57 text 80 text
58 color="primary" 81 color="primary"
59 - @click="initfMove" 82 + @click="cancelMove"
60 >Cancel</v-btn> 83 >Cancel</v-btn>
61 </v-card-actions> 84 </v-card-actions>
62 </v-card> 85 </v-card>
63 </v-dialog> 86 </v-dialog>
64 -
65 - <v-menu
66 - v-model="showMenu"
67 - :position-x="x"
68 - :position-y="y"
69 - absolute
70 - offset-y
71 - >
72 - <v-list dense>
73 - <v-list-item @click.prevent="moveW(item.folder_name)">
74 - <v-list-item-title>이동</v-list-item-title>
75 - </v-list-item>
76 - <v-list-item @click.prevent="deleteF(item.folder_name)">
77 - <v-list-item-title>삭제</v-list-item-title>
78 - </v-list-item>
79 - </v-list>
80 - </v-menu>
81 - </v-list-item>
82 -
83 <v-divider inset></v-divider> 87 <v-divider inset></v-divider>
84 <v-subheader inset>Files</v-subheader> 88 <v-subheader inset>Files</v-subheader>
85 <v-list-item 89 <v-list-item
...@@ -143,7 +147,6 @@ ...@@ -143,7 +147,6 @@
143 > 147 >
144 <v-icon>mdi-plus</v-icon> 148 <v-icon>mdi-plus</v-icon>
145 </v-btn> 149 </v-btn>
146 -
147 <v-dialog 150 <v-dialog
148 v-model="dialog" 151 v-model="dialog"
149 width="500px" 152 width="500px"
...@@ -181,9 +184,9 @@ import Axios from 'axios'; ...@@ -181,9 +184,9 @@ import Axios from 'axios';
181 data() { 184 data() {
182 return { 185 return {
183 foldername:'', 186 foldername:'',
187 + curfName:'',
184 folders: [], 188 folders: [],
185 files: [], 189 files: [],
186 - fMove:[],
187 search:'', 190 search:'',
188 id: '', 191 id: '',
189 dialog:false, 192 dialog:false,
...@@ -216,6 +219,10 @@ import Axios from 'axios'; ...@@ -216,6 +219,10 @@ import Axios from 'axios';
216 initFolderName(){ 219 initFolderName(){
217 this.foldername = ''; 220 this.foldername = '';
218 }, 221 },
222 + cancelMove(){
223 + this.curfName = '';
224 + this.dialog2 = false;
225 + },
219 async makeF(){ 226 async makeF(){
220 try { 227 try {
221 const folderData = { 228 const folderData = {
...@@ -270,12 +277,12 @@ import Axios from 'axios'; ...@@ -270,12 +277,12 @@ import Axios from 'axios';
270 console.log(error.response.data); 277 console.log(error.response.data);
271 } 278 }
272 }, 279 },
273 - async deleteF(folderName){ 280 + async deleteF(){
274 try { 281 try {
275 const cData = { 282 const cData = {
276 id: this.$store.state.id, 283 id: this.$store.state.id,
277 cur : this.$store.state.cur, 284 cur : this.$store.state.cur,
278 - folder_name: folderName 285 + folder_name: this.curfName
279 } 286 }
280 const response = await deleteFolder(cData); 287 const response = await deleteFolder(cData);
281 console.log(response); 288 console.log(response);
...@@ -284,16 +291,18 @@ import Axios from 'axios'; ...@@ -284,16 +291,18 @@ import Axios from 'axios';
284 } catch (error) { 291 } catch (error) {
285 console.log("에러"); 292 console.log("에러");
286 console.log(error.response.data); 293 console.log(error.response.data);
287 - } 294 + } finally{
295 + this.curfName = '';
296 + }
288 }, 297 },
289 - async transferF(folderName1, folderName2){ 298 + async transferF(folderName){
290 try { 299 try {
291 const cData = { 300 const cData = {
292 id: this.$store.state.id, 301 id: this.$store.state.id,
293 cur : this.$store.state.cur, 302 cur : this.$store.state.cur,
294 - folder_name: folderName1, 303 + folder_name: this.curfName,
295 isfolder: true, 304 isfolder: true,
296 - newPath: this.$store.state.cur + folderName2 305 + newPath: this.$store.state.cur + folderName + '/'
297 } 306 }
298 const response = await moveFolder(cData); 307 const response = await moveFolder(cData);
299 console.log(response); 308 console.log(response);
...@@ -304,30 +313,19 @@ import Axios from 'axios'; ...@@ -304,30 +313,19 @@ import Axios from 'axios';
304 console.log(error.response.data); 313 console.log(error.response.data);
305 } finally{ 314 } finally{
306 this.initFolderName(); 315 this.initFolderName();
316 + this.curfName = '';
307 this.dialog2 = false; 317 this.dialog2 = false;
308 } 318 }
309 }, 319 },
310 - show (e) { 320 + show (folderN, e) {
311 e.preventDefault() 321 e.preventDefault()
322 + this.curfName = folderN;
312 this.showMenu = false 323 this.showMenu = false
313 this.x = e.clientX 324 this.x = e.clientX
314 this.y = e.clientY 325 this.y = e.clientY
315 this.$nextTick(() => { 326 this.$nextTick(() => {
316 this.showMenu = true 327 this.showMenu = true
317 }) 328 })
318 - },
319 - moveW(fName){
320 - for(let i of this.folders){
321 - if(i.folder_name !==fName){
322 - this.fMove.push(i);
323 - }
324 - }
325 - this.dialog2 = !this.dialog2;
326 - console.log(fName);
327 - },
328 - initfMove(){
329 - this.fMove = [];
330 - this.dialog2 = !this.dialog2;
331 } 329 }
332 } 330 }
333 } 331 }
......