diff --git a/src/api/admin.ts b/src/api/admin.ts index df2edbf..7ef09fd 100644 --- a/src/api/admin.ts +++ b/src/api/admin.ts @@ -46,6 +46,6 @@ export const getMemberDetailAdmin = async (id: string) => { } export const updateMemberAdmin = async (id: string, data: UserUpdateValue) => { - const response = await axiosInstance.post(`api/managements/members/${id}`, data) + const response = await axiosInstance.patch(`api/managements/members/${id}`, data) return response.data } diff --git a/src/components/common/LoadingIcon.vue b/src/components/common/LoadingIcon.vue new file mode 100644 index 0000000..e0786b3 --- /dev/null +++ b/src/components/common/LoadingIcon.vue @@ -0,0 +1,19 @@ + diff --git a/src/components/common/ModalView.vue b/src/components/common/ModalView.vue index fc2a2f1..d12bb65 100644 --- a/src/components/common/ModalView.vue +++ b/src/components/common/ModalView.vue @@ -19,7 +19,7 @@ - +
@@ -84,6 +84,7 @@ import { failIcon, successIcon, warningIcon } from '@/constants/iconPath' import { preventEnter } from '@/utils/preventEnter' import { onUnmounted, ref, watch } from 'vue' import CommonIcons from './CommonIcons.vue' +import LoadingIcon from './LoadingIcon.vue' const { isOpen, type, modelValue } = defineProps<{ isOpen: boolean diff --git a/src/components/request-approve/RequestApprove.vue b/src/components/request-approve/RequestApprove.vue index 82cceb6..fa7bd00 100644 --- a/src/components/request-approve/RequestApprove.vue +++ b/src/components/request-approve/RequestApprove.vue @@ -157,7 +157,6 @@ const handleSubmit = async () => { isInvalidate.value = '' return } - console.log(isTimeFilled.value, isTimeComplete.value, isDueDateValid.value) const requestData = { categoryId: category2.value.subCategoryId, diff --git a/src/components/request-task/ReRequestTask.vue b/src/components/request-task/ReRequestTask.vue index f6b16c7..979abd8 100644 --- a/src/components/request-task/ReRequestTask.vue +++ b/src/components/request-task/ReRequestTask.vue @@ -25,7 +25,9 @@ :is-invalidate="isInvalidate" :placeholderText="'부가 정보를 입력해주세요'" :limit-length="200" /> - + - + 작업이 요청되었습니다 - - + :isOpen="isModalVisible === 'loading'" + type="loadingType"> + +
@@ -66,9 +67,11 @@ const category2 = ref(null) const title = ref('') const description = ref('') const file = ref(null as File[] | null) + const isInvalidate = ref('') const isModalVisible = ref('') const isSubmitting = ref(false) +const isUploading = ref(false) const mainCategoryArr = ref([]) const subCategoryArr = ref([]) @@ -127,6 +130,8 @@ const handleSubmit = async () => { } isSubmitting.value = true + isUploading.value = true + isModalVisible.value = 'loading' const formData = new FormData() const taskInfo = { @@ -144,5 +149,6 @@ const handleSubmit = async () => { await postTaskRequest(formData) isModalVisible.value = 'success' isSubmitting.value = false + isUploading.value = false } diff --git a/src/components/request-task/RequestTaskFileInput.vue b/src/components/request-task/RequestTaskFileInput.vue index 8b83e29..33d3308 100644 --- a/src/components/request-task/RequestTaskFileInput.vue +++ b/src/components/request-task/RequestTaskFileInput.vue @@ -10,6 +10,7 @@
() const emit = defineEmits(['update:modelValue']) @@ -61,10 +63,21 @@ const handleModal = () => { isModalVisible.value = !isModalVisible.value } +const truncateFilename = (name: string, maxLength: number) => { + return [...name].slice(0, maxLength).join('') +} + const handleFileUpload = (event: Event) => { const target = event.target as HTMLInputElement if (target.files && target.files.length > 0) { - const newFiles = Array.from(target.files).filter(file => file.size <= 5 * 1024 * 1024) + const newFiles = Array.from(target.files) + .map(file => { + const truncatedName = truncateFilename(file.name, 35) + const newFile = new File([file], truncatedName, { type: file.type }) + return newFile.size <= 5 * 1024 * 1024 ? newFile : null + }) + .filter(file => file !== null) as File[] + if (newFiles.length !== target.files.length) { handleModal() return @@ -83,7 +96,13 @@ const handleDrop = (event: DragEvent) => { isDragging.value = false const files = event.dataTransfer?.files if (files && files.length > 0) { - const newFiles = Array.from(files).filter(file => file.size <= 5 * 1024 * 1024) + const newFiles = Array.from(files) + .map(file => { + const truncatedName = truncateFilename(file.name, 35) + const newFile = new File([file], truncatedName, { type: file.type }) + return newFile.size <= 5 * 1024 * 1024 ? newFile : null + }) + .filter(file => file !== null) as File[] if (newFiles.length !== files.length) { handleModal() return diff --git a/src/components/request-task/RequestTaskFileInputAfter.vue b/src/components/request-task/RequestTaskFileInputAfter.vue index 1585fc8..62f13ef 100644 --- a/src/components/request-task/RequestTaskFileInputAfter.vue +++ b/src/components/request-task/RequestTaskFileInputAfter.vue @@ -19,7 +19,7 @@ class="flex w-full justify-between items-center h-8 text-xs border-b border-b-border-2 px-4 shrink-0">

{{ file.name }}

-

{{ formatFileSize(file.size) }}

+

{{ isEdit ? file.size : formatFileSize(file.size) }}

{{ new Date().toLocaleString() }}

() +const { files, removeFile, isEdit } = defineProps() diff --git a/src/components/task-detail/TaskDetailHistory.vue b/src/components/task-detail/TaskDetailHistory.vue index cc3ca58..842095f 100644 --- a/src/components/task-detail/TaskDetailHistory.vue +++ b/src/components/task-detail/TaskDetailHistory.vue @@ -5,6 +5,7 @@ :history="historyData" :taskId="taskId" :requestor-name="requestorName" /> +

{{ history.details.commentDetails?.comment || history.details.taskDetails?.value }} diff --git a/src/components/task-detail/TaskDetailHistoryInput.vue b/src/components/task-detail/TaskDetailHistoryInput.vue index 87bdbcf..2dcc29a 100644 --- a/src/components/task-detail/TaskDetailHistoryInput.vue +++ b/src/components/task-detail/TaskDetailHistoryInput.vue @@ -34,6 +34,7 @@ @click="sendMessage" />

+

({{ inputLength }}/{{ 254 }})

isPossible.value && messageText.value.trim() !== '') +const inputLength = computed(() => messageText.value.length) const placeHolderText = computed(() => { if (history.length === 0) { diff --git a/src/components/task-detail/TaskDetailTopBar.vue b/src/components/task-detail/TaskDetailTopBar.vue index 6efe6ea..73fa368 100644 --- a/src/components/task-detail/TaskDetailTopBar.vue +++ b/src/components/task-detail/TaskDetailTopBar.vue @@ -24,7 +24,7 @@

요청 취소

@@ -99,7 +99,6 @@ const finishCancel = async () => { await queryClient.refetchQueries({ queryKey: ['myRequest'] }) - toggleModal('success') closeTaskDetail() } diff --git a/src/components/user-manage/UserUpdate.vue b/src/components/user-manage/UserUpdate.vue index f4ca1c8..db997b5 100644 --- a/src/components/user-manage/UserUpdate.vue +++ b/src/components/user-manage/UserUpdate.vue @@ -8,6 +8,7 @@ { router.back() } +const usernameRegex = /^[a-z]{3,10}\.[a-z]{1,5}$/ +const emailRegex = /^@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/ + const handleSubmit = async () => { try { + if (!userRegistrationForm.value.name) { + isInvalidate.value = 'nameEmpty' + return + } + if (!usernameRegex.test(userRegistrationForm.value.nickname)) { + isInvalidate.value = 'wrongNickname' + return + } + if (!emailRegex.test(userRegistrationForm.value.email)) { + isInvalidate.value = 'wrongEmail' + return + } if (typeof userId.value === 'string') { const userData = { role: RoleTypeMapping[userRegistrationForm.value.role], @@ -123,6 +139,7 @@ const handleSubmit = async () => { departmentId: userRegistrationForm.value.departmentId, departmentRole: userRegistrationForm.value.departmentRole } + await updateMemberAdmin(userId.value, userData) isModalVisible.value = true } diff --git a/src/types/user.ts b/src/types/user.ts index c68ad16..ff25da4 100644 --- a/src/types/user.ts +++ b/src/types/user.ts @@ -38,6 +38,7 @@ export interface RequestTaskInputProps { export interface RequestTaskFileInputProps { files: File[] | null removeFile: (index: number) => void + isEdit?: boolean } export interface RequestTaskTextAreaProps {