yjryu / KERIS star
Stormen123 2023-11-20
231120 게시판 상단고정, sort 추가
@cb14513026e6b3ad5db7b5332c6e10ff72489ac7
client/views/pages/admin/databook/DataInsert.vue
--- client/views/pages/admin/databook/DataInsert.vue
+++ client/views/pages/admin/databook/DataInsert.vue
@@ -38,7 +38,7 @@
                         </tr>
                         <tr>
                             <th>게시물 상단고정 사용여부</th>
-                            <td><input type="checkbox" name="" id=""><label>사용</label></td>
+                            <td><input type="checkbox" v-model="post.notice_yn" true-value="Y" false-value="N"><label>사용</label></td>
                         </tr>
                         <tr>
                             <th>내용</th>
@@ -79,6 +79,7 @@
                 link_url: null,
                 // 카테고리가 없는 게시판에서는 null로 설정 부탁합니다!
                 ctgry_nm: null,
+                notice_yn: 'N',
             },
             fileList: [],
             filecount: 0,
client/views/pages/admin/news/NewsInsert.vue
--- client/views/pages/admin/news/NewsInsert.vue
+++ client/views/pages/admin/news/NewsInsert.vue
@@ -86,6 +86,7 @@
                 post_content: null,
                 // 카테고리가 없는 게시판에서는 null로 설정 부탁합니다!
                 ctgry_nm: null,
+                notice_yn: 'N',
             },
             fileList: [],
             filecount: 0,
client/views/pages/admin/notice/NoticeInsert.vue
--- client/views/pages/admin/notice/NoticeInsert.vue
+++ client/views/pages/admin/notice/NoticeInsert.vue
@@ -16,7 +16,7 @@
                         </tr>
                         <tr>
                             <th>게시물 상단고정 사용여부</th>
-                            <td><input type="checkbox" name="" id=""><label>사용</label></td>
+                            <td><input type="checkbox" v-model="post.notice_yn" true-value="Y" false-value="N"><label>사용</label></td>
                         </tr>
                         <tr>
                             <th>내용</th>
@@ -56,6 +56,7 @@
                 post_content: null,
                 // 카테고리가 없는 게시판에서는 null로 설정 부탁합니다!
                 ctgry_nm: null,
+                notice_yn: 'N',
             },
             fileList: [],
             filecount: 0,
client/views/pages/admin/technology/TechInsert.vue
--- client/views/pages/admin/technology/TechInsert.vue
+++ client/views/pages/admin/technology/TechInsert.vue
@@ -105,6 +105,7 @@
                 link_url: null,
                 // 카테고리가 없는 게시판에서는 null로 설정 부탁합니다!
                 ctgry_nm: null,
+                notice_yn: 'N',
                 tech_doc_nm: null,
                 tech_doc_version: null,
                 tech_doc_main_content: null,
client/views/pages/admin/wgcommunity/WgInsert.vue
--- client/views/pages/admin/wgcommunity/WgInsert.vue
+++ client/views/pages/admin/wgcommunity/WgInsert.vue
@@ -72,6 +72,7 @@
                 link_url: null,
                 // 카테고리가 없는 게시판에서는 null로 설정 부탁합니다!
                 ctgry_nm: null,
+                notice_yn: 'N',
             },
             fileList: [],
             filecount: 0,
client/views/pages/user/Data/Data.vue
--- client/views/pages/user/Data/Data.vue
+++ client/views/pages/user/Data/Data.vue
@@ -63,7 +63,7 @@
                                 <ul class="flex-end">
                                     <li v-for="(item, index) in sorts" :key="index"
                                         :class="{ active: activeIndex === index }" @click="changeColor(index)">
-                                        {{ item }}
+                                        {{ item.name }}
                                     </li>
                                 </ul>
                             </div>
@@ -77,20 +77,31 @@
                             <th style="width:10%">작성자</th>
                             <th style="width:15%">작성일자</th>
                             <th style="width:20%">조회수</th>
