수정사항 완료
This commit is contained in:
parent
37c335fc12
commit
7e484c12be
@ -39,7 +39,6 @@
|
|||||||
<div
|
<div
|
||||||
v-if="isPopoverVisible"
|
v-if="isPopoverVisible"
|
||||||
class="position-absolute w-100 map text-end"
|
class="position-absolute w-100 map text-end"
|
||||||
@click.stop
|
|
||||||
>
|
>
|
||||||
<button type="button" class="btn-close popover-close" @click.stop="isPopoverVisible = !isPopoverVisible"></button>
|
<button type="button" class="btn-close popover-close" @click.stop="isPopoverVisible = !isPopoverVisible"></button>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -48,6 +47,7 @@
|
|||||||
v-if="coordinates"
|
v-if="coordinates"
|
||||||
:lat="coordinates.lat"
|
:lat="coordinates.lat"
|
||||||
:lng="coordinates.lng"
|
:lng="coordinates.lng"
|
||||||
|
:draggable="false"
|
||||||
class="w-100 h-px-200"
|
class="w-100 h-px-200"
|
||||||
>
|
>
|
||||||
<KakaoMapMarker
|
<KakaoMapMarker
|
||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button type="button" class="btn btn-secondary" @click="closeModal">닫기</button>
|
<BackButton @click="closeModal" />
|
||||||
</template>
|
</template>
|
||||||
</CenterModal>
|
</CenterModal>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
<h5 class="modal-title m-auto fw-bold" id="modalCenterTitle">
|
<h5 class="modal-title m-auto fw-bold" id="modalCenterTitle">
|
||||||
<slot name="title">Modal Title</slot>
|
<slot name="title">Modal Title</slot>
|
||||||
</h5>
|
</h5>
|
||||||
<button type="button" class="btn-close" @click="closeModal" aria-label="Close"></button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<slot name="body">Modal body</slot>
|
<slot name="body">Modal body</slot>
|
||||||
@ -21,17 +20,26 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
const prop = defineProps({
|
const prop = defineProps({
|
||||||
display : {
|
display : {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
create: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close' , 'reset']);
|
||||||
|
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
|
if (prop.create) {
|
||||||
|
emit('reset');
|
||||||
|
}
|
||||||
|
|
||||||
emit('close', false);
|
emit('close', false);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@ -45,3 +53,4 @@ const closeModal = () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 등록 모달 -->
|
<!-- 등록 모달 -->
|
||||||
<CenterModal :display="isCreateModalOpen" @close="closeCreateModal">
|
<form @reset.prevent="formReset">
|
||||||
|
<CenterModal :display="isCreateModalOpen" @close="closeCreateModal" :create="true" @reset="formReset">
|
||||||
<template #title> 프로젝트 등록 </template>
|
<template #title> 프로젝트 등록 </template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<FormInput
|
<FormInput
|
||||||
@ -34,7 +35,9 @@
|
|||||||
name="name"
|
name="name"
|
||||||
:is-essential="true"
|
:is-essential="true"
|
||||||
:is-alert="nameAlert"
|
:is-alert="nameAlert"
|
||||||
|
:modelValue="name"
|
||||||
@update:modelValue="name = $event"
|
@update:modelValue="name = $event"
|
||||||
|
@update:alert="nameAlert = $event"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormSelect
|
<FormSelect
|
||||||
@ -49,22 +52,25 @@
|
|||||||
|
|
||||||
<FormInput
|
<FormInput
|
||||||
title="시작 일"
|
title="시작 일"
|
||||||
type="date"
|
|
||||||
name="startDay"
|
name="startDay"
|
||||||
v-model="startDay"
|
:type="'date'"
|
||||||
:is-essential="true"
|
:is-essential="true"
|
||||||
|
:modelValue="startDay"
|
||||||
|
v-model="startDay"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormInput
|
<FormInput
|
||||||
title="종료 일"
|
title="종료 일"
|
||||||
name="endDay"
|
|
||||||
:type="'date'"
|
:type="'date'"
|
||||||
|
name="endDay"
|
||||||
|
:modelValue="endDay"
|
||||||
@update:modelValue="endDay = $event"
|
@update:modelValue="endDay = $event"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormInput
|
<FormInput
|
||||||
title="설명"
|
title="설명"
|
||||||
name="description"
|
name="description"
|
||||||
|
:modelValue="description"
|
||||||
@update:modelValue="description = $event"
|
@update:modelValue="description = $event"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -79,10 +85,11 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<BackButton @click="closeCreateModal" />
|
<BackButton type="reset" @click="closeCreateModal" />
|
||||||
<SaveButton @click="handleCreate" />
|
<SaveButton @click="handleCreate" />
|
||||||
</template>
|
</template>
|
||||||
</CenterModal>
|
</CenterModal>
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- 수정 모달 -->
|
<!-- 수정 모달 -->
|
||||||
<CenterModal :display="isEditModalOpen" @close="closeEditModal">
|
<CenterModal :display="isEditModalOpen" @close="closeEditModal">
|
||||||
@ -95,6 +102,7 @@
|
|||||||
:is-alert="nameAlert"
|
:is-alert="nameAlert"
|
||||||
:modelValue="selectedProject.PROJCTNAM"
|
:modelValue="selectedProject.PROJCTNAM"
|
||||||
@update:modelValue="selectedProject.PROJCTNAM = $event"
|
@update:modelValue="selectedProject.PROJCTNAM = $event"
|
||||||
|
@update:alert="nameAlert = $event"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormSelect
|
<FormSelect
|
||||||
@ -149,7 +157,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, inject, ref, watch, onMounted } from 'vue';
|
import { computed, ref, watch, onMounted, inject } from 'vue';
|
||||||
import SearchBar from '@c/search/SearchBar.vue';
|
import SearchBar from '@c/search/SearchBar.vue';
|
||||||
import ProjectCard from '@c/list/ProjectCard.vue';
|
import ProjectCard from '@c/list/ProjectCard.vue';
|
||||||
import CategoryBtn from '@c/category/CategoryBtn.vue';
|
import CategoryBtn from '@c/category/CategoryBtn.vue';
|
||||||
@ -164,10 +172,8 @@ import { useUserInfoStore } from '@/stores/useUserInfoStore';
|
|||||||
import { useProjectStore } from '@/stores/useProjectStore';
|
import { useProjectStore } from '@/stores/useProjectStore';
|
||||||
import $api from '@api';
|
import $api from '@api';
|
||||||
import SaveButton from '@c/button/SaveBtn.vue';
|
import SaveButton from '@c/button/SaveBtn.vue';
|
||||||
import BackButton from '@c/button/BackBtn.vue'
|
import BackButton from '@c/button/BackBtn.vue';
|
||||||
|
|
||||||
const dayjs = inject('dayjs');
|
|
||||||
const today = dayjs().format('YYYY-MM-DD');
|
|
||||||
const toastStore = useToastStore();
|
const toastStore = useToastStore();
|
||||||
const userStore = useUserInfoStore();
|
const userStore = useUserInfoStore();
|
||||||
const projectStore = useProjectStore();
|
const projectStore = useProjectStore();
|
||||||
@ -177,6 +183,12 @@ const user = ref(null);
|
|||||||
const selectedCategory = ref(null);
|
const selectedCategory = ref(null);
|
||||||
const searchText = ref('');
|
const searchText = ref('');
|
||||||
|
|
||||||
|
// dayjs 인스턴스 가져오기
|
||||||
|
const dayjs = inject('dayjs');
|
||||||
|
|
||||||
|
// 오늘 날짜를 YYYY-MM-DD 형식으로 변환
|
||||||
|
const today = dayjs().format('YYYY-MM-DD');
|
||||||
|
|
||||||
// 등록 모달 상태
|
// 등록 모달 상태
|
||||||
const isCreateModalOpen = ref(false);
|
const isCreateModalOpen = ref(false);
|
||||||
const name = ref('');
|
const name = ref('');
|
||||||
@ -214,7 +226,7 @@ const { yearCategory, colorList } = commonApi({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 검색 처리
|
// 검색 처리
|
||||||
const search = async (searchKeyword) => {
|
const search = async searchKeyword => {
|
||||||
searchText.value = searchKeyword.trim();
|
searchText.value = searchKeyword.trim();
|
||||||
await getProjectList();
|
await getProjectList();
|
||||||
};
|
};
|
||||||
@ -244,10 +256,9 @@ const openCreateModal = () => {
|
|||||||
|
|
||||||
const closeCreateModal = () => {
|
const closeCreateModal = () => {
|
||||||
isCreateModalOpen.value = false;
|
isCreateModalOpen.value = false;
|
||||||
resetCreateForm();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetCreateForm = () => {
|
const formReset = () => {
|
||||||
name.value = '';
|
name.value = '';
|
||||||
color.value = '';
|
color.value = '';
|
||||||
address.value = '';
|
address.value = '';
|
||||||
@ -258,7 +269,7 @@ const resetCreateForm = () => {
|
|||||||
description.value = '';
|
description.value = '';
|
||||||
nameAlert.value = false;
|
nameAlert.value = false;
|
||||||
addressAlert.value = false;
|
addressAlert.value = false;
|
||||||
};
|
}
|
||||||
|
|
||||||
// 등록 :: 주소 업데이트 핸들러
|
// 등록 :: 주소 업데이트 핸들러
|
||||||
const handleAddressUpdate = addressData => {
|
const handleAddressUpdate = addressData => {
|
||||||
@ -286,8 +297,7 @@ const handleCreate = async () => {
|
|||||||
projctDtl: detailAddress.value,
|
projctDtl: detailAddress.value,
|
||||||
projctZip: postcode.value,
|
projctZip: postcode.value,
|
||||||
projctCmb: user.value.name,
|
projctCmb: user.value.name,
|
||||||
})
|
}).then(res => {
|
||||||
.then(res => {
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
toastStore.onToast('프로젝트가 등록되었습니다.', 's');
|
toastStore.onToast('프로젝트가 등록되었습니다.', 's');
|
||||||
closeCreateModal();
|
closeCreateModal();
|
||||||
@ -297,7 +307,7 @@ const handleCreate = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 수정 모달 관리
|
// 수정 모달 관리
|
||||||
const openEditModal = (post) => {
|
const openEditModal = post => {
|
||||||
isEditModalOpen.value = true;
|
isEditModalOpen.value = true;
|
||||||
selectedProject.value = { ...post };
|
selectedProject.value = { ...post };
|
||||||
originalColor.value = post.PROJCTCOL;
|
originalColor.value = post.PROJCTCOL;
|
||||||
@ -331,17 +341,23 @@ const hasChanges = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 수정 :: 주소
|
// 수정 :: 주소
|
||||||
const updateAddress = (addressData) => {
|
const updateAddress = addressData => {
|
||||||
selectedProject.value = {
|
selectedProject.value = {
|
||||||
...selectedProject.value,
|
...selectedProject.value,
|
||||||
PROJCTZIP: addressData.postcode,
|
PROJCTZIP: addressData.postcode,
|
||||||
PROJCTARR: addressData.address,
|
PROJCTARR: addressData.address,
|
||||||
PROJCTDTL: addressData.detailAddress
|
PROJCTDTL: addressData.detailAddress,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// 프로젝트 수정
|
// 프로젝트 수정
|
||||||
const handleUpdate = () => {
|
const handleUpdate = () => {
|
||||||
|
nameAlert.value = selectedProject.value.PROJCTNAM.trim() === '';
|
||||||
|
|
||||||
|
if (nameAlert.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasChanges.value) {
|
if (!hasChanges.value) {
|
||||||
toastStore.onToast('변경된 내용이 없습니다.', 'e');
|
toastStore.onToast('변경된 내용이 없습니다.', 'e');
|
||||||
return;
|
return;
|
||||||
@ -358,7 +374,7 @@ const handleUpdate = () => {
|
|||||||
projctEnd: selectedProject.value.PROJCTEND || null,
|
projctEnd: selectedProject.value.PROJCTEND || null,
|
||||||
projctDes: selectedProject.value.PROJCTDES || null,
|
projctDes: selectedProject.value.PROJCTDES || null,
|
||||||
projctUmb: user.value.name,
|
projctUmb: user.value.name,
|
||||||
originalColor: originalColor.value === selectedProject.value.PROJCTCOL ? null : originalColor.value
|
originalColor: originalColor.value === selectedProject.value.PROJCTCOL ? null : originalColor.value,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
toastStore.onToast('수정이 완료 되었습니다.', 's');
|
toastStore.onToast('수정이 완료 되었습니다.', 's');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user