Skip to content

Commit df215ce

Browse files
committed
✨ [feat] : RequestHistoryList 컴포넌트 구현
1 parent 74758e3 commit df215ce

File tree

10 files changed

+420
-15
lines changed

10 files changed

+420
-15
lines changed

src/components/lists/ListCardTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div
33
class="flex gap-2 items-center"
44
:style="{ width: width ? `${width}px` : '' }"
5-
:class="!width && 'grow'">
5+
:class="width ? 'shrink-0' : 'grow'">
66
<div
77
v-if="profileImg"
88
class="w-6 h-6 rounded-full overflow-hidden">
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<ListContainer>
3+
<template #listBar>
4+
<RequestHistoryListBar />
5+
</template>
6+
7+
<template #listCards>
8+
<RequestHistoryListCard
9+
v-for="info in DUMMY_REQUEST_HISTORY_LIST_DATA"
10+
:key="info.taskId"
11+
:info="info" />
12+
</template>
13+
14+
<template #pagination>
15+
<ListPagination
16+
:page-number="params.page"
17+
:total-page="DUMMY_TOTAL_PAGE"
18+
@update:page-number="onPageChange" />
19+
</template>
20+
</ListContainer>
21+
</template>
22+
23+
<script setup lang="ts">
24+
import ListPagination from '../lists/ListPagination.vue'
25+
import ListContainer from '../lists/ListContainer.vue'
26+
import { DUMMY_REQUEST_HISTORY_LIST_DATA } from '@/datas/dummy'
27+
import { useRequestParamsStore } from '@/stores/params'
28+
import RequestHistoryListBar from './RequestHistoryListBar.vue'
29+
import RequestHistoryListCard from './RequestHistoryListCard.vue'
30+
31+
const { params } = useRequestParamsStore()
32+
const DUMMY_TOTAL_PAGE = 18
33+
const onPageChange = (value: number) => {
34+
params.page = value
35+
}
36+
37+
// Data Handling
38+
</script>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<template>
2+
<div class="list-bar">
3+
<ListBarTab
4+
v-for="tab in REQUEST_HISTORY_LIST_BAR_TAB"
5+
:key="tab.content"
6+
:content="tab.content"
7+
:width="tab.width"
8+
:sortBy="tab.sortBy"
9+
:current-order-request="params.orderRequest"
10+
@toggle-sort-by="toggleSortBy" />
11+
</div>
12+
</template>
13+
14+
<script setup lang="ts">
15+
import ListBarTab from '../lists/ListBarTab.vue'
16+
import { useRequestParamsStore } from '@/stores/params'
17+
import { REQUEST_HISTORY_LIST_BAR_TAB } from '@/constants/manager'
18+
19+
const { params } = useRequestParamsStore()
20+
21+
const toggleSortBy = (sortBy: 'REQUESTED' | 'FINISHED') => {
22+
if (sortBy === params.orderRequest.sortBy) {
23+
params.orderRequest.sortDirection =
24+
params.orderRequest.sortDirection === 'DESC' ? 'ASC' : 'DESC'
25+
} else {
26+
params.orderRequest = { sortBy, sortDirection: 'DESC' }
27+
}
28+
}
29+
</script>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<div class="list-card">
3+
<ListCardTab
4+
v-for="tab in myRequestTabList"
5+
:key="tab.content"
6+
:content="tab.content"
7+
:width="tab.width"
8+
:is-text-xs="tab.isTextXs"
9+
:profile-img="tab.profileImg"
10+
:is-status="tab.isStatus" />
11+
</div>
12+
</template>
13+
14+
<script setup lang="ts">
15+
import type { ListCardProps } from '@/types/common'
16+
import ListCardTab from '../lists/ListCardTab.vue'
17+
import type { RequestHistoryListData } from '@/types/manager'
18+
19+
const { info } = defineProps<{ info: RequestHistoryListData }>()
20+
const myRequestTabList: ListCardProps[] = [
21+
{ content: info.taskCode, width: 120, isTextXs: true },
22+
{ content: info.requestedAt, width: 80 },
23+
{ content: info.mainCategoryName, width: 80 },
24+
{ content: info.categoryName, width: 80 },
25+
{ content: info.title },
26+
{ content: info.requesterName, width: 120, profileImg: info.requesterImg },
27+
{ content: info.processorName, width: 120, profileImg: info.processorImg },
28+
{ content: info.taskStatus, width: 64, isStatus: true },
29+
{ content: info.finishedAt, width: 80 }
30+
]
31+
</script>

src/components/requested/RequestedListBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</template>
1414

1515
<script setup lang="ts">
16-
import { REQUESTED_LIST_BAR_TAB } from '@/constants/user'
16+
import { REQUESTED_LIST_BAR_TAB } from '@/constants/manager'
1717
import ListBarTab from '../lists/ListBarTab.vue'
1818
import { useRequestParamsStore } from '@/stores/params'
1919

src/constants/manager.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { ListBarTabProps } from '@/types/common'
2+
3+
export const REQUESTED_LIST_BAR_TAB: ListBarTabProps[] = [
4+
{ content: '요청일', width: 80, sortBy: 'REQUESTED' },
5+
{ content: '1차 카테고리', width: 80 },
6+
{ content: '2차 카테고리', width: 80 },
7+
{ content: '제목' },
8+
{ content: '요청자', width: 120 },
9+
{ content: '처리', width: 120, justifyCenter: true }
10+
]
11+
12+
export const REQUEST_HISTORY_LIST_BAR_TAB: ListBarTabProps[] = [
13+
{ content: '고유코드', width: 120 },
14+
{ content: '요청일', width: 80, sortBy: 'REQUESTED' },
15+
{ content: '1차 카테고리', width: 80 },
16+
{ content: '2차 카테고리', width: 80 },
17+
{ content: '제목' },
18+
{ content: '요청자', width: 120 },
19+
{ content: '처리자', width: 120 },
20+
{ content: '상태', width: 64 },
21+
{ content: '종료일', width: 80, sortBy: 'FINISHED' }
22+
]

src/constants/user.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ export const MY_REQUEST_LIST_BAR_TAB: ListBarTabProps[] = [
1111
{ content: '종료일', width: 80, sortBy: 'FINISHED' }
1212
]
1313

14-
export const REQUESTED_LIST_BAR_TAB: ListBarTabProps[] = [
15-
{ content: '요청일', width: 80, sortBy: 'REQUESTED' },
16-
{ content: '1차 카테고리', width: 80 },
17-
{ content: '2차 카테고리', width: 80 },
18-
{ content: '제목' },
19-
{ content: '요청자', width: 120 },
20-
{ content: '처리', width: 120, justifyCenter: true }
21-
]
22-
2314
export const REQUEST_TASK_CATEGORIES: string[] = [
2415
'Categroy 1',
2516
'Categroy 2',

0 commit comments

Comments
 (0)