-                            <tr v-for="(item, idx) in postList" :key="idx" @click="postSelectOnePage(item)">
-                                <td :class="{ 'first-row': idx === 0 }">{{ postIdx - idx }}</td>
-                                <td :class="{ 'first-row': idx === 0 }" v-if="item.ctgry_nm === 'policy'"><span
-                                        class="category-zone">정책자료</span></td>
-                                <td :class="{ 'first-row': idx === 0 }" v-else-if="item.ctgry_nm === 'research'"><span
-                                        class="category-zone">연구자료</span></td>
-                                <td :class="{ 'first-row': idx === 0 }" v-else><span class="category-zone">가이드라인</span></td>
-                                <td :class="{ 'first-row': idx === 0 }">
-                                    <p class="board-title pen-nib-icon"> <i class="fas fa-thumbtack" v-if="idx === 0"></i>{{
-                                        item.post_title }}</p>
+                            <tr v-for="(notice, nIdx) in postNoticeList" :key="nIdx" @click="postSelectOnePage(notice)">
+                                <td class="board-title pen-nib-icon" :class="{ 'first-row': notice.notice_yn === 'Y' }">
+                                    <i class="fas fa-thumbtack" v-if="notice.notice_yn === 'Y'"></i>
                                 </td>
-                                <td :class="{ 'first-row': idx === 0 }">{{ item.rgtr_id }}</td>
-                                <td :class="{ 'first-row': idx === 0 }">{{ yyyymmdd(item.reg_dt) }}</td>
-                                <td :class="{ 'first-row': idx === 0 }">{{ item.view_cnt }}</td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }" v-if="notice.ctgry_nm === 'policy'"><span
+                                        class="category-zone">정책자료</span></td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }" v-else-if="notice.ctgry_nm === 'research'"><span
+                                        class="category-zone">연구자료</span></td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }" v-else><span class="category-zone">가이드라인</span></td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }"> {{ notice.post_title }} </td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }">{{ notice.rgtr_id }}</td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }">{{ yyyymmdd(notice.reg_dt) }}</td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }">{{ notice.view_cnt }}</td>
+                            </tr>
+                            <tr v-for="(post, pIdx) in postList" :key="pIdx" @click="postSelectOnePage(post)">
+                                <td >{{ postIdx - pIdx }}</td>
+                                <td v-if="post.ctgry_nm === 'policy'"><span
+                                        class="category-zone">정책자료</span></td>
+                                <td v-else-if="post.ctgry_nm === 'research'"><span
+                                        class="category-zone">연구자료</span></td>
+                                <td v-else><span class="category-zone">가이드라인</span></td>
+                                <td> {{ post.post_title }} </td>
+                                <td>{{ post.rgtr_id }}</td>
+                                <td>{{ yyyymmdd(post.reg_dt) }}</td>
+                                <td>{{ post.view_cnt }}</td>
                             </tr>
                             <tr v-if="postListCount == 0">
                                 <td style="font-size: 12px;" colspan="5">검색조건에 해당하는 데이터가 없습니다.</td>
@@ -123,15 +134,18 @@
                 searchType: null,
                 searchText: null,
                 ctgry_nm: null,
-                bbs_id: '0'
+                bbs_id: '0',
+                sort: 'dt'
             },
             postList: [],
+            postNoticeList:[],
             postListCount: 0,
             postIdx: 0,
             categoryName: '전체',
             route: useRoute(),
             // 최신순 조회순
-            sorts: ['최신순', '조회수순'],
+            sorts: [ { name: '최신순', value: 'dt'}, 
+                     { name: '조회수순', value: 'view'}],
             activeIndex: 0,
 
             // 자료실 버튼
@@ -156,7 +170,11 @@
         //  최신순 조회순
         changeColor(index) {
             this.activeIndex = index;
+            this.postListSearch.sort = this.sorts[index].value;
+            console.log(this.postListSearch.sort);
+            this.postSelectList();
         },
