Skip to content

Commit 0199021

Browse files
authored
Merge pull request #62 from TaskFlow-CLAP/CLAP-202
CLAP-202 담당자 기능 목록 조회 API 연결
2 parents 36cd54f + 6ea044b commit 0199021

File tree

11 files changed

+138
-748
lines changed

11 files changed

+138
-748
lines changed

src/components/my-request/MyRequestList.vue

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<template #pagination>
1616
<ListPagination
1717
:page-number="params.page + 1"
18-
:total-page="totalPage"
18+
:total-page="totalPage || 0"
1919
@update:page-number="onPageChange" />
2020
</template>
2121
</ListContainer>
@@ -26,20 +26,20 @@ import { useRequestParamsStore } from '@/stores/params'
2626
import type { MyRequestResponse } from '@/types/user'
2727
import { axiosInstance } from '@/utils/axios'
2828
import { useQuery } from '@tanstack/vue-query'
29-
import { ref, watch } from 'vue'
3029
import { useParseParams } from '../hooks/useParseParams'
3130
import ListContainer from '../lists/ListContainer.vue'
3231
import ListPagination from '../lists/ListPagination.vue'
3332
import NoContent from '../lists/NoContent.vue'
3433
import MyRequestListBar from './MyRequestListBar.vue'
3534
import MyRequestListCard from './MyRequestListCard.vue'
35+
import { computed } from 'vue'
3636
3737
const { params } = useRequestParamsStore()
3838
const onPageChange = (value: number) => {
3939
params.page = value
4040
}
4141
42-
const fetchRequestList = async () => {
42+
const fetchMyRequestList = async () => {
4343
const { parseRequestParams } = useParseParams()
4444
const parsedParams = parseRequestParams(params)
4545
const response = await axiosInstance.get('/api/tasks/requests', {
@@ -53,15 +53,10 @@ const fetchRequestList = async () => {
5353
5454
const { data } = useQuery<MyRequestResponse>({
5555
queryKey: ['myRequest', params],
56-
queryFn: fetchRequestList
56+
queryFn: fetchMyRequestList
5757
})
5858
59-
watch(
60-
data,
61-
() => {
62-
if (data.value?.totalPages) totalPage.value = data.value.totalPages
63-
},
64-
{ once: true }
65-
)
66-
const totalPage = ref(0)
59+
const totalPage = computed(() => {
60+
return data.value?.totalPages
61+
})
6762
</script>

src/components/my-task/MyTaskList.vue

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
<template #listCards>
88
<MyTaskListCard
9-
v-for="info in DUMMY_MY_TASK_LIST_DATA"
9+
v-for="info in data?.content"
1010
:key="info.taskId"
1111
:info="info" />
12+
<NoContent v-if="data?.content.length === 0" />
1213
</template>
1314

1415
<template #pagination>
1516
<ListPagination
16-
:page-number="params.page"
17-
:total-page="DUMMY_TOTAL_PAGE"
17+
:page-number="params.page + 1"
18+
:total-page="totalPage || 0"
1819
@update:page-number="onPageChange" />
1920
</template>
2021
</ListContainer>
@@ -23,16 +24,39 @@
2324
<script setup lang="ts">
2425
import ListPagination from '../lists/ListPagination.vue'
2526
import ListContainer from '../lists/ListContainer.vue'
26-
import { DUMMY_MY_TASK_LIST_DATA } from '@/datas/dummy'
2727
import { useRequestParamsStore } from '@/stores/params'
2828
import MyTaskListCard from './MyTaskListCard.vue'
2929
import MyTaskListBar from './MyTaskListBar.vue'
30+
import { useParseParams } from '../hooks/useParseParams'
31+
import axiosInstance from '@/utils/axios'
32+
import type { MyTaskResponse } from '@/types/manager'
33+
import { useQuery } from '@tanstack/vue-query'
34+
import { computed } from 'vue'
35+
import NoContent from '../lists/NoContent.vue'
3036
3137
const { params } = useRequestParamsStore()
32-
const DUMMY_TOTAL_PAGE = 18
3338
const onPageChange = (value: number) => {
3439
params.page = value
3540
}
3641
37-
// Data Handling
42+
const fetchMyTaskList = async () => {
43+
const { parseRequestParams } = useParseParams()
44+
const parsedParams = parseRequestParams(params)
45+
const response = await axiosInstance.get('/api/tasks/assigned', {
46+
headers: {
47+
Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`
48+
},
49+
params: parsedParams
50+
})
51+
return response.data
52+
}
53+
54+
const { data } = useQuery<MyTaskResponse>({
55+
queryKey: ['myTask', params],
56+
queryFn: fetchMyTaskList
57+
})
58+
59+
const totalPage = computed(() => {
60+
return data.value?.totalPages
61+
})
3862
</script>

src/components/my-task/MyTaskListCard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
import type { ListCardProps } from '@/types/common'
1616
import ListCardTab from '../lists/ListCardTab.vue'
1717
import type { MyTaskListData } from '@/types/manager'
18+
import { formatDate } from '@/utils/date'
1819
1920
const { info } = defineProps<{ info: MyTaskListData }>()
2021
const myRequestTabList: ListCardProps[] = [
2122
{ content: info.taskCode, width: 120, isTextXs: true },
22-
{ content: info.requestedAt, width: 80 },
23+
{ content: formatDate(info.requestedAt), width: 80 },
2324
{ content: info.mainCategoryName, width: 80 },
2425
{ content: info.categoryName, width: 80 },
2526
{ content: info.title },
2627
{ content: info.requesterName, width: 120, profileImg: info.requesterImg },
2728
{ content: info.taskStatus, width: 64, isStatus: true },
28-
{ content: info.finishedAt, width: 80 }
29+
{ content: info.finishedAt ? formatDate(info.finishedAt) : '', width: 80 }
2930
]
3031
</script>

src/components/request-history/RequestHistoryList.vue

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
<template #listCards>
88
<RequestHistoryListCard
9-
v-for="info in DUMMY_REQUEST_HISTORY_LIST_DATA"
9+
v-for="info in data?.content"
1010
:key="info.taskId"
1111
:info="info" />
12+
<NoContent v-if="data?.content.length === 0" />
1213
</template>
1314

1415
<template #pagination>
1516
<ListPagination
16-
:page-number="params.page"
17-
:total-page="DUMMY_TOTAL_PAGE"
17+
:page-number="params.page + 1"
18+
:total-page="totalPage || 0"
1819
@update:page-number="onPageChange" />
1920
</template>
2021
</ListContainer>
@@ -23,16 +24,39 @@
2324
<script setup lang="ts">
2425
import ListPagination from '../lists/ListPagination.vue'
2526
import ListContainer from '../lists/ListContainer.vue'
26-
import { DUMMY_REQUEST_HISTORY_LIST_DATA } from '@/datas/dummy'
2727
import { useRequestParamsStore } from '@/stores/params'
2828
import RequestHistoryListBar from './RequestHistoryListBar.vue'
2929
import RequestHistoryListCard from './RequestHistoryListCard.vue'
30+
import { useParseParams } from '../hooks/useParseParams'
31+
import axiosInstance from '@/utils/axios'
32+
import { useQuery } from '@tanstack/vue-query'
33+
import { computed } from 'vue'
34+
import type { RequestHistoryResponse } from '@/types/manager'
35+
import NoContent from '../lists/NoContent.vue'
3036
3137
const { params } = useRequestParamsStore()
32-
const DUMMY_TOTAL_PAGE = 18
3338
const onPageChange = (value: number) => {
3439
params.page = value
3540
}
3641
37-
// Data Handling
42+
const fetchRequestHistoryList = async () => {
43+
const { parseRequestParams } = useParseParams()
44+
const parsedParams = parseRequestParams(params)
45+
const response = await axiosInstance.get('/api/tasks', {
46+
headers: {
47+
Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`
48+
},
49+
params: parsedParams
50+
})
51+
return response.data
52+
}
53+
54+
const { data } = useQuery<RequestHistoryResponse>({
55+
queryKey: ['requestHistory', params],
56+
queryFn: fetchRequestHistoryList
57+
})
58+
59+
const totalPage = computed(() => {
60+
return data.value?.totalPages
61+
})
3862
</script>

src/components/request-history/RequestHistoryListCard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@
1515
import type { ListCardProps } from '@/types/common'
1616
import ListCardTab from '../lists/ListCardTab.vue'
1717
import type { RequestHistoryListData } from '@/types/manager'
18+
import { formatDate } from '@/utils/date'
1819
1920
const { info } = defineProps<{ info: RequestHistoryListData }>()
2021
const myRequestTabList: ListCardProps[] = [
2122
{ content: info.taskCode, width: 120, isTextXs: true },
22-
{ content: info.requestedAt, width: 80 },
23+
{ content: formatDate(info.requestedAt), width: 80 },
2324
{ content: info.mainCategoryName, width: 80 },
2425
{ content: info.categoryName, width: 80 },
2526
{ content: info.title },
2627
{ content: info.requesterName, width: 120, profileImg: info.requesterImg },
2728
{ content: info.processorName, width: 120, profileImg: info.processorImg },
2829
{ content: info.taskStatus, width: 64, isStatus: true },
29-
{ content: info.finishedAt, width: 80 }
30+
{ content: info.finishedAt ? formatDate(info.finishedAt) : '', width: 80 }
3031
]
3132
</script>

src/components/requested/RequestedFilterBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
:value="store.params.title"
1717
@update:value="onParamsChange.onTitleChange" />
1818
<FilterInput
19-
title="처리자"
19+
title="요청자"
2020
:value="store.params.nickName"
2121
@update:value="onParamsChange.onNickNameChange" />
2222
<FilterDropdown

src/components/requested/RequestedList.vue

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
<template #listCards>
88
<RequestedListCard
9-
v-for="info in DUMMY_REQUESTED_LIST_DATA"
9+
v-for="info in data?.content"
1010
:key="info.taskId"
1111
:info="info" />
12+
<NoContent v-if="data?.content.length === 0" />
1213
</template>
1314

1415
<template #pagination>
1516
<ListPagination
16-
:page-number="params.page"
17-
:total-page="DUMMY_TOTAL_PAGE"
17+
:page-number="params.page + 1"
18+
:total-page="totalPage || 0"
1819
@update:page-number="onPageChange" />
1920
</template>
2021
</ListContainer>
@@ -24,15 +25,38 @@
2425
import ListPagination from '../lists/ListPagination.vue'
2526
import ListContainer from '../lists/ListContainer.vue'
2627
import RequestedListBar from './RequestedListBar.vue'
27-
import { DUMMY_REQUESTED_LIST_DATA } from '@/datas/dummy'
2828
import RequestedListCard from './RequestedListCard.vue'
2929
import { useRequestParamsStore } from '@/stores/params'
30+
import { useParseParams } from '../hooks/useParseParams'
31+
import axiosInstance from '@/utils/axios'
32+
import { useQuery } from '@tanstack/vue-query'
33+
import { computed } from 'vue'
34+
import type { RequestedResponse } from '@/types/manager'
35+
import NoContent from '../lists/NoContent.vue'
3036
3137
const { params } = useRequestParamsStore()
32-
const DUMMY_TOTAL_PAGE = 18
3338
const onPageChange = (value: number) => {
3439
params.page = value
3540
}
3641
37-
// Data Handling
42+
const fetchRequestedList = async () => {
43+
const { parseRequestParams } = useParseParams()
44+
const parsedParams = parseRequestParams(params)
45+
const response = await axiosInstance.get('/api/tasks/requests/pending', {
46+
headers: {
47+
Authorization: `Bearer ${import.meta.env.VITE_ACCESS_TOKEN}`
48+
},
49+
params: parsedParams
50+
})
51+
return response.data
52+
}
53+
54+
const { data } = useQuery<RequestedResponse>({
55+
queryKey: ['requested', params],
56+
queryFn: fetchRequestedList
57+
})
58+
59+
const totalPage = computed(() => {
60+
return data.value?.totalPages
61+
})
3862
</script>

src/components/requested/RequestedListCard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ import type { ListCardProps } from '@/types/common'
2424
import ListCardTab from '../lists/ListCardTab.vue'
2525
import type { RequestedListData } from '@/types/manager'
2626
import { useRouter } from 'vue-router'
27+
import { formatDate } from '@/utils/date'
2728
2829
const { info } = defineProps<{ info: RequestedListData }>()
2930
const requestedTabList: ListCardProps[] = [
30-
{ content: info.requestedAt, width: 80 },
31+
{ content: formatDate(info.requestedAt), width: 80 },
3132
{ content: info.mainCategoryName, width: 80 },
3233
{ content: info.categoryName, width: 80 },
3334
{ content: info.title },

src/constants/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const TERM_LIST = [
99
export const TASK_STATUS_LIST = [
1010
{ value: 'REQUESTED', content: '요청' },
1111
{ value: 'IN_PROGRESS', content: '진행 중' },
12-
{ value: 'IN_REVIEWING', content: '검토 중' },
12+
{ value: 'PENDING_COMPLETED', content: '검토 중' },
1313
{ value: 'COMPLETED', content: '완료' },
1414
{ value: 'TERMINATED', content: '종료' }
1515
]

0 commit comments

Comments
 (0)