pressKitList.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div>
  3. <div class="inner--headers">
  4. <h2>{{ pageId }}</h2>
  5. <div class="bread--crumbs--wrap">
  6. <span>홈</span>
  7. <span>{{ pageId }}</span>
  8. <span v-if="pageIdSub">{{ pageIdSub }}</span>
  9. </div>
  10. </div>
  11. <searchModules />
  12. <div class="data--list--wrap">
  13. <div class="btn--actions--wrap">
  14. <div class="left--sections">
  15. <v-btn class="custom-btn mini btn-white">선택 삭제</v-btn>
  16. </div>
  17. <div class="right--sections">
  18. <v-btn class="custom-btn mini btn-reg" @click="addLocated"
  19. ><i class="ico"></i>신규 등록</v-btn
  20. >
  21. </div>
  22. </div>
  23. <div class="tbl-wrapper">
  24. <div class="tbl-wrap">
  25. <!-- ag grid -->
  26. <ag-grid-vue
  27. style="width: 100%; height: calc(10 * 2.94rem)"
  28. class="ag-theme-quartz"
  29. :gridOptions="gridOptions"
  30. :paginationPageSize="pageObj.pageSize"
  31. @grid-ready="onGridReady"
  32. @rowClicked="detailLocated"
  33. >
  34. </ag-grid-vue>
  35. <!-- 페이징 -->
  36. <div class="ag-grid-custom-pagenations">
  37. <pagination @chg_page="chgPage" :pageObj="pageObj"></pagination>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script setup>
  45. import pagination from "../components/common/pagination.vue";
  46. import { AgGridVue } from "ag-grid-vue3";
  47. import searchModules from "@/components/search/searchModules";
  48. /************************************************************************
  49. | 레이아웃
  50. ************************************************************************/
  51. definePageMeta({
  52. layout: "default",
  53. });
  54. /************************************************************************
  55. | PROPS
  56. ************************************************************************/
  57. const props = defineProps({
  58. propsData: {
  59. type: Object,
  60. default: () => {},
  61. },
  62. });
  63. /************************************************************************
  64. | 전역
  65. ************************************************************************/
  66. const { $toast, $log, $dayjs, $eventBus } = useNuxtApp();
  67. const router = useRouter();
  68. const pageId = ref("보도자료");
  69. const pageIdSub = ref();
  70. let pageObj = ref({
  71. page: 1, // 현재 페이지
  72. pageMaxNumSize: 5, // 페이지 숫자 최대 표현 개수
  73. pageSize: 10, // 테이블 조회 데이터 개수
  74. totalCnt: 0, // 전체 페이지
  75. });
  76. const tblItems = ref([]); // stat 데이터
  77. /* eslint-disable */
  78. /* prettier-ignore */
  79. tblItems.value = [
  80. {th1: "1",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  81. {th1: "2",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  82. {th1: "3",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  83. {th1: "4",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  84. {th1: "5",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  85. {th1: "6",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "비노출",th7: "2024-12-25"},
  86. {th1: "7",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  87. {th1: "8",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  88. {th1: "9",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  89. {th1: "10",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  90. {th1: "11",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  91. {th1: "12",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  92. {th1: "13",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  93. {th1: "14",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  94. {th1: "15",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  95. {th1: "16",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  96. {th1: "17",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  97. {th1: "18",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  98. {th1: "19",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  99. {th1: "20",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  100. {th1: "21",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  101. {th1: "22",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  102. {th1: "23",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  103. {th1: "24",th2: "한국어",th3: "텔레칩스 뉴스 전달드립니다.",th4: "홍길동",th5: "135", th6: "노출",th7: "2024-12-25"},
  104. ];
  105. pageObj.value.totalCnt = tblItems.value.length;
  106. const remToPx = () => parseFloat(getComputedStyle(document.documentElement).fontSize);
  107. const rowHeightRem = 2.65; // 원하는 rem 값
  108. const rowHeightPx = rowHeightRem * remToPx();
  109. const gridApi = shallowRef();
  110. // gridOption
  111. const gridOptions = {
  112. columnDefs: [
  113. { headerName: "No", field: "th1", sortable: false },
  114. { headerName: "언어", field: "th2", sortable: false },
  115. { headerName: "제목", field: "th3", sortable: false },
  116. { headerName: "작성자", field: "th4", sortable: false },
  117. { headerName: "조회수", field: "th5", sortable: false },
  118. { headerName: "노출여부", field: "th6", sortable: false },
  119. { headerName: "등록일", field: "th7", sortable: false },
  120. {
  121. headerName: "알림 메일 수신 여부",
  122. field: "th7",
  123. sortable: false,
  124. },
  125. ],
  126. rowData: tblItems.value, // 테이블 데이터
  127. autoSizeStrategy: {
  128. type: "fitGridWidth", // width맞춤
  129. },
  130. suppressMovableColumns: true,
  131. headerHeight: rowHeightPx,
  132. rowHeight: rowHeightPx,
  133. pagination: true,
  134. suppressPaginationPanel: true, // 하단 default 페이징 컨트롤 숨김
  135. rowSelection: {
  136. checkboxes: true,
  137. headerCheckbox: true,
  138. enableClickSelection: false,
  139. mode: "multiRow",
  140. },
  141. };
  142. /************************************************************************
  143. | 함수(METHODS)
  144. ************************************************************************/
  145. const onGridReady = (__PARAMS) => {
  146. gridApi.value = __PARAMS.api;
  147. };
  148. const chgPage = (__PAGE) => {
  149. pageObj.value.page = __PAGE;
  150. gridApi.value.paginationGoToPage(__PAGE - 1);
  151. };
  152. const addLocated = () => {
  153. router.push({
  154. path: "/view/mng/newsAdd",
  155. //query: { id: rowId },
  156. });
  157. };
  158. const detailLocated = (__EVENT) => {
  159. const rowId = __EVENT.data.th1;
  160. router.push({
  161. path: "/view/mng/newsAdd",
  162. query: { id: rowId },
  163. });
  164. };
  165. /************************************************************************
  166. | WATCH
  167. ************************************************************************/
  168. watch(
  169. () => props,
  170. () => {
  171. searchObj.value = props.propsData;
  172. fnGetStat();
  173. },
  174. { deep: true }
  175. );
  176. </script>