+
         clickButton(index) {
             this.buttons.forEach((button, idx) => {
                 if (idx === index) {
@@ -201,6 +219,7 @@
             }).then(function (response) {
                 vm.postList = response.data.postSelectList;
                 vm.postListCount = response.data.postSelectListCount;
+                vm.postNoticeList = response.data.postNoticeSelectList;
                 vm.postIdx = vm.postListCount - (vm.postListSearch.currentPage - 1) * vm.postListSearch.perPage;
             }).catch(function (error) {
                 alert('자료집 목록 조회 오류, 관리자에게 문의하세요.');
client/views/pages/user/Data/DataOne.vue
--- client/views/pages/user/Data/DataOne.vue
+++ client/views/pages/user/Data/DataOne.vue
@@ -10,8 +10,10 @@
                     <tbody>
                         <tr>
                             <td class="title-zone" colspan="2">
-                                <p class="flex"><span class="post-title">{{ post.post_title }}</span><span
-                                        class="category-zone">{{ post.ctgry_nm }}</span></p>
+                                <p class="flex"><span class="post-title">{{ post.post_title }}</span>
+                                    <span class="category-zone"  v-if="post.ctgry_nm === 'policy'">정책자료</span>
+                                    <span class="category-zone"  v-else-if="post.ctgry_nm === 'research'">연구자료</span>
+                                    <span class="category-zone"  v-else>가이드라인</span></p>
                                 <div class="flex-end">
                                    <p><span class="writer">작성자 </span><span>{{ post.rgtr_id }}</span></p> 
                                     <p><span class="view">조회수 </span><span>{{ post.view_cnt }}</span></p></div>
client/views/pages/user/Data/Technology.vue
--- client/views/pages/user/Data/Technology.vue
+++ client/views/pages/user/Data/Technology.vue
@@ -11,7 +11,7 @@
                     <ul class="flex-end">
                         <li v-for="(item, index) in sorts" :key="index" :class="{ active: activeIndex === index }"
                             @click="changeColor(index)">
-                            {{ item }}
+                            {{ item.name }}
                         </li>
                     </ul>
                 </div>
@@ -30,7 +30,7 @@
                             <img src="../../../../resources/jpg/tech.png" alt="">
                         </div>
                         <div>
-                            <p class="keyword-zone">
+                            <p class="keyword-zone" v-if="item.tech_doc_keyword">
                                 <span v-for="(keyword, keywordIndex) in item.tech_doc_keyword.split(',')"
                                     :key="keywordIndex">
                                     {{ keyword }}
@@ -259,13 +259,14 @@
                 searchType: null,
                 searchText: null,
                 bbs_id: '3',
-
+                sort: 'dt'
             },
             postList: [],
             postListCount: 0,
             postIdx: 0,
             // 최신순 조회순
-            sorts: ['최신순', '조회수순'],
+            sorts: [ { name: '최신순', value: 'dt'}, 
+                     { name: '조회수순', value: 'view'}],
             activeIndex: 0,
         }
     },
@@ -273,7 +274,11 @@
         //  최신순 조회순
         changeColor(index) {
             this.activeIndex = index;
+            this.postListSearch.sort = this.sorts[index].value;
+            console.log(this.postListSearch.sort);
+            this.postSelectList();
         },
+
         postSelectOnePage(item) {
             const vm = this;
 
client/views/pages/user/community/News.vue
--- client/views/pages/user/community/News.vue
+++ client/views/pages/user/community/News.vue
@@ -11,7 +11,7 @@
                     <ul class="flex-end">
                         <li v-for="(item, index) in sorts" :key="index" :class="{ active: activeIndex === index }"
                             @click="changeColor(index)">
-                            {{ item }}
+                            {{ item.name }}
                         </li>
                     </ul>
                 </div>
@@ -79,14 +79,16 @@
                 perPage: 9,
                 searchType: null,
                 searchText: null,
-                bbs_id: '1'
+                bbs_id: '1',
+                sort: 'dt'
             },
             modalItem: null,
             realContent: null,
             fileList: [],
             realFileList: [],
             // 최신순 조회순
-            sorts: ['최신순', '조회수순'],
+            sorts: [ { name: '최신순', value: 'dt'}, 
+                     { name: '조회수순', value: 'view'}],
             activeIndex: 0,
         }
     },
@@ -94,7 +96,11 @@
         //  최신순 조회순
         changeColor(index) {
             this.activeIndex = index;
+            this.postListSearch.sort = this.sorts[index].value;
+            console.log(this.postListSearch.sort);
+            this.postSelectList();
         },
