From dae8e6d3a78aeb3e75b2879ad69951e53ab2a97b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=8C=E1=85=B5=E1=86=AB=E1=84=80?=
=?UTF-8?q?=E1=85=B5?= <>
Date: Tue, 26 Nov 2024 14:46:19 +0900
Subject: [PATCH] =?UTF-8?q?/admin/content/list=20=ED=94=84=EB=A1=A0?=
=?UTF-8?q?=ED=8A=B8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
nuxt/components/data/Pagenation.vue | 2 +-
nuxt/constants/grid/index.ts | 20 +++
nuxt/nuxt.config.ts | 10 +-
nuxt/pages/admin/content/index.vue | 126 ++++++++++++++++++
nuxt/pages/admin/content/list.vue | 194 ++++++++++++++++++++++++++++
nuxt/stores/contents/index.ts | 140 ++++++++++++++++++++
nuxt/stores/index.ts | 99 ++++++++++++++
nuxt/types/common/index.ts | 10 ++
nuxt/types/contents/index.ts | 32 +++++
nuxt/types/index.ts | 20 +++
10 files changed, 644 insertions(+), 9 deletions(-)
create mode 100644 nuxt/constants/grid/index.ts
create mode 100644 nuxt/pages/admin/content/index.vue
create mode 100644 nuxt/pages/admin/content/list.vue
create mode 100644 nuxt/stores/contents/index.ts
create mode 100644 nuxt/stores/index.ts
create mode 100644 nuxt/types/common/index.ts
create mode 100644 nuxt/types/contents/index.ts
create mode 100644 nuxt/types/index.ts
diff --git a/nuxt/components/data/Pagenation.vue b/nuxt/components/data/Pagenation.vue
index ac467ee..7a5b687 100644
--- a/nuxt/components/data/Pagenation.vue
+++ b/nuxt/components/data/Pagenation.vue
@@ -1,5 +1,5 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 저장
+ 수정
+
+ 목록
+
+
+
+
+
+
+
+
diff --git a/nuxt/pages/admin/content/list.vue b/nuxt/pages/admin/content/list.vue
new file mode 100644
index 0000000..bc2133a
--- /dev/null
+++ b/nuxt/pages/admin/content/list.vue
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+ 관리기관
+
+
+
+
+
+
+
+
+
+
+
+ 검색어
+
+
+
+
+
+ 검색
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nuxt/stores/contents/index.ts b/nuxt/stores/contents/index.ts
new file mode 100644
index 0000000..b89036b
--- /dev/null
+++ b/nuxt/stores/contents/index.ts
@@ -0,0 +1,140 @@
+import type {
+ ContentListQueryType,
+ ContentListType,
+ ContentType
+} from '~/types/contents';
+import { cloneDeep } from 'lodash-es';
+import type { Page } from '~/types/common';
+import { defineStore } from 'pinia';
+import { ref } from 'vue';
+import { useAxios } from '~/composables/useAxios';
+import { message } from 'ant-design-vue';
+
+const DEFAULT_CONTENT_QUERY: ContentListQueryType = {
+ keyword: '',
+ orgId: '',
+ page: 1,
+ siteId: '',
+ size: 10,
+ type: ''
+};
+
+const DEFAULT_CONTENTS_LIST: Page = {
+ content: [],
+ totalElements: 0,
+ totalPages: 0
+};
+
+const DEFAULT_CONTENTS: ContentType = {
+ contentTitle: '',
+ contentPlain: '',
+ contents: '',
+ frstRegDt: '',
+ frstRgtrId: '',
+ lastMdfcnDt: '',
+ lastMdfrId: '',
+ orgId: '',
+ siteId: '',
+ useYn: true
+};
+
+export const useContentStore = defineStore('useContentStore', () => {
+ const contentsQuery = ref(
+ cloneDeep(DEFAULT_CONTENT_QUERY)
+ );
+
+ const contentsList = ref>(
+ cloneDeep(DEFAULT_CONTENTS_LIST)
+ );
+
+ const contents = ref(cloneDeep(DEFAULT_CONTENTS));
+ const initialValue = ref('');
+
+ const resetContentListQuery = () => {
+ contentsQuery.value = cloneDeep(DEFAULT_CONTENT_QUERY);
+ };
+
+ const resetContentList = () => {
+ contentsList.value = cloneDeep(DEFAULT_CONTENTS_LIST);
+ };
+
+ const resetContents = () => {
+ contents.value = cloneDeep(DEFAULT_CONTENTS);
+ initialValue.value = '';
+ };
+
+ const initContentsQuery = () => {
+ contentsQuery.value = cloneDeep(DEFAULT_CONTENT_QUERY);
+ };
+
+ const searchContentList = async () => {
+ try {
+ const { data } = await useAxios().get(
+ '/api/admin/contents/contentsList',
+ {
+ params: {
+ ...contentsQuery.value
+ }
+ }
+ );
+
+ contentsList.value = data;
+ } catch (e) {
+ message.error('사이트 리스트를 불러오는데 실패하였습니다.');
+ }
+ };
+
+ const searchContents = async (contentId: number) => {
+ try {
+ const { data } = await useAxios().get('/api/admin/contents/detail', {
+ params: {
+ contentId
+ }
+ });
+
+ contents.value = data;
+ initialValue.value = data.contents;
+ } catch (e) {
+ message.error('컨텐츠 정보를 불러오는데 실패하였습니다.');
+ }
+ };
+
+ const updateContents = () => {
+ console.log(contents.value);
+ return useAxios().post(
+ '/api/admin/contents/updateContents',
+ contents.value
+ );
+ };
+
+ const deleteContents = async (data: ContentType[]) => {
+ try {
+ const params = new URLSearchParams();
+ data.forEach((item) => {
+ params.append('contentId', String(item.contentId));
+ });
+
+ await useAxios().post('/api/admin/contents/deleteContents', null, {
+ params
+ });
+ message.success('컨텐츠 정보가 삭제 되었습니다.');
+ } catch (e) {
+ message.error('컨텐츠 정보 삭제에 실패하였습니다.');
+ }
+ };
+
+ return {
+ contentsQuery,
+ contentsList,
+ contents,
+ initialValue,
+ resetContentListQuery,
+ searchContentList,
+ searchContents,
+ resetContentList,
+ resetContents,
+ initContentsQuery,
+ deleteContents,
+ updateContents
+ };
+});
diff --git a/nuxt/stores/index.ts b/nuxt/stores/index.ts
new file mode 100644
index 0000000..a24eec1
--- /dev/null
+++ b/nuxt/stores/index.ts
@@ -0,0 +1,99 @@
+import type { SiteType } from '~/types/sys/site';
+import type { GridCodeType } from '~/types';
+import { defineStore } from 'pinia';
+import { computed, ref } from 'vue';
+import { useAxios } from '~/composables/useAxios';
+
+export const useLoadingStore = defineStore('useLoadingStore', () => {
+ const loadCount = ref(0);
+
+ const incrementLoadCount = () => {
+ loadCount.value++;
+ };
+
+ const decrementLoadCount = () => {
+ loadCount.value--;
+ };
+
+ const resetLoadCount = () => {
+ loadCount.value = 0;
+ };
+
+ const isLoading = computed(() => {
+ return loadCount.value > 0;
+ });
+
+ return {
+ isLoading,
+ resetLoadCount,
+ incrementLoadCount,
+ decrementLoadCount
+ };
+});
+
+export const useDefaultStore = defineStore('useDefaultStore', () => {
+ const siteInfo = ref({
+ siteId: '',
+ siteName: '',
+ siteDescription: '',
+ siteDomain: '',
+ siteType: '',
+ sitePrefix: '',
+ siteLocale: '',
+ siteLogo: '',
+ bscUrl: '',
+ lgnUrl: '',
+ delYn: false,
+ useYn: true,
+ frstRgtrId: '',
+ frstRegDt: '',
+ lastMdfrId: '',
+ lastMdfcnDt: ''
+ });
+
+ const fetchSiteInfo = async () => {
+ const { data } = await useAxios().get('/api/admin/siteInfo');
+ siteInfo.value = data;
+ };
+
+ return { siteInfo, fetchSiteInfo };
+});
+
+export const useCommonCodeStore = defineStore('useCommonCodeStore', () => {
+ const searchCommonCodeList = async (
+ codeGroupId: string
+ ): Promise => {
+ const { data } = await useAxios().get('/api/admin/code/codeList', {
+ params: {
+ codeGroupId
+ }
+ });
+ return data;
+ };
+
+ const searchSiteCodeList = async (): Promise => {
+ const { data } = await useAxios().get('/api/admin/code/siteList');
+ return data;
+ };
+
+ const searchInstCodeList = async (): Promise => {
+ const { data } = await useAxios().get(
+ '/api/admin/code/instList'
+ );
+ return data;
+ };
+
+ const searchRoleCodeList = async (): Promise => {
+ const { data } = await useAxios().get(
+ '/api/admin/code/roleList'
+ );
+ return data;
+ };
+
+ return {
+ searchInstCodeList,
+ searchSiteCodeList,
+ searchCommonCodeList,
+ searchRoleCodeList
+ };
+});
diff --git a/nuxt/types/common/index.ts b/nuxt/types/common/index.ts
new file mode 100644
index 0000000..e7acb8b
--- /dev/null
+++ b/nuxt/types/common/index.ts
@@ -0,0 +1,10 @@
+export type Page = {
+ content: T[];
+ totalElements: number;
+ totalPages: number;
+};
+
+export type PagingQuery = {
+ page: number;
+ size: number;
+};
diff --git a/nuxt/types/contents/index.ts b/nuxt/types/contents/index.ts
new file mode 100644
index 0000000..7f9a38b
--- /dev/null
+++ b/nuxt/types/contents/index.ts
@@ -0,0 +1,32 @@
+export type ContentListQueryType = {
+ page: number;
+ size: number;
+ siteId: string;
+ orgId: string;
+ keyword: string;
+ type: '' | 'TITLE' | 'CONTENT';
+};
+
+export type ContentListType = {
+ contentId: number;
+ contentTitle: string;
+ useYn: boolean;
+ frstRgtrId: string;
+ frstRegDt: string;
+ lastMdfrId: string;
+ lastMdfcnDt: string;
+};
+
+export type ContentType = {
+ contentId?: number;
+ siteId: string;
+ orgId: string;
+ contentTitle: string;
+ contents: string;
+ contentPlain: string;
+ useYn: boolean;
+ frstRgtrId: string;
+ frstRegDt: string;
+ lastMdfrId: string;
+ lastMdfcnDt: string;
+};
diff --git a/nuxt/types/index.ts b/nuxt/types/index.ts
new file mode 100644
index 0000000..6f159bd
--- /dev/null
+++ b/nuxt/types/index.ts
@@ -0,0 +1,20 @@
+export type PagingQueryType = {
+ page: number;
+ size: number;
+};
+
+export type GridCodeType = {
+ label?: string;
+ text?: string;
+ value: string;
+};
+
+export type FileInfoType = {
+ fileId: number;
+ fileOriginalName: string;
+ filePath: string;
+ fileMimeType: string;
+ fileSize: number;
+ fileAltText: string;
+ fileDownloadCount: number;
+};