3838 label-name =" 고유코드 (대문자 영어 2글자까지)"
3939 :is-invalidate =" isCodeInvalidate" />
4040
41+ <div
42+ v-if =" categoryStep === '2'"
43+ class =" flex flex-col gap-2" >
44+ <p class =" text-body text-xs font-bold" >부가설명 템플릿</p >
45+ <textarea
46+ class =" w-full h-32 border border-border-1 px-4 py-2 resize-none focus:outline-none rounded"
47+ :value =" categoryForm.descriptionExample"
48+ :placeholder =" '부가설명 템플릿을 작성해주세요'"
49+ @input =" onValueChange" >
50+ </textarea >
51+ </div >
52+
4153 <FormButtonContainer
4254 :handle-cancel =" handleCancel"
4355 :handle-submit =" handleSubmit"
@@ -55,8 +67,8 @@ import ModalView from '../ModalView.vue'
5567import RequestTaskDropdown from ' ../request-task/RequestTaskDropdown.vue'
5668import RequestTaskInput from ' ../request-task/RequestTaskInput.vue'
5769import { axiosInstance } from ' @/utils/axios'
58- import { getMainCategory , getSubCategory } from ' @/api/common'
59- import type { Category , CategoryForm , SubCategory } from ' @/types/common'
70+ import { getMainCategory } from ' @/api/common'
71+ import type { Category , CategoryForm } from ' @/types/common'
6072
6173const router = useRouter ()
6274const route = useRoute ()
@@ -134,24 +146,24 @@ onMounted(async () => {
134146 if (categoryStep === ' 1' ) {
135147 if (id ) {
136148 const mainCategories: Category [] = await getMainCategory ()
137- const initailValue = mainCategories .find (el => el .id === id )
138- if (initailValue ) {
139- categoryForm .value = { name: initailValue .name , code: initailValue .code }
149+ const initialValue = mainCategories .find (el => el .id === id )
150+ if (initialValue ) {
151+ categoryForm .value = { name: initialValue .name , code: initialValue .code }
140152 }
141153 }
142154 } else if (categoryStep === ' 2' ) {
143155 categoryOptions .value = await getMainCategory ()
144156 if (id ) {
145- const subCategory: SubCategory [] = await getSubCategory ()
146- const initailValue = subCategory .find (el => el .id === id )
147- if (initailValue ) {
157+ const { data : initialValue } = await axiosInstance .get (` /api/sub-categories/${id } ` )
158+ if (initialValue ) {
148159 categoryForm .value = {
149- name: initailValue .name ,
150- code: initailValue .code ,
151- mainCategoryId: initailValue .mainCategoryId
160+ name: initialValue .name ,
161+ code: initialValue .code ,
162+ mainCategoryId: initialValue .mainCategoryId ,
163+ descriptionExample: initialValue .descriptionExample
152164 }
153165 mainCategory .value =
154- categoryOptions .value .find (el => el .id === initailValue .mainCategoryId )?.name || ' '
166+ categoryOptions .value .find (el => el .id === initialValue .mainCategoryId )?.name || ' '
155167 }
156168 }
157169 }
@@ -161,4 +173,9 @@ watch(mainCategory, () => {
161173 el => el .name === mainCategory .value
162174 )?.id
163175})
176+
177+ const onValueChange = (event : Event ) => {
178+ const target = event .target as HTMLInputElement
179+ categoryForm .value .descriptionExample = target .value
180+ }
164181 </script >
0 commit comments