2626 v-model =" categoryForm.name"
2727 placeholder-text =" 카테고리명을 입력해주세요"
2828 :label-name =" `${categoryStep}차 카테고리명`"
29- :is-invalidate =" errorMessage.categoryName" />
29+ :is-invalidate =" errorMessage.categoryName"
30+ :limitLength =" 30" />
3031 <RequestTaskInput
3132 v-model =" categoryForm.code"
3233 placeholder-text =" 카테고리의 작업코드를 입력해주세요"
3334 label-name =" 작업코드 (대문자 영어 2글자까지)"
3435 :is-invalidate =" errorMessage.categoryCode === 'noCode' ? 'noCode' : isCodeInvalidate" />
35-
3636 <div
3737 v-if =" categoryStep === '2'"
38- class =" flex flex-col gap-2" >
39- <p class =" text-body text-xs font-semibold" >부가설명 템플릿</p >
38+ class =" flex flex-col gap-2 relative" >
39+ <div class =" flex gap-1 text-xs" >
40+ <p class =" text-body font-semibold" >부가설명 템플릿</p >
41+ <p
42+ class =" text-red-1"
43+ v-if =" errorMessage.description === 'tooLong'" >
44+ 템플릿은 100자 이내로 적어주세요
45+ </p >
46+ </div >
4047 <textarea
4148 class =" w-full h-32 border border-border-1 px-4 py-2 resize-none focus:outline-none rounded"
4249 :value =" categoryForm.descriptionExample"
50+ :maxlength =" 100"
4351 :placeholder =" '부가설명 템플릿을 작성해주세요'"
4452 @input =" onValueChange" >
4553 </textarea >
54+ <p class =" absolute text-xs top-[calc(100%+4px)] w-full flex justify-end text-body" >
55+ {{ categoryForm.descriptionExample?.length || 0 }}/{{ 100 }}
56+ </p >
4657 </div >
4758
4859 <FormButtonContainer
5465</template >
5566
5667<script lang="ts" setup>
68+ import { getMainCategory } from ' @/api/common'
5769import { CATEGORY_FORM } from ' @/constants/admin'
70+ import type { Category , CategoryForm } from ' @/types/common'
71+ import { axiosInstance } from ' @/utils/axios'
72+ import DOMPurify from ' dompurify'
5873import { computed , onMounted , ref , watch } from ' vue'
5974import { useRoute , useRouter } from ' vue-router'
6075import FormButtonContainer from ' ../common/FormButtonContainer.vue'
76+ import ModalView from ' ../common/ModalView.vue'
6177import RequestTaskDropdown from ' ../request-task/RequestTaskDropdown.vue'
6278import RequestTaskInput from ' ../request-task/RequestTaskInput.vue'
63- import { axiosInstance } from ' @/utils/axios'
64- import { getMainCategory } from ' @/api/common'
65- import type { Category , CategoryForm } from ' @/types/common'
66- import ModalView from ' ../common/ModalView.vue'
67- import DOMPurify from ' dompurify'
6879
6980const router = useRouter ()
7081const route = useRoute ()
@@ -74,11 +85,10 @@ const { categoryStep } = defineProps<{
7485}>()
7586
7687const isModalVisible = ref ({ add: false , cancel: false , fail: false })
77- const errorMessage = ref ({ categoryName: ' ' , categoryCode: ' ' })
88+ const errorMessage = ref ({ categoryName: ' ' , categoryCode: ' ' , description: ' ' })
7889const hasMainCategory = ref (true )
7990
8091const categoryForm = ref <CategoryForm >(CATEGORY_FORM )
81-
8292const handleAddModal = () => {
8393 isModalVisible .value .add = false
8494 handleGoBack ()
@@ -97,7 +107,7 @@ const handleGoBack = () => {
97107
98108const handleSubmit = async () => {
99109 hasMainCategory .value = true
100- errorMessage .value = { categoryCode: ' ' , categoryName: ' ' }
110+ errorMessage .value = { categoryCode: ' ' , categoryName: ' ' , description: ' ' }
101111 if (! categoryForm .value .mainCategoryId && categoryStep === ' 2' ) {
102112 hasMainCategory .value = false
103113 return
@@ -110,6 +120,9 @@ const handleSubmit = async () => {
110120 } else if (categoryForm .value .code .length === 0 ) {
111121 errorMessage .value .categoryCode = ' noCode'
112122 return
123+ } else if ((categoryForm .value .descriptionExample ?? ' ' ).length > 100 ) {
124+ errorMessage .value .description = ' tooLong'
125+ return
113126 }
114127
115128 categoryForm .value .name = DOMPurify .sanitize (categoryForm .value .name )
0 commit comments