
+++ client/views/component/List/CardViewList.vue
... | ... | @@ -0,0 +1,108 @@ |
1 | +<template> | |
2 | + <div class="mb-30"> | |
3 | + <div class="flex-sp-bw mb-20"> | |
4 | + <div class="resultext"> | |
5 | + <img :src="resulticon" alt=""> | |
6 | + <p>총 <b>{{ count }}개</b>의 {{ helpText }}</p> | |
7 | + </div> | |
8 | + <button type="button" class="gopage" @click="fnMoveTo(routeName, null)">모두보기</button> | |
9 | + </div> | |
10 | + <ul> | |
11 | + <li v-for="(item, idx2) of list" :key="idx2" class="result-box mb-15"> | |
12 | + <div class="main-img"> | |
13 | + <img v-if="item.hasOwnProperty('files') && item.files.length > 0" :src="item.files[0].filePath" alt=""> | |
14 | + <img v-else src="client/resources/images/img6.png" alt=""> | |
15 | + </div> | |
16 | + <div class="text-box"> | |
17 | + <h5>{{ item.sj }}</h5> | |
18 | + <p v-if="name === 'P' || name === 'V'" class="address">{{ item.adres }}</p> | |
19 | + <p class="text">{{ item.cn }}</p> | |
20 | + <div class="mb-20"> | |
21 | + <ul class="category"> | |
22 | + <li v-for="(ctgry, idx3) of item.ctgrys" :key="idx3" class="category1">{{ ctgry.ctgryNm }}</li> | |
23 | + </ul> | |
24 | + </div> | |
25 | + <div class="date"> | |
26 | + <ul> | |
27 | + <li>생산연도 <b>{{ item.prdctnYear }}</b></li> | |
28 | + <li>|</li> | |
29 | + <li>등록일 <b>{{ item.rgsde }}</b></li> | |
30 | + </ul> | |
31 | + </div> | |
32 | + </div> | |
33 | + </li> | |
34 | + </ul> | |
35 | + </div> | |
36 | +</template> | |
37 | +<script> | |
38 | +export default { | |
39 | + name: "CardViewList", | |
40 | + | |
41 | + props: { | |
42 | + name: { | |
43 | + type: String, | |
44 | + default: 'P', | |
45 | + }, | |
46 | + count: { | |
47 | + type: Number, | |
48 | + default: 0, | |
49 | + }, | |
50 | + list: { | |
51 | + type: Array, | |
52 | + default: () => [], | |
53 | + }, | |
54 | + }, | |
55 | + | |
56 | + data() { | |
57 | + return { | |
58 | + }; | |
59 | + }, | |
60 | + | |
61 | + computed: { | |
62 | + helpText() { | |
63 | + switch (this.name) { | |
64 | + case 'P': | |
65 | + return '사진 기록물이 검색되었습니다.'; | |
66 | + case 'V': | |
67 | + return '영상 기록물이 검색되었습니다.'; | |
68 | + case 'M': | |
69 | + return '미디어 영상이 검색되었습니다.'; | |
70 | + case 'N': | |
71 | + return '보도자료가 검색되었습니다.'; | |
72 | + } | |
73 | + }, | |
74 | + routeName() { | |
75 | + switch (this.name) { | |
76 | + case 'P': | |
77 | + return 'PicHistorySearch'; | |
78 | + case 'V': | |
79 | + return '영상 기록물'; | |
80 | + case 'M': | |
81 | + return '미디어 영상'; | |
82 | + case 'N': | |
83 | + return '보도자료'; | |
84 | + } | |
85 | + }, | |
86 | + }, | |
87 | + | |
88 | + created() { }, | |
89 | + mounted() { }, | |
90 | + watch: {}, | |
91 | + methods: { | |
92 | + // 페이지 이동 | |
93 | + fnMoveTo(page, id) { | |
94 | + if (id !== null || id !== '') { | |
95 | + this.$router.push({ name: page, query: { id: id } }); | |
96 | + } else { | |
97 | + this.$router.push({ name: page }); | |
98 | + } | |
99 | + } | |
100 | + }, | |
101 | +}; | |
102 | +</script> | |
103 | +<style scoped> | |
104 | +/* 임시로 추가 */ | |
105 | +.main-img img { | |
106 | + max-width: 320px; | |
107 | +} | |
108 | +</style>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/component/modal/CategorySelectModal.vue
+++ client/views/component/modal/CategorySelectModal.vue
... | ... | @@ -50,17 +50,62 @@ |
50 | 50 |
</div> |
51 | 51 |
</template> |
52 | 52 |
<script> |
53 |
-// 모달 사용 용례 |
|
54 |
-// selectedCtgries: 부모 요소에 저장된 '선택한 카테고리' 목록 |
|
55 |
-// @toggleModal: 모달 열고 닫는 함수 (호출만 해도 됨/열려있는 경우 닫힘, 닫혀있는 경우 열림) |
|
53 |
+import { DoubleLeftOutlined, LeftOutlined, RightOutlined, DoubleRightOutlined } from '@ant-design/icons-vue'; |
|
54 |
+ |
|
56 | 55 |
export default { |
57 | 56 |
name: 'CategorySelectModal', |
57 |
+ components: { |
|
58 |
+ DoubleLeftOutlined, |
|
59 |
+ LeftOutlined, |
|
60 |
+ RightOutlined, |
|
61 |
+ DoubleRightOutlined |
|
62 |
+ }, |
|
58 | 63 |
props: { |
59 | 64 |
selectedCtgries: { |
60 | 65 |
type: Array, |
61 |
- default: [], |
|
66 |
+ default: () => [], |
|
62 | 67 |
} |
63 | 68 |
}, |
64 |
-} |
|
65 |
-</script> |
|
66 |
-<style></style>(파일 끝에 줄바꿈 문자 없음) |
|
69 |
+ data() { |
|
70 |
+ return { |
|
71 |
+ items: [ |
|
72 |
+ { id: 1, category: '카테고리 1', selected: false }, |
|
73 |
+ { id: 2, category: '카테고리 2', selected: false }, |
|
74 |
+ { id: 3, category: '카테고리 3', selected: false }, |
|
75 |
+ ], |
|
76 |
+ searchicon: 'client/resources/images/icon/search.png', |
|
77 |
+ currentPage: 1, |
|
78 |
+ totalPages: 1 |
|
79 |
+ }; |
|
80 |
+ }, |
|
81 |
+ methods: { |
|
82 |
+ closeModal() { |
|
83 |
+ this.$emit('toggleModal'); |
|
84 |
+ }, |
|
85 |
+ registerCategories() { |
|
86 |
+ // 선택된 카테고리 목록 |
|
87 |
+ const selectedCategories = this.items |
|
88 |
+ .filter(item => item.selected) |
|
89 |
+ .map(item => item.category); |
|
90 |
+ |
|
91 |
+ // 선택된 카테고리 ID 목록 |
|
92 |
+ const selectedIds = this.items |
|
93 |
+ .filter(item => item.selected) |
|
94 |
+ .map(item => item.id); |
|
95 |
+ |
|
96 |
+ // 부모 컴포넌트로 전달하고 모달 닫기 |
|
97 |
+ this.$emit('toggleModal', selectedIds); |
|
98 |
+ }, |
|
99 |
+ previousPage() { |
|
100 |
+ if (this.currentPage > 1) { |
|
101 |
+ this.currentPage--; |
|
102 |
+ } |
|
103 |
+ }, |
|
104 |
+ nextPage() { |
|
105 |
+ if (this.currentPage < this.totalPages) { |
|
106 |
+ this.currentPage++; |
|
107 |
+ } |
|
108 |
+ } |
|
109 |
+ } |
|
110 |
+}; |
|
111 |
+</script>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/layout/Header.vue
+++ client/views/layout/Header.vue
... | ... | @@ -1,86 +1,78 @@ |
1 | 1 |
<template> |
2 |
- |
|
3 |
- <header> |
|
4 |
- <div class="header-container w1500"> |
|
5 |
- <div class="logo-wrap"> |
|
6 |
- <router-link :to="{ path: '/' }" class="logo"><img :src="logo" alt=""></router-link> |
|
7 |
- </div> |
|
8 |
- <div class="nav-wrap"> |
|
9 |
- <nav> |
|
10 |
- <ul> |
|
11 |
- <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" |
|
12 |
- @click="updateMenuStats('MENU_00000001')"><router-link :to="{ path: '/' }" >기록물</router-link></li> |
|
13 |
- <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" |
|
14 |
- @click="updateMenuStats('MENU_00000004')"><router-link :to="{ path: '/' }" >언론에서 바라본 구미시</router-link></li> |
|
15 |
- <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" |
|
16 |
- @click="updateMenuStats('MENU_00000007')"><router-link :to="{ path: '/MemberManagement.page' }" >회원관리</router-link></li> |
|
17 |
- <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" |
|
18 |
- @click="updateMenuStats('MENU_00000008')"><router-link :to="{ path: '/CategoryManagement.page' }" >카테고리 관리</router-link></li> |
|
19 |
- |
|
20 |
- <li v-if="$store.state.roles[0]?.authority === 'ROLE_USER'" |
|
21 |
- @click="updateMenuStats('MENU_00000001')">기록물</li> |
|
22 |
- <li v-if="$store.state.roles[0]?.authority === 'ROLE_USER'" |
|
23 |
- @click="updateMenuStats('MENU_00000004')">언론에서 바라본 구미시</li> |
|
24 |
- </ul> |
|
25 |
- </nav> |
|
26 |
- </div> |
|
27 |
- <div class="auth-area"> |
|
28 |
- <ul v-if="$store.state.userId != null"> |
|
29 |
- <li><img src="../../resources/images/icon/user-settings-line.png" alt=""> |
|
30 |
- <router-link :to="{ path: '/MyInfo.page' }">{{ $store.state.userNm }}</router-link> |
|
31 |
- </li> |
|
32 |
- <li> |
|
33 |
- <div class="line"></div> |
|
34 |
- </li> |
|
35 |
- <li><img src="../../resources/images/icon/logout-box-line.png" alt=""> |
|
36 |
- <a href="#" @click.prevent="logout">로그아웃</a> |
|
37 |
- </li> |
|
38 |
- </ul> |
|
39 |
- <a href="#" class="all-menu"><img src="../../resources/images/allmenu.png" alt=""></a> |
|
40 |
- </div> |
|
41 |
- </div> |
|
42 |
- </header> |
|
2 |
+ <header> |
|
3 |
+ <div class="header-container w1500"> |
|
4 |
+ <div class="logo-wrap"> |
|
5 |
+ <router-link :to="{ path: '/' }" class="logo"><img :src="logo" alt=""></router-link> |
|
6 |
+ </div> |
|
7 |
+ <div class="nav-wrap"> |
|
8 |
+ <nav> |
|
9 |
+ <ul> |
|
10 |
+ <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" @click="updateMenuStats('MENU_00000001')"><router-link :to="{ path: '/PicHistorySearch.page' }">기록물</router-link></li> |
|
11 |
+ <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" @click="updateMenuStats('MENU_00000004')"><router-link :to="{ path: '/' }">언론에서 바라본 구미시</router-link></li> |
|
12 |
+ <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" @click="updateMenuStats('MENU_00000007')"><router-link :to="{ path: '/MemberManagement.page' }">회원관리</router-link></li> |
|
13 |
+ <li v-if="$store.state.roles[0]?.authority === 'ROLE_ADMIN'" @click="updateMenuStats('MENU_00000008')"><router-link :to="{ path: '/CategoryManagement.page' }">카테고리 관리</router-link></li> |
|
14 |
+ <li v-if="$store.state.roles[0]?.authority === 'ROLE_USER'" @click="updateMenuStats('MENU_00000001')">기록물</li> |
|
15 |
+ <li v-if="$store.state.roles[0]?.authority === 'ROLE_USER'" @click="updateMenuStats('MENU_00000004')">언론에서 바라본 구미시</li> |
|
16 |
+ </ul> |
|
17 |
+ </nav> |
|
18 |
+ </div> |
|
19 |
+ <div class="auth-area"> |
|
20 |
+ <ul v-if="$store.state.userId != null"> |
|
21 |
+ <li><img src="../../resources/images/icon/user-settings-line.png" alt=""> |
|
22 |
+ <router-link :to="{ path: '/MyInfo.page' }">{{ $store.state.userNm }}</router-link> |
|
23 |
+ </li> |
|
24 |
+ <li> |
|
25 |
+ <div class="line"></div> |
|
26 |
+ </li> |
|
27 |
+ <li><img src="../../resources/images/icon/logout-box-line.png" alt=""> |
|
28 |
+ <a href="#" @click.prevent="logout">로그아웃</a> |
|
29 |
+ </li> |
|
30 |
+ </ul> |
|
31 |
+ <a href="#" class="all-menu"><img src="../../resources/images/allmenu.png" alt=""></a> |
|
32 |
+ </div> |
|
33 |
+ </div> |
|
34 |
+ </header> |
|
43 | 35 |
</template> |
44 | 36 |
<script> |
45 | 37 |
import { logOutProc } from "../../resources/api/user" |
46 | 38 |
import { updateStatsByMenuId } from "../../resources/api/main" |
47 | 39 |
export default { |
48 |
- data() { |
|
49 |
- return { |
|
50 |
- // Define the image sources |
|
51 |
- logo: 'client/resources/images/logo.png', |
|
52 |
- }; |
|
40 |
+ data() { |
|
41 |
+ return { |
|
42 |
+ // Define the image sources |
|
43 |
+ logo: 'client/resources/images/logo.png', |
|
44 |
+ }; |
|
45 |
+ }, |
|
46 |
+ methods: { |
|
47 |
+ async updateMenuStats(menuId) { |
|
48 |
+ try { |
|
49 |
+ const response = await updateStatsByMenuId(menuId); |
|
50 |
+ if (response.status === 200) { |
|
51 |
+ console.log(`메뉴 ID ${menuId} 통계 업데이트 성공`); |
|
52 |
+ } |
|
53 |
+ } catch (error) { |
|
54 |
+ console.error(`메뉴 ID ${menuId} 통계 업데이트 중 오류:`, error); |
|
55 |
+ } |
|
53 | 56 |
}, |
54 |
- methods: { |
|
55 |
- async updateMenuStats(menuId) { |
|
56 |
- try { |
|
57 |
- const response = await updateStatsByMenuId(menuId); |
|
58 |
- if (response.status === 200) { |
|
59 |
- console.log(`메뉴 ID ${menuId} 통계 업데이트 성공`); |
|
60 |
- } |
|
61 |
- } catch (error) { |
|
62 |
- console.error(`메뉴 ID ${menuId} 통계 업데이트 중 오류:`, error); |
|
63 |
- } |
|
64 |
- }, |
|
65 |
- logout() { |
|
66 |
- // 백엔드 로그아웃 API 호출 |
|
67 |
- logOutProc() |
|
68 |
- .then(() => { |
|
69 |
- console.log('로그아웃 성공 - 서버 측 쿠키 삭제 완료'); |
|
70 |
- this.$store.commit('setStoreReset'); // 로그아웃 성공 후 스토어 초기화 |
|
71 |
- this.$router.push({ path: '/Login.page' }); // 로그인 페이지로 리다이렉트 |
|
72 |
- }) |
|
73 |
- .catch(err => { |
|
74 |
- console.error('로그아웃 처리 중 오류:', err); |
|
75 |
- this.$store.commit('setStoreReset'); // 오류가 있어도 스토어는 초기화 |
|
76 |
- this.$router.push({ path: '/Login.page' }); // 로그인 페이지로 리다이렉트 |
|
77 |
- }); |
|
78 |
- }, |
|
79 |
- |
|
57 |
+ logout() { |
|
58 |
+ // 백엔드 로그아웃 API 호출 |
|
59 |
+ logOutProc() |
|
60 |
+ .then(() => { |
|
61 |
+ console.log('로그아웃 성공 - 서버 측 쿠키 삭제 완료'); |
|
62 |
+ this.$store.commit('setStoreReset'); // 로그아웃 성공 후 스토어 초기화 |
|
63 |
+ this.$router.push({ path: '/Login.page' }); // 로그인 페이지로 리다이렉트 |
|
64 |
+ }) |
|
65 |
+ .catch(err => { |
|
66 |
+ console.error('로그아웃 처리 중 오류:', err); |
|
67 |
+ this.$store.commit('setStoreReset'); // 오류가 있어도 스토어는 초기화 |
|
68 |
+ this.$router.push({ path: '/Login.page' }); // 로그인 페이지로 리다이렉트 |
|
69 |
+ }); |
|
80 | 70 |
}, |
81 |
- watch: {}, |
|
82 |
- computed: {}, |
|
83 |
- components: {}, |
|
84 |
- mounted() { }, |
|
71 |
+ |
|
72 |
+ }, |
|
73 |
+ watch: {}, |
|
74 |
+ computed: {}, |
|
75 |
+ components: {}, |
|
76 |
+ mounted() { }, |
|
85 | 77 |
}; |
86 | 78 |
</script>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/AppRouter.js
+++ client/views/pages/AppRouter.js
... | ... | @@ -1,26 +1,29 @@ |
1 | 1 |
import { createWebHistory, createRouter } from "vue-router"; |
2 | 2 |
import store from "./AppStore"; |
3 | 3 |
|
4 |
-// 공통페이지 |
|
4 |
+// 공통 |
|
5 | 5 |
import Login from "./login/Login.vue"; |
6 |
-import MyInfo from "./user/MyInfo.vue"; |
|
7 | 6 |
import Main from "./main/Main.vue"; |
8 | 7 |
import NotFound from "./etc/NotFound.vue"; |
9 |
- |
|
8 |
+// 통합검색 |
|
10 | 9 |
import TotalSearch from "./user/TotalSearch.vue"; |
10 |
+// 사진기록물 |
|
11 | 11 |
import PicHistorySearch from "./user/PicHistorySearch.vue"; |
12 | 12 |
import PicHistoryInsert from "./user/PicHistoryInsert.vue"; |
13 | 13 |
import PicHistoryDetail from "./user/PicHistoryDetail.vue"; |
14 |
+// 보도자료 |
|
14 | 15 |
import BodoDetail from "./user/BodoDetail.vue"; |
15 |
- |
|
16 |
+// 회원관리 |
|
17 |
+import MyInfo from "./user/MyInfo.vue"; |
|
16 | 18 |
import MemberManagement from "./user/MemberManagement.vue"; |
19 |
+// 카테고리관리 |
|
17 | 20 |
import CategoryManagement from "./user/CategoryManagement.vue"; |
18 | 21 |
|
19 | 22 |
|
20 | 23 |
const routes = [ |
21 |
- { path: "/", name: "MainPage", component: Main, meta: { authorization: ['ROLE_ADMIN', 'ROLE_USER']} }, |
|
24 |
+ { path: "/", name: "MainPage", component: Main, meta: { authorization: ['ROLE_ADMIN', 'ROLE_USER'] } }, |
|
22 | 25 |
{ path: "/Login.page", name: "Login", component: Login }, |
23 |
- { path: "/MyInfo.page", name: "MyInfo", component: MyInfo, meta: { authorization: ['ROLE_ADMIN', 'ROLE_USER']} }, |
|
26 |
+ { path: "/MyInfo.page", name: "MyInfo", component: MyInfo, meta: { authorization: ['ROLE_ADMIN', 'ROLE_USER'] } }, |
|
24 | 27 |
{ path: "/notFound.page", name: "NotFoundPage", component: NotFound }, |
25 | 28 |
|
26 | 29 |
{ path: "/TotalSearch.page", name: "TotalSearch", component: TotalSearch }, |
... | ... | @@ -28,11 +31,8 @@ |
28 | 31 |
{ path: "/PicHistoryInsert.page", name: "PicHistoryInsert", component: PicHistoryInsert }, |
29 | 32 |
{ path: "/PicHistoryDetail.page", name: "PicHistoryDetail", component: PicHistoryDetail }, |
30 | 33 |
{ path: "/BodoDetail.page", name: "BodoDetail", component: BodoDetail }, |
31 |
- |
|
32 | 34 |
{ path: "/MemberManagement.page", name: "MemberManagement", component: MemberManagement }, |
33 | 35 |
{ path: "/CategoryManagement.page", name: "CategoryManagement", component: CategoryManagement }, |
34 |
- |
|
35 |
- |
|
36 | 36 |
]; |
37 | 37 |
|
38 | 38 |
const AppRouter = createRouter({ |
... | ... | @@ -57,10 +57,10 @@ |
57 | 57 |
alert('로그인이 필요합니다.'); |
58 | 58 |
return next('/Login.page'); // 로그인 페이지로 리다이렉트 |
59 | 59 |
} |
60 |
- |
|
60 |
+ |
|
61 | 61 |
// 권한이 없을 경우 |
62 |
- if(authorization){ |
|
63 |
- if(!authorization.includes(store.state.roles[0].authority)){ |
|
62 |
+ if (authorization) { |
|
63 |
+ if (!authorization.includes(store.state.roles[0].authority)) { |
|
64 | 64 |
alert('접근 권한이 없습니다.'); |
65 | 65 |
return next(from.path); |
66 | 66 |
} |
--- client/views/pages/user/PicHistoryInsert.vue
+++ client/views/pages/user/PicHistoryInsert.vue
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 |
</ul> |
13 | 13 |
</div> |
14 | 14 |
</div> |
15 |
- <form action="" class="insert-form mb-50"> |
|
15 |
+ <form class="insert-form mb-50"> |
|
16 | 16 |
<dl> |
17 | 17 |
<dd> |
18 | 18 |
<label for="id" class="require">제목</label> |
... | ... | @@ -51,11 +51,11 @@ |
51 | 51 |
<ul class="wfull"> |
52 | 52 |
<li class="flex align-center"> |
53 | 53 |
<p>파일첨부</p> |
54 |
- <div class="invalid-feedback"><img :src="erroricon" alt=""><span>첨부파일은 10건까지 등록 가능하며, 건당 최대 100MB를 초과할 수 없습니다.</span></div> |
|
54 |
+ <div class="invalid-feedback"><img :src="erroricon" alt=""><span>첨부파일은 건당 최대 10GB를 초과할 수 없습니다.</span></div> |
|
55 | 55 |
</li> |
56 | 56 |
<li class="file-insert"> |
57 |
- <input type="file" id="fileInput" class="file-input" multiple @change="showFileNames"> |
|
58 |
- <label for="fileInput" class="file-label mb-20"> |
|
57 |
+ <input type="file" id="fileInput" class="file-input" multiple @change="showFileNames" accept="image/jpeg,image/png,image/gif,image/jpg"> |
|
58 |
+ <label for="fileInput" class="file-label mb-20" @dragover.prevent="handleDragOver" @dragleave.prevent="handleDragLeave" @drop.prevent="handleDrop" :class="{ 'drag-over': isDragging }"> |
|
59 | 59 |
<div class="flex-center align-center"><img :src="fileicon" alt=""> |
60 | 60 |
<p>파일첨부하기</p> |
61 | 61 |
</div> |
... | ... | @@ -66,7 +66,6 @@ |
66 | 66 |
<span v-if="fileNames.length === 0">선택된 파일이 없습니다.</span> |
67 | 67 |
<div v-for="(file, index) in fileNames" :key="index" class="flex-sp-bw mb-5 file-wrap"> |
68 | 68 |
<div class="file-name"> |
69 |
- <!-- Corrected here: Use file.icon instead of fileicons.img --> |
|
70 | 69 |
<img :src="file.icon" alt="fileicon"> |
71 | 70 |
<p>{{ file.name }}</p> |
72 | 71 |
</div> |
... | ... | @@ -79,13 +78,15 @@ |
79 | 78 |
</dl> |
80 | 79 |
</form> |
81 | 80 |
<div class="btn-group flex-center"> |
82 |
- <button class="cancel">취소</button> |
|
83 |
- <button class="register">등록</button> |
|
81 |
+ <button type="button" class="cancel" @click="fnMoveTo('PicHistorySearch')">취소</button> |
|
82 |
+ <button type="button" class="register" @click="submitForm">등록</button> |
|
84 | 83 |
</div> |
85 | 84 |
</div> |
86 | 85 |
<CategorySelectModal v-if="isModalOpen" :selectedCtgries="selectedCtgries" @toggleModal="fnToggleModal" /> |
87 | 86 |
</template> |
88 | 87 |
<script> |
88 |
+import axios from 'axios'; |
|
89 |
+import apiClient from '../../../resources/api'; |
|
89 | 90 |
import { DoubleLeftOutlined, LeftOutlined, RightOutlined, DoubleRightOutlined } from '@ant-design/icons-vue'; |
90 | 91 |
// COMPONENT |
91 | 92 |
import EditorComponent from '../../component/EditorComponent.vue'; |
... | ... | @@ -97,12 +98,13 @@ |
97 | 98 |
LeftOutlined, |
98 | 99 |
RightOutlined, |
99 | 100 |
DoubleRightOutlined, |
100 |
- EditorComponent, CategorySelectModal, |
|
101 |
+ EditorComponent, |
|
102 |
+ CategorySelectModal, |
|
101 | 103 |
}, |
102 | 104 |
|
103 | 105 |
data() { |
104 | 106 |
return { |
105 |
- // Define the image sources |
|
107 |
+ // 아이콘 경로 |
|
106 | 108 |
homeicon: 'client/resources/images/icon/home.png', |
107 | 109 |
erroricon: 'client/resources/images/icon/error.png', |
108 | 110 |
righticon: 'client/resources/images/icon/right.png', |
... | ... | @@ -110,6 +112,7 @@ |
110 | 112 |
searchicon: 'client/resources/images/icon/search.png', |
111 | 113 |
|
112 | 114 |
isModalOpen: false, |
115 |
+ isDragging: false, |
|
113 | 116 |
|
114 | 117 |
items: [ |
115 | 118 |
{ id: 1, category: '카테고리 1', selected: false }, |
... | ... | @@ -123,11 +126,10 @@ |
123 | 126 |
adres: null, // 주소 |
124 | 127 |
prdctnYear: null, // 생산연도 |
125 | 128 |
ty: 'P', // 타입 ( P: 사진, V: 영상 ) |
126 |
- multipartFiles: null, // 첨부파일 정보 |
|
127 | 129 |
ctgryIds: null, // 카테고리 정보 |
128 | 130 |
}, |
129 | 131 |
|
130 |
- files: [], |
|
132 |
+ selectedFiles: [], |
|
131 | 133 |
selectedCtgries: [], // 카테고리 목록 |
132 | 134 |
}; |
133 | 135 |
}, |
... | ... | @@ -139,74 +141,209 @@ |
139 | 141 |
); |
140 | 142 |
} |
141 | 143 |
}, |
142 |
- created() { |
|
143 |
- }, |
|
144 | 144 |
methods: { |
145 |
- registerCategories() { |
|
146 |
- // Add selected categories to the displayed list |
|
147 |
- this.selectedCtgries = this.items |
|
148 |
- .filter(item => item.selected) |
|
149 |
- .map(item => item.category); |
|
150 |
- this.closeModal(); // Close modal after registration |
|
145 |
+ // 드래그 앤 드롭 이벤트 핸들러 |
|
146 |
+ handleDragOver(event) { |
|
147 |
+ this.isDragging = true; |
|
148 |
+ }, |
|
149 |
+ handleDragLeave(event) { |
|
150 |
+ this.isDragging = false; |
|
151 |
+ }, |
|
152 |
+ handleDrop(event) { |
|
153 |
+ this.isDragging = false; |
|
154 |
+ const files = event.dataTransfer.files; |
|
155 |
+ if (files.length > 0) { |
|
156 |
+ this.processFiles(files); |
|
157 |
+ } |
|
158 |
+ }, |
|
159 |
+ |
|
160 |
+ // 파일 업로드 처리 함수 |
|
161 |
+ processFiles(files) { |
|
162 |
+ // 파일 타입 검증 (이미지 파일만 허용) |
|
163 |
+ const allowedTypes = ['jpg', 'jpeg', 'png', 'gif']; |
|
164 |
+ const maxSize = 10 * 1024 * 1024 * 1024; // 10GB |
|
165 |
+ |
|
166 |
+ for (let i = 0; i < files.length; i++) { |
|
167 |
+ const fileType = files[i].name.split('.').pop().toLowerCase(); |
|
168 |
+ if (!allowedTypes.includes(fileType)) { |
|
169 |
+ alert(`${files[i].name} 파일은 허용되지 않는 형식입니다. 이미지 파일(jpg, jpeg, png, gif)만 업로드 가능합니다.`); |
|
170 |
+ return; |
|
171 |
+ } |
|
172 |
+ |
|
173 |
+ // 파일 크기 제한 체크 (10GB) |
|
174 |
+ if (files[i].size > maxSize) { |
|
175 |
+ alert(`${files[i].name} 파일이 10GB를 초과합니다.`); |
|
176 |
+ return; |
|
177 |
+ } |
|
178 |
+ } |
|
179 |
+ |
|
180 |
+ // 실제 File 객체들을 저장 |
|
181 |
+ for (let i = 0; i < files.length; i++) { |
|
182 |
+ this.selectedFiles.push(files[i]); |
|
183 |
+ } |
|
184 |
+ |
|
185 |
+ // UI에 표시할 파일 정보 저장 |
|
186 |
+ for (let i = 0; i < files.length; i++) { |
|
187 |
+ const file = files[i]; |
|
188 |
+ const fileType = file.name.split('.').pop().toLowerCase(); // 파일 확장자 추출 |
|
189 |
+ |
|
190 |
+ // 파일 타입에 따른 아이콘 선택 |
|
191 |
+ let iconPath = this.fileicon; // 기본 아이콘 |
|
192 |
+ |
|
193 |
+ if (['jpg', 'jpeg', 'png', 'gif'].includes(fileType)) { |
|
194 |
+ iconPath = 'client/resources/images/icon/imgicon.png'; |
|
195 |
+ } else if (['pdf'].includes(fileType)) { |
|
196 |
+ iconPath = 'client/resources/images/icon/pdficon.png'; |
|
197 |
+ } else if (['xls', 'xlsx'].includes(fileType)) { |
|
198 |
+ iconPath = 'client/resources/images/icon/excelicon.png'; |
|
199 |
+ } else if (['hwp'].includes(fileType)) { |
|
200 |
+ iconPath = 'client/resources/images/icon/hwpicon.png'; |
|
201 |
+ } |
|
202 |
+ |
|
203 |
+ // 파일 이름과 아이콘을 목록에 추가 |
|
204 |
+ this.fileNames.push({ |
|
205 |
+ name: file.name, |
|
206 |
+ icon: iconPath, |
|
207 |
+ size: this.formatFileSize(file.size) |
|
208 |
+ }); |
|
209 |
+ } |
|
210 |
+ }, |
|
211 |
+ |
|
212 |
+ fnToggleModal(selectedCtgryIds) { |
|
213 |
+ this.isModalOpen = !this.isModalOpen; |
|
214 |
+ if (selectedCtgryIds && selectedCtgryIds.length > 0) { |
|
215 |
+ this.insertDTO.ctgryIds = selectedCtgryIds; |
|
216 |
+ } |
|
151 | 217 |
}, |
152 | 218 |
removeCategory(index) { |
153 | 219 |
// Remove category from the list |
154 | 220 |
this.selectedCtgries.splice(index, 1); |
155 | 221 |
}, |
156 |
- searchCategories() { |
|
157 |
- // You can implement search logic if needed |
|
158 |
- }, |
|
159 |
- nextPage() { |
|
160 |
- if (this.currentPage < this.totalPages) { |
|
161 |
- this.currentPage++; |
|
162 |
- } |
|
163 |
- }, |
|
164 |
- previousPage() { |
|
165 |
- if (this.currentPage > 1) { |
|
166 |
- this.currentPage--; |
|
167 |
- } |
|
168 |
- }, |
|
169 |
- showFileNames(event) { |
|
170 |
- const files = event.target.files; |
|
171 |
- this.fileNames = []; // Clear previous file names |
|
172 |
- |
|
173 |
- for (let i = 0; i < files.length; i++) { |
|
174 |
- const file = files[i]; |
|
175 |
- const fileType = file.name.split('.').pop().toLowerCase(); // Get file extension |
|
176 |
- |
|
177 |
- // Set default icon |
|
178 |
- let iconPath = this.fileicons; |
|
179 |
- |
|
180 |
- // Determine the icon based on file type |
|
181 |
- if (['jpg', 'jpeg', 'png', 'gif'].includes(fileType)) { |
|
182 |
- iconPath = 'client/resources/images/icon/imgicon.png'; // Example for image files |
|
183 |
- } else if (['pdf'].includes(fileType)) { |
|
184 |
- iconPath = 'client/resources/images/icon/pdficon.png'; // Example for PDF files |
|
185 |
- } else if (['xls'].includes(fileType)) { |
|
186 |
- iconPath = 'client/resources/images/icon/excelicon.png'; // Example for audio files |
|
187 |
- } else if (['hwp'].includes(fileType)) { |
|
188 |
- iconPath = 'client/resources/images/icon/hwpicon.png'; // Example for video files |
|
189 |
- } |
|
190 |
- |
|
191 |
- // Push the file name and corresponding icon to the fileNames array |
|
192 |
- this.fileNames.push({ |
|
193 |
- name: file.name, |
|
194 |
- icon: iconPath |
|
195 |
- }); |
|
196 |
- } |
|
197 |
- }, |
|
198 |
- removeFile(index) { |
|
199 |
- // Remove file from the list |
|
200 |
- this.fileNames.splice(index, 1); |
|
201 |
- console.log(removeFile) |
|
202 |
- }, |
|
203 | 222 |
openModal() { |
204 | 223 |
this.isModalOpen = true; |
205 | 224 |
}, |
206 |
- // 모달 닫기 |
|
207 | 225 |
closeModal() { |
208 | 226 |
this.isModalOpen = false; |
209 | 227 |
}, |
228 |
+ showFileNames(event) { |
|
229 |
+ const files = event.target.files; |
|
230 |
+ if (files.length > 0) { |
|
231 |
+ this.processFiles(files); |
|
232 |
+ } |
|
233 |
+ }, |
|
234 |
+ removeFile(index) { |
|
235 |
+ // UI 목록과 실제 파일 객체 목록에서 모두 제거 |
|
236 |
+ this.fileNames.splice(index, 1); |
|
237 |
+ this.selectedFiles.splice(index, 1); |
|
238 |
+ }, |
|
239 |
+ formatFileSize(bytes) { |
|
240 |
+ if (bytes === 0) return '0 Bytes'; |
|
241 |
+ const k = 1024; |
|
242 |
+ const sizes = ['Bytes', 'KB', 'MB', 'GB']; |
|
243 |
+ const i = Math.floor(Math.log(bytes) / Math.log(k)); |
|
244 |
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; |
|
245 |
+ }, |
|
246 |
+ |
|
247 |
+ // 등록 |
|
248 |
+ submitForm() { |
|
249 |
+ const vm = this; |
|
250 |
+ |
|
251 |
+ // 폼 요소들의 값을 가져오기 |
|
252 |
+ const titleInput = document.getElementById('id'); |
|
253 |
+ const yearInput = document.getElementById('year'); |
|
254 |
+ const addressInput = document.getElementById('address'); |
|
255 |
+ |
|
256 |
+ // insertDTO 업데이트 |
|
257 |
+ vm.insertDTO.sj = titleInput ? titleInput.value : null; |
|
258 |
+ vm.insertDTO.prdctnYear = yearInput ? yearInput.value : null; |
|
259 |
+ vm.insertDTO.adres = addressInput ? addressInput.value : null; |
|
260 |
+ |
|
261 |
+ // 유효성 검사 |
|
262 |
+ if (!vm.insertDTO.sj) { |
|
263 |
+ alert("제목을 입력해 주세요."); |
|
264 |
+ return; |
|
265 |
+ } |
|
266 |
+ if (vm.selectedFiles.length < 1) { |
|
267 |
+ alert("파일을 1개 이상 첨부해 주세요."); |
|
268 |
+ return; |
|
269 |
+ } |
|
270 |
+ |
|
271 |
+ // 데이터 세팅 |
|
272 |
+ const formData = new FormData(); |
|
273 |
+ |
|
274 |
+ // 텍스트 데이터 추가 |
|
275 |
+ formData.append('sj', vm.insertDTO.sj); |
|
276 |
+ formData.append('cn', vm.insertDTO.cn || ''); |
|
277 |
+ formData.append('adres', vm.insertDTO.adres || ''); |
|
278 |
+ formData.append('prdctnYear', vm.insertDTO.prdctnYear || ''); |
|
279 |
+ formData.append('ty', vm.insertDTO.ty); |
|
280 |
+ |
|
281 |
+ // 카테고리 IDs 추가 |
|
282 |
+ if (vm.insertDTO.ctgryIds && vm.insertDTO.ctgryIds.length > 0) { |
|
283 |
+ // 백엔드 요구사항에 따라 조정 필요 |
|
284 |
+ vm.insertDTO.ctgryIds.forEach((id, index) => { |
|
285 |
+ formData.append(`ctgryIds[${index}]`, id); |
|
286 |
+ }); |
|
287 |
+ } |
|
288 |
+ |
|
289 |
+ // 파일 추가 |
|
290 |
+ for (let i = 0; i < vm.selectedFiles.length; i++) { |
|
291 |
+ formData.append("multipartFiles", vm.selectedFiles[i]); |
|
292 |
+ } |
|
293 |
+ |
|
294 |
+ // API 통신 |
|
295 |
+ axios({ |
|
296 |
+ url: "/dcry/saveDcry.file", |
|
297 |
+ method: "post", |
|
298 |
+ headers: { |
|
299 |
+ "Content-Type": "multipart/form-data", |
|
300 |
+ }, |
|
301 |
+ data: formData, |
|
302 |
+ }).then(response => { |
|
303 |
+ let result = response.data; |
|
304 |
+ let id = result.data.dcryId; |
|
305 |
+ alert("등록 되었습니다."); |
|
306 |
+ |
|
307 |
+ // 상세 페이지로 이동 |
|
308 |
+ vm.fnMoveTo('PicHistoryDetail', id); |
|
309 |
+ }).catch(error => { |
|
310 |
+ if (error.response) { |
|
311 |
+ alert(error.response.data.message); |
|
312 |
+ } else { |
|
313 |
+ alert("에러가 발생했습니다."); |
|
314 |
+ } |
|
315 |
+ console.error(error.message); |
|
316 |
+ }); |
|
317 |
+ }, |
|
318 |
+ |
|
319 |
+ // 페이지 이동 |
|
320 |
+ fnMoveTo(page, id) { |
|
321 |
+ if (id !== null || id !== '') { |
|
322 |
+ this.$router.push({ name: page, query: { id: id } }); |
|
323 |
+ } else { |
|
324 |
+ this.$router.push({ name: page }); |
|
325 |
+ } |
|
326 |
+ } |
|
210 | 327 |
} |
211 | 328 |
}; |
212 | 329 |
</script> |
330 |
+<style> |
|
331 |
+.file-label { |
|
332 |
+ border: 2px dashed #ddd; |
|
333 |
+ border-radius: 8px; |
|
334 |
+ padding: 20px; |
|
335 |
+ text-align: center; |
|
336 |
+ cursor: pointer; |
|
337 |
+ transition: all 0.3s ease; |
|
338 |
+} |
|
339 |
+ |
|
340 |
+.file-label:hover { |
|
341 |
+ border-color: #aaa; |
|
342 |
+ background-color: #f9f9f9; |
|
343 |
+} |
|
344 |
+ |
|
345 |
+.file-label.drag-over { |
|
346 |
+ border-color: #1890ff; |
|
347 |
+ background-color: rgba(24, 144, 255, 0.1); |
|
348 |
+} |
|
349 |
+</style>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/user/TotalSearch.vue
+++ client/views/pages/user/TotalSearch.vue
... | ... | @@ -4,7 +4,6 @@ |
4 | 4 |
<h2>통합검색</h2> |
5 | 5 |
<div class="breadcrumb-list"> |
6 | 6 |
<ul> |
7 |
- <!-- Bind the image source dynamically for homeicon --> |
|
8 | 7 |
<li> |
9 | 8 |
<img :src="homeicon" alt="Home Icon"> |
10 | 9 |
<p></p> |
... | ... | @@ -14,7 +13,7 @@ |
14 | 13 |
</ul> |
15 | 14 |
</div> |
16 | 15 |
</div> |
17 |
- <form action="search" class="search-form mb-40"> |
|
16 |
+ <div class="search-form mb-40"> |
|
18 | 17 |
<dl> |
19 | 18 |
<dd class="mb-15"> |
20 | 19 |
<p>기록유형</p> |
... | ... | @@ -23,9 +22,21 @@ |
23 | 22 |
<input type="checkbox" id="allRecord" v-model="isChkAllRecord" @change="fnChkAllOptions('record')" /> |
24 | 23 |
<label for="allRecord">전체</label> |
25 | 24 |
</li> |
26 |
- <li v-for="(record, idx) in searchRecord" :key="idx"> |
|
27 |
- <input type="checkbox" :id="idx" :name="searchRecord" :value="record.key" v-model="searchReqDTO.searchRecord" @change="fnChkOption('record')" /> |
|
28 |
- <label :for="idx">{{ record.value }}</label> |
|
25 |
+ <li> |
|
26 |
+ <input type="checkbox" id="photoRecord" v-model="searchReqDTO.usePhoto" @change="fnChkOption('record')" /> |
|
27 |
+ <label for="photoRecord">사진</label> |
|
28 |
+ </li> |
|
29 |
+ <li> |
|
30 |
+ <input type="checkbox" id="videoRecord" v-model="searchReqDTO.useVideo" @change="fnChkOption('record')" /> |
|
31 |
+ <label for="videoRecord">영상</label> |
|
32 |
+ </li> |
|
33 |
+ <li> |
|
34 |
+ <input type="checkbox" id="mediaVideo" v-model="searchReqDTO.useMedia" @change="fnChkOption('record')" /> |
|
35 |
+ <label for="mediaVideo">미디어영상</label> |
|
36 |
+ </li> |
|
37 |
+ <li> |
|
38 |
+ <input type="checkbox" id="newsData" v-model="searchReqDTO.useNews" @change="fnChkOption('record')" /> |
|
39 |
+ <label for="newsData">보도자료</label> |
|
29 | 40 |
</li> |
30 | 41 |
</ul> |
31 | 42 |
</dd> |
... | ... | @@ -36,15 +47,23 @@ |
36 | 47 |
<input type="checkbox" id="allScope" v-model="isChkAllScope" @change="fnChkAllOptions('scope')" /> |
37 | 48 |
<label for="allScope">전체</label> |
38 | 49 |
</li> |
39 |
- <li v-for="(scope, idx) in searchType" :key="idx"> |
|
40 |
- <input type="checkbox" :id="idx" :name="searchType" :value="scope.key" v-model="searchReqDTO.searchType" @change="fnChkOption('scope')" /> |
|
41 |
- <label :for="idx">{{ scope.value }}</label> |
|
50 |
+ <li> |
|
51 |
+ <input type="checkbox" id="searchSj" v-model="searchReqDTO.useSj" @change="fnChkOption('scope')" /> |
|
52 |
+ <label for="searchSj">제목</label> |
|
53 |
+ </li> |
|
54 |
+ <li> |
|
55 |
+ <input type="checkbox" id="searchCn" v-model="searchReqDTO.useCn" @change="fnChkOption('scope')" /> |
|
56 |
+ <label for="searchCn">내용</label> |
|
57 |
+ </li> |
|
58 |
+ <li> |
|
59 |
+ <input type="checkbox" id="searchAdres" v-model="searchReqDTO.useAdres" @change="fnChkOption('scope')" /> |
|
60 |
+ <label for="searchAdres">주소</label> |
|
42 | 61 |
</li> |
43 | 62 |
</ul> |
44 | 63 |
</dd> |
45 | 64 |
<dd class="mb-15"> |
46 | 65 |
<p>검색어</p> |
47 |
- <div class="wfull"><input type="text" v-model="searchReqDTO.searchText"></div> |
|
66 |
+ <div class="wfull"><input type="text" v-model="searchReqDTO.searchText" v-on:keyup.enter="fnSearch()"></div> |
|
48 | 67 |
</dd> |
49 | 68 |
<dd class="mb-15"> |
50 | 69 |
<p>생산연도</p> |
... | ... | @@ -56,7 +75,7 @@ |
56 | 75 |
<p>카테고리</p> |
57 | 76 |
<ul> |
58 | 77 |
<li v-for="(category, idx) of categorys" :key="idx"> |
59 |
- <input type="checkbox" :id="category.ctgryId" name="categorys" :value="category.ctgryId" v-model="searchReqDTO.searchCtgry" /> |
|
78 |
+ <input type="checkbox" :id="category.ctgryId" name="categorys" :value="category.ctgryId" v-model="searchReqDTO.searchCtgries" /> |
|
60 | 79 |
<label :for="category.ctgryId">{{ category.ctgryNm }}</label> |
61 | 80 |
</li> |
62 | 81 |
</ul> |
... | ... | @@ -75,48 +94,15 @@ |
75 | 94 |
<img :src="reseticon" alt=""> |
76 | 95 |
<p>초기화</p> |
77 | 96 |
</button> |
78 |
- <button type="button" class="search" @click="fnFindAllDatas"> |
|
97 |
+ <button type="button" class="search" @click="fnSearch"> |
|
79 | 98 |
<img :src="searchicon" alt=""> |
80 | 99 |
<p>검색</p> |
81 | 100 |
</button> |
82 | 101 |
</div> |
83 | 102 |
</dl> |
84 |
- </form> |
|
103 |
+ </div> |
|
85 | 104 |
<div class="search-result"> |
86 |
- <ul> |
|
87 |
- <li v-for="(resultItem, idx) of searchResult" :key="idx" class="mb-30"> |
|
88 |
- <div class="flex-sp-bw mb-20"> |
|
89 |
- <div class="resultext"> |
|
90 |
- <img :src="resulticon" alt=""> |
|
91 |
- <p>총 <b>{{ resultItem.count }}개</b>의 {{ searchRecord[idx].value }}{{ resultItem.key === 'N' ? '가' : '이' }} 검색되었습니다.</p> |
|
92 |
- </div> |
|
93 |
- <router-link :to="{ path: '/' + resultItem.id }" class="gopage">모두보기</router-link> |
|
94 |
- </div> |
|
95 |
- <div v-for="(item, idx2) of resultItem.list" :key="idx2" class="result-box"> |
|
96 |
- <div class="main-img"> |
|
97 |
- <img v-if="item.hasOwnProperty('files') && item.files.length > 0" :src="item.files[0].filePath" alt=""> |
|
98 |
- <img v-else src="client/resources/images/img6.png" alt=""> |
|
99 |
- </div> |
|
100 |
- <div class="text-box"> |
|
101 |
- <h5>{{ item.sj }}</h5> |
|
102 |
- <p v-if="resultItem.key === 'P' || resultItem.key === 'V'" class="address">{{ item.adres }}</p> |
|
103 |
- <p class="text">{{ item.cn }}</p> |
|
104 |
- <div class="mb-20"> |
|
105 |
- <ul class="category"> |
|
106 |
- <li v-for="(ctgry, idx3) of item.ctgrys" :key="idx3" class="category1">{{ ctgry.ctgryNm }}</li> |
|
107 |
- </ul> |
|
108 |
- </div> |
|
109 |
- <div class="date"> |
|
110 |
- <ul> |
|
111 |
- <li>생산연도 <b>{{ item.prdctnYear }}</b></li> |
|
112 |
- <li>|</li> |
|
113 |
- <li>등록 <b>{{ item.rgsde }}</b></li> |
|
114 |
- </ul> |
|
115 |
- </div> |
|
116 |
- </div> |
|
117 |
- </div> |
|
118 |
- </li> |
|
119 |
- </ul> |
|
105 |
+ <CardViewList v-for="(item, idx) of searchResult" :key="idx" :name="item.key" :count="item.count" :list="item.list" /> |
|
120 | 106 |
</div> |
121 | 107 |
</div> |
122 | 108 |
</template> |
... | ... | @@ -124,8 +110,12 @@ |
124 | 110 |
// 통합 검색 |
125 | 111 |
import { findAllDatas } from "../../../resources/api/main"; |
126 | 112 |
import { findAllByNullProc } from "../../../resources/api/category"; // 카테고리 목록 검색 |
113 |
+import CardViewList from "../../component/List/CardViewList.vue"; |
|
127 | 114 |
|
128 | 115 |
export default { |
116 |
+ components: { |
|
117 |
+ CardViewList |
|
118 |
+ }, |
|
129 | 119 |
data() { |
130 | 120 |
return { |
131 | 121 |
// icon |
... | ... | @@ -137,14 +127,20 @@ |
137 | 127 |
|
138 | 128 |
// 검색용 객체 초기값 |
139 | 129 |
searchDefault: { |
140 |
- searchRecord: ["P", "V", "M", "N"], |
|
141 |
- searchType: ["sj", "cn", "adres"], |
|
130 |
+ usePhoto: true, |
|
131 |
+ useVideo: true, |
|
132 |
+ useMedia: true, |
|
133 |
+ useNews: true, |
|
134 |
+ useSj: true, |
|
135 |
+ useCn: true, |
|
136 |
+ useAdres: true, |
|
142 | 137 |
searchText: null, |
143 | 138 |
startYear: null, |
144 | 139 |
endYear: null, |
145 |
- searchCtgry: [], |
|
140 |
+ searchCtgries: [], |
|
146 | 141 |
order: "rgsde", |
147 | 142 |
}, |
143 |
+ |
|
148 | 144 |
searchReqDTO: {}, |
149 | 145 |
|
150 | 146 |
isChkAllRecord: true, // 기록유형 전체 체크 여부 |
... | ... | @@ -183,7 +179,7 @@ |
183 | 179 |
this.searchReqDTO.searchText = searchText; |
184 | 180 |
} |
185 | 181 |
|
186 |
- this.fnFindAllDatas(); // 통합검색 |
|
182 |
+ this.fnSearch(); // 통합검색 |
|
187 | 183 |
}, |
188 | 184 |
|
189 | 185 |
methods: { |
... | ... | @@ -196,9 +192,14 @@ |
196 | 192 |
return; |
197 | 193 |
} |
198 | 194 |
} |
199 |
- this.searchReqDTO = Object.assign({}, this.searchDefault); // 검색객체 초기화 |
|
195 |
+ |
|
196 |
+ this.searchReqDTO = JSON.parse(JSON.stringify(this.searchDefault)); |
|
197 |
+ this.isChkAllRecord = true; |
|
198 |
+ this.isChkAllScope = true; |
|
199 |
+ |
|
200 | 200 |
this.searchResult = []; // 검색결과 초기화 |
201 | 201 |
}, |
202 |
+ |
|
202 | 203 |
// 카테고리 목록 조회 |
203 | 204 |
async fnFindCategorys() { |
204 | 205 |
try { |
... | ... | @@ -208,34 +209,33 @@ |
208 | 209 |
this.categorys = []; // 카테고리 목록 초기화 |
209 | 210 |
|
210 | 211 |
if (error.response) { |
211 |
- console.log("에러 응답:", error.response.data); |
|
212 |
+ alert(error.response.data.message); |
|
212 | 213 |
} |
213 |
- console.error("Error:", error); |
|
214 |
+ console.error(error.message); |
|
214 | 215 |
} |
215 | 216 |
}, |
216 | 217 |
|
217 | 218 |
// 통합검색 |
218 |
- async fnFindAllDatas() { |
|
219 |
- if (this.searchReqDTO.searchRecord == null || this.searchReqDTO.searchRecord.length < 1) { |
|
219 |
+ async fnSearch() { |
|
220 |
+ // 유효성 검사 |
|
221 |
+ if (!this.searchReqDTO.usePhoto && !this.searchReqDTO.useVideo && !this.searchReqDTO.useMedia && !this.searchReqDTO.useNews) { |
|
220 | 222 |
alert('검색 유형은 최소 한 개 이상 선택해주세요.'); |
221 | 223 |
return; |
222 | 224 |
} |
223 | 225 |
|
224 | 226 |
try { |
225 |
- let params = {}; |
|
226 |
- if (this.searchReqDTO.searchRecord.length > 0) { |
|
227 |
- params.searchRecords = this.searchReqDTO.searchRecord.join(','); |
|
227 |
+ // 깊은 복사로 파라미터 생성 |
|
228 |
+ const params = JSON.parse(JSON.stringify(this.searchReqDTO)); |
|
229 |
+ |
|
230 |
+ // 디버깅용 로그 - 실제 전송되는 값 확인 |
|
231 |
+ console.log("검색 파라미터:", params); |
|
232 |
+ |
|
233 |
+ // 카테고리 목록 처리 |
|
234 |
+ if (this.searchReqDTO.searchCtgries && this.searchReqDTO.searchCtgries.length > 0) { |
|
235 |
+ params.searchCtgries = this.searchReqDTO.searchCtgries.join(','); |
|
236 |
+ } else { |
|
237 |
+ delete params.searchCtgries; |
|
228 | 238 |
} |
229 |
- if (this.searchReqDTO.searchType.length > 0) { |
|
230 |
- params.searchTypes = this.searchReqDTO.searchType.join(','); |
|
231 |
- } |
|
232 |
- if (this.searchReqDTO.searchCtgry.length > 0) { |
|
233 |
- params.searchCtgries = this.searchReqDTO.searchCtgry.join(','); |
|
234 |
- } |
|
235 |
- params.searchText = this.searchReqDTO.searchText; |
|
236 |
- params.startYear = this.searchReqDTO.startYear; |
|
237 |
- params.endYear = this.searchReqDTO.endYear; |
|
238 |
- params.order = this.searchReqDTO.order; |
|
239 | 239 |
|
240 | 240 |
// API 호출 |
241 | 241 |
const response = await findAllDatas(params); |
... | ... | @@ -254,18 +254,15 @@ |
254 | 254 |
fnChkAllOptions(type) { |
255 | 255 |
switch (type) { |
256 | 256 |
case 'record': |
257 |
- if (this.isChkAllRecord) { |
|
258 |
- this.searchReqDTO.searchRecord = this.searchRecord.map(item => item.key); |
|
259 |
- } else { |
|
260 |
- this.searchReqDTO.searchRecord = []; |
|
261 |
- } |
|
257 |
+ this.searchReqDTO.usePhoto = this.isChkAllRecord; |
|
258 |
+ this.searchReqDTO.useVideo = this.isChkAllRecord; |
|
259 |
+ this.searchReqDTO.useMedia = this.isChkAllRecord; |
|
260 |
+ this.searchReqDTO.useNews = this.isChkAllRecord; |
|
262 | 261 |
break; |
263 | 262 |
case 'scope': |
264 |
- if (this.isChkAllScope) { |
|
265 |
- this.searchReqDTO.searchType = this.searchType.map(item => item.key); |
|
266 |
- } else { |
|
267 |
- this.searchReqDTO.searchType = []; |
|
268 |
- } |
|
263 |
+ this.searchReqDTO.useSj = this.isChkAllScope; |
|
264 |
+ this.searchReqDTO.useCn = this.isChkAllScope; |
|
265 |
+ this.searchReqDTO.useAdres = this.isChkAllScope; |
|
269 | 266 |
break; |
270 | 267 |
} |
271 | 268 |
}, |
... | ... | @@ -274,13 +271,13 @@ |
274 | 271 |
fnChkOption(type) { |
275 | 272 |
switch (type) { |
276 | 273 |
case 'record': |
277 |
- this.isChkAllRecord = this.searchReqDTO.searchRecord.length === this.searchRecord.length; |
|
274 |
+ this.isChkAllRecord = this.searchReqDTO.usePhoto && this.searchReqDTO.useVideo && this.searchReqDTO.useMedia && this.searchReqDTO.useNews; |
|
278 | 275 |
break; |
279 | 276 |
case 'scope': |
280 |
- this.isChkAllScope = this.searchReqDTO.searchType.length === this.searchType.length; |
|
277 |
+ this.isChkAllScope = this.searchReqDTO.useSj && this.searchReqDTO.useCn && this.searchReqDTO.useAdres; |
|
281 | 278 |
break; |
282 | 279 |
} |
283 |
- }, |
|
280 |
+ } |
|
284 | 281 |
}, |
285 | 282 |
}; |
286 |
-</script> |
|
283 |
+</script>(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?