+
         openModal: function (item) {
             const vm = this;
 
client/views/pages/user/community/Notice.vue
--- client/views/pages/user/community/Notice.vue
+++ client/views/pages/user/community/Notice.vue
@@ -25,7 +25,7 @@
                     <ul class="flex-end">
                         <li v-for="(item, index) in sorts" :key="index" :class="{ active: activeIndex === index }"
                             @click="changeColor(index)">
-                            {{ item }}
+                            {{ item.name }}
                         </li>
                     </ul>
                 </div>
@@ -37,16 +37,21 @@
                             <th style="width:10%">작성자</th>
                             <th style="width:10%">작성일자</th>
                             <th style="width:10%">조회수</th>
-                            <tr v-for="(item, idx) in postList" :key="idx" @click="postSelectOnePage(item)">
-                                <td :class="{ 'first-row': idx === 0 }">{{ postIdx - idx }}</td>
-                                <td :class="{ 'first-row': idx === 0 }">
-                                    <p class="board-title pen-nib-icon"> <i class="fas fa-thumbtack" v-if="idx === 0"></i>
-                                        {{ item.post_title
-                                        }}</p>
+                            <tr v-for="(notice, nIdx) in postNoticeList" :key="nIdx" @click="postSelectOnePage(notice)">
+                                <td class="board-title pen-nib-icon" :class="{ 'first-row': notice.notice_yn === 'Y' }">
+                                    <i class="fas fa-thumbtack" v-if="notice.notice_yn === 'Y'"></i>
                                 </td>
-                                <td :class="{ 'first-row': idx === 0 }">{{ item.rgtr_id }}</td>
-                                <td :class="{ 'first-row': idx === 0 }">{{ yyyymmdd(item.reg_dt) }}</td>
-                                <td :class="{ 'first-row': idx === 0 }">{{ item.view_cnt }}</td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }"> {{ notice.post_title }} </td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }">{{ notice.rgtr_id }}</td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }">{{ yyyymmdd(notice.reg_dt) }}</td>
+                                <td :class="{ 'first-row': notice.notice_yn === 'Y' }">{{ notice.view_cnt }}</td>
+                            </tr>
+                            <tr v-for="(post, pIdx) in postList" :key="pIdx" @click="postSelectOnePage(post)">
+                                <td>{{ postIdx - pIdx }}</td>
+                                <td>{{ post.post_title }}</td>
+                                <td>{{ post.rgtr_id }}</td>
+                                <td>{{ yyyymmdd(post.reg_dt) }}</td>
+                                <td>{{ post.view_cnt }}</td>
                             </tr>
                             <tr v-if="postListCount == 0">
                                 <td colspan="5">검색조건에 해당하는 데이터가 없습니다.</td>
@@ -75,13 +80,16 @@
                 perPage: 10,
                 searchType: null,
                 searchText: null,
-                bbs_id: '2'
+                bbs_id: '2',
+                sort: 'dt'
             },
             postList: [],
+            postNoticeList:[],
             postListCount: 0,
             postIdx: 0,
             // 최신순 조회순
-            sorts: ['최신순', '조회수순'],
+            sorts: [ { name: '최신순', value: 'dt'}, 
+                     { name: '조회수순', value: 'view'}],
             activeIndex: 0,
         }
     },
@@ -89,7 +97,11 @@
         //  최신순 조회순
         changeColor(index) {
             this.activeIndex = index;
+            this.postListSearch.sort = this.sorts[index].value;
+            console.log(this.postListSearch.sort);
+            this.postSelectList();
         },
+
         postSelectList: function () {
             const vm = this;
 
@@ -103,6 +115,7 @@
             }).then(function (response) {
                 vm.postList = response.data.postSelectList;
                 vm.postListCount = response.data.postSelectListCount;
+                vm.postNoticeList = response.data.postNoticeSelectList;
                 vm.postIdx = vm.postListCount - (vm.postListSearch.currentPage - 1) * vm.postListSearch.perPage;
             }).catch(function (error) {
                 alert('공지사항 목록 조회 오류, 관리자에게 문의하세요.');
Add a comment
List