diff --git a/src/api/admin.ts b/src/api/admin.ts index 65f6e852..86c6c982 100644 --- a/src/api/admin.ts +++ b/src/api/admin.ts @@ -1,19 +1,19 @@ -import type { NewLabelTypes } from '@/types/admin' +import type { NewLabelTypes, UserRegistrationProps } from '@/types/admin' import type { LabelDataTypes } from '@/types/common' import { axiosInstance } from '@/utils/axios' export const deleteLabelAdmin = async (id: number) => { - const response = await axiosInstance.delete(`/api/management/labels/${id}`) + const response = await axiosInstance.delete(`/api/managements/labels/${id}`) return response.data } export const postAddLabelAdmin = async (newLabel: NewLabelTypes) => { - const response = await axiosInstance.post('/api/management/labels', newLabel) + const response = await axiosInstance.post('/api/managements/labels', newLabel) return response.data } export const patchLabelAdmin = async (editLabel: LabelDataTypes) => { - const response = await axiosInstance.patch(`/api/management/labels/${editLabel.labelId}`, { + const response = await axiosInstance.patch(`/api/managements/labels/${editLabel.labelId}`, { labelName: editLabel.labelName, labelColor: editLabel.labelColor }) @@ -24,3 +24,9 @@ export const deleteCategoryAdmin = async (id: number) => { const response = await axiosInstance.delete(`/api/managements/categories/${id}`) return response.data } + +export const addMemberAdmin = async (memberData: UserRegistrationProps) => { + console.log(memberData, '요청 데이터') + const response = await axiosInstance.post('/api/managements/members', memberData) + return response.data +} diff --git a/src/api/user.ts b/src/api/user.ts index 00bcc2d9..0315d6e2 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,3 +1,4 @@ +import type { Status } from '@/types/common' import type { RequestApprovePostTypes } from '@/types/manager' import { axiosInstance, formDataAxiosInstance } from '@/utils/axios' @@ -30,3 +31,23 @@ export const getManager = async () => { const response = await axiosInstance.get('/api/managers') return response.data } + +export const changeProcessor = async (taskID: number, processorId: number) => { + const response = await axiosInstance.patch(`/api/tasks/${taskID}/processor`, { processorId }) + return response.data +} + +export const patchChangeStatus = async (taskID: number, status: Status) => { + const response = await axiosInstance.patch(`/api/tasks/${taskID}/status`, status) + return response.data +} + +export const changeLabel = async (taskID: number, labelId: number) => { + const response = await axiosInstance.patch(`/api/tasks/${taskID}/label`, { labelId }) + return response.data +} + +export const getHistory = async (taskID: number) => { + const response = await axiosInstance.get(`/api/tasks/${taskID}/histories`) + return response.data +} diff --git a/src/assets/styles.css b/src/assets/styles.css index cce74742..4627248b 100644 --- a/src/assets/styles.css +++ b/src/assets/styles.css @@ -110,7 +110,7 @@ body { @apply flex w-full h-11 items-center rounded p-4 bg-white border border-border-1 cursor-pointer text-black; } .request-task-dropdown-option-list { - @apply absolute w-full h-40 overflow-y-auto top-[52px] flex flex-col gap-2 p-2 bg-white rounded z-10 shadow border-t border-t-border-2 text-black; + @apply absolute w-full h-40 overflow-y-auto top-[52px] flex flex-col gap-2 p-2 bg-white rounded z-10 shadow-custom text-black; } .request-task-dropdown-option { @apply w-full flex items-center h-11 p-2 rounded hover:bg-background-2 cursor-pointer; @@ -138,3 +138,6 @@ body { .task-detail-dropdown-option { @apply w-full flex items-center h-10 p-2 rounded hover:bg-background-2 cursor-pointer; } +.task-detail-manager-dropdown { + @apply flex w-full h-10 items-center rounded p-4 bg-white border border-border-1 cursor-pointer text-black; +} diff --git a/src/components/TopBar.vue b/src/components/TopBar.vue index f39df6e6..5f74dcba 100644 --- a/src/components/TopBar.vue +++ b/src/components/TopBar.vue @@ -31,13 +31,13 @@ diff --git a/src/components/task-detail/TaskDetailHistory.vue b/src/components/task-detail/TaskDetailHistory.vue index 4be13103..d6670ad3 100644 --- a/src/components/task-detail/TaskDetailHistory.vue +++ b/src/components/task-detail/TaskDetailHistory.vue @@ -1,33 +1,33 @@ diff --git a/src/components/task-detail/TaskDetailTopBar.vue b/src/components/task-detail/TaskDetailTopBar.vue index 3674414d..46e31bb1 100644 --- a/src/components/task-detail/TaskDetailTopBar.vue +++ b/src/components/task-detail/TaskDetailTopBar.vue @@ -2,20 +2,20 @@

재요청

요청 수정

요청 승인

@@ -50,18 +50,14 @@ import { modificationIcon, reRequestIcon } from '@/constants/iconPath' -import { useMemberStore } from '@/stores/member' import type { TaskDetailTopBarProps } from '@/types/manager' -import { storeToRefs } from 'pinia' -import { computed, ref } from 'vue' +import { ref } from 'vue' import { useRouter } from 'vue-router' import CommonIcons from '../common/CommonIcons.vue' import ModalView from '../ModalView.vue' -const memberStore = useMemberStore() const router = useRouter() -const { info } = storeToRefs(memberStore) -const isManager = computed(() => info.value.memberRole === 'ROLE_MANAGER') +const { isApproved, closeTaskDetail, id, isProcessor } = defineProps() const isModalOpen = ref({ cancel: false, @@ -81,7 +77,5 @@ const ApproveTask = () => { router.push(`/request-approve/${id}`) } -const { isApproved, closeTaskDetail, id } = defineProps() +console.log(isProcessor, '이즈 프로세서 값') - - diff --git a/src/components/task-detail/TaskStatusList.vue b/src/components/task-detail/TaskStatusList.vue index 6b7edcad..51e2995f 100644 --- a/src/components/task-detail/TaskStatusList.vue +++ b/src/components/task-detail/TaskStatusList.vue @@ -1,34 +1,65 @@ diff --git a/src/components/task-management/LabelManagement.vue b/src/components/task-management/LabelManagement.vue index 6afd3716..dbdf6448 100644 --- a/src/components/task-management/LabelManagement.vue +++ b/src/components/task-management/LabelManagement.vue @@ -58,6 +58,7 @@ diff --git a/src/constants/admin.ts b/src/constants/admin.ts index 44c1e4be..b5370a56 100644 --- a/src/constants/admin.ts +++ b/src/constants/admin.ts @@ -42,13 +42,13 @@ export const CATEGORY_FORM: CategoryForm = { } export const INITIAL_USER_REGISTRATION: UserRegistrationProps = { - name: '', - email: '', - nickname: '', + name: '조철득', + email: 'choiron@gmail.com', + nickname: 'iron.ch', isReviewer: false, - departmentId: '', - role: '회원의 역할을 선택해주세요', - departmentRole: '' + departmentId: 1, + role: 'ROLE_USER', + departmentRole: 'FE' } export const RoleTypeMapping: { [key in RoleTypes]: RoleTypesEnum } = { diff --git a/src/constants/user.ts b/src/constants/user.ts index 3a719d20..28442bda 100644 --- a/src/constants/user.ts +++ b/src/constants/user.ts @@ -27,7 +27,8 @@ export const HistoryMessageBefore: Record = { PROCESSOR_CHANGED: '처리자가', COMMENT: '', COMMENT_FILE: '', - PROCESSOR_ASSIGNED: '처리자가' + PROCESSOR_ASSIGNED: '처리자가', + TASK_TERMINATED: '작업이' } export const HistoryMessageAfter: Record = { @@ -35,5 +36,6 @@ export const HistoryMessageAfter: Record = { PROCESSOR_CHANGED: '님으로 변경되었습니다.', COMMENT: '', COMMENT_FILE: '', - PROCESSOR_ASSIGNED: '님으로 할당되었습니다.' + PROCESSOR_ASSIGNED: '님으로 할당되었습니다.', + TASK_TERMINATED: '종료되었습니다.' } diff --git a/src/datas/taskdetail.ts b/src/datas/taskdetail.ts deleted file mode 100644 index 06afc167..00000000 --- a/src/datas/taskdetail.ts +++ /dev/null @@ -1,101 +0,0 @@ -import type { LabelDataTypes } from '@/types/common' -import type { TaskDetailHistoryProps } from '@/types/user' - -export const DUMMY_REQUEST_TASK_CATEGORIES: string[] = [ - 'Categroy 1', - 'Categroy 2', - 'Categroy 3', - 'Categroy 4' -] - -export const DUMMY_TASK_DETAIL_HISTORY: TaskDetailHistoryProps[] = [ - { - date: '2023-10-01', - time: '10:00', - name: 'John Doe', - profileImageUrl: 'images/mockProfile.jpg', - TaskHistoryType: 'COMMENT', - isModified: false, - details: { - previousProcessor: 'Hello.world', - currentProcessor: 'Tony.tsx', - comment: 'Initial comment on the task.' - } - }, - { - date: '2023-10-02', - time: '11:30', - name: 'Jane Smith', - profileImageUrl: 'images/mockProfile.jpg', - TaskHistoryType: 'STATUS_SWITCHED', - isModified: true, - details: { - previousProcessor: 'Hello.world', - currentProcessor: 'Tony.tsx', - taskStatus: 'In Progress' - } - }, - { - date: '2023-10-03', - time: '14:45', - name: 'Alice Johnson', - profileImageUrl: 'images/mockProfile.jpg', - TaskHistoryType: 'PROCESSOR_ASSIGNED', - isModified: false, - details: { - previousProcessor: 'Hello.world', - currentProcessor: 'Tony.tsx', - updateDetails: 'Processor assigned to Tony.' - } - }, - { - date: '2023-10-04', - time: '16:20', - name: 'Bob Brown', - profileImageUrl: 'images/mockProfile.jpg', - TaskHistoryType: 'COMMENT_FILE', - isModified: true, - details: { - previousProcessor: 'Hello.world', - currentProcessor: 'Tony.tsx', - file: { - fileId: 1, - fileUrl: 'https://example.com/file1.pdf', - fileName: 'file1.pdf' - } - } - } -] - -export const DUMMY_REQUEST_TASK_LABELS: string[] = ['긴급', '정기', '오류', '점검'] - -export const DUMMY_PROCESSOR = { - nickName: 'Tony', - profileUrl: 'images/mockProfile.jpg', - totalAssignedTasks: 5 -} - -export const DUMMY_TASK_DETAIL_LABELS: string[] = ['긴급', '정기', '오류', '점검'] - -export const DUMMY_TASK_LABELS: LabelDataTypes[] = [ - { - labelId: 1, - labelName: '긴급', - labelColor: 'red' - }, - { - labelId: 2, - labelName: '정기', - labelColor: 'green' - }, - { - labelId: 3, - labelName: '오류', - labelColor: 'blue' - }, - { - labelId: 4, - labelName: '점검', - labelColor: 'gray' - } -] diff --git a/src/types/admin.ts b/src/types/admin.ts index d655ec38..abbfd33b 100644 --- a/src/types/admin.ts +++ b/src/types/admin.ts @@ -27,7 +27,7 @@ export interface UserRegistrationProps { email: string nickname: string isReviewer: boolean - departmentId: string + departmentId: number role: string departmentRole: string } diff --git a/src/types/manager.ts b/src/types/manager.ts index 013d2c91..608887fc 100644 --- a/src/types/manager.ts +++ b/src/types/manager.ts @@ -103,6 +103,7 @@ export interface TaskDetailTopBarProps { isApproved: boolean closeTaskDetail: () => void id: number + isProcessor: boolean } export interface DraggableEvent { diff --git a/src/types/user.ts b/src/types/user.ts index 6a32eb7b..14a699f4 100644 --- a/src/types/user.ts +++ b/src/types/user.ts @@ -74,28 +74,44 @@ export type TaskHistoryType = | 'STATUS_SWITCHED' | 'PROCESSOR_ASSIGNED' | 'PROCESSOR_CHANGED' + | 'TASK_TERMINATED' -interface TaskDetailHistoryFileTypes { - fileId: number - fileUrl: string - fileName: string +export interface TaskDetailHistoryProps { + histories: TaskHistory[] } -export interface TaskDetailHistoryProps { +export interface TaskHistory { + historyId: number date: string time: string - name: string + taskHistoryType: TaskHistoryType + details: TaskHistoryDetails +} + +export interface TaskHistoryDetails { + taskDetails?: TaskDetails | null + commentDetails?: CommentDetails | null + commentFileDetails?: CommentFileDetails | null +} + +export interface TaskDetails { + value: string +} + +export interface CommentDetails { + nickName: string profileImageUrl: string - TaskHistoryType: TaskHistoryType isModified: boolean - details: { - previousProcessor: string - currentProcessor: string - comment?: string - updateDetails?: string - taskStatus?: string - file?: TaskDetailHistoryFileTypes - } + comment: string +} + +export interface CommentFileDetails { + nickName: string + profileImageUrl: string + isModified: boolean + fileName: string + url: string + size: string } export interface TaskDetailProps { @@ -121,7 +137,7 @@ export interface TaskDetailRightProps { export interface TaskDetailLabelDropdownProps { options: LabelDataTypes[] - modelValue: string + modelValue: LabelDataTypes } export interface TaskHistoryDatas { @@ -154,6 +170,7 @@ export interface MyRequestResponse { } export interface LabelDropdownProps { + taskId?: number modelValue: LabelDataTypes | null placeholderText: string } @@ -163,3 +180,13 @@ export interface ManagerDropdownProps { placeholderText: string isInvalidate: string } + +export interface DetailManagerDropdownProps { + modelValue: ManagerTypes +} + +export interface TaskStatusListProps { + modelValue: Status + isProcessor: boolean + taskId?: number +} diff --git a/src/utils/date.ts b/src/utils/date.ts index 753a9b85..48a7ef26 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -24,3 +24,29 @@ export const convertToISO = (dateStr: string, timeStr: string) => { const date = new Date(`${dateStr}T${timeStr}:00`) return date.toISOString() } + +export const formatDueDate = (dateString: string) => { + const date = new Date(dateString) + + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hours = date.getHours() + const minutes = date.getMinutes() + + return `${year}년 ${month}월 ${day}일, ${hours}시 ${minutes}분까지` +} + +export const formatDaysBefore = (dateString: string) => { + const date = new Date(dateString) + const today = new Date() + + const koreaOffset = 9 * 60 * 60 * 1000 + const koreaDate = new Date(date.getTime() + koreaOffset) + const koreaToday = new Date(today.getTime() + koreaOffset) + + const diffTime = koreaDate.getTime() - koreaToday.getTime() + const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24)) + + return `${diffDays}일 남음